linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] arm64: allwinner: h6: Add second IOMMU reference to Cedrus
@ 2022-11-17  6:07 Jernej Skrabec
  2022-11-17  6:07 ` [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels Jernej Skrabec
  2022-11-17  6:07 ` [PATCH v2 2/2] arm64: dts: allwinner: h6: Fix Cedrus " Jernej Skrabec
  0 siblings, 2 replies; 6+ messages in thread
From: Jernej Skrabec @ 2022-11-17  6:07 UTC (permalink / raw)
  To: mchehab, robh+dt, krzysztof.kozlowski+dt, wens, samuel
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, Jernej Skrabec

It turns out that Cedrus on H6 actually uses two IOMMU channels. Manual
mentiones two IOMMU channels, but it doesn't specify which is used when.
Page faults were also observed from both.

This series updates binding to allow up to two IOMMU channels and fixes
H6 DTSI.

Please take a look.

Best regards,
Jernej

Changes from v1:
- add minItems to binding
- add reviewed-by to DT patch

Jernej Skrabec (2):
  media: dt-bindings: allwinner: video-engine: Fix number of IOMMU
    channels
  arm64: dts: allwinner: h6: Fix Cedrus IOMMU channels

 .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 ++-
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi                   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

--
2.38.1


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

* [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels
  2022-11-17  6:07 [PATCH v2 0/2] arm64: allwinner: h6: Add second IOMMU reference to Cedrus Jernej Skrabec
@ 2022-11-17  6:07 ` Jernej Skrabec
  2022-11-17 13:13   ` Krzysztof Kozlowski
  2022-11-17  6:07 ` [PATCH v2 2/2] arm64: dts: allwinner: h6: Fix Cedrus " Jernej Skrabec
  1 sibling, 1 reply; 6+ messages in thread
From: Jernej Skrabec @ 2022-11-17  6:07 UTC (permalink / raw)
  To: mchehab, robh+dt, krzysztof.kozlowski+dt, wens, samuel
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, Jernej Skrabec

Cedrus (video engine) on Allwinner H6 actually uses two IOMMU channel,
not just one. However, Cedrus on SoCs like D1 only uses one channel.

Allow up to 2 IOMMU channels.

Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
index 541325f900a1..6446004d59d9 100644
--- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
+++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
@@ -55,7 +55,8 @@ properties:
     description: Phandle to the device SRAM
 
   iommus:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   memory-region:
     maxItems: 1
-- 
2.38.1


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

* [PATCH v2 2/2] arm64: dts: allwinner: h6: Fix Cedrus IOMMU channels
  2022-11-17  6:07 [PATCH v2 0/2] arm64: allwinner: h6: Add second IOMMU reference to Cedrus Jernej Skrabec
  2022-11-17  6:07 ` [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels Jernej Skrabec
@ 2022-11-17  6:07 ` Jernej Skrabec
  1 sibling, 0 replies; 6+ messages in thread
From: Jernej Skrabec @ 2022-11-17  6:07 UTC (permalink / raw)
  To: mchehab, robh+dt, krzysztof.kozlowski+dt, wens, samuel
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, Jernej Skrabec

Cedrus H6 actually uses two IOMMU channels. During development page
faults from both were observed. Documentation also lists both of them
to be connected to Cedrus, but it doesn't make clear which is used for
what.

Add second IOMMU channel.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 53f6660656ac..7bff054a9bdf 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -172,7 +172,7 @@ video-codec@1c0e000 {
 			resets = <&ccu RST_BUS_VE>;
 			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
 			allwinner,sram = <&ve_sram 1>;
-			iommus = <&iommu 3>;
+			iommus = <&iommu 1>, <&iommu 3>;
 		};
 
 		gpu: gpu@1800000 {
-- 
2.38.1


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

* Re: [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels
  2022-11-17  6:07 ` [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels Jernej Skrabec
@ 2022-11-17 13:13   ` Krzysztof Kozlowski
  2022-11-17 20:31     ` Jernej Škrabec
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2022-11-17 13:13 UTC (permalink / raw)
  To: Jernej Skrabec, mchehab, robh+dt, krzysztof.kozlowski+dt, wens, samuel
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel

On 17/11/2022 07:07, Jernej Skrabec wrote:
> Cedrus (video engine) on Allwinner H6 actually uses two IOMMU channel,
> not just one. However, Cedrus on SoCs like D1 only uses one channel.
> 
> Allow up to 2 IOMMU channels.
> 
> Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
> index 541325f900a1..6446004d59d9 100644
> --- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
> +++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
> @@ -55,7 +55,8 @@ properties:
>      description: Phandle to the device SRAM
>  
>    iommus:
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2

You have several compatibles in the file, so usually this is further
constrained per each variant in allOf:if:then:.

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels
  2022-11-17 13:13   ` Krzysztof Kozlowski
@ 2022-11-17 20:31     ` Jernej Škrabec
  2022-11-18  8:09       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Jernej Škrabec @ 2022-11-17 20:31 UTC (permalink / raw)
  To: mchehab, robh+dt, krzysztof.kozlowski+dt, wens, samuel,
	Krzysztof Kozlowski
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel

Dne četrtek, 17. november 2022 ob 14:13:00 CET je Krzysztof Kozlowski 
napisal(a):
> On 17/11/2022 07:07, Jernej Skrabec wrote:
> > Cedrus (video engine) on Allwinner H6 actually uses two IOMMU channel,
> > not just one. However, Cedrus on SoCs like D1 only uses one channel.
> > 
> > Allow up to 2 IOMMU channels.
> > 
> > Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> > ---
> > 
> >  .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
> > e.yaml
> > b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
> > e.yaml index 541325f900a1..6446004d59d9 100644
> > ---
> > a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
> > e.yaml +++
> > b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
> > e.yaml> 
> > @@ -55,7 +55,8 @@ properties:
> >      description: Phandle to the device SRAM
> >    
> >    iommus:
> > -    maxItems: 1
> > +    minItems: 1
> > +    maxItems: 2
> 
> You have several compatibles in the file, so usually this is further
> constrained per each variant in allOf:if:then:.

Usually, yes. But this whole binding would need update. It has a few optional 
properties and none of them is tied to any compatible. Additionally, if I do 
it as you suggest, then Robs automatic test will report the issue, because 
existing H6 based boards won't match this binding anymore. I would much rather 
send follow up patch which clears up all optional properties.

Best regards,
Jernej



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

* Re: [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels
  2022-11-17 20:31     ` Jernej Škrabec
@ 2022-11-18  8:09       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2022-11-18  8:09 UTC (permalink / raw)
  To: Jernej Škrabec, mchehab, robh+dt, krzysztof.kozlowski+dt,
	wens, samuel
  Cc: linux-media, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel

On 17/11/2022 21:31, Jernej Škrabec wrote:
> Dne četrtek, 17. november 2022 ob 14:13:00 CET je Krzysztof Kozlowski 
> napisal(a):
>> On 17/11/2022 07:07, Jernej Skrabec wrote:
>>> Cedrus (video engine) on Allwinner H6 actually uses two IOMMU channel,
>>> not just one. However, Cedrus on SoCs like D1 only uses one channel.
>>>
>>> Allow up to 2 IOMMU channels.
>>>
>>> Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
>>> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
>>> ---
>>>
>>>  .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
>>> e.yaml
>>> b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
>>> e.yaml index 541325f900a1..6446004d59d9 100644
>>> ---
>>> a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
>>> e.yaml +++
>>> b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engin
>>> e.yaml> 
>>> @@ -55,7 +55,8 @@ properties:
>>>      description: Phandle to the device SRAM
>>>    
>>>    iommus:
>>> -    maxItems: 1
>>> +    minItems: 1
>>> +    maxItems: 2
>>
>> You have several compatibles in the file, so usually this is further
>> constrained per each variant in allOf:if:then:.
> 
> Usually, yes. But this whole binding would need update. It has a few optional 
> properties and none of them is tied to any compatible. Additionally, if I do 
> it as you suggest, then Robs automatic test will report the issue, because 
> existing H6 based boards won't match this binding anymore. I would much rather 
> send follow up patch which clears up all optional properties.

I don't understand last argument. It's basically like saying - I keep
bindings not really correct, because otherwise I would see warnings and
I would need to fix them.

If this can be constrained per variant, constrain it and then fix the
boards.
Best regards,
Krzysztof


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

end of thread, other threads:[~2022-11-18  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  6:07 [PATCH v2 0/2] arm64: allwinner: h6: Add second IOMMU reference to Cedrus Jernej Skrabec
2022-11-17  6:07 ` [PATCH v2 1/2] media: dt-bindings: allwinner: video-engine: Fix number of IOMMU channels Jernej Skrabec
2022-11-17 13:13   ` Krzysztof Kozlowski
2022-11-17 20:31     ` Jernej Škrabec
2022-11-18  8:09       ` Krzysztof Kozlowski
2022-11-17  6:07 ` [PATCH v2 2/2] arm64: dts: allwinner: h6: Fix Cedrus " Jernej Skrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).