Commit 7df1dac5 authored by Matthew Rosato's avatar Matthew Rosato Committed by Christian Borntraeger
Browse files

s390: PCI: fix IOMMU region init



The fix in dbe9cf60 shrinks the IOMMU memory region to a size
that seems reasonable on the surface, however is actually too
small as it is based against a 0-mapped address space.  This
causes breakage with small guests as they can overrun the IOMMU window.

Let's go back to the prior method of initializing iommu for now.

Fixes: dbe9cf60 ("s390x/pci: Set the iommu region size mpcifc request")
Cc: qemu-stable@nongnu.org
Reviewed-by: default avatarPierre Morel <pmorel@linux.ibm.com>
Reported-by: default avatarBoris Fiuczynski <fiuczy@linux.ibm.com>
Tested-by: default avatarBoris Fiuczynski <fiuczy@linux.ibm.com>
Reported-by: default avatarStefan Zimmerman <stzi@linux.ibm.com>
Signed-off-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <1569507036-15314-1-git-send-email-mjrosato@linux.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent ecd6663d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -695,10 +695,15 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {

void s390_pci_iommu_enable(S390PCIIOMMU *iommu)
{
    /*
     * The iommu region is initialized against a 0-mapped address space,
     * so the smallest IOMMU region we can define runs from 0 to the end
     * of the PCI address space.
     */
    char *name = g_strdup_printf("iommu-s390-%04x", iommu->pbdev->uid);
    memory_region_init_iommu(&iommu->iommu_mr, sizeof(iommu->iommu_mr),
                             TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu->mr),
                             name, iommu->pal - iommu->pba + 1);
                             name, iommu->pal + 1);
    iommu->enabled = true;
    memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&iommu->iommu_mr));
    g_free(name);