Skip to content

Commit

Permalink
qemu_vm: introduce amd-iommu
Browse files Browse the repository at this point in the history
Introduce `amd-iommu` device to guests. Configuration example:

    ```
    vm_iommu_model = amd
    iommu_$foo = ...
    iommu_$bar = ...
    ```

Signed-off-by: Xu Han <xuhan@redhat.com>
  • Loading branch information
luckyh committed Nov 18, 2024
1 parent 3a65355 commit 9f1046b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,24 @@ def __iothread_conflict_check(params):
)
devices.insert(dev)

if params.get("vm_iommu_model") == "amd" and devices.has_device("amd-iommu"):
devices.insert(
qdevices.QStringDevice(
"AMDVI-PCI",
{"driver": "AMDVI-PCI", "pcie_direct_plug": "yes"},
parent_bus={"type": "PCIE"},
)
)
iommu_params = {
"device-iotlb": params.get("iommu_device_iotlb"),
"intremap": params.get("iommu_intremap"),
"pt": params.get("iommu_pt"),
"xtsup": params.get("iommu_xtsup"),
}
dev = QDevice("amd-iommu", iommu_params)
set_cmdline_format_by_cfg(dev, self._get_cmdline_format_cfg(), "iommu_dev")
devices.insert(dev)

# Add device virtio-iommu, it must be added before any virtio devices
if params.get_boolean("virtio_iommu") and devices.has_device(
"virtio-iommu-pci"
Expand Down

0 comments on commit 9f1046b

Please sign in to comment.