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 15, 2024
1 parent 3a65355 commit 2e5fc35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,18 @@ def __iothread_conflict_check(params):
)
devices.insert(dev)

if params.get("vm_iommu_model") == "amd" and devices.has_device("amd-iommu"):
iommu_params = {
"device-iotlb": params.get("iommu_device_iotlb"),
"intremap": params.get("iommu_intremap"),
"pt": params.get("iommu_pt"),
"xtsup": params.get("iommu_xtsup"),
}
parent_bus = {"type": "PCIE"}
dev = QDevice("amd-iommu", iommu_params, parent_bus=parent_bus)
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 2e5fc35

Please sign in to comment.