iommu/arm-smmu-qcom: Fix missing adreno_smmu's
Subsystems (6)
PATCH 1/2 iommu/arm-smmu-qcom: Fix missing adreno_smmu's
From: Rob Clark <[email protected]>
When the special handling of qcom,adreno-smmu was moved into qcom_smmu_create(), it was overlooked that we didn't have all the required entries in qcom_smmu_impl_of_match. So we stopped getting adreno_smmu_priv on sc7180, breaking per-process pgtables.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +3 -0
@@ -496,20 +496,21 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {/* * Do not add any more qcom,SOC-smmu-500 entries to this list, unless they need * special handling and can not be covered by the qcom,smmu-500 entry. */ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .compatible ="qcom,msm8996-smmu-v2" , .data = &msm8996_smmu_data }, { .compatible ="qcom,msm8998-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,qcm2290-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,qdu1000-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc7180-smmu-500" , .data = &qcom_smmu_500_impl0_data }, + { .compatible ="qcom,sc7180-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sc7280-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8180x-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8280xp-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sdm630-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-500" , .data = &sdm845_smmu_500_data }, { .compatible ="qcom,sm6115-smmu-500" , .data = &qcom_smmu_500_impl0_data}, { .compatible ="qcom,sm6125-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sm6350-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sm6350-smmu-500" , .data = &qcom_smmu_500_impl0_data },
@@ -540,12 +541,14 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)/* Match platform for ACPI boot */ if (acpi_match_platform_list (qcom_acpi_platlist) >=0 )return qcom_smmu_create (smmu, &qcom_smmu_500_impl0_data); }#endif match =of_match_node (qcom_smmu_impl_of_match, np);if (match)return qcom_smmu_create (smmu, match->data); +WARN_ON (of_device_is_compatible (np,"qcom,adreno-smmu" )); +return smmu; }
Signature · 1 line
2.40.1
PATCH 2/2 drm/msm: Be more shouty if per-process pgtables aren't working
From: Rob Clark <[email protected]>
Otherwise it is not always obvious if a dt or iommu change is causing us to fall back to global pgtable.
--- drivers/gpu/drm/msm/msm_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_iommu.c +6 -1
@@ -227,21 +227,26 @@ struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent)struct adreno_smmu_priv *adreno_smmu =dev_get_drvdata (parent->dev);struct msm_iommu *iommu =to_msm_iommu (parent);struct msm_iommu_pagetable *pagetable;const struct io_pgtable_cfg *ttbr1_cfg =NULL ;struct io_pgtable_cfg ttbr0_cfg;int ret;/* Get the pagetable configuration from the domain */ if (adreno_smmu->cookie) ttbr1_cfg = adreno_smmu->get_ttbr1_cfg (adreno_smmu->cookie); -if (!ttbr1_cfg) + +/* +* If you hit this WARN_ONCE() you are probably missing an entry in +* qcom_smmu_impl_of_match[] in arm-smmu-qcom.c +*/ +if (WARN_ONCE (!ttbr1_cfg,"No per-process page tables" ))return ERR_PTR (-ENODEV ); pagetable =kzalloc (sizeof (*pagetable),GFP_KERNEL );if (!pagetable)return ERR_PTR (-ENOMEM );msm_mmu_init (&pagetable->base, parent->dev, &pagetable_funcs,MSM_MMU_IOMMU_PAGETABLE );/* Clone the TTBR1 cfg as starting point for TTBR0 cfg: */
Signature · 1 line
2.40.1
Quoted 11 lines · Rob Clark
From: Rob Clark <[email protected]>
When the special handling of qcom,adreno-smmu was moved into
qcom_smmu_create(), it was overlooked that we didn't have all the required entries inqcom_smmu_impl_of_match. So we stopped gettingadreno_smmu_privon sc7180, breaking per-process pgtables.Fixes 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")Suggested-by Lepton Wu <[email protected]>Signed-off-by Rob Clark <[email protected]>
Any chance I could get an ack for landing this fix via msm-fixes? Broken per-process pgtables is kind of a serious regression..
BR,
-R
Quoted 48 lines
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++ 1 file changed, 3 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +3
-1@@ -496,20 +496,21 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {/* * Do not add any more qcom,SOC-smmu-500 entries to this list, unless they need * special handling and can not be covered by the qcom,smmu-500 entry. */ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .compatible ="qcom,msm8996-smmu-v2" , .data = &msm8996_smmu_data }, { .compatible ="qcom,msm8998-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,qcm2290-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,qdu1000-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc7180-smmu-500" , .data = &qcom_smmu_500_impl0_data }, + { .compatible ="qcom,sc7180-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sc7280-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8180x-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8280xp-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sdm630-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-500" , .data = &sdm845_smmu_500_data }, { .compatible ="qcom,sm6115-smmu-500" , .data = &qcom_smmu_500_impl0_data}, { .compatible ="qcom,sm6125-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sm6350-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sm6350-smmu-500" , .data = &qcom_smmu_500_impl0_data },@@ -540,12 +541,14 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)/* Match platform for ACPI boot */ if (acpi_match_platform_list (qcom_acpi_platlist) >=0 )return qcom_smmu_create (smmu, &qcom_smmu_500_impl0_data); }#endif match =of_match_node (qcom_smmu_impl_of_match, np);if (match)return qcom_smmu_create (smmu, match->data); +WARN_ON (of_device_is_compatible (np,"qcom,adreno-smmu" )); +return smmu; } --2.40.1
Quoted 43 lines · Rob Clark
From: Rob Clark <[email protected]>
When the special handling of qcom,adreno-smmu was moved into
qcom_smmu_create(), it was overlooked that we didn't have all the required entries inqcom_smmu_impl_of_match. So we stopped gettingadreno_smmu_privon sc7180, breaking per-process pgtables.Fixes 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")Suggested-by Lepton Wu <[email protected]>Signed-off-by Rob Clark <[email protected]>--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++ 1 file changed, 3 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-0@@ -496,20 +496,21 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {/* * Do not add any more qcom,SOC-smmu-500 entries to this list, unless they need * special handling and can not be covered by the qcom,smmu-500 entry. */ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .compatible ="qcom,msm8996-smmu-v2" , .data = &msm8996_smmu_data }, { .compatible ="qcom,msm8998-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,qcm2290-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,qdu1000-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc7180-smmu-500" , .data = &qcom_smmu_500_impl0_data }, + { .compatible ="qcom,sc7180-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sc7280-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8180x-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8280xp-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sdm630-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-500" , .data = &sdm845_smmu_500_data }, { .compatible ="qcom,sm6115-smmu-500" , .data = &qcom_smmu_500_impl0_data}, { .compatible ="qcom,sm6125-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sm6350-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sm6350-smmu-500" , .data = &qcom_smmu_500_impl0_data },@@ -540,12 +541,14 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)/* Match platform for ACPI boot */
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu) · line 551
Quoted 10 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-0if (acpi_match_platform_list (qcom_acpi_platlist) >=0 )return qcom_smmu_create (smmu, &qcom_smmu_500_impl0_data); }#endif match =of_match_node (qcom_smmu_impl_of_match, np);if (match)return qcom_smmu_create (smmu, match->data); +WARN_ON (of_device_is_compatible (np,"qcom,adreno-smmu" ));
Could you please add a comment here, noting the reason? Or maybe we should change that to:
if (WARN_ON(...))
return ERR_PTR(-EINVAL);
Quoted 6 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-1+return smmu; } --2.40.1
Signature · 2 lines
With best wishes Dmitry
Quoted 54 lines · Dmitry Baryshkov
Quoted 52 lines · Rob Clark
From: Rob Clark <[email protected]>
When the special handling of qcom,adreno-smmu was moved into
qcom_smmu_create(), it was overlooked that we didn't have all the required entries inqcom_smmu_impl_of_match. So we stopped gettingadreno_smmu_privon sc7180, breaking per-process pgtables.Fixes 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")Suggested-by Lepton Wu <[email protected]>Signed-off-by Rob Clark <[email protected]>--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++ 1 file changed, 3 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-0@@ -496,20 +496,21 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {/* * Do not add any more qcom,SOC-smmu-500 entries to this list, unless they need * special handling and can not be covered by the qcom,smmu-500 entry. */ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .compatible ="qcom,msm8996-smmu-v2" , .data = &msm8996_smmu_data }, { .compatible ="qcom,msm8998-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,qcm2290-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,qdu1000-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc7180-smmu-500" , .data = &qcom_smmu_500_impl0_data }, + { .compatible ="qcom,sc7180-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sc7280-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8180x-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sc8280xp-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sdm630-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sdm845-smmu-500" , .data = &sdm845_smmu_500_data }, { .compatible ="qcom,sm6115-smmu-500" , .data = &qcom_smmu_500_impl0_data}, { .compatible ="qcom,sm6125-smmu-500" , .data = &qcom_smmu_500_impl0_data }, { .compatible ="qcom,sm6350-smmu-v2" , .data = &qcom_smmu_v2_data }, { .compatible ="qcom,sm6350-smmu-500" , .data = &qcom_smmu_500_impl0_data },@@ -540,12 +541,14 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)/* Match platform for ACPI boot */ if (acpi_match_platform_list (qcom_acpi_platlist) >=0 ) return qcom_smmu_create(smmu, &qcom_smmu_500_impl0_data); }#endif match =of_match_node (qcom_smmu_impl_of_match, np);if (match)return qcom_smmu_create (smmu, match->data);
Quoted 6 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu) · line 551
Quoted 1 line
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-0+WARN_ON (of_device_is_compatible (np,"qcom,adreno-smmu" ));Could you please add a comment here, noting the reason? Or maybe we should change that to:
if (WARN_ON(...))
returnERR_PTR(-EINVAL);
I'll add a comment. Not having an iommu is even worse, so returning an error isn't a good idea. I just wanted to leave some breadcrumbs so people can see where the problem actually is if per-process pgtables break again.
BR,
-R
Quoted 12 lines
Quoted 7 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1
-1+return smmu; } --2.40.1
--
With best wishes
Dmitry