test-runner: add support for PCI passthrough
James Prestwood
PATCH 1/3 test-runner: add support for PCI passthrough
Adding back in PCI passthrough support
--- tools/test-runner | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/test-runner +10 -1
@@ -1649,6 +1649,7 @@ class Main: def start(self): usb_adapters = None + pci_adapters = None qemu_table = [ 'qemu-system-x86_64',
@@ -1691,7 +1692,7 @@ class Main: if self.args.hw: hw_conf = ConfigParser() hw_conf.read(self.args.hw) - # TODO: Parse PCI adapters + if hw_conf.has_section('USBAdapters'): # The actual key name of the adapter # doesn't matter since all we need is the
@@ -1699,6 +1700,9 @@ class Main: # anyways once in the VM. usb_adapters = [v for v in hw_conf['USBAdapters'].values()] + if hw_conf.has_section('PCIAdapters'): + pci_adapters = [v for v in hw_conf['PCIAdapters'].values()] + # # Additional arguments not provided to test-runner which are # needed once booted into the kernel.
@@ -1828,6 +1832,11 @@ class Main: '-device', 'usb-host,hostbus=%s,hostaddr=%s' % \ (bus, addr)]) + if pci_adapters: + qemu_cmdline.extend(['-enable-kvm']) + for addr in pci_adapters: + qemu_cmdline.extend(['-device', 'vfio-pci,host=%s' % addr]) + if self.args.log: # # Creates a virtfs device that can be mounted. This mount
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 5 lines · James Prestwood
Adding back in PCI passthrough support
--- tools/test-runner | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
All applied, thanks.
Regards,
-Denis
James Prestwood
PATCH 2/3 test-runner: handle pyroute2 IW() between versions
In reply to James PrestwoodIt appears different versions of pyroute2 may or may not have iwutil, and instead use pyroute2.IW() directly. Try the iwutil way first, then pyroute2.IW()
--- tools/test-runner | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/test-runner +5 -1
@@ -853,7 +853,11 @@ class TestContext(Namespace): def discover_radios(self): phys = [] - iw = pyroute2.iwutil.IW() + + try: + iw = pyroute2.iwutil.IW() + except: + iw = pyroute2.IW() attrs = [phy['attrs'] for phy in iw.list_wiphy()]
Signature · 1 line
2.31.1
James Prestwood
PATCH 3/3 test-runner: fix qemu warning for newer versions
In reply to James Prestwoodwarning: short-form boolean option 'readonly' deprecated Please use readonly=on instead
--- tools/test-runner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/test-runner +1 -1
@@ -1806,7 +1806,7 @@ class Main: '-display', 'none', '-m', '%dM' % ram, '-nographic', '-vga', 'none', '-no-acpi', '-no-hpet', '-no-reboot', '-fsdev', - 'local,id=fsdev-root,path=/,readonly,security_model=none,multidevs=remap', + 'local,id=fsdev-root,path=/,readonly=on,security_model=none,multidevs=remap', '-device', 'virtio-9p-pci,fsdev=fsdev-root,mount_tag=/dev/root', '-chardev', 'stdio,id=chardev-serial0,signal=off',
Signature · 1 line
2.31.1