commit 4d66e11b0ce054f51c5d48835786488e82bbf4af
parent 3a47181a50b66227be6fcd4783dbe67dcbea81c8
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 28 Oct 2021 10:34:08 -0700
test-runner: add support for PCI passthrough
Adding back in PCI passthrough support
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/test-runner b/tools/test-runner
@@ -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