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 | 5 +++++ 1 file changed, 5 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +5 -0
@@ -512,20 +512,25 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .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 }, { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,smmu-500", .data = &qcom_smmu_500_impl0_data }, + /* + * Should come after the qcom,smmu-500 fallback so smmu-500 variants of + * adreno-smmu get qcom_adreno_smmu_500_impl: + */ + { .compatible = "qcom,adreno-smmu", .data = &qcom_smmu_v2_data }, { } };#ifdef CONFIG_ACPI static struct acpi_platform_list qcom_acpi_platlist[] = { {"LENOVO" ,"CB-01 " ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, {"QCOM " ,"QCOMEDK2" ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, { } };#endif
Signature · 1 line
2.39.2
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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_iommu.c +2 -1
@@ -224,24 +224,25 @@ static int msm_fault_handler(struct iommu_domain *domain, struct device *dev,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 (WARN_ON_ONCE (!ttbr1_cfg))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.39.2
Quoted 10 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")Signed-off-by Rob Clark <[email protected]>---
I believe the issue here is the lack of qcom,sc7180-smmu-v2 instead.
qcom,adreno-smmu does not have to imply the "qcom smmu v2" impl
Konrad
Quoted 33 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +5
-0@@ -512,20 +512,25 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .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 }, { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,smmu-500", .data = &qcom_smmu_500_impl0_data }, + /* + * Should come after the qcom,smmu-500 fallback so smmu-500 variants of + * adreno-smmu get qcom_adreno_smmu_500_impl: + */ + { .compatible = "qcom,adreno-smmu", .data = &qcom_smmu_v2_data }, { } };#ifdef CONFIG_ACPI static struct acpi_platform_list qcom_acpi_platlist[] = { {"LENOVO" ,"CB-01 " ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, {"QCOM " ,"QCOMEDK2" ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, { } };#endif
Quoted 11 lines · Konrad Dybcio
Quoted 7 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.
Quoted 6 lines
Quoted 3 lines
Fixes 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")Signed-off-by Rob Clark <[email protected]>---
I believe the issue here is the lack of qcom,sc7180-smmu-v2 instead.
qcom,adreno-smmu does not have to imply the "qcom smmu v2" impl
Yes, but the ordering after "qcom,smmu-500" does. Currently we just need the one missing "qcom,sc7180-smmu-v2" but that seemed kind of fragile to me, which is why I went with "qcom,adreno-smmu" as a catch-all
BR,
-R
Quoted 35 lines
Konrad
Quoted 33 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +5
-0@@ -512,20 +512,25 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .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 }, { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,smmu-500", .data = &qcom_smmu_500_impl0_data }, + /* + * Should come after the qcom,smmu-500 fallback so smmu-500 variants of + * adreno-smmu get qcom_adreno_smmu_500_impl: + */ + { .compatible = "qcom,adreno-smmu", .data = &qcom_smmu_v2_data }, { } };#ifdef CONFIG_ACPI static struct acpi_platform_list qcom_acpi_platlist[] = { {"LENOVO" ,"CB-01 " ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, {"QCOM " ,"QCOMEDK2" ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, { } };#endif
Quoted 15 lines · Rob Clark
Quoted 14 lines · Konrad Dybcio
Quoted 10 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")Signed-off-by Rob Clark <[email protected]>---
Quoted 8 lines
Quoted 3 lines
I believe the issue here is the lack of qcom,sc7180-smmu-v2 instead.
qcom,adreno-smmu does not have to imply the "qcom smmu v2" impl
Yes, but the ordering after "qcom,smmu-500" does. Currently we just need the one missing "qcom,sc7180-smmu-v2" but that seemed kind of fragile to me, which is why I went with "qcom,adreno-smmu" as a catch-all
I think, the order is not relevant when comparing compatible entries, see __of_match_node(). It uses scoring and the more specific compatible wins. This way, "qcom,adreno-smmu", "qcom,smmu-500" will always end up with the v2 ops instead smmu500. It was not included into the list intentionally, rather than being by omission.
Thus I'd also suggest adding "qcom,sc7180-smmu-v2" to the list, as we currently do for all SMMU_v2 devices.
Quoted 39 lines
BR,
-RQuoted 35 lines
Konrad
Quoted 33 lines
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +5
-0@@ -512,20 +512,25 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { .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 }, { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_500_impl0_data }, { .compatible = "qcom,smmu-500", .data = &qcom_smmu_500_impl0_data }, + /* + * Should come after the qcom,smmu-500 fallback so smmu-500 variants of + * adreno-smmu get qcom_adreno_smmu_500_impl: + */ + { .compatible = "qcom,adreno-smmu", .data = &qcom_smmu_v2_data }, { } };#ifdef CONFIG_ACPI static struct acpi_platform_list qcom_acpi_platlist[] = { {"LENOVO" ,"CB-01 " ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, {"QCOM " ,"QCOMEDK2" ,0x8180 ,ACPI_SIG_IORT , equal,"QCOM SMMU" }, { } };#endif
Signature · 2 lines
With best wishes Dmitry