On 1/19/23 11:33 AM, Niklas Schnelle wrote: > On Tue, 2023-01-17 at 10:09 -0500, Matthew Rosato wrote: >> On 1/4/23 7:05 AM, Niklas Schnelle wrote: >>> While s390 already has a standard IOMMU driver and previous changes have >>> added I/O TLB flushing operations this driver is currently only used for >>> user-space PCI access such as vfio-pci. For the DMA API s390 instead >>> utilizes its own implementation in arch/s390/pci/pci_dma.c which drives >>> the same hardware and shares some code but requires a complex and >>> fragile hand over between DMA API and IOMMU API use of a device and >>> despite code sharing still leads to significant duplication and >>> maintenance effort. Let's utilize the common code DMAP API >>> implementation from drivers/iommu/dma-iommu.c instead allowing us to >>> get rid of arch/s390/pci/pci_dma.c. >>> >>> Signed-off-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx> >>> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c >>> index ef38b1514c77..6b0fe8761509 100644 >>> --- a/arch/s390/pci/pci.c >>> +++ b/arch/s390/pci/pci.c >>> @@ -124,7 +124,11 @@ int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas, >>> >>> WARN_ON_ONCE(iota & 0x3fff); >>> fib.pba = base; >>> - fib.pal = limit; >>> + /* Work around off by one in ISM virt device */ >>> + if (zdev->pft == 0x5 && limit > base) >> >> Nit: maybe a named #define for the ISM pft rather than hard-coding 0x5 here >> > > Hmm, I agree in principle but not sure where to put this #define. Maybe I would suggest pci_clp.h since the value is coming from a clp. > also important to mention that the off-by-one has actually been fixed > in current firmware but of course we still have to support broken > devices and the workaround still works with fixed ISM. +1