mbox series

[v2,0/5] iommu: sun50i: Add Allwinner H616 support

Message ID 20240616224056.29159-1-andre.przywara@arm.com (mailing list archive)
Headers show
Series iommu: sun50i: Add Allwinner H616 support | expand

Message

Andre Przywara June 16, 2024, 10:40 p.m. UTC
Version two of this series adds a check that no physical address larger
than 4GB makes it into the PTEs: the map_pages() function returns an
error and prints a warning into dmesg to give users a clue why this
failed. I haven't tested whether this really happens, or whether the
32-bit DMA mask of the master devices already prevents this. In the
worst case this might fail on devices with 4GB of DRAM, but would always
work on smaller devices, which are arguably under bigger pressure to
find contiguous PA ranges. Changelog below.
===========================================

The Allwinner H616 contains an IOMMU almost compatible to the one used
in the H6. The differing default reset value of the bypass register
makes the two technically incompatible, so use a new DT compatible
string to be on the safe side.
The required driver changes can be applied to both variants, so the driver
is ignorant of the differences between the two for now.

Change the driver to cope with the new variant in patch 1/5 and 2/5,
then apply the required devicetree and binding changes in the remaining
patches.

I could just verify that the driver probes and allocates the page table
from below 4 GB. Others have verified that the driver works with the
(not yet upstream) video decoder engine, but more tests are surely
welcome.

Cheers,
Andre.

Changelog v1 .. v2:
- return error for too large PA in map_pages()
- add Krzysztof's ACK to the binding patch

Andre Przywara (4):
  iommu: sun50i: allocate page tables from below 4 GiB
  dt-bindings: iommu: add new compatible strings
  iommu: sun50i: Add H616 compatible string
  arm64: dts: allwinner: h616: add IOMMU node

Jernej Skrabec (1):
  iommu: sun50i: clear bypass register

 .../bindings/iommu/allwinner,sun50i-h6-iommu.yaml |  7 ++++++-
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi    |  9 +++++++++
 drivers/iommu/sun50i-iommu.c                      | 15 +++++++++++++--
 3 files changed, 28 insertions(+), 3 deletions(-)

Comments

Joerg Roedel June 25, 2024, 12:03 p.m. UTC | #1
On Sun, Jun 16, 2024 at 11:40:51PM +0100, Andre Przywara wrote:
>  .../bindings/iommu/allwinner,sun50i-h6-iommu.yaml |  7 ++++++-
>  arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi    |  9 +++++++++
>  drivers/iommu/sun50i-iommu.c                      | 15 +++++++++++++--
>  3 files changed, 28 insertions(+), 3 deletions(-)

Applied, thanks.
Chen-Yu Tsai June 25, 2024, 4:20 p.m. UTC | #2
Hi Joerg,

On Tue, Jun 25, 2024 at 8:03 PM Joerg Roedel <joro@8bytes.org> wrote:
>
> On Sun, Jun 16, 2024 at 11:40:51PM +0100, Andre Przywara wrote:
> >  .../bindings/iommu/allwinner,sun50i-h6-iommu.yaml |  7 ++++++-
> >  arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi    |  9 +++++++++
> >  drivers/iommu/sun50i-iommu.c                      | 15 +++++++++++++--
> >  3 files changed, 28 insertions(+), 3 deletions(-)
>
> Applied, thanks.

Could you back out the last patch? I'd like to take it through the sunxi
tree, which already has other H616 device tree patches.


Thanks
ChenYu
Joerg Roedel June 27, 2024, 10:15 a.m. UTC | #3
On Wed, Jun 26, 2024 at 12:20:08AM +0800, Chen-Yu Tsai wrote:
> Could you back out the last patch? I'd like to take it through the sunxi
> tree, which already has other H616 device tree patches.

Done. Removed "arm64: dts: allwinner: h616: add IOMMU node" from the
IOMMU tree.

Regards,

	Joerg
Chen-Yu Tsai June 27, 2024, 2:02 p.m. UTC | #4
From: Chen-Yu Tsai <wens@csie.org>

On Sun, 16 Jun 2024 23:40:51 +0100, Andre Przywara wrote:
> Version two of this series adds a check that no physical address larger
> than 4GB makes it into the PTEs: the map_pages() function returns an
> error and prints a warning into dmesg to give users a clue why this
> failed. I haven't tested whether this really happens, or whether the
> 32-bit DMA mask of the master devices already prevents this. In the
> worst case this might fail on devices with 4GB of DRAM, but would always
> work on smaller devices, which are arguably under bigger pressure to
> find contiguous PA ranges. Changelog below.
> ===========================================
> 
> [...]

Applied to sunxi/dt-for-6.11 in sunxi/linux.git, thanks!

[5/5] arm64: dts: allwinner: h616: add IOMMU node
      https://git.kernel.org/sunxi/linux/c/0c85e2e377c3

FTR, I moved the IOMMU device node after the GIC node so the nodes are
properly ordered.


Best regards,