On sPAPR, IOMMU page size varies and if QEMU is running with RAM
backed with hugepages, we can advertise this to the guest so does
this patch.

Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru>
---
 hw/ppc/spapr_pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index fd6fc1d953..09244056fc 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1505,6 +1505,9 @@ static void spapr_phb_realize(DeviceState *dev, Error 
**errp)
     }
 
     /* DMA setup */
+    /* This allows huge pages for IOMMU when guest is backed with huge pages */
+    sphb->page_size_mask |= qemu_getrampagesize();
+
     for (i = 0; i < windows_supported; ++i) {
         tcet = spapr_tce_new_table(DEVICE(sphb), sphb->dma_liobn[i]);
         if (!tcet) {
-- 
2.11.0


Reply via email to