s390/pci: use physical addresses in DMA tables
authorNiklas Schnelle <schnelle@linux.ibm.com>
Thu, 25 Nov 2021 15:46:00 +0000 (16:46 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 6 Dec 2021 13:42:26 +0000 (14:42 +0100)
commit568de506e31749ae9140c1a804f3b1d1ab47b4c2
treeb8b530d2e892d9e7c83c48357c66129259b831f7
parent4e4dc65ab578c962ea898d475c0418ea29cc6b2f
s390/pci: use physical addresses in DMA tables

The entries in the DMA translation tables for our IOMMU must specify
physical addresses of either the next level table or the final page
to be mapped for DMA. Currently however the code simply passes the
virtual addresses of both. On the other hand we still need to walk the
tables via their virtual addresses so we need to do a phys_to_virt()
when setting the entries and a virt_to_phys() when getting them.
Similarly when passing the I/O translation anchor to the hardware we
must also specify its physical address.

As the DMA and IOMMU APIs we are implementing already use the correct
phys_addr_t type for the address to be mapped let's also thread this
through instead of treating it as just an unsigned long.

Note: this currently doesn't fix a real bug, since virtual addresses
are indentical to physical ones.

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/pci_dma.h
arch/s390/pci/pci.c
arch/s390/pci/pci_dma.c
drivers/iommu/s390-iommu.c