Skip to content

Commit 922fbc1

Browse files
virtinst: add support for iommufd
A minimal config to enable iommufd would be $ virt-install ...args... --host-device 0x062a:0x0001,driver.iommufd=yes Signed-off-by: Nathan Chen <nathanc@nvidia.com>
1 parent d132714 commit 922fbc1

4 files changed

Lines changed: 9 additions & 0 deletions

File tree

tests/data/cli/compare/virt-install-many-devices.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,12 @@
928928
<zpci uid="0xffff" fid="0xffffffff"/>
929929
</address>
930930
</hostdev>
931+
<hostdev mode="subsystem" type="pci" managed="yes">
932+
<source>
933+
<address domain="0" bus="21" slot="0" function="4"/>
934+
</source>
935+
<driver name="vfio" iommufd="yes"/>
936+
</hostdev>
931937
<hostdev mode="subsystem" type="usb" managed="yes">
932938
<source>
933939
<vendor id="0x062a"/>

tests/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ def add_compare(self, cat, args, compbase, **kwargs):
748748
--hostdev 15:0.1
749749
--host-device 2:15:0.2
750750
--hostdev 0:15:0.3,address.type=pci,address.zpci.uid=0xffff,address.zpci.fid=0xffffffff
751+
--hostdev 0:15:0.4,driver_name=vfio,driver.iommufd=yes
751752
--host-device 0x062a:0x0001,driver_name=vfio
752753
--host-device 0483:2016
753754
--host-device pci_8086_2829_scsi_host_scsi_device_lun0,rom.bar=on,acpi.nodeset=0-2

virtinst/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5287,6 +5287,7 @@ def _virtcli_class_init(cls):
52875287
cls.add_arg("type", "type")
52885288
cls.add_arg("name", None, cb=cls.set_name_cb, lookup_cb=cls.name_lookup_cb)
52895289
cls.add_arg("driver.name", "driver_name")
5290+
cls.add_arg("driver.iommufd", "driver_iommufd")
52905291
cls.add_arg("rom.bar", "rom_bar", is_onoff=True)
52915292
cls.add_arg("acpi.nodeset", "acpi_nodeset", can_comma=True)
52925293
cls.add_arg("source.startupPolicy", "startup_policy")

virtinst/devices/hostdev.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def set_from_nodedev(self, nodedev):
127127
slot = XMLProperty("./source/address/@slot")
128128

129129
driver_name = XMLProperty("./driver/@name")
130+
driver_iommufd = XMLProperty("./driver/@iommufd", is_yesno=True)
130131
rom_bar = XMLProperty("./rom/@bar", is_onoff=True)
131132
acpi_nodeset = XMLProperty("./acpi/@nodeset")
132133

0 commit comments

Comments
 (0)