3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-28 21:19:24 +01:00

test-runner: add support for PCI passthrough

Adding back in PCI passthrough support
This commit is contained in:
James Prestwood 2021-10-28 10:34:08 -07:00 committed by Denis Kenzior
parent 3a47181a50
commit 4d66e11b0c

View File

@ -1649,6 +1649,7 @@ class Main:
def start(self): def start(self):
usb_adapters = None usb_adapters = None
pci_adapters = None
qemu_table = [ qemu_table = [
'qemu-system-x86_64', 'qemu-system-x86_64',
@ -1691,7 +1692,7 @@ class Main:
if self.args.hw: if self.args.hw:
hw_conf = ConfigParser() hw_conf = ConfigParser()
hw_conf.read(self.args.hw) hw_conf.read(self.args.hw)
# TODO: Parse PCI adapters
if hw_conf.has_section('USBAdapters'): if hw_conf.has_section('USBAdapters'):
# The actual key name of the adapter # The actual key name of the adapter
# doesn't matter since all we need is the # doesn't matter since all we need is the
@ -1699,6 +1700,9 @@ class Main:
# anyways once in the VM. # anyways once in the VM.
usb_adapters = [v for v in hw_conf['USBAdapters'].values()] 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 # Additional arguments not provided to test-runner which are
# needed once booted into the kernel. # needed once booted into the kernel.
@ -1828,6 +1832,11 @@ class Main:
'-device', '-device',
'usb-host,hostbus=%s,hostaddr=%s' % \ 'usb-host,hostbus=%s,hostaddr=%s' % \
(bus, addr)]) (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: if self.args.log:
# #
# Creates a virtfs device that can be mounted. This mount # Creates a virtfs device that can be mounted. This mount