diff --git a/Documentation/devicetree/bindings/iommu/msm_iommu_v1.txt b/Documentation/devicetree/bindings/iommu/msm_iommu_v1.txt index b1f6197701ba..7115656aae81 100644 --- a/Documentation/devicetree/bindings/iommu/msm_iommu_v1.txt +++ b/Documentation/devicetree/bindings/iommu/msm_iommu_v1.txt @@ -75,6 +75,8 @@ Optional properties: the same property except this is for IOMMU with LPAE support. - qcom,iommu-sid-mask : List of mask values to map the unique stream ids to the Stream Mapping Table entries. +- qcom,report-error-on-fault : boolean indicating that when any fault + occurs in this context bank, an error will be sent to respective master Example: diff --git a/drivers/iommu/msm_iommu-v1.c b/drivers/iommu/msm_iommu-v1.c index 16d91c4df978..6c09a2652db7 100644 --- a/drivers/iommu/msm_iommu-v1.c +++ b/drivers/iommu/msm_iommu-v1.c @@ -672,6 +672,12 @@ static void __program_context(struct msm_iommu_drvdata *iommu_drvdata, /* Enable context fault interrupt */ SET_CB_SCTLR_CFIE(cb_base, ctx, 1); + /* Enable context fault error report */ + if (ctx_drvdata->report_error_on_fault) { + SET_CB_SCTLR_HUPCF(cb_base, ctx, 1); + SET_CB_SCTLR_CFRE(cb_base, ctx, 1); + } + if (iommu_drvdata->model != MMU_500) { /* Redirect all cacheable requests to L2 slave port. */ SET_CB_ACTLR_BPRCISH(cb_base, ctx, 1); diff --git a/drivers/iommu/msm_iommu_dev-v1.c b/drivers/iommu/msm_iommu_dev-v1.c index a8c80431c071..efbddf5cc9f7 100644 --- a/drivers/iommu/msm_iommu_dev-v1.c +++ b/drivers/iommu/msm_iommu_dev-v1.c @@ -591,6 +591,10 @@ static int msm_iommu_ctx_parse_dt(struct platform_device *pdev, &ctx_drvdata->name)) ctx_drvdata->name = dev_name(&pdev->dev); + ctx_drvdata->report_error_on_fault = + of_property_read_bool(pdev->dev.of_node, + "qcom,report-error-on-fault"); + if (!of_get_property(pdev->dev.of_node, "qcom,iommu-ctx-sids", &nsid)) { ret = -EINVAL; goto out; diff --git a/include/linux/qcom_iommu.h b/include/linux/qcom_iommu.h index 86b0b3f30e32..f476deef355e 100644 --- a/include/linux/qcom_iommu.h +++ b/include/linux/qcom_iommu.h @@ -181,6 +181,7 @@ void iommu_resume(const struct msm_iommu_drvdata *iommu_drvdata); the secure environment, false otherwise * @asid ASID used with this context. * @attach_count Number of time this context has been attached. + * @report_error_on_fault - true if error is returned back to master * * A msm_iommu_ctx_drvdata holds the driver data for a single context bank * within each IOMMU hardware instance @@ -198,6 +199,7 @@ struct msm_iommu_ctx_drvdata { int attach_count; u32 sid_mask[MAX_NUM_SMR]; unsigned int n_sid_mask; + bool report_error_on_fault; }; enum dump_reg {