Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
@ 2023-05-02 16:09 Rob Clark
  2023-05-04 17:41 ` Konrad Dybcio
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2023-05-02 16:09 UTC (permalink / raw)
  To: dri-devel, iommu
  Cc: freedreno, linux-arm-msm, Dmitry Baryshkov, Rob Clark,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Konrad Dybcio, Bjorn Andersson, Marijn Suijten,
	moderated list:ARM SMMU DRIVERS, open list:IOMMU SUBSYSTEM,
	open list

From: Rob Clark <robdclark@chromium.org>

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.

Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index d1b296b95c86..88c89424485b 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -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
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-02 16:09 Rob Clark
@ 2023-05-04 17:41 ` Konrad Dybcio
  2023-05-04 18:08   ` Rob Clark
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Dybcio @ 2023-05-04 17:41 UTC (permalink / raw)
  To: Rob Clark, dri-devel, iommu
  Cc: freedreno, linux-arm-msm, Dmitry Baryshkov, Rob Clark,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Bjorn Andersson, Marijn Suijten, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list



On 2.05.2023 18:09, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
> 
> 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.
> 
> Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
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
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index d1b296b95c86..88c89424485b 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-04 17:41 ` Konrad Dybcio
@ 2023-05-04 18:08   ` Rob Clark
  2023-05-04 18:24     ` Dmitry Baryshkov
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2023-05-04 18:08 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: dri-devel, iommu, freedreno, linux-arm-msm, Dmitry Baryshkov,
	Rob Clark, Will Deacon, Robin Murphy, Joerg Roedel,
	Sai Prakash Ranjan, Bjorn Andersson, Marijn Suijten,
	moderated list:ARM SMMU DRIVERS, open list:IOMMU SUBSYSTEM,
	open list

On Thu, May 4, 2023 at 10:41 AM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
>
>
> On 2.05.2023 18:09, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > 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.
> >
> > Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> 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

>
> Konrad
> >  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > index d1b296b95c86..88c89424485b 100644
> > --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > @@ -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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-04 18:08   ` Rob Clark
@ 2023-05-04 18:24     ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-04 18:24 UTC (permalink / raw)
  To: Rob Clark, Konrad Dybcio
  Cc: dri-devel, iommu, freedreno, linux-arm-msm, Rob Clark,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Bjorn Andersson, Marijn Suijten, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list

On 04/05/2023 21:08, Rob Clark wrote:
> On Thu, May 4, 2023 at 10:41 AM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>
>>
>>
>> On 2.05.2023 18:09, Rob Clark wrote:
>>> From: Rob Clark <robdclark@chromium.org>
>>>
>>> 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.
>>>
>>> Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
>>> Signed-off-by: Rob Clark <robdclark@chromium.org>
>>> ---
>> 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.

> 
> BR,
> -R
> 
>>
>> Konrad
>>>   drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 5 +++++
>>>   1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>> index d1b296b95c86..88c89424485b 100644
>>> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>> @@ -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

-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
@ 2023-05-09 16:37 Rob Clark
  2023-05-11 14:25 ` Rob Clark
  2023-05-11 14:51 ` Dmitry Baryshkov
  0 siblings, 2 replies; 8+ messages in thread
From: Rob Clark @ 2023-05-09 16:37 UTC (permalink / raw)
  To: dri-devel, iommu
  Cc: freedreno, linux-arm-msm, Dmitry Baryshkov, Rob Clark, Lepton Wu,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Konrad Dybcio, Bjorn Andersson, Elliot Berman, Marijn Suijten,
	Emma Anholt, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list

From: Rob Clark <robdclark@chromium.org>

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.

Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
Suggested-by: Lepton Wu <lepton@chromium.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index d1b296b95c86..760d9c43dbd2 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-09 16:37 [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's Rob Clark
@ 2023-05-11 14:25 ` Rob Clark
  2023-05-11 14:51 ` Dmitry Baryshkov
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Clark @ 2023-05-11 14:25 UTC (permalink / raw)
  To: dri-devel, iommu
  Cc: freedreno, linux-arm-msm, Dmitry Baryshkov, Rob Clark, Lepton Wu,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Konrad Dybcio, Bjorn Andersson, Elliot Berman, Marijn Suijten,
	Emma Anholt, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list

On Tue, May 9, 2023 at 9:37 AM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> 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.
>
> Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
> Suggested-by: Lepton Wu <lepton@chromium.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>

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

> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index d1b296b95c86..760d9c43dbd2 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-09 16:37 [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's Rob Clark
  2023-05-11 14:25 ` Rob Clark
@ 2023-05-11 14:51 ` Dmitry Baryshkov
  2023-05-11 14:57   ` Rob Clark
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-11 14:51 UTC (permalink / raw)
  To: Rob Clark
  Cc: dri-devel, iommu, freedreno, linux-arm-msm, Rob Clark, Lepton Wu,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Konrad Dybcio, Bjorn Andersson, Elliot Berman, Marijn Suijten,
	Emma Anholt, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list

On Tue, 9 May 2023 at 19:37, Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> 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.
>
> Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
> Suggested-by: Lepton Wu <lepton@chromium.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index d1b296b95c86..760d9c43dbd2 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -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"));

Could you please add a comment here, noting the reason? Or maybe we
should  change that to:
if (WARN_ON(...))
  return ERR_PTR(-EINVAL);

> +
>         return smmu;
>  }
> --
> 2.40.1
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's
  2023-05-11 14:51 ` Dmitry Baryshkov
@ 2023-05-11 14:57   ` Rob Clark
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Clark @ 2023-05-11 14:57 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: dri-devel, iommu, freedreno, linux-arm-msm, Rob Clark, Lepton Wu,
	Will Deacon, Robin Murphy, Joerg Roedel, Sai Prakash Ranjan,
	Konrad Dybcio, Bjorn Andersson, Elliot Berman, Marijn Suijten,
	Emma Anholt, moderated list:ARM SMMU DRIVERS,
	open list:IOMMU SUBSYSTEM, open list

On Thu, May 11, 2023 at 7:51 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Tue, 9 May 2023 at 19:37, Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > 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.
> >
> > Fixes: 30b912a03d91 ("iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create")
> > Suggested-by: Lepton Wu <lepton@chromium.org>
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> >  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > index d1b296b95c86..760d9c43dbd2 100644
> > --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> > @@ -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"));
>
> Could you please add a comment here, noting the reason? Or maybe we
> should  change that to:
> if (WARN_ON(...))
>   return ERR_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

>
> > +
> >         return smmu;
> >  }
> > --
> > 2.40.1
> >
>
>
> --
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-11 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 16:37 [PATCH 1/2] iommu/arm-smmu-qcom: Fix missing adreno_smmu's Rob Clark
2023-05-11 14:25 ` Rob Clark
2023-05-11 14:51 ` Dmitry Baryshkov
2023-05-11 14:57   ` Rob Clark
  -- strict thread matches above, loose matches on Subject: below --
2023-05-02 16:09 Rob Clark
2023-05-04 17:41 ` Konrad Dybcio
2023-05-04 18:08   ` Rob Clark
2023-05-04 18:24     ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox