[PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus

Sven Peter posted 22 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Sven Peter 1 month, 1 week ago
Apple's dwc3 variant requires two iommus.

Signed-off-by: Sven Peter <sven@kernel.org>
---
 Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index 4380bb6fa2f08a475b557e80467abc2861f622e2..6d35dcc605c01977f4fc6fdb6f12976f1cef2b9e 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -60,7 +60,7 @@ properties:
   dma-coherent: true
 
   iommus:
-    maxItems: 1
+    maxItems: 2
 
   power-domains:
     description:

-- 
2.34.1
Re: [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Krzysztof Kozlowski 1 month, 1 week ago
On Thu, Aug 21, 2025 at 03:38:53PM +0000, Sven Peter wrote:
> Apple's dwc3 variant requires two iommus.
> 
> Signed-off-by: Sven Peter <sven@kernel.org>
> ---
>  Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> index 4380bb6fa2f08a475b557e80467abc2861f622e2..6d35dcc605c01977f4fc6fdb6f12976f1cef2b9e 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> @@ -60,7 +60,7 @@ properties:
>    dma-coherent: true
>  
>    iommus:
> -    maxItems: 1
> +    maxItems: 2

Never tested. You anyway need specific constraints.

>  
>    power-domains:
>      description:
> 
> -- 
> 2.34.1
> 
>
Re: [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Krzysztof Kozlowski 1 month, 1 week ago
On 22/08/2025 09:22, Krzysztof Kozlowski wrote:
> On Thu, Aug 21, 2025 at 03:38:53PM +0000, Sven Peter wrote:
>> Apple's dwc3 variant requires two iommus.
>>
>> Signed-off-by: Sven Peter <sven@kernel.org>
>> ---
>>  Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>> index 4380bb6fa2f08a475b557e80467abc2861f622e2..6d35dcc605c01977f4fc6fdb6f12976f1cef2b9e 100644
>> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>> @@ -60,7 +60,7 @@ properties:
>>    dma-coherent: true
>>  
>>    iommus:
>> -    maxItems: 1
>> +    maxItems: 2
> 
> Never tested. You anyway need specific constraints.
I realized that's pretty vague, so clarifying: you changed all bindings
to have two iommus and that's unexpected. All other devices have only
one IOMMU mapping here, so they need to stay like that. If these IOMMUs
differ, you should also list them, but probably that's not the case here.

Best regards,
Krzysztof
Re: [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Sven Peter 1 month, 1 week ago
On 24.08.25 10:31, Krzysztof Kozlowski wrote:
> On 22/08/2025 09:22, Krzysztof Kozlowski wrote:
>> On Thu, Aug 21, 2025 at 03:38:53PM +0000, Sven Peter wrote:
>>> Apple's dwc3 variant requires two iommus.
>>>
>>> Signed-off-by: Sven Peter <sven@kernel.org>
>>> ---
>>>   Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>> index 4380bb6fa2f08a475b557e80467abc2861f622e2..6d35dcc605c01977f4fc6fdb6f12976f1cef2b9e 100644
>>> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>> @@ -60,7 +60,7 @@ properties:
>>>     dma-coherent: true
>>>   
>>>     iommus:
>>> -    maxItems: 1
>>> +    maxItems: 2
>>
>> Never tested. You anyway need specific constraints.
> I realized that's pretty vague, so clarifying: you changed all bindings
> to have two iommus and that's unexpected. All other devices have only
> one IOMMU mapping here, so they need to stay like that. If these IOMMUs
> differ, you should also list them, but probably that's not the case here.

Makes sense, thanks for the detailed explanation.

I don't quite understand why this controller needs two iommus but they 
must essentially be programmed to the same mapping for xhci to work.
All of device mode goes through one of them and xhci buffers are split 
between the two iommus (iirc I saw the command ring using the first one 
and the event ring the second one and then just decided to program them 
the same since anything else would result in a big mess).



Thanks,


Sven
Re: [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Krzysztof Kozlowski 1 month ago
On 27/08/2025 18:07, Sven Peter wrote:
> On 24.08.25 10:31, Krzysztof Kozlowski wrote:
>> On 22/08/2025 09:22, Krzysztof Kozlowski wrote:
>>> On Thu, Aug 21, 2025 at 03:38:53PM +0000, Sven Peter wrote:
>>>> Apple's dwc3 variant requires two iommus.
>>>>
>>>> Signed-off-by: Sven Peter <sven@kernel.org>
>>>> ---
>>>>   Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>>> index 4380bb6fa2f08a475b557e80467abc2861f622e2..6d35dcc605c01977f4fc6fdb6f12976f1cef2b9e 100644
>>>> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>>> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>>>> @@ -60,7 +60,7 @@ properties:
>>>>     dma-coherent: true
>>>>   
>>>>     iommus:
>>>> -    maxItems: 1
>>>> +    maxItems: 2
>>>
>>> Never tested. You anyway need specific constraints.
>> I realized that's pretty vague, so clarifying: you changed all bindings
>> to have two iommus and that's unexpected. All other devices have only
>> one IOMMU mapping here, so they need to stay like that. If these IOMMUs
>> differ, you should also list them, but probably that's not the case here.
> 
> Makes sense, thanks for the detailed explanation.
> 
> I don't quite understand why this controller needs two iommus but they 
> must essentially be programmed to the same mapping for xhci to work.

That's fine.

> All of device mode goes through one of them and xhci buffers are split 
> between the two iommus (iirc I saw the command ring using the first one 
> and the event ring the second one and then just decided to program them 
> the same since anything else would result in a big mess).

Sure. But if you change existing bindings (existing devices) allowing
them to have two IOMMUs, this must be explicitly mentioned in commit msg
with some sort of rationale (even if rationale was "we just missed that").

Best regards,
Krzysztof
Re: [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus
Posted by Rob Herring (Arm) 1 month, 1 week ago
On Thu, 21 Aug 2025 15:38:53 +0000, Sven Peter wrote:
> Apple's dwc3 variant requires two iommus.
> 
> Signed-off-by: Sven Peter <sven@kernel.org>
> ---
>  Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,dwc3.example.dtb: usb@a6f8800 (qcom,sdm845-dwc3): usb@a600000:iommus: [[4294967295, 1856, 0]] is too short
	from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,dwc3.example.dtb: usb@a6f8800 (qcom,sdm845-dwc3): usb@a600000: Unevaluated properties are not allowed ('iommus' was unexpected)
	from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,dwc3.example.dtb: usb@a6f8800 (qcom,sdm845-dwc3): usb@a600000: Unevaluated properties are not allowed ('iommus' was unexpected)
	from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,dwc3.example.dtb: usb@a600000 (snps,dwc3): iommus: [[4294967295, 1856, 0]] is too short
	from schema $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,dwc3.example.dtb: usb@a600000 (snps,dwc3): Unevaluated properties are not allowed ('iommus' was unexpected)
	from schema $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250821-atcphy-6-17-v1-1-172beda182b8@kernel.org

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

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 after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.