From: Michal Privoznik <[email protected]>

Resolves: https://issues.redhat.com/browse/RHEL-76269
Signed-off-by: Michal Privoznik <[email protected]>
---
 src/qemu/qemu_command.c                                     | 6 ++++++
 .../virtio-iommu-aarch64.aarch64-latest.args                | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6a01d647b9..0fde2eb659 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6285,6 +6285,7 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
         virDomainIOMMUDef *iommu = def->iommus[i];
         g_autoptr(virJSONValue) props = NULL;
         g_autoptr(virJSONValue) wrapperProps = NULL;
+        const char *granule_mode = NULL;
 
         switch (iommu->model) {
         case VIR_DOMAIN_IOMMU_MODEL_INTEL:
@@ -6306,10 +6307,15 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
             break;
 
         case VIR_DOMAIN_IOMMU_MODEL_VIRTIO:
+            if (iommu->granule_mode != VIR_DOMAIN_IOMMU_GRANULE_MODE_NONE) {
+                granule_mode = 
virDomainIOMMUGranuleModeTypeToString(iommu->granule_mode);
+            }
+
             if (virJSONValueObjectAdd(&props,
                                       "s:driver", "virtio-iommu",
                                       "s:id", iommu->info.alias,
                                       "z:aw-bits", iommu->aw_bits,
+                                      "S:granule", granule_mode,
                                       NULL) < 0) {
                 return -1;
             }
diff --git a/tests/qemuxmlconfdata/virtio-iommu-aarch64.aarch64-latest.args 
b/tests/qemuxmlconfdata/virtio-iommu-aarch64.aarch64-latest.args
index 071bc00b34..85160f3ca4 100644
--- a/tests/qemuxmlconfdata/virtio-iommu-aarch64.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/virtio-iommu-aarch64.aarch64-latest.args
@@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config 
\
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device 
'{"driver":"virtio-iommu","id":"iommu0","aw-bits":48,"bus":"pcie.0","addr":"0x1"}'
 \
+-device 
'{"driver":"virtio-iommu","id":"iommu0","aw-bits":48,"granule":"64K","bus":"pcie.0","addr":"0x1"}'
 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
-- 
2.52.0

Reply via email to