[PATCH 0/4] bhyve: introduce PCI device passthrough support
Alexander Shursha (3): bhyve: Support passing the 'passthru' command line option bhyve: Advertise hostdev support bhyve: Tie the 'passthru' option to the 'hostdev' XML config Roman Bogorodskiy (1): bhyve: auto-assign PCI addresses for hostdevs src/bhyve/bhyve_capabilities.c | 2 +- src/bhyve/bhyve_command.c | 27 +++++++++ src/bhyve/bhyve_device.c | 10 ++++ src/bhyve/bhyve_domain.c | 6 ++ src/bhyve/bhyve_parse_command.c | 60 +++++++++++++++++++ .../bhyveargv2xml-passthru.args | 7 +++ .../bhyveargv2xml-passthru.xml | 22 +++++++ tests/bhyveargv2xmltest.c | 1 + .../bhyvexml2argv-passthru-multiple-devs.args | 12 ++++ ...hyvexml2argv-passthru-multiple-devs.ldargs | 4 ++ .../bhyvexml2argv-passthru-multiple-devs.xml | 41 +++++++++++++ .../bhyvexml2argv-passthru.args | 10 ++++ .../bhyvexml2argv-passthru.ldargs | 4 ++ .../bhyvexml2argv-passthru.xml | 31 ++++++++++ tests/bhyvexml2argvtest.c | 2 + ...bhyvexml2xmlout-passthru-multiple-devs.xml | 48 +++++++++++++++ tests/bhyvexml2xmltest.c | 1 + tests/domaincapsdata/bhyve_basic.x86_64.xml | 3 +- tests/domaincapsdata/bhyve_fbuf.x86_64.xml | 3 +- tests/domaincapsdata/bhyve_uefi.x86_64.xml | 3 +- 20 files changed, 293 insertions(+), 4 deletions(-) create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru-multiple-devs.xml -- 2.51.0
From: Alexander Shursha <kekek2@ya.ru> Bhyve supports PCI device passthrough using the following syntax: bhyve ... -s 4:0,passthru,5/2/0 ... Where 5/2/0 is PCI address of the device in the host, and "4:0" is the address in the guest. Currently, user is responsible for reserving the device for passthrough, i.e. by configuring pptdevs in loader.conf(5), or using devctl(8) to detach the device. Co-authored-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Signed-off-by: Alexander Shursha <kekek2@ya.ru> --- src/bhyve/bhyve_command.c | 27 ++++++++++++++++ src/bhyve/bhyve_domain.c | 6 ++++ .../bhyvexml2argv-passthru.args | 10 ++++++ .../bhyvexml2argv-passthru.ldargs | 4 +++ .../bhyvexml2argv-passthru.xml | 31 +++++++++++++++++++ tests/bhyvexml2argvtest.c | 1 + 6 files changed, 79 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 4c5b4518ea..4224cdf0fc 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -3,6 +3,7 @@ * * Copyright (C) 2014 Roman Bogorodskiy * Copyright (C) 2025 The FreeBSD Foundation + * Copyright (C) 2024-2025 Future Crew, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -216,6 +217,29 @@ bhyveBuildRNGArgStr(const virDomainDef *def G_GNUC_UNUSED, return 0; } +static int +bhyveBuildHostdevArgStr(const virDomainDef *def, virCommand *cmd) +{ + size_t i; + + for (i = 0; i < def->nhostdevs; i++) { + virDomainHostdevDef *hostdev = def->hostdevs[i]; + virDomainHostdevSubsys *subsys = &hostdev->source.subsys; + + if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) + continue; + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%d:%d,passthru,%d/%d/%d", + hostdev->info->addr.pci.slot, + hostdev->info->addr.pci.function, + subsys->u.pci.addr.bus, + subsys->u.pci.addr.slot, + subsys->u.pci.addr.function); + } + return 0; +} + static int bhyveBuildAHCIControllerArgStr(const virDomainDef *def, virDomainControllerDef *controller, @@ -940,6 +964,9 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def, virCommandAddArg(cmd, bhyvecmd->args[i]); } + if (bhyveBuildHostdevArgStr(def, cmd) < 0) + return NULL; + virCommandAddArg(cmd, def->name); return g_steal_pointer(&cmd); diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 3c7997ad86..63d61b9f85 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -345,6 +345,12 @@ bhyveDomainDefValidate(const virDomainDef *def, } } + if (def->nhostdevs && !def->mem.locked) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("using passthrough devices requires locking guest memory")); + return -1; + } + if (!def->os.loader) return 0; diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args new file mode 100644 index 0000000000..2ff43ad3b1 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args @@ -0,0 +1,10 @@ +bhyve \ +-c 1 \ +-m 214 \ +-S \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 7:0,passthru,3/0/0 \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml new file mode 100644 index 0000000000..02c932f62b --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml @@ -0,0 +1,31 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <memoryBacking> + <locked/> + </memoryBacking> + <vcpu placement='static'>1</vcpu> + <os> + <type>hvm</type> + </os> + <clock offset='localtime'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </hostdev> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 6837db2c7a..5d234b39fa 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -222,6 +222,7 @@ mymain(void) DO_TEST("serial-grub"); DO_TEST("localtime"); DO_TEST("net-e1000"); + DO_TEST("passthru"); DO_TEST("uefi"); DO_TEST("uefi-nvram"); DO_TEST("uefi-nvram-template-set"); -- 2.51.0
From: Alexander Shursha <kekek2@ya.ru> Signed-off-by: Alexander Shursha <kekek2@ya.ru> --- src/bhyve/bhyve_capabilities.c | 2 +- tests/domaincapsdata/bhyve_basic.x86_64.xml | 3 ++- tests/domaincapsdata/bhyve_fbuf.x86_64.xml | 3 ++- tests/domaincapsdata/bhyve_uefi.x86_64.xml | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index aad757e801..0585fff8e9 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -119,7 +119,7 @@ virBhyveDomainCapsFill(virDomainCaps *caps, VIR_DOMAIN_RNG_BACKEND_RANDOM); } - caps->hostdev.supported = VIR_TRISTATE_BOOL_NO; + caps->hostdev.supported = VIR_TRISTATE_BOOL_YES; caps->features[VIR_DOMAIN_CAPS_FEATURE_IOTHREADS] = VIR_TRISTATE_BOOL_NO; caps->features[VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO] = VIR_TRISTATE_BOOL_NO; caps->features[VIR_DOMAIN_CAPS_FEATURE_GENID] = VIR_TRISTATE_BOOL_NO; diff --git a/tests/domaincapsdata/bhyve_basic.x86_64.xml b/tests/domaincapsdata/bhyve_basic.x86_64.xml index 0c386c79d2..2dee7c6547 100644 --- a/tests/domaincapsdata/bhyve_basic.x86_64.xml +++ b/tests/domaincapsdata/bhyve_basic.x86_64.xml @@ -26,7 +26,8 @@ </disk> <graphics supported='no'/> <video supported='no'/> - <hostdev supported='no'/> + <hostdev supported='yes'> + </hostdev> <console supported='yes'> <enum name='type'> <value>tcp</value> diff --git a/tests/domaincapsdata/bhyve_fbuf.x86_64.xml b/tests/domaincapsdata/bhyve_fbuf.x86_64.xml index 2936281857..d2f0dd6383 100644 --- a/tests/domaincapsdata/bhyve_fbuf.x86_64.xml +++ b/tests/domaincapsdata/bhyve_fbuf.x86_64.xml @@ -43,7 +43,8 @@ <value>gop</value> </enum> </video> - <hostdev supported='no'/> + <hostdev supported='yes'> + </hostdev> <console supported='yes'> <enum name='type'> <value>tcp</value> diff --git a/tests/domaincapsdata/bhyve_uefi.x86_64.xml b/tests/domaincapsdata/bhyve_uefi.x86_64.xml index fa87fd3640..b093358c49 100644 --- a/tests/domaincapsdata/bhyve_uefi.x86_64.xml +++ b/tests/domaincapsdata/bhyve_uefi.x86_64.xml @@ -35,7 +35,8 @@ </disk> <graphics supported='no'/> <video supported='no'/> - <hostdev supported='no'/> + <hostdev supported='yes'> + </hostdev> <console supported='yes'> <enum name='type'> <value>tcp</value> -- 2.51.0
From: Alexander Shursha <kekek2@ya.ru> Signed-off-by: Alexander Shursha <kekek2@ya.ru> --- src/bhyve/bhyve_parse_command.c | 60 +++++++++++++++++++ .../bhyveargv2xml-passthru.args | 7 +++ .../bhyveargv2xml-passthru.xml | 22 +++++++ tests/bhyveargv2xmltest.c | 1 + 4 files changed, 90 insertions(+) create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c index 7a4e48fbf8..9ca5e1aab9 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -6,6 +6,7 @@ * Copyright (c) 2011 NetApp, Inc. * Copyright (C) 2020 Fabian Freyer * Copyright (C) 2025 The FreeBSD Foundation + * Copyright (C) 2024-2025 Future Crew, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -666,6 +667,63 @@ bhyveParsePCIRND(virDomainDef *def, return 0; } +static int +bhyveParsePassthru(virDomainDef *def G_GNUC_UNUSED, + unsigned pcibus, + unsigned pcislot, + unsigned pcifunction, + char *addr) +{ + /* -s slot,bus/slot/function */ + /* -s slot,pcibus:slot:function */ + virDomainHostdevDef *hostdev = NULL; + g_auto(GStrv) params = NULL; + GStrv param; + char *p = NULL; + + hostdev = virDomainHostdevDefNew(); + hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; + hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; + + hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + hostdev->info->addr.pci.bus = pcibus; + hostdev->info->addr.pci.slot = pcislot; + hostdev->info->addr.pci.function = pcifunction; + + if (!addr) + goto error; + + if (!(params = g_strsplit(addr, ":", -1))) { + virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to parse PCI address %1$s"), addr); + goto error; + } + if (g_str_equal(addr, *params)) { + g_free(params); + if (!(params = g_strsplit(addr, "/", -1))) { + virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to parse PCI address %1$s"), addr); + goto error; + } + } + if (g_strv_length(params) != 3) { + virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to parse PCI address %1$s"), addr); + goto error; + } + param = params; + hostdev->source.subsys.u.pci.addr.bus = g_ascii_strtoull(*param++, &p, 10); + hostdev->source.subsys.u.pci.addr.slot = g_ascii_strtoull(*param++, &p, 10); + hostdev->source.subsys.u.pci.addr.function = g_ascii_strtoull(*param, &p, 10); + + hostdev->source.subsys.u.pci.addr.domain = 0; + hostdev->managed = false; + + VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, hostdev); + return 0; + + error: + virDomainHostdevDefFree(hostdev); + return -1; +} + static int bhyveParseBhyvePCIArg(virDomainDef *def, virDomainXMLOption *xmlopt, @@ -732,6 +790,8 @@ bhyveParseBhyvePCIArg(virDomainDef *def, bhyveParsePCIFbuf(def, xmlopt, caps, bus, slot, function, conf); else if (STREQ(emulation, "virtio-rnd")) bhyveParsePCIRND(def, xmlopt, caps, bus, slot, function, conf); + else if (STREQ(emulation, "passthru")) + bhyveParsePassthru(def, bus, slot, function, conf); VIR_FREE(emulation); VIR_FREE(slotdef); diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args new file mode 100644 index 0000000000..4eb1ff14b5 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args @@ -0,0 +1,7 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 7,passthru,3/0/0 bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml new file mode 100644 index 0000000000..64118ff89c --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml @@ -0,0 +1,22 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type>hvm</type> + </os> + <clock offset='localtime'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </hostdev> + </devices> +</domain> diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index 82abce5b8f..acfaade24c 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -161,6 +161,7 @@ mymain(void) DO_TEST("virtio-blk"); DO_TEST("virtio-net"); DO_TEST("e1000"); + DO_TEST("passthru"); DO_TEST_WARN("virtio-net2"); DO_TEST_WARN("virtio-net3"); DO_TEST_WARN("virtio-net4"); -- 2.51.0
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_device.c | 10 ++++ .../bhyvexml2argv-passthru-multiple-devs.args | 12 +++++ ...hyvexml2argv-passthru-multiple-devs.ldargs | 4 ++ .../bhyvexml2argv-passthru-multiple-devs.xml | 41 ++++++++++++++++ tests/bhyvexml2argvtest.c | 1 + ...bhyvexml2xmlout-passthru-multiple-devs.xml | 48 +++++++++++++++++++ tests/bhyvexml2xmltest.c | 1 + 7 files changed, 117 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru-multiple-devs.xml diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 49cfccaeba..ead52ae704 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -196,6 +196,16 @@ bhyveAssignDevicePCISlots(virDomainDef *def, return -1; } + for (i = 0; i < def->nhostdevs; i++) { + if (!virDeviceInfoPCIAddressIsWanted(def->hostdevs[i]->info)) + continue; + if (virDomainPCIAddressReserveNextAddr(addrs, + def->hostdevs[i]->info, + VIR_PCI_CONNECT_TYPE_PCI_DEVICE, + -1) < 0) + return -1; + } + return 0; } diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.args b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.args new file mode 100644 index 0000000000..97647987bd --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.args @@ -0,0 +1,12 @@ +bhyve \ +-c 1 \ +-m 214 \ +-S \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 7:1,passthru,3/0/4 \ +-s 3:0,passthru,4/0/0 \ +-s 4:0,passthru,5/2/0 \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.xml new file mode 100644 index 0000000000..bcea7aa033 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru-multiple-devs.xml @@ -0,0 +1,41 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <memoryBacking> + <locked/> + </memoryBacking> + <vcpu placement='static'>1</vcpu> + <os> + <type>hvm</type> + </os> + <clock offset='localtime'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x03' slot='0x00' function='0x4'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/> + </hostdev> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> + </source> + </hostdev> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x05' slot='0x02' function='0x0'/> + </source> + </hostdev> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 5d234b39fa..f7411ee094 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -223,6 +223,7 @@ mymain(void) DO_TEST("localtime"); DO_TEST("net-e1000"); DO_TEST("passthru"); + DO_TEST("passthru-multiple-devs"); DO_TEST("uefi"); DO_TEST("uefi-nvram"); DO_TEST("uefi-nvram-template-set"); diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru-multiple-devs.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru-multiple-devs.xml new file mode 100644 index 0000000000..dbb2a03cd3 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru-multiple-devs.xml @@ -0,0 +1,48 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <memoryBacking> + <locked/> + </memoryBacking> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='localtime'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='pci' index='0' model='pci-root'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x03' slot='0x00' function='0x4'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/> + </hostdev> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </hostdev> + <hostdev mode='subsystem' type='pci' managed='no'> + <source> + <address domain='0x0000' bus='0x05' slot='0x02' function='0x0'/> + </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </hostdev> + </devices> +</domain> diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 226eaccc6a..97c8647192 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -119,6 +119,7 @@ mymain(void) DO_TEST_DIFFERENT("4-consoles"); DO_TEST_DIFFERENT("nvme"); DO_TEST_DIFFERENT("2-nvme-2-controllers"); + DO_TEST_DIFFERENT("passthru-multiple-devs"); /* Address allocation tests */ DO_TEST_DIFFERENT("addr-single-sata-disk"); -- 2.51.0
participants (1)
-
Roman Bogorodskiy