• Y
    s390x/pci: fix up IOMMU size · f0a399db
    Yi Min Zhao 提交于
    Present code uses @size==UINT64_MAX to initialize IOMMU. It infers that it
    can map any 64-bit IOVA whatsoever. But in fact, the largest DMA range for
    each PCI Device on s390x is from ZPCI_SDMA_ADDR to ZPCI_EDMA_ADDR. The largest
    value is returned from hardware, which is to indicate the largest range
    hardware can support. But the real IOMMU size for specific PCI Device is
    obtained once qemu intercepts mpcifc instruction that guest is requesting a
    DMA range for that PCI Device. Therefore, before intercepting mpcifc instruction,
    qemu cannot be aware of the size of IOMMU region that guest will use.
    
    Moreover, iommu replay during device initialization for the whole region in
    4k steps takes a very long time.
    
    In conclusion, this patch intializes IOMMU region for each PCI Device when
    intercept mpcifc instruction which is to register DMA range for the PCI Device.
    And then, destroy IOMMU region when guest wants to deregister IOAT.
    Signed-off-by: NYi Min Zhao <zyimin@linux.vnet.ibm.com>
    Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
    Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
    f0a399db
s390-pci-bus.h 7.3 KB