* [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-22 0:59 ` Krzysztof Kozlowski
2022-10-22 15:43 ` Krzysztof Kozlowski
2022-10-21 16:55 ` [RFC PATCH 2/9] dt-bindings: arm-smmu: fix clocks/clock-names schema Dmitry Baryshkov
` (7 subsequent siblings)
8 siblings, 2 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
Add missing compatibles used for Adreno SMMU on sc7280 and sm8450
platforms and for the Qualcomm v2 SMMU used on SDM630 platform.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index 9066e6df1ba1..34ee33a62ba5 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -28,6 +28,7 @@ properties:
- enum:
- qcom,msm8996-smmu-v2
- qcom,msm8998-smmu-v2
+ - qcom,sdm630-smmu-v2
- const: qcom,smmu-v2
- description: Qcom SoCs implementing "arm,mmu-500"
@@ -48,10 +49,20 @@ properties:
- qcom,sm8350-smmu-500
- qcom,sm8450-smmu-500
- const: arm,mmu-500
+
+ - description: Qcom Adreno GPUs implementing "arm,smmu-500"
+ items:
+ - enum:
+ - qcom,sc7280-smmu-500
+ - qcom,sm8250-smmu-500
+ - const: qcom,adreno-smmu
+ - const: arm,mmu-500
- description: Qcom Adreno GPUs implementing "arm,smmu-v2"
items:
- enum:
+ - qcom,msm8996-smmu-v2
- qcom,sc7180-smmu-v2
+ - qcom,sdm630-smmu-v2
- qcom,sdm845-smmu-v2
- const: qcom,adreno-smmu
- const: qcom,smmu-v2
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles
2022-10-21 16:55 ` [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles Dmitry Baryshkov
@ 2022-10-22 0:59 ` Krzysztof Kozlowski
2022-10-22 9:17 ` Dmitry Baryshkov
2022-10-22 15:43 ` Krzysztof Kozlowski
1 sibling, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-22 0:59 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
On 21/10/2022 12:55, Dmitry Baryshkov wrote:
> Add missing compatibles used for Adreno SMMU on sc7280 and sm8450
> platforms and for the Qualcomm v2 SMMU used on SDM630 platform.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> index 9066e6df1ba1..34ee33a62ba5 100644
> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> @@ -28,6 +28,7 @@ properties:
> - enum:
> - qcom,msm8996-smmu-v2
> - qcom,msm8998-smmu-v2
> + - qcom,sdm630-smmu-v2
So qcom,adreno-smmu is not compatible with Adreno? See below.
> - const: qcom,smmu-v2
>
> - description: Qcom SoCs implementing "arm,mmu-500"
> @@ -48,10 +49,20 @@ properties:
> - qcom,sm8350-smmu-500
> - qcom,sm8450-smmu-500
> - const: arm,mmu-500
> +
> + - description: Qcom Adreno GPUs implementing "arm,smmu-500"
> + items:
> + - enum:
> + - qcom,sc7280-smmu-500
> + - qcom,sm8250-smmu-500
> + - const: qcom,adreno-smmu
> + - const: arm,mmu-500
> - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> items:
> - enum:
> + - qcom,msm8996-smmu-v2
> - qcom,sc7180-smmu-v2
> + - qcom,sdm630-smmu-v2
This does not look correct. The same compatible should not be present in
two different setups.
If qcom,msm8996-smmu-v2 is compatible with qcom,adreno-smmu, then your
first hunk is not correct.
> - qcom,sdm845-smmu-v2
> - const: qcom,adreno-smmu
> - const: qcom,smmu-v2
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles
2022-10-22 0:59 ` Krzysztof Kozlowski
@ 2022-10-22 9:17 ` Dmitry Baryshkov
2022-10-22 15:42 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-22 9:17 UTC (permalink / raw)
To: Krzysztof Kozlowski, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
On 22/10/2022 03:59, Krzysztof Kozlowski wrote:
> On 21/10/2022 12:55, Dmitry Baryshkov wrote:
>> Add missing compatibles used for Adreno SMMU on sc7280 and sm8450
>> platforms and for the Qualcomm v2 SMMU used on SDM630 platform.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>> index 9066e6df1ba1..34ee33a62ba5 100644
>> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>> @@ -28,6 +28,7 @@ properties:
>> - enum:
>> - qcom,msm8996-smmu-v2
>> - qcom,msm8998-smmu-v2
>> + - qcom,sdm630-smmu-v2
>
> So qcom,adreno-smmu is not compatible with Adreno? See below.
>
>> - const: qcom,smmu-v2
>>
>> - description: Qcom SoCs implementing "arm,mmu-500"
>> @@ -48,10 +49,20 @@ properties:
>> - qcom,sm8350-smmu-500
>> - qcom,sm8450-smmu-500
>> - const: arm,mmu-500
>> +
>> + - description: Qcom Adreno GPUs implementing "arm,smmu-500"
>> + items:
>> + - enum:
>> + - qcom,sc7280-smmu-500
>> + - qcom,sm8250-smmu-500
>> + - const: qcom,adreno-smmu
>> + - const: arm,mmu-500
>> - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
>> items:
>> - enum:
>> + - qcom,msm8996-smmu-v2
>> - qcom,sc7180-smmu-v2
>> + - qcom,sdm630-smmu-v2
>
> This does not look correct. The same compatible should not be present in
> two different setups.
>
> If qcom,msm8996-smmu-v2 is compatible with qcom,adreno-smmu, then your
> first hunk is not correct.
Currently the qcom,adreno-smmu compat string is used as a flag, telling
the kernel that this SMMU instance needs some special setup to work with
Adreno GPU driver
For example, we have the following compat lists in the existing DT files:
- "qcom,msm8996-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
- "qcom,msm8996-smmu-v2", "qcom,smmu-v2" // not handled by arm-qcom-smmu
- "qcom,sdm630-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
- "qcom,sdm630-smmu-v2", "qcom,smmu-v2"
- "qcom,sdm845-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
- "qcom,sdm845-smmu-500", "arm,mmu-500"
- "qcom,sdm845-smmu-v2", "qcom,smmu-v2" // special setup used on Cheza
- "qcom,sm8250-smmu-500", "qcom,adreno-smmu", "arm,mmu-500"
- "qcom,sm8250-smmu-500", "arm,mmu-500"
As we are trying to refactor the IOMMU bindings, what would be your
recommendation?
To introduce minimal changes, I wanted to have the following lists:
- "qcom,SOC-smmu-500", "qcom,adreno-smmu", "qcom,smmu-500", "arm,mmu-500"
- "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500"
However maybe you would prefer the following model:
- "qcom,SOC-adreno-smmu-500", "qcom,adreno-smmu-500", "arm,mmu-500"
- "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500"
Or:
- "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500" +
'qcom,adreno-smmu' flag/property?
>
>> - qcom,sdm845-smmu-v2
>> - const: qcom,adreno-smmu
>> - const: qcom,smmu-v2
>
> Best regards,
> Krzysztof
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles
2022-10-22 9:17 ` Dmitry Baryshkov
@ 2022-10-22 15:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-22 15:42 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
On 22/10/2022 05:17, Dmitry Baryshkov wrote:
> On 22/10/2022 03:59, Krzysztof Kozlowski wrote:
>> On 21/10/2022 12:55, Dmitry Baryshkov wrote:
>>> Add missing compatibles used for Adreno SMMU on sc7280 and sm8450
>>> platforms and for the Qualcomm v2 SMMU used on SDM630 platform.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>> Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 11 +++++++++++
>>> 1 file changed, 11 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>>> index 9066e6df1ba1..34ee33a62ba5 100644
>>> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>>> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
>>> @@ -28,6 +28,7 @@ properties:
>>> - enum:
>>> - qcom,msm8996-smmu-v2
>>> - qcom,msm8998-smmu-v2
>>> + - qcom,sdm630-smmu-v2
>>
>> So qcom,adreno-smmu is not compatible with Adreno? See below.
>>
>>> - const: qcom,smmu-v2
>>>
>>> - description: Qcom SoCs implementing "arm,mmu-500"
>>> @@ -48,10 +49,20 @@ properties:
>>> - qcom,sm8350-smmu-500
>>> - qcom,sm8450-smmu-500
>>> - const: arm,mmu-500
>>> +
>>> + - description: Qcom Adreno GPUs implementing "arm,smmu-500"
>>> + items:
>>> + - enum:
>>> + - qcom,sc7280-smmu-500
>>> + - qcom,sm8250-smmu-500
>>> + - const: qcom,adreno-smmu
>>> + - const: arm,mmu-500
>>> - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
>>> items:
>>> - enum:
>>> + - qcom,msm8996-smmu-v2
>>> - qcom,sc7180-smmu-v2
>>> + - qcom,sdm630-smmu-v2
>>
>> This does not look correct. The same compatible should not be present in
>> two different setups.
>>
>> If qcom,msm8996-smmu-v2 is compatible with qcom,adreno-smmu, then your
>> first hunk is not correct.
>
> Currently the qcom,adreno-smmu compat string is used as a flag, telling
> the kernel that this SMMU instance needs some special setup to work with
> Adreno GPU driver
Indeed, I see the usage in DTS,
>
> For example, we have the following compat lists in the existing DT files:
> - "qcom,msm8996-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
> - "qcom,msm8996-smmu-v2", "qcom,smmu-v2" // not handled by arm-qcom-smmu
>
> - "qcom,sdm630-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
> - "qcom,sdm630-smmu-v2", "qcom,smmu-v2"
>
> - "qcom,sdm845-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
> - "qcom,sdm845-smmu-500", "arm,mmu-500"
> - "qcom,sdm845-smmu-v2", "qcom,smmu-v2" // special setup used on Cheza
>
> - "qcom,sm8250-smmu-500", "qcom,adreno-smmu", "arm,mmu-500"
> - "qcom,sm8250-smmu-500", "arm,mmu-500"
>
>
> As we are trying to refactor the IOMMU bindings, what would be your
> recommendation?
>
> To introduce minimal changes, I wanted to have the following lists:
> - "qcom,SOC-smmu-500", "qcom,adreno-smmu", "qcom,smmu-500", "arm,mmu-500"
>
> - "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500"
>
> However maybe you would prefer the following model:
>
> - "qcom,SOC-adreno-smmu-500", "qcom,adreno-smmu-500", "arm,mmu-500"
> - "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500"
If we started from scratch, I would prefer this one, however as DTSes
are already using your previous method, It's fine.
It's a bit confusing to have most specific compatible followed by
different fallbacks, but we already have few cases for this (e.g.
Renesas boards), so I guess it is fine here as well. At the end entire
compatible list uniquely describes the hardware.
>
>
> Or:
> - "qcom,SOC-smmu-500", "qcom,smmu-500", "arm,mmu-500" +
> 'qcom,adreno-smmu' flag/property?
>
>
>>
>>> - qcom,sdm845-smmu-v2
>>> - const: qcom,adreno-smmu
>>> - const: qcom,smmu-v2
>>
>> Best regards,
>> Krzysztof
>>
>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles
2022-10-21 16:55 ` [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles Dmitry Baryshkov
2022-10-22 0:59 ` Krzysztof Kozlowski
@ 2022-10-22 15:43 ` Krzysztof Kozlowski
1 sibling, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-22 15:43 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
On 21/10/2022 12:55, Dmitry Baryshkov wrote:
> Add missing compatibles used for Adreno SMMU on sc7280 and sm8450
> platforms and for the Qualcomm v2 SMMU used on SDM630 platform.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 2/9] dt-bindings: arm-smmu: fix clocks/clock-names schema
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
2022-10-21 16:55 ` [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-21 21:00 ` Rob Herring
2022-10-21 16:55 ` [RFC PATCH 3/9] dt-bindings: arm-smmu: Add generic qcom,smmu-500 bindings Dmitry Baryshkov
` (6 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
Rework clocks/clock-names properties schema to property describe
possible usage cases.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../devicetree/bindings/iommu/arm,smmu.yaml | 129 ++++++++++++++++--
1 file changed, 121 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index 34ee33a62ba5..bae9fb3ffadb 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -158,16 +158,12 @@ properties:
present in such cases.
clock-names:
- items:
- - const: bus
- - const: iface
+ minItems: 1
+ maxItems: 7
clocks:
- items:
- - description: bus clock required for downstream bus access and for the
- smmu ptw
- - description: interface clock required to access smmu's registers
- through the TCU's programming interface.
+ minItems: 1
+ maxItems: 7
power-domains:
maxItems: 1
@@ -217,6 +213,123 @@ allOf:
reg:
maxItems: 1
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,msm8996-smmu-v2
+ - qcom,msm8998-smmu-v2
+ - qcom,sdm630-smmu-v2
+ then:
+ anyOf:
+ - properties:
+ clock-names:
+ items:
+ - const: bus
+ clocks:
+ items:
+ - description: bus clock required for downstream bus access and for
+ the smmu ptw
+ - properties:
+ clock-names:
+ items:
+ - const: iface
+ - const: mem
+ - const: mem_iface
+ clocks:
+ items:
+ - description: interface clock required to access smmu's registers
+ through the TCU's programming interface.
+ - description: bus clock required for memory access
+ - description: bus clock required for GPU memory access
+ - properties:
+ clock-names:
+ items:
+ - const: iface-mm
+ - const: iface-smmu
+ - const: bus-mm
+ - const: bus-smmu
+ clocks:
+ items:
+ - description: interface clock required to access mnoc's registers
+ through the TCU's programming interface.
+ - description: interface clock required to access smmu's registers
+ through the TCU's programming interface.
+ - description: bus clock required for downstream bus access
+ - description: bus clock required for the smmu ptw
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,sc7180-smmu-v2
+ - qcom,sdm845-smmu-v2
+ then:
+ properties:
+ clock-names:
+ items:
+ - const: bus
+ - const: iface
+
+ clocks:
+ items:
+ - description: bus clock required for downstream bus access and for
+ the smmu ptw
+ - description: interface clock required to access smmu's registers
+ through the TCU's programming interface.
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: qcom,sc7280-smmu-500
+ then:
+ properties:
+ clock-names:
+ items:
+ - const: gcc_gpu_memnoc_gfx_clk
+ - const: gcc_gpu_snoc_dvm_gfx_clk
+ - const: gpu_cc_ahb_clk
+ - const: gpu_cc_hlos1_vote_gpu_smmu_clk
+ - const: gpu_cc_cx_gmu_clk
+ - const: gpu_cc_hub_cx_int_clk
+ - const: gpu_cc_hub_aon_clk
+
+ clocks:
+ items:
+ - description: GPU memnoc_gfx clock
+ - description: GPU snoc_dvm_gfx clock
+ - description: GPU ahb clock
+ - description: GPU hlos1_vote_GPU smmu clock
+ - description: GPU cx_gmu clock
+ - description: GPU hub_cx_int clock
+ - description: GPU hub_aon clock
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,sm8150-smmu-500
+ - qcom,sm8250-smmu-500
+ then:
+ properties:
+ clock-names:
+ items:
+ - const: ahb
+ - const: bus
+ - const: iface
+
+ clocks:
+ items:
+ - description: bus clock required for AHB bus access
+ - description: bus clock required for downstream bus access and for
+ the smmu ptw
+ - description: interface clock required to access smmu's registers
+ through the TCU's programming interface.
+
examples:
- |+
/* SMMU with stream matching or stream indexing */
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 2/9] dt-bindings: arm-smmu: fix clocks/clock-names schema
2022-10-21 16:55 ` [RFC PATCH 2/9] dt-bindings: arm-smmu: fix clocks/clock-names schema Dmitry Baryshkov
@ 2022-10-21 21:00 ` Rob Herring
0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2022-10-21 21:00 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Will Deacon, linux-arm-msm, Joerg Roedel, Rob Clark, Rob Herring,
Sai Prakash Ranjan, freedreno, Vinod Koul, devicetree,
Bjorn Andersson, linux-arm-kernel, Robin Murphy,
Krzysztof Kozlowski, iommu, Konrad Dybcio
On Fri, 21 Oct 2022 19:55:27 +0300, Dmitry Baryshkov wrote:
> Rework clocks/clock-names properties schema to property describe
> possible usage cases.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> .../devicetree/bindings/iommu/arm,smmu.yaml | 129 ++++++++++++++++--
> 1 file changed, 121 insertions(+), 8 deletions(-)
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iommu/arm,smmu.example.dtb: iommu@d00000: 'anyOf' conditional failed, one must be fixed:
['bus', 'iface'] is too long
['bus', 'iface'] is too short
'iface' was expected
'iface-mm' was expected
'mem' was expected
'iface-smmu' was expected
[[4294967295, 123], [4294967295, 124]] is too long
[[4294967295, 123], [4294967295, 124]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 3/9] dt-bindings: arm-smmu: Add generic qcom,smmu-500 bindings
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
2022-10-21 16:55 ` [RFC PATCH 1/9] dt-bindings: arm-smmu: Add missing Qualcomm SMMU compatibles Dmitry Baryshkov
2022-10-21 16:55 ` [RFC PATCH 2/9] dt-bindings: arm-smmu: fix clocks/clock-names schema Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-22 15:45 ` Krzysztof Kozlowski
2022-10-21 16:55 ` [RFC PATCH 4/9] iommu/arm-smmu-qcom: Move implementation data into match data Dmitry Baryshkov
` (5 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
Add generic bindings for the Qualcomm variant of the ARM MMU-500. It is
expected that all future platforms will use the generic qcom,smmu-500
compat string in addition to SoC-specific and the generic arm,mmu-500
ones. Older bindings are now described as deprecated.
Note: I have split the sdx55 and sdx65 from the legacy bindings. They
are not supported by the qcom SMMU implementation. I can suppose that
they are using the generic implementation rather than the
Qualcomm-speicific one.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../devicetree/bindings/iommu/arm,smmu.yaml | 28 ++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index bae9fb3ffadb..796dc7d4dbdd 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -31,7 +31,7 @@ properties:
- qcom,sdm630-smmu-v2
- const: qcom,smmu-v2
- - description: Qcom SoCs implementing "arm,mmu-500"
+ - description: Qcom SoCs implementing "qcom,smmu-500" and "arm,mmu-500"
items:
- enum:
- qcom,qcm2290-smmu-500
@@ -40,8 +40,34 @@ properties:
- qcom,sc8180x-smmu-500
- qcom,sc8280xp-smmu-500
- qcom,sdm845-smmu-500
+ - qcom,sm6350-smmu-500
+ - qcom,sm6375-smmu-500
+ - qcom,sm8150-smmu-500
+ - qcom,sm8250-smmu-500
+ - qcom,sm8350-smmu-500
+ - qcom,sm8450-smmu-500
+ - const: qcom,smmu-500
+ - const: arm,mmu-500
+
+ - description: Qcom SoCs implementing "arm,mmu-500" (non-qcom implementation)
+ deprecated: true
+ items:
+ - enum:
- qcom,sdx55-smmu-500
- qcom,sdx65-smmu-500
+ - const: arm,mmu-500
+
+ - description: Qcom SoCs implementing "arm,mmu-500" (legacy binding)
+ deprecated: true
+ items:
+ # Do not add additional SoC to this list. Instead use two previous lists.
+ - enum:
+ - qcom,qcm2290-smmu-500
+ - qcom,sc7180-smmu-500
+ - qcom,sc7280-smmu-500
+ - qcom,sc8180x-smmu-500
+ - qcom,sc8280xp-smmu-500
+ - qcom,sdm845-smmu-500
- qcom,sm6350-smmu-500
- qcom,sm6375-smmu-500
- qcom,sm8150-smmu-500
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 3/9] dt-bindings: arm-smmu: Add generic qcom,smmu-500 bindings
2022-10-21 16:55 ` [RFC PATCH 3/9] dt-bindings: arm-smmu: Add generic qcom,smmu-500 bindings Dmitry Baryshkov
@ 2022-10-22 15:45 ` Krzysztof Kozlowski
0 siblings, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-22 15:45 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
On 21/10/2022 12:55, Dmitry Baryshkov wrote:
> Add generic bindings for the Qualcomm variant of the ARM MMU-500. It is
> expected that all future platforms will use the generic qcom,smmu-500
> compat string in addition to SoC-specific and the generic arm,mmu-500
> ones. Older bindings are now described as deprecated.
>
> Note: I have split the sdx55 and sdx65 from the legacy bindings. They
> are not supported by the qcom SMMU implementation. I can suppose that
> they are using the generic implementation rather than the
> Qualcomm-speicific one.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 4/9] iommu/arm-smmu-qcom: Move implementation data into match data
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (2 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 3/9] dt-bindings: arm-smmu: Add generic qcom,smmu-500 bindings Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:10 ` Sai Prakash Ranjan
2022-10-21 16:55 ` [RFC PATCH 5/9] iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create Dmitry Baryshkov
` (4 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
In preparation to rework of the implementation and configuration
details, make qcom_smmu_create() accept new qcom_smmu_match_data
structure pointer. Make implementation a field in this struct.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 58 ++++++++++++++--------
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 4 ++
2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index b2708de25ea3..bd228b7d6817 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -405,10 +405,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
};
static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
- const struct arm_smmu_impl *impl)
+ const struct qcom_smmu_match_data *data)
{
+ const struct arm_smmu_impl *impl;
struct qcom_smmu *qsmmu;
+ if (!data)
+ return ERR_PTR(-EINVAL);
+
+ impl = data->impl;
+ if (!impl)
+ return smmu;
+
/* Check to make sure qcom_scm has finished probing */
if (!qcom_scm_is_available())
return ERR_PTR(-EPROBE_DEFER);
@@ -423,22 +431,30 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
return &qsmmu->smmu;
}
+static const struct qcom_smmu_match_data qcom_smmu_data = {
+ .impl = &qcom_smmu_impl,
+};
+
+static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
+ .impl = &qcom_adreno_smmu_impl,
+};
+
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
- { .compatible = "qcom,msm8998-smmu-v2" },
- { .compatible = "qcom,qcm2290-smmu-500" },
- { .compatible = "qcom,sc7180-smmu-500" },
- { .compatible = "qcom,sc7280-smmu-500" },
- { .compatible = "qcom,sc8180x-smmu-500" },
- { .compatible = "qcom,sc8280xp-smmu-500" },
- { .compatible = "qcom,sdm630-smmu-v2" },
- { .compatible = "qcom,sdm845-smmu-500" },
- { .compatible = "qcom,sm6125-smmu-500" },
- { .compatible = "qcom,sm6350-smmu-500" },
- { .compatible = "qcom,sm6375-smmu-500" },
- { .compatible = "qcom,sm8150-smmu-500" },
- { .compatible = "qcom,sm8250-smmu-500" },
- { .compatible = "qcom,sm8350-smmu-500" },
- { .compatible = "qcom,sm8450-smmu-500" },
+ { .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_data },
+ { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sc7280-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_data },
{ }
};
@@ -453,12 +469,13 @@ static struct acpi_platform_list qcom_acpi_platlist[] = {
struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
{
const struct device_node *np = smmu->dev->of_node;
+ const struct of_device_id *match;
#ifdef CONFIG_ACPI
if (np == NULL) {
/* Match platform for ACPI boot */
if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
- return qcom_smmu_create(smmu, &qcom_smmu_impl);
+ return qcom_smmu_create(smmu, &qcom_smmu_data);
}
#endif
@@ -469,10 +486,11 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
* features if the order is changed.
*/
if (of_device_is_compatible(np, "qcom,adreno-smmu"))
- return qcom_smmu_create(smmu, &qcom_adreno_smmu_impl);
+ return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
- if (of_match_node(qcom_smmu_impl_of_match, np))
- return qcom_smmu_create(smmu, &qcom_smmu_impl);
+ match = of_match_node(qcom_smmu_impl_of_match, np);
+ if (match)
+ return qcom_smmu_create(smmu, match->data);
return smmu;
}
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
index 99ec8f8629a0..2424f10b7110 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
@@ -14,6 +14,10 @@ struct qcom_smmu {
u32 stall_enabled;
};
+struct qcom_smmu_match_data {
+ const struct arm_smmu_impl *impl;
+};
+
#ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu);
const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu);
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 4/9] iommu/arm-smmu-qcom: Move implementation data into match data
2022-10-21 16:55 ` [RFC PATCH 4/9] iommu/arm-smmu-qcom: Move implementation data into match data Dmitry Baryshkov
@ 2022-10-27 3:10 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:10 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> In preparation to rework of the implementation and configuration
> details, make qcom_smmu_create() accept new qcom_smmu_match_data
> structure pointer. Make implementation a field in this struct.
>
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 58 ++++++++++++++--------
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 4 ++
> 2 files changed, 42 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index b2708de25ea3..bd228b7d6817 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -405,10 +405,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
> };
>
> static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
> - const struct arm_smmu_impl *impl)
> + const struct qcom_smmu_match_data *data)
> {
> + const struct arm_smmu_impl *impl;
> struct qcom_smmu *qsmmu;
>
> + if (!data)
> + return ERR_PTR(-EINVAL);
> +
> + impl = data->impl;
> + if (!impl)
> + return smmu;
> +
> /* Check to make sure qcom_scm has finished probing */
> if (!qcom_scm_is_available())
> return ERR_PTR(-EPROBE_DEFER);
> @@ -423,22 +431,30 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
> return &qsmmu->smmu;
> }
>
> +static const struct qcom_smmu_match_data qcom_smmu_data = {
> + .impl = &qcom_smmu_impl,
> +};
> +
> +static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
> + .impl = &qcom_adreno_smmu_impl,
> +};
> +
> static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
> - { .compatible = "qcom,msm8998-smmu-v2" },
> - { .compatible = "qcom,qcm2290-smmu-500" },
> - { .compatible = "qcom,sc7180-smmu-500" },
> - { .compatible = "qcom,sc7280-smmu-500" },
> - { .compatible = "qcom,sc8180x-smmu-500" },
> - { .compatible = "qcom,sc8280xp-smmu-500" },
> - { .compatible = "qcom,sdm630-smmu-v2" },
> - { .compatible = "qcom,sdm845-smmu-500" },
> - { .compatible = "qcom,sm6125-smmu-500" },
> - { .compatible = "qcom,sm6350-smmu-500" },
> - { .compatible = "qcom,sm6375-smmu-500" },
> - { .compatible = "qcom,sm8150-smmu-500" },
> - { .compatible = "qcom,sm8250-smmu-500" },
> - { .compatible = "qcom,sm8350-smmu-500" },
> - { .compatible = "qcom,sm8450-smmu-500" },
> + { .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_data },
> + { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sc7280-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_data },
> { }
> };
>
> @@ -453,12 +469,13 @@ static struct acpi_platform_list qcom_acpi_platlist[] = {
> struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
> {
> const struct device_node *np = smmu->dev->of_node;
> + const struct of_device_id *match;
>
> #ifdef CONFIG_ACPI
> if (np == NULL) {
> /* Match platform for ACPI boot */
> if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
> - return qcom_smmu_create(smmu, &qcom_smmu_impl);
> + return qcom_smmu_create(smmu, &qcom_smmu_data);
> }
> #endif
>
> @@ -469,10 +486,11 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
> * features if the order is changed.
> */
> if (of_device_is_compatible(np, "qcom,adreno-smmu"))
> - return qcom_smmu_create(smmu, &qcom_adreno_smmu_impl);
> + return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
>
> - if (of_match_node(qcom_smmu_impl_of_match, np))
> - return qcom_smmu_create(smmu, &qcom_smmu_impl);
> + match = of_match_node(qcom_smmu_impl_of_match, np);
> + if (match)
> + return qcom_smmu_create(smmu, match->data);
>
> return smmu;
> }
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> index 99ec8f8629a0..2424f10b7110 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> @@ -14,6 +14,10 @@ struct qcom_smmu {
> u32 stall_enabled;
> };
>
> +struct qcom_smmu_match_data {
> + const struct arm_smmu_impl *impl;
> +};
> +
> #ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
> void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu);
> const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu);
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 5/9] iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (3 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 4/9] iommu/arm-smmu-qcom: Move implementation data into match data Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:11 ` Sai Prakash Ranjan
2022-10-21 16:55 ` [RFC PATCH 6/9] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500 Dmitry Baryshkov
` (3 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
Move special handling of qcom,adreno-smmu into qcom_smmu_create()
function. This allows us to further customize the Adreno SMMU
implementation.
Note, this also adds two entries to the qcom_smmu_impl_of_match table.
They were used with the qcom,adreno-smmu compat and were handled by the
removed clause.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 32 ++++++++++++----------
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 1 +
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index bd228b7d6817..c3bcd6eb2f42 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -407,13 +407,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
const struct qcom_smmu_match_data *data)
{
+ const struct device_node *np = smmu->dev->of_node;
const struct arm_smmu_impl *impl;
struct qcom_smmu *qsmmu;
if (!data)
return ERR_PTR(-EINVAL);
- impl = data->impl;
+ if (np && of_device_is_compatible(np, "qcom,adreno-smmu"))
+ impl = data->adreno_impl;
+ else
+ impl = data->impl;
+
if (!impl)
return smmu;
@@ -431,15 +436,22 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
return &qsmmu->smmu;
}
-static const struct qcom_smmu_match_data qcom_smmu_data = {
- .impl = &qcom_smmu_impl,
+/*
+ * It is not yet possible to use MDP SMMU with the bypass quirk on the msm8996,
+ * there are not enough context banks.
+ */
+static const struct qcom_smmu_match_data msm8996_smmu_data = {
+ .impl = NULL,
+ .adreno_impl = &qcom_adreno_smmu_impl,
};
-static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
- .impl = &qcom_adreno_smmu_impl,
+static const struct qcom_smmu_match_data qcom_smmu_data = {
+ .impl = &qcom_smmu_impl,
+ .adreno_impl = &qcom_adreno_smmu_impl,
};
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_data },
{ .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
@@ -447,6 +459,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
{ .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
{ .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
@@ -479,15 +492,6 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
}
#endif
- /*
- * Do not change this order of implementation, i.e., first adreno
- * smmu impl and then apss smmu since we can have both implementing
- * arm,mmu-500 in which case we will miss setting adreno smmu specific
- * features if the order is changed.
- */
- if (of_device_is_compatible(np, "qcom,adreno-smmu"))
- return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
-
match = of_match_node(qcom_smmu_impl_of_match, np);
if (match)
return qcom_smmu_create(smmu, match->data);
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
index 2424f10b7110..424d8d342ce0 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
@@ -16,6 +16,7 @@ struct qcom_smmu {
struct qcom_smmu_match_data {
const struct arm_smmu_impl *impl;
+ const struct arm_smmu_impl *adreno_impl;
};
#ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 5/9] iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create
2022-10-21 16:55 ` [RFC PATCH 5/9] iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create Dmitry Baryshkov
@ 2022-10-27 3:11 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:11 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> Move special handling of qcom,adreno-smmu into qcom_smmu_create()
> function. This allows us to further customize the Adreno SMMU
> implementation.
>
> Note, this also adds two entries to the qcom_smmu_impl_of_match table.
> They were used with the qcom,adreno-smmu compat and were handled by the
> removed clause.
>
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 32 ++++++++++++----------
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 1 +
> 2 files changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index bd228b7d6817..c3bcd6eb2f42 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -407,13 +407,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
> static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
> const struct qcom_smmu_match_data *data)
> {
> + const struct device_node *np = smmu->dev->of_node;
> const struct arm_smmu_impl *impl;
> struct qcom_smmu *qsmmu;
>
> if (!data)
> return ERR_PTR(-EINVAL);
>
> - impl = data->impl;
> + if (np && of_device_is_compatible(np, "qcom,adreno-smmu"))
> + impl = data->adreno_impl;
> + else
> + impl = data->impl;
> +
> if (!impl)
> return smmu;
>
> @@ -431,15 +436,22 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
> return &qsmmu->smmu;
> }
>
> -static const struct qcom_smmu_match_data qcom_smmu_data = {
> - .impl = &qcom_smmu_impl,
> +/*
> + * It is not yet possible to use MDP SMMU with the bypass quirk on the msm8996,
> + * there are not enough context banks.
> + */
> +static const struct qcom_smmu_match_data msm8996_smmu_data = {
> + .impl = NULL,
> + .adreno_impl = &qcom_adreno_smmu_impl,
> };
>
> -static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
> - .impl = &qcom_adreno_smmu_impl,
> +static const struct qcom_smmu_match_data qcom_smmu_data = {
> + .impl = &qcom_smmu_impl,
> + .adreno_impl = &qcom_adreno_smmu_impl,
> };
>
> 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_data },
> { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
> @@ -447,6 +459,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
> { .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
> { .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
> @@ -479,15 +492,6 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
> }
> #endif
>
> - /*
> - * Do not change this order of implementation, i.e., first adreno
> - * smmu impl and then apss smmu since we can have both implementing
> - * arm,mmu-500 in which case we will miss setting adreno smmu specific
> - * features if the order is changed.
> - */
> - if (of_device_is_compatible(np, "qcom,adreno-smmu"))
> - return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
> -
> match = of_match_node(qcom_smmu_impl_of_match, np);
> if (match)
> return qcom_smmu_create(smmu, match->data);
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> index 2424f10b7110..424d8d342ce0 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> @@ -16,6 +16,7 @@ struct qcom_smmu {
>
> struct qcom_smmu_match_data {
> const struct arm_smmu_impl *impl;
> + const struct arm_smmu_impl *adreno_impl;
> };
>
> #ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 6/9] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (4 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 5/9] iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:12 ` Sai Prakash Ranjan
2022-10-21 16:55 ` [RFC PATCH 7/9] iommu/arm-smmu-qcom: Merge table from arm-smmu-qcom-debug into match data Dmitry Baryshkov
` (2 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
There is only one platform, which needs special care in the reset
function, the SDM845. Add special handler for sdm845 and drop the
qcom_smmu500_reset() function.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 34 ++++++++++++----------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index c3bcd6eb2f42..75bc770ccf8c 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -361,6 +361,8 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
{
int ret;
+ arm_mmu500_reset(smmu);
+
/*
* To address performance degradation in non-real time clients,
* such as USB and UFS, turn off wait-for-safe on sdm845 based boards,
@@ -374,23 +376,20 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
return ret;
}
-static int qcom_smmu500_reset(struct arm_smmu_device *smmu)
-{
- const struct device_node *np = smmu->dev->of_node;
-
- arm_mmu500_reset(smmu);
-
- if (of_device_is_compatible(np, "qcom,sdm845-smmu-500"))
- return qcom_sdm845_smmu500_reset(smmu);
-
- return 0;
-}
-
static const struct arm_smmu_impl qcom_smmu_impl = {
.init_context = qcom_smmu_init_context,
.cfg_probe = qcom_smmu_cfg_probe,
.def_domain_type = qcom_smmu_def_domain_type,
- .reset = qcom_smmu500_reset,
+ .reset = arm_mmu500_reset,
+ .write_s2cr = qcom_smmu_write_s2cr,
+ .tlb_sync = qcom_smmu_tlb_sync,
+};
+
+static const struct arm_smmu_impl sdm845_smmu_500_impl = {
+ .init_context = qcom_smmu_init_context,
+ .cfg_probe = qcom_smmu_cfg_probe,
+ .def_domain_type = qcom_smmu_def_domain_type,
+ .reset = qcom_sdm845_smmu500_reset,
.write_s2cr = qcom_smmu_write_s2cr,
.tlb_sync = qcom_smmu_tlb_sync,
};
@@ -398,7 +397,7 @@ static const struct arm_smmu_impl qcom_smmu_impl = {
static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
.init_context = qcom_adreno_smmu_init_context,
.def_domain_type = qcom_smmu_def_domain_type,
- .reset = qcom_smmu500_reset,
+ .reset = arm_mmu500_reset,
.alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
.write_sctlr = qcom_adreno_smmu_write_sctlr,
.tlb_sync = qcom_smmu_tlb_sync,
@@ -450,6 +449,11 @@ static const struct qcom_smmu_match_data qcom_smmu_data = {
.adreno_impl = &qcom_adreno_smmu_impl,
};
+static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
+ .impl = &sdm845_smmu_500_impl,
+ /* No adreno impl, on sdm845 it is handled by separete sdm845-smmu-v2. */
+};
+
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_data },
@@ -460,7 +464,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
{ .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
{ .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
- { .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sdm845-smmu-500", .data = &sdm845_smmu_500_data },
{ .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
{ .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 6/9] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500
2022-10-21 16:55 ` [RFC PATCH 6/9] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500 Dmitry Baryshkov
@ 2022-10-27 3:12 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:12 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> There is only one platform, which needs special care in the reset
> function, the SDM845. Add special handler for sdm845 and drop the
> qcom_smmu500_reset() function.
>
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 34 ++++++++++++----------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index c3bcd6eb2f42..75bc770ccf8c 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -361,6 +361,8 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
> {
> int ret;
>
> + arm_mmu500_reset(smmu);
> +
> /*
> * To address performance degradation in non-real time clients,
> * such as USB and UFS, turn off wait-for-safe on sdm845 based boards,
> @@ -374,23 +376,20 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
> return ret;
> }
>
> -static int qcom_smmu500_reset(struct arm_smmu_device *smmu)
> -{
> - const struct device_node *np = smmu->dev->of_node;
> -
> - arm_mmu500_reset(smmu);
> -
> - if (of_device_is_compatible(np, "qcom,sdm845-smmu-500"))
> - return qcom_sdm845_smmu500_reset(smmu);
> -
> - return 0;
> -}
> -
> static const struct arm_smmu_impl qcom_smmu_impl = {
> .init_context = qcom_smmu_init_context,
> .cfg_probe = qcom_smmu_cfg_probe,
> .def_domain_type = qcom_smmu_def_domain_type,
> - .reset = qcom_smmu500_reset,
> + .reset = arm_mmu500_reset,
> + .write_s2cr = qcom_smmu_write_s2cr,
> + .tlb_sync = qcom_smmu_tlb_sync,
> +};
> +
> +static const struct arm_smmu_impl sdm845_smmu_500_impl = {
> + .init_context = qcom_smmu_init_context,
> + .cfg_probe = qcom_smmu_cfg_probe,
> + .def_domain_type = qcom_smmu_def_domain_type,
> + .reset = qcom_sdm845_smmu500_reset,
> .write_s2cr = qcom_smmu_write_s2cr,
> .tlb_sync = qcom_smmu_tlb_sync,
> };
> @@ -398,7 +397,7 @@ static const struct arm_smmu_impl qcom_smmu_impl = {
> static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
> .init_context = qcom_adreno_smmu_init_context,
> .def_domain_type = qcom_smmu_def_domain_type,
> - .reset = qcom_smmu500_reset,
> + .reset = arm_mmu500_reset,
> .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
> .write_sctlr = qcom_adreno_smmu_write_sctlr,
> .tlb_sync = qcom_smmu_tlb_sync,
> @@ -450,6 +449,11 @@ static const struct qcom_smmu_match_data qcom_smmu_data = {
> .adreno_impl = &qcom_adreno_smmu_impl,
> };
>
> +static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
> + .impl = &sdm845_smmu_500_impl,
> + /* No adreno impl, on sdm845 it is handled by separete sdm845-smmu-v2. */
Typo
> +};
> +
> 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_data },
> @@ -460,7 +464,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
> { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
> { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sdm845-smmu-500", .data = &sdm845_smmu_500_data },
> { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
> { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 7/9] iommu/arm-smmu-qcom: Merge table from arm-smmu-qcom-debug into match data
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (5 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 6/9] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500 Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:08 ` Sai Prakash Ranjan
2022-10-21 16:55 ` [RFC PATCH 8/9] iommu/arm-smmu-qcom: Stop using mmu500 reset for v2 MMUs Dmitry Baryshkov
2022-10-21 16:55 ` [RFC PATCH 9/9] iommu/arm-smmu-qcom: Add generic qcom,smmu-500 match entry Dmitry Baryshkov
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
There is little point in having a separate match table in
arm-smmu-qcom-debug.c. Merge it into the main match data table in
arm-smmu-qcom.c
Note, this also enables debug support for sm6375 and ACPI-based sc8180x
systems, since these SoCs are expected to support tlb_sync debug.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../iommu/arm/arm-smmu/arm-smmu-qcom-debug.c | 91 -------------------
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 46 +++++++---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 16 +++-
3 files changed, 43 insertions(+), 110 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
index 6eed8e67a0ca..74e9ef2fd580 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
@@ -10,16 +10,6 @@
#include "arm-smmu.h"
#include "arm-smmu-qcom.h"
-enum qcom_smmu_impl_reg_offset {
- QCOM_SMMU_TBU_PWR_STATUS,
- QCOM_SMMU_STATS_SYNC_INV_TBU_ACK,
- QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR,
-};
-
-struct qcom_smmu_config {
- const u32 *reg_offset;
-};
-
void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu)
{
int ret;
@@ -59,84 +49,3 @@ void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu)
tbu_pwr_status, sync_inv_ack, sync_inv_progress);
}
}
-
-/* Implementation Defined Register Space 0 register offsets */
-static const u32 qcom_smmu_impl0_reg_offset[] = {
- [QCOM_SMMU_TBU_PWR_STATUS] = 0x2204,
- [QCOM_SMMU_STATS_SYNC_INV_TBU_ACK] = 0x25dc,
- [QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR] = 0x2670,
-};
-
-static const struct qcom_smmu_config qcm2290_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sc7180_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sc7280_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sc8180x_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sc8280xp_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm6125_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm6350_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm8150_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm8250_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm8350_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct qcom_smmu_config sm8450_smmu_cfg = {
- .reg_offset = qcom_smmu_impl0_reg_offset,
-};
-
-static const struct of_device_id __maybe_unused qcom_smmu_impl_debug_match[] = {
- { .compatible = "qcom,msm8998-smmu-v2" },
- { .compatible = "qcom,qcm2290-smmu-500", .data = &qcm2290_smmu_cfg },
- { .compatible = "qcom,sc7180-smmu-500", .data = &sc7180_smmu_cfg },
- { .compatible = "qcom,sc7280-smmu-500", .data = &sc7280_smmu_cfg},
- { .compatible = "qcom,sc8180x-smmu-500", .data = &sc8180x_smmu_cfg },
- { .compatible = "qcom,sc8280xp-smmu-500", .data = &sc8280xp_smmu_cfg },
- { .compatible = "qcom,sdm630-smmu-v2" },
- { .compatible = "qcom,sdm845-smmu-500" },
- { .compatible = "qcom,sm6125-smmu-500", .data = &sm6125_smmu_cfg},
- { .compatible = "qcom,sm6350-smmu-500", .data = &sm6350_smmu_cfg},
- { .compatible = "qcom,sm8150-smmu-500", .data = &sm8150_smmu_cfg },
- { .compatible = "qcom,sm8250-smmu-500", .data = &sm8250_smmu_cfg },
- { .compatible = "qcom,sm8350-smmu-500", .data = &sm8350_smmu_cfg },
- { .compatible = "qcom,sm8450-smmu-500", .data = &sm8450_smmu_cfg },
- { }
-};
-
-const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu)
-{
- const struct of_device_id *match;
- const struct device_node *np = smmu->dev->of_node;
-
- match = of_match_node(qcom_smmu_impl_debug_match, np);
- if (!match)
- return NULL;
-
- return match->data;
-}
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index 75bc770ccf8c..20cbb39cb670 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -430,11 +430,22 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
return ERR_PTR(-ENOMEM);
qsmmu->smmu.impl = impl;
- qsmmu->cfg = qcom_smmu_impl_data(smmu);
+ qsmmu->cfg = data->cfg;
return &qsmmu->smmu;
}
+/* Implementation Defined Register Space 0 register offsets */
+static const u32 qcom_smmu_impl0_reg_offset[] = {
+ [QCOM_SMMU_TBU_PWR_STATUS] = 0x2204,
+ [QCOM_SMMU_STATS_SYNC_INV_TBU_ACK] = 0x25dc,
+ [QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR] = 0x2670,
+};
+
+static const struct qcom_smmu_config qcom_smmu_impl0_cfg = {
+ .reg_offset = qcom_smmu_impl0_reg_offset,
+};
+
/*
* It is not yet possible to use MDP SMMU with the bypass quirk on the msm8996,
* there are not enough context banks.
@@ -452,26 +463,33 @@ static const struct qcom_smmu_match_data qcom_smmu_data = {
static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
.impl = &sdm845_smmu_500_impl,
/* No adreno impl, on sdm845 it is handled by separete sdm845-smmu-v2. */
+ /* No debug configuration */
+};
+
+static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
+ .impl = &qcom_smmu_impl,
+ .adreno_impl = &qcom_adreno_smmu_impl,
+ .cfg = &qcom_smmu_impl0_cfg,
};
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_data },
- { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sc7280-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_500_impl0_data },
+ { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_500_impl0_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_data },
{ .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
{ .compatible = "qcom,sdm845-smmu-500", .data = &sdm845_smmu_500_data },
- { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_data },
- { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_data },
+ { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_500_impl0_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 },
{ }
};
@@ -492,7 +510,7 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
if (np == NULL) {
/* Match platform for ACPI boot */
if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
- return qcom_smmu_create(smmu, &qcom_smmu_data);
+ return qcom_smmu_create(smmu, &qcom_smmu_500_impl0_data);
}
#endif
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
index 424d8d342ce0..593910567b88 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
@@ -14,20 +14,26 @@ struct qcom_smmu {
u32 stall_enabled;
};
+enum qcom_smmu_impl_reg_offset {
+ QCOM_SMMU_TBU_PWR_STATUS,
+ QCOM_SMMU_STATS_SYNC_INV_TBU_ACK,
+ QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR,
+};
+
+struct qcom_smmu_config {
+ const u32 *reg_offset;
+};
+
struct qcom_smmu_match_data {
+ const struct qcom_smmu_config *cfg;
const struct arm_smmu_impl *impl;
const struct arm_smmu_impl *adreno_impl;
};
#ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu);
-const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu);
#else
static inline void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu) { }
-static inline const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu)
-{
- return NULL;
-}
#endif
#endif /* _ARM_SMMU_QCOM_H */
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 7/9] iommu/arm-smmu-qcom: Merge table from arm-smmu-qcom-debug into match data
2022-10-21 16:55 ` [RFC PATCH 7/9] iommu/arm-smmu-qcom: Merge table from arm-smmu-qcom-debug into match data Dmitry Baryshkov
@ 2022-10-27 3:08 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:08 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> There is little point in having a separate match table in
> arm-smmu-qcom-debug.c. Merge it into the main match data table in
> arm-smmu-qcom.c
>
> Note, this also enables debug support for sm6375 and ACPI-based sc8180x
> systems, since these SoCs are expected to support tlb_sync debug.
>
Nice cleanup,
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> .../iommu/arm/arm-smmu/arm-smmu-qcom-debug.c | 91 -------------------
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 46 +++++++---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 16 +++-
> 3 files changed, 43 insertions(+), 110 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
> index 6eed8e67a0ca..74e9ef2fd580 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
> @@ -10,16 +10,6 @@
> #include "arm-smmu.h"
> #include "arm-smmu-qcom.h"
>
> -enum qcom_smmu_impl_reg_offset {
> - QCOM_SMMU_TBU_PWR_STATUS,
> - QCOM_SMMU_STATS_SYNC_INV_TBU_ACK,
> - QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR,
> -};
> -
> -struct qcom_smmu_config {
> - const u32 *reg_offset;
> -};
> -
> void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu)
> {
> int ret;
> @@ -59,84 +49,3 @@ void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu)
> tbu_pwr_status, sync_inv_ack, sync_inv_progress);
> }
> }
> -
> -/* Implementation Defined Register Space 0 register offsets */
> -static const u32 qcom_smmu_impl0_reg_offset[] = {
> - [QCOM_SMMU_TBU_PWR_STATUS] = 0x2204,
> - [QCOM_SMMU_STATS_SYNC_INV_TBU_ACK] = 0x25dc,
> - [QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR] = 0x2670,
> -};
> -
> -static const struct qcom_smmu_config qcm2290_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sc7180_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sc7280_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sc8180x_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sc8280xp_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm6125_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm6350_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm8150_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm8250_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm8350_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct qcom_smmu_config sm8450_smmu_cfg = {
> - .reg_offset = qcom_smmu_impl0_reg_offset,
> -};
> -
> -static const struct of_device_id __maybe_unused qcom_smmu_impl_debug_match[] = {
> - { .compatible = "qcom,msm8998-smmu-v2" },
> - { .compatible = "qcom,qcm2290-smmu-500", .data = &qcm2290_smmu_cfg },
> - { .compatible = "qcom,sc7180-smmu-500", .data = &sc7180_smmu_cfg },
> - { .compatible = "qcom,sc7280-smmu-500", .data = &sc7280_smmu_cfg},
> - { .compatible = "qcom,sc8180x-smmu-500", .data = &sc8180x_smmu_cfg },
> - { .compatible = "qcom,sc8280xp-smmu-500", .data = &sc8280xp_smmu_cfg },
> - { .compatible = "qcom,sdm630-smmu-v2" },
> - { .compatible = "qcom,sdm845-smmu-500" },
> - { .compatible = "qcom,sm6125-smmu-500", .data = &sm6125_smmu_cfg},
> - { .compatible = "qcom,sm6350-smmu-500", .data = &sm6350_smmu_cfg},
> - { .compatible = "qcom,sm8150-smmu-500", .data = &sm8150_smmu_cfg },
> - { .compatible = "qcom,sm8250-smmu-500", .data = &sm8250_smmu_cfg },
> - { .compatible = "qcom,sm8350-smmu-500", .data = &sm8350_smmu_cfg },
> - { .compatible = "qcom,sm8450-smmu-500", .data = &sm8450_smmu_cfg },
> - { }
> -};
> -
> -const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu)
> -{
> - const struct of_device_id *match;
> - const struct device_node *np = smmu->dev->of_node;
> -
> - match = of_match_node(qcom_smmu_impl_debug_match, np);
> - if (!match)
> - return NULL;
> -
> - return match->data;
> -}
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index 75bc770ccf8c..20cbb39cb670 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -430,11 +430,22 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
> return ERR_PTR(-ENOMEM);
>
> qsmmu->smmu.impl = impl;
> - qsmmu->cfg = qcom_smmu_impl_data(smmu);
> + qsmmu->cfg = data->cfg;
>
> return &qsmmu->smmu;
> }
>
> +/* Implementation Defined Register Space 0 register offsets */
> +static const u32 qcom_smmu_impl0_reg_offset[] = {
> + [QCOM_SMMU_TBU_PWR_STATUS] = 0x2204,
> + [QCOM_SMMU_STATS_SYNC_INV_TBU_ACK] = 0x25dc,
> + [QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR] = 0x2670,
> +};
> +
> +static const struct qcom_smmu_config qcom_smmu_impl0_cfg = {
> + .reg_offset = qcom_smmu_impl0_reg_offset,
> +};
> +
> /*
> * It is not yet possible to use MDP SMMU with the bypass quirk on the msm8996,
> * there are not enough context banks.
> @@ -452,26 +463,33 @@ static const struct qcom_smmu_match_data qcom_smmu_data = {
> static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
> .impl = &sdm845_smmu_500_impl,
> /* No adreno impl, on sdm845 it is handled by separete sdm845-smmu-v2. */
> + /* No debug configuration */
> +};
> +
> +static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
> + .impl = &qcom_smmu_impl,
> + .adreno_impl = &qcom_adreno_smmu_impl,
> + .cfg = &qcom_smmu_impl0_cfg,
> };
>
> 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_data },
> - { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sc7280-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_500_impl0_data },
> + { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_500_impl0_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_data },
> { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
> { .compatible = "qcom,sdm845-smmu-500", .data = &sdm845_smmu_500_data },
> - { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_data },
> - { .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_data },
> + { .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_500_impl0_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 },
> { }
> };
>
> @@ -492,7 +510,7 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
> if (np == NULL) {
> /* Match platform for ACPI boot */
> if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
> - return qcom_smmu_create(smmu, &qcom_smmu_data);
> + return qcom_smmu_create(smmu, &qcom_smmu_500_impl0_data);
> }
> #endif
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> index 424d8d342ce0..593910567b88 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
> @@ -14,20 +14,26 @@ struct qcom_smmu {
> u32 stall_enabled;
> };
>
> +enum qcom_smmu_impl_reg_offset {
> + QCOM_SMMU_TBU_PWR_STATUS,
> + QCOM_SMMU_STATS_SYNC_INV_TBU_ACK,
> + QCOM_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR,
> +};
> +
> +struct qcom_smmu_config {
> + const u32 *reg_offset;
> +};
> +
> struct qcom_smmu_match_data {
> + const struct qcom_smmu_config *cfg;
> const struct arm_smmu_impl *impl;
> const struct arm_smmu_impl *adreno_impl;
> };
>
> #ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
> void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu);
> -const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu);
> #else
> static inline void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu) { }
> -static inline const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu)
> -{
> - return NULL;
> -}
> #endif
>
> #endif /* _ARM_SMMU_QCOM_H */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 8/9] iommu/arm-smmu-qcom: Stop using mmu500 reset for v2 MMUs
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (6 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 7/9] iommu/arm-smmu-qcom: Merge table from arm-smmu-qcom-debug into match data Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:13 ` Sai Prakash Ranjan
2022-10-21 16:55 ` [RFC PATCH 9/9] iommu/arm-smmu-qcom: Add generic qcom,smmu-500 match entry Dmitry Baryshkov
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
The arm_mmu500_reset() writes into registers specific for MMU500. For
the generic ARM SMMU v2 these registers (sACR) are defined as
'implementation defined'. Downstream Qualcomm driver for SMMUv2 doesn't
touch them.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 41 ++++++++++++++++------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index 20cbb39cb670..9abc40c00f3e 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -376,7 +376,15 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
return ret;
}
-static const struct arm_smmu_impl qcom_smmu_impl = {
+static const struct arm_smmu_impl qcom_smmu_v2_impl = {
+ .init_context = qcom_smmu_init_context,
+ .cfg_probe = qcom_smmu_cfg_probe,
+ .def_domain_type = qcom_smmu_def_domain_type,
+ .write_s2cr = qcom_smmu_write_s2cr,
+ .tlb_sync = qcom_smmu_tlb_sync,
+};
+
+static const struct arm_smmu_impl qcom_smmu_500_impl = {
.init_context = qcom_smmu_init_context,
.cfg_probe = qcom_smmu_cfg_probe,
.def_domain_type = qcom_smmu_def_domain_type,
@@ -394,7 +402,15 @@ static const struct arm_smmu_impl sdm845_smmu_500_impl = {
.tlb_sync = qcom_smmu_tlb_sync,
};
-static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
+static const struct arm_smmu_impl qcom_adreno_smmu_v2_impl = {
+ .init_context = qcom_adreno_smmu_init_context,
+ .def_domain_type = qcom_smmu_def_domain_type,
+ .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
+ .write_sctlr = qcom_adreno_smmu_write_sctlr,
+ .tlb_sync = qcom_smmu_tlb_sync,
+};
+
+static const struct arm_smmu_impl qcom_adreno_smmu_500_impl = {
.init_context = qcom_adreno_smmu_init_context,
.def_domain_type = qcom_smmu_def_domain_type,
.reset = arm_mmu500_reset,
@@ -452,12 +468,17 @@ static const struct qcom_smmu_config qcom_smmu_impl0_cfg = {
*/
static const struct qcom_smmu_match_data msm8996_smmu_data = {
.impl = NULL,
- .adreno_impl = &qcom_adreno_smmu_impl,
+ .adreno_impl = &qcom_adreno_smmu_v2_impl,
+};
+
+static const struct qcom_smmu_match_data qcom_smmu_v2_data = {
+ .impl = &qcom_smmu_v2_impl,
+ .adreno_impl = &qcom_adreno_smmu_v2_impl,
};
static const struct qcom_smmu_match_data qcom_smmu_data = {
- .impl = &qcom_smmu_impl,
- .adreno_impl = &qcom_adreno_smmu_impl,
+ .impl = &qcom_smmu_500_impl,
+ .adreno_impl = &qcom_adreno_smmu_500_impl,
};
static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
@@ -467,21 +488,21 @@ static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
};
static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
- .impl = &qcom_smmu_impl,
- .adreno_impl = &qcom_adreno_smmu_impl,
+ .impl = &qcom_smmu_500_impl,
+ .adreno_impl = &qcom_adreno_smmu_500_impl,
.cfg = &qcom_smmu_impl0_cfg,
};
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_data },
+ { .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_v2_data },
{ .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_500_impl0_data },
{ .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_500_impl0_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_data },
- { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_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,sm6125-smmu-500", .data = &qcom_smmu_500_impl0_data },
{ .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_500_impl0_data },
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 8/9] iommu/arm-smmu-qcom: Stop using mmu500 reset for v2 MMUs
2022-10-21 16:55 ` [RFC PATCH 8/9] iommu/arm-smmu-qcom: Stop using mmu500 reset for v2 MMUs Dmitry Baryshkov
@ 2022-10-27 3:13 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:13 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> The arm_mmu500_reset() writes into registers specific for MMU500. For
> the generic ARM SMMU v2 these registers (sACR) are defined as
> 'implementation defined'. Downstream Qualcomm driver for SMMUv2 doesn't
> touch them.
>
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 41 ++++++++++++++++------
> 1 file changed, 31 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index 20cbb39cb670..9abc40c00f3e 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -376,7 +376,15 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
> return ret;
> }
>
> -static const struct arm_smmu_impl qcom_smmu_impl = {
> +static const struct arm_smmu_impl qcom_smmu_v2_impl = {
> + .init_context = qcom_smmu_init_context,
> + .cfg_probe = qcom_smmu_cfg_probe,
> + .def_domain_type = qcom_smmu_def_domain_type,
> + .write_s2cr = qcom_smmu_write_s2cr,
> + .tlb_sync = qcom_smmu_tlb_sync,
> +};
> +
> +static const struct arm_smmu_impl qcom_smmu_500_impl = {
> .init_context = qcom_smmu_init_context,
> .cfg_probe = qcom_smmu_cfg_probe,
> .def_domain_type = qcom_smmu_def_domain_type,
> @@ -394,7 +402,15 @@ static const struct arm_smmu_impl sdm845_smmu_500_impl = {
> .tlb_sync = qcom_smmu_tlb_sync,
> };
>
> -static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
> +static const struct arm_smmu_impl qcom_adreno_smmu_v2_impl = {
> + .init_context = qcom_adreno_smmu_init_context,
> + .def_domain_type = qcom_smmu_def_domain_type,
> + .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
> + .write_sctlr = qcom_adreno_smmu_write_sctlr,
> + .tlb_sync = qcom_smmu_tlb_sync,
> +};
> +
> +static const struct arm_smmu_impl qcom_adreno_smmu_500_impl = {
> .init_context = qcom_adreno_smmu_init_context,
> .def_domain_type = qcom_smmu_def_domain_type,
> .reset = arm_mmu500_reset,
> @@ -452,12 +468,17 @@ static const struct qcom_smmu_config qcom_smmu_impl0_cfg = {
> */
> static const struct qcom_smmu_match_data msm8996_smmu_data = {
> .impl = NULL,
> - .adreno_impl = &qcom_adreno_smmu_impl,
> + .adreno_impl = &qcom_adreno_smmu_v2_impl,
> +};
> +
> +static const struct qcom_smmu_match_data qcom_smmu_v2_data = {
> + .impl = &qcom_smmu_v2_impl,
> + .adreno_impl = &qcom_adreno_smmu_v2_impl,
> };
>
> static const struct qcom_smmu_match_data qcom_smmu_data = {
> - .impl = &qcom_smmu_impl,
> - .adreno_impl = &qcom_adreno_smmu_impl,
> + .impl = &qcom_smmu_500_impl,
> + .adreno_impl = &qcom_adreno_smmu_500_impl,
> };
>
> static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
> @@ -467,21 +488,21 @@ static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
> };
>
> static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
> - .impl = &qcom_smmu_impl,
> - .adreno_impl = &qcom_adreno_smmu_impl,
> + .impl = &qcom_smmu_500_impl,
> + .adreno_impl = &qcom_adreno_smmu_500_impl,
> .cfg = &qcom_smmu_impl0_cfg,
> };
>
> 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_data },
> + { .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_v2_data },
> { .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_500_impl0_data },
> { .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_500_impl0_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_data },
> - { .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_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,sm6125-smmu-500", .data = &qcom_smmu_500_impl0_data },
> { .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_500_impl0_data },
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 9/9] iommu/arm-smmu-qcom: Add generic qcom,smmu-500 match entry
2022-10-21 16:55 [RFC PATCH 0/9] iommy/arm-smmu-qcom: Rework Qualcomm SMMU bindings and implementation Dmitry Baryshkov
` (7 preceding siblings ...)
2022-10-21 16:55 ` [RFC PATCH 8/9] iommu/arm-smmu-qcom: Stop using mmu500 reset for v2 MMUs Dmitry Baryshkov
@ 2022-10-21 16:55 ` Dmitry Baryshkov
2022-10-27 3:12 ` Sai Prakash Ranjan
8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2022-10-21 16:55 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, Joerg Roedel, Rob Herring,
Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio, Rob Clark
Cc: Vinod Koul, Sai Prakash Ranjan, linux-arm-kernel, linux-arm-msm,
iommu, devicetree, freedreno
Add generic qcom,smmu-500 compatibility string. Newer platforms should
use this generic entry rather than declaring per-SoC entries.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.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 9abc40c00f3e..3be81338a25b 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -493,6 +493,10 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
.cfg = &qcom_smmu_impl0_cfg,
};
+/*
+ * 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 },
@@ -511,6 +515,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
{ .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 },
{ }
};
--
2.35.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [RFC PATCH 9/9] iommu/arm-smmu-qcom: Add generic qcom,smmu-500 match entry
2022-10-21 16:55 ` [RFC PATCH 9/9] iommu/arm-smmu-qcom: Add generic qcom,smmu-500 match entry Dmitry Baryshkov
@ 2022-10-27 3:12 ` Sai Prakash Ranjan
0 siblings, 0 replies; 22+ messages in thread
From: Sai Prakash Ranjan @ 2022-10-27 3:12 UTC (permalink / raw)
To: Dmitry Baryshkov, Will Deacon, Robin Murphy, Joerg Roedel,
Rob Herring, Krzysztof Kozlowski, Bjorn Andersson, Konrad Dybcio,
Rob Clark
Cc: Vinod Koul, linux-arm-kernel, linux-arm-msm, iommu, devicetree,
freedreno
On 10/21/2022 10:25 PM, Dmitry Baryshkov wrote:
> Add generic qcom,smmu-500 compatibility string. Newer platforms should
> use this generic entry rather than declaring per-SoC entries.
>
Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.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 9abc40c00f3e..3be81338a25b 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -493,6 +493,10 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
> .cfg = &qcom_smmu_impl0_cfg,
> };
>
> +/*
> + * 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 },
> @@ -511,6 +515,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
> { .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 },
> { }
> };
>
^ permalink raw reply [flat|nested] 22+ messages in thread