[libvirt] [PATCH 0/4] bhyve: model PCI ISA bridge

This adds modeling of the pci-isa bridge device for bhyve to make it possible to assign specific PCI address for instead of the default PCI slot 0. I tried to keep the existing behaviour, i.e. the isa-bridge controller is automatically added to domain if it uses serial or video devices, or boot ROM. It also tries to assign pci slot 1 for it, that should not be a problem because previously that address was always reserved for the isa-bridge, so it definitely wasn't used by other devices. Now, however, it's not always reserved. For example, if there are no devices in the domain configuration that require isa-bridge, and users didn't explicitly add it (or added that on a different slot), then PCI slot 1 is available for allocation. This probably can be a problem for users when they figure out that they still need to add the isa-bridge device on slot 1, but it's already used, but I'm not sure if it's worth to always reserve slot 1 for that purpose. Roman Bogorodskiy (4): conf: add 'isa-bridge' PCI controller model bhyve: model PCI ISA bridge docs: bhyve: document isa-bridge addressing news: document bhyve isa-bridge changes docs/drvbhyve.html.in | 22 +++++++++ docs/news.xml | 10 ++++ docs/schemas/domaincommon.rng | 1 + src/bhyve/bhyve_command.c | 32 +++++-------- src/bhyve/bhyve_device.c | 47 ++++++++++++------- src/bhyve/bhyve_domain.c | 6 +++ src/conf/domain_addr.c | 10 ++++ src/conf/domain_addr.h | 4 +- src/conf/domain_conf.c | 2 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 1 + src/qemu/qemu_domain.c | 9 ++++ src/qemu/qemu_domain_address.c | 2 + .../bhyvexml2argv-acpiapic.args | 2 +- ...xml2argv-addr-more-than-32-sata-disks.args | 6 +-- ...hyvexml2argv-addr-multiple-sata-disks.args | 4 +- ...vexml2argv-addr-multiple-virtio-disks.args | 6 +-- ...rgv-addr-no32devs-multiple-sata-disks.args | 6 +-- ...l2argv-addr-no32devs-single-sata-disk.args | 4 +- .../bhyvexml2argv-addr-single-sata-disk.args | 4 +- ...bhyvexml2argv-addr-single-virtio-disk.args | 2 +- ...vexml2argv-addr-slot-1-and-31-not-lpc.args | 10 ++++ ...xml2argv-addr-slot-1-and-31-not-lpc.ldargs | 3 ++ ...yvexml2argv-addr-slot-1-and-31-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argv-addr-slot-1-not-lpc.args | 10 ++++ .../bhyvexml2argv-addr-slot-1-not-lpc.ldargs | 3 ++ .../bhyvexml2argv-addr-slot-1-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argvdata/bhyvexml2argv-base.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder1.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder3.args | 2 +- .../bhyvexml2argv-bhyveload-explicitargs.args | 2 +- .../bhyvexml2argv-commandline.args | 2 +- .../bhyvexml2argv-console.args | 2 +- .../bhyvexml2argv-cputopology.args | 2 +- .../bhyvexml2argv-custom-loader.args | 2 +- .../bhyvexml2argv-disk-cdrom-grub.args | 2 +- .../bhyvexml2argv-disk-cdrom.args | 2 +- .../bhyvexml2argv-explicit-lpc.args | 10 ++++ .../bhyvexml2argv-explicit-lpc.ldargs | 3 ++ .../bhyvexml2argv-explicit-lpc.xml | 26 ++++++++++ .../bhyvexml2argv-grub-bootorder.args | 2 +- .../bhyvexml2argv-grub-bootorder2.args | 2 +- .../bhyvexml2argv-grub-defaults.args | 2 +- .../bhyvexml2argv-input-xhci-tablet.args | 4 +- .../bhyvexml2argv-localtime.args | 2 +- .../bhyvexml2argv-macaddr.args | 2 +- .../bhyvexml2argv-net-e1000.args | 2 +- .../bhyvexml2argv-serial-grub-nocons.args | 2 +- .../bhyvexml2argv-serial-grub.args | 2 +- .../bhyvexml2argv-serial.args | 2 +- .../bhyvexml2argvdata/bhyvexml2argv-uefi.args | 4 +- .../bhyvexml2argv-vnc-autoport.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-io.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-off.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-on.args | 4 +- .../bhyvexml2argvdata/bhyvexml2argv-vnc.args | 4 +- .../bhyvexml2argv-wired.args | 2 +- tests/bhyvexml2argvtest.c | 3 ++ .../bhyvexml2xmlout-acpiapic.xml | 2 +- ...ml2xmlout-addr-more-than-32-sata-disks.xml | 6 +-- ...yvexml2xmlout-addr-multiple-sata-disks.xml | 4 +- ...exml2xmlout-addr-multiple-virtio-disks.xml | 6 +-- ...lout-addr-no32devs-multiple-sata-disks.xml | 8 ++-- ...2xmlout-addr-no32devs-single-sata-disk.xml | 4 +- .../bhyvexml2xmlout-addr-single-sata-disk.xml | 4 +- ...hyvexml2xmlout-addr-single-virtio-disk.xml | 2 +- ...exml2xmlout-addr-slot-1-and-31-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-addr-slot-1-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-base.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder1.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder2.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder3.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder4.xml | 2 +- ...bhyvexml2xmlout-bhyveload-explicitargs.xml | 2 +- .../bhyvexml2xmlout-commandline.xml | 2 +- .../bhyvexml2xmlout-console.xml | 3 ++ .../bhyvexml2xmlout-custom-loader.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom-grub.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom.xml | 2 +- .../bhyvexml2xmlout-explicit-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-grub-bootorder.xml | 2 +- .../bhyvexml2xmlout-grub-bootorder2.xml | 2 +- .../bhyvexml2xmlout-grub-defaults.xml | 2 +- .../bhyvexml2xmlout-input-xhci-tablet.xml | 4 +- .../bhyvexml2xmlout-localtime.xml | 2 +- .../bhyvexml2xmlout-macaddr.xml | 2 +- .../bhyvexml2xmlout-metadata.xml | 4 +- .../bhyvexml2xmlout-serial-grub-nocons.xml | 3 ++ .../bhyvexml2xmlout-serial-grub.xml | 3 ++ .../bhyvexml2xmlout-serial.xml | 3 ++ .../bhyvexml2xmlout-vnc-autoport.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-io.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-off.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-on.xml | 3 ++ .../bhyvexml2xmlout-vnc.xml | 3 ++ .../bhyvexml2xmlout-wired.xml | 2 +- tests/bhyvexml2xmltest.c | 3 ++ 99 files changed, 461 insertions(+), 128 deletions(-) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml -- 2.20.1

Introduce 'isa-bridge' PCI controller model that looks this way in domain XML: ... <controller type='pci' index='1' model='isa-bridge'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> ... Currently, this is needed by the bhyve driver to allow choosing a specific PCI address for that. In bhyve, this controller is used to attach serial ports and a boot ROM. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_addr.c | 10 ++++++++++ src/conf/domain_addr.h | 4 +++- src/conf/domain_conf.c | 2 ++ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 1 + src/qemu/qemu_domain.c | 9 +++++++++ src/qemu/qemu_domain_address.c | 2 ++ 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ba80440c72..382582063e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2294,6 +2294,7 @@ <value>pcie-switch-downstream-port</value> <value>pci-expander-bus</value> <value>pcie-expander-bus</value> + <value>isa-bridge</value> </choice> </attribute> </group> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 04c4e6d7e1..10f0c151c7 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -304,6 +304,9 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model) case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: return VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: + return VIR_PCI_CONNECT_TYPE_PCI_ISA_BRIDGE; } return 0; } @@ -591,6 +594,13 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus, bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST; break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: + bus->flags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE | + VIR_PCI_CONNECT_TYPE_PCI_BRIDGE); + bus->minSlot = 1; + bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index 803d07d415..bb4ddc385a 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -53,6 +53,7 @@ typedef enum { VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS = 1 << 9, VIR_PCI_CONNECT_TYPE_PCI_BRIDGE = 1 << 10, VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE = 1 << 11, + VIR_PCI_CONNECT_TYPE_PCI_ISA_BRIDGE = 1 << 12, } virDomainPCIConnectFlags; /* a combination of all bits that describe the type of connections @@ -67,7 +68,8 @@ typedef enum { VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS | \ VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS | \ VIR_PCI_CONNECT_TYPE_PCI_BRIDGE | \ - VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE) + VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE | \ + VIR_PCI_CONNECT_TYPE_PCI_ISA_BRIDGE) /* combination of all bits that could be used to connect a normal * endpoint device (i.e. excluding the connection possible between an diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6772c327ed..9a6fa14eb2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -354,6 +354,7 @@ VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST, "pcie-switch-downstream-port", "pci-expander-bus", "pcie-expander-bus", + "isa-bridge", ); VIR_ENUM_IMPL(virDomainControllerPCIModelName, @@ -10619,6 +10620,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt, case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: /* Other controller models don't require extra checks */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2bc3f879f7..06e003d8cd 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -704,6 +704,7 @@ typedef enum { VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT, VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS, VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS, + VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST } virDomainControllerModelPCI; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 572d3bc20f..101badf4ef 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3012,6 +3012,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Unsupported PCI Express root controller")); goto error; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 801d25a44b..512d74f382 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5405,6 +5405,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5486,6 +5487,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5530,6 +5532,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5571,6 +5574,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5606,6 +5610,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5637,6 +5642,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5682,6 +5688,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5713,6 +5720,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: @@ -5752,6 +5760,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont, } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: default: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 32fdd59566..88cf385c4a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2402,6 +2402,7 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont, *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE; break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: break; @@ -2803,6 +2804,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: break; -- 2.20.1

bhyve(8) uses PCI ISA bridge to attach serial ports and a boot ROM. In the libvirt driver a PCI slot 1 was always reserved for that, and if a domain used serial ports or a boot ROM, then it would be added to the command line. However, some guests require the ISA bridge to have PCI slot other than 1. To make things more flexible, explicitly model that in XML. So now the behavior is as follows: * The 'isa-bridge' PCI controller is added to the domain if it uses video or serial devices, or boot ROM * If user didn't assign a PCI address for that controller, slot 1 will reserved for it * If user did assign a PCI address for it, this address will be used, and PCI slot 1 will be free (available for reservation for other devices) * If user assigned slot 1 to other device, slot is checked. If it's also assigned already, then the next available PCI slot is used for LPC PCI-ISA bridge, and a warning about that is emitted Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 32 +++++-------- src/bhyve/bhyve_device.c | 47 ++++++++++++------- src/bhyve/bhyve_domain.c | 6 +++ .../bhyvexml2argv-acpiapic.args | 2 +- ...xml2argv-addr-more-than-32-sata-disks.args | 6 +-- ...hyvexml2argv-addr-multiple-sata-disks.args | 4 +- ...vexml2argv-addr-multiple-virtio-disks.args | 6 +-- ...rgv-addr-no32devs-multiple-sata-disks.args | 6 +-- ...l2argv-addr-no32devs-single-sata-disk.args | 4 +- .../bhyvexml2argv-addr-single-sata-disk.args | 4 +- ...bhyvexml2argv-addr-single-virtio-disk.args | 2 +- ...vexml2argv-addr-slot-1-and-31-not-lpc.args | 10 ++++ ...xml2argv-addr-slot-1-and-31-not-lpc.ldargs | 3 ++ ...yvexml2argv-addr-slot-1-and-31-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argv-addr-slot-1-not-lpc.args | 10 ++++ .../bhyvexml2argv-addr-slot-1-not-lpc.ldargs | 3 ++ .../bhyvexml2argv-addr-slot-1-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argvdata/bhyvexml2argv-base.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder1.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder3.args | 2 +- .../bhyvexml2argv-bhyveload-explicitargs.args | 2 +- .../bhyvexml2argv-commandline.args | 2 +- .../bhyvexml2argv-console.args | 2 +- .../bhyvexml2argv-cputopology.args | 2 +- .../bhyvexml2argv-custom-loader.args | 2 +- .../bhyvexml2argv-disk-cdrom-grub.args | 2 +- .../bhyvexml2argv-disk-cdrom.args | 2 +- .../bhyvexml2argv-explicit-lpc.args | 10 ++++ .../bhyvexml2argv-explicit-lpc.ldargs | 3 ++ .../bhyvexml2argv-explicit-lpc.xml | 26 ++++++++++ .../bhyvexml2argv-grub-bootorder.args | 2 +- .../bhyvexml2argv-grub-bootorder2.args | 2 +- .../bhyvexml2argv-grub-defaults.args | 2 +- .../bhyvexml2argv-input-xhci-tablet.args | 4 +- .../bhyvexml2argv-localtime.args | 2 +- .../bhyvexml2argv-macaddr.args | 2 +- .../bhyvexml2argv-net-e1000.args | 2 +- .../bhyvexml2argv-serial-grub-nocons.args | 2 +- .../bhyvexml2argv-serial-grub.args | 2 +- .../bhyvexml2argv-serial.args | 2 +- .../bhyvexml2argvdata/bhyvexml2argv-uefi.args | 4 +- .../bhyvexml2argv-vnc-autoport.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-io.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-off.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-on.args | 4 +- .../bhyvexml2argvdata/bhyvexml2argv-vnc.args | 4 +- .../bhyvexml2argv-wired.args | 2 +- tests/bhyvexml2argvtest.c | 3 ++ .../bhyvexml2xmlout-acpiapic.xml | 2 +- ...ml2xmlout-addr-more-than-32-sata-disks.xml | 6 +-- ...yvexml2xmlout-addr-multiple-sata-disks.xml | 4 +- ...exml2xmlout-addr-multiple-virtio-disks.xml | 6 +-- ...lout-addr-no32devs-multiple-sata-disks.xml | 8 ++-- ...2xmlout-addr-no32devs-single-sata-disk.xml | 4 +- .../bhyvexml2xmlout-addr-single-sata-disk.xml | 4 +- ...hyvexml2xmlout-addr-single-virtio-disk.xml | 2 +- ...exml2xmlout-addr-slot-1-and-31-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-addr-slot-1-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-base.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder1.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder2.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder3.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder4.xml | 2 +- ...bhyvexml2xmlout-bhyveload-explicitargs.xml | 2 +- .../bhyvexml2xmlout-commandline.xml | 2 +- .../bhyvexml2xmlout-console.xml | 3 ++ .../bhyvexml2xmlout-custom-loader.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom-grub.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom.xml | 2 +- .../bhyvexml2xmlout-explicit-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-grub-bootorder.xml | 2 +- .../bhyvexml2xmlout-grub-bootorder2.xml | 2 +- .../bhyvexml2xmlout-grub-defaults.xml | 2 +- .../bhyvexml2xmlout-input-xhci-tablet.xml | 4 +- .../bhyvexml2xmlout-localtime.xml | 2 +- .../bhyvexml2xmlout-macaddr.xml | 2 +- .../bhyvexml2xmlout-metadata.xml | 4 +- .../bhyvexml2xmlout-serial-grub-nocons.xml | 3 ++ .../bhyvexml2xmlout-serial-grub.xml | 3 ++ .../bhyvexml2xmlout-serial.xml | 3 ++ .../bhyvexml2xmlout-vnc-autoport.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-io.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-off.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-on.xml | 3 ++ .../bhyvexml2xmlout-vnc.xml | 3 ++ .../bhyvexml2xmlout-wired.xml | 2 +- tests/bhyvexml2xmltest.c | 3 ++ 89 files changed, 400 insertions(+), 127 deletions(-) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 1f215dac08..0842484086 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -325,14 +325,6 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED, return 0; } -static int -bhyveBuildLPCArgStr(const virDomainDef *def ATTRIBUTE_UNUSED, - virCommandPtr cmd) -{ - virCommandAddArgList(cmd, "-s", "1,lpc", NULL); - return 0; -} - static int bhyveBuildGraphicsArgStr(const virDomainDef *def, virDomainGraphicsDefPtr graphics, @@ -460,7 +452,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, * vm0 */ size_t i; - bool add_lpc = false; int nusbcontrollers = 0; unsigned int nvcpus = virDomainDefGetVcpus(def); @@ -549,7 +540,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM)) { virCommandAddArg(cmd, "-l"); virCommandAddArgFormat(cmd, "bootrom,%s", def->os.loader->path); - add_lpc = true; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " @@ -563,12 +553,20 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, virDomainControllerDefPtr controller = def->controllers[i]; switch (controller->type) { case VIR_DOMAIN_CONTROLLER_TYPE_PCI: - if (controller->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("unsupported PCI controller model: only PCI root supported")); - goto error; - } + switch (controller->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%d:0,lpc", + controller->info.addr.pci.slot); + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("unsupported PCI controller model: only PCI root supported")); + goto error; + } + break; case VIR_DOMAIN_CONTROLLER_TYPE_SATA: if (bhyveBuildAHCIControllerArgStr(def, controller, conn, cmd) < 0) goto error; @@ -613,7 +611,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->videos[0], conn, cmd, dryRun) < 0) goto error; - add_lpc = true; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Multiple graphics devices are not supported")); @@ -621,9 +618,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, } } - if (add_lpc || def->nserials) - bhyveBuildLPCArgStr(def, cmd); - if (bhyveBuildConsoleArgStr(def, cmd) < 0) goto error; diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 201044d9e6..d9ac1911a3 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -43,16 +43,8 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, virDomainPCIAddressSetPtr addrs = opaque; virPCIDeviceAddressPtr addr = &info->addr.pci; - if (addr->domain == 0 && addr->bus == 0) { - if (addr->slot == 0) { - return 0; - } else if (addr->slot == 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("PCI bus 0 slot 1 is reserved for the implicit " - "LPC PCI-ISA bridge")); - return -1; - } - } + if (addr->domain == 0 && addr->bus == 0 && addr->slot == 0) + return 0; if (virDomainPCIAddressReserveAddr(addrs, addr, VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { @@ -92,15 +84,36 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def, virDomainPCIAddressSetPtr addrs) { size_t i; - virPCIDeviceAddress lpc_addr; - /* explicitly reserve slot 1 for LPC-ISA bridge */ - memset(&lpc_addr, 0, sizeof(lpc_addr)); - lpc_addr.slot = 0x1; + /* Look for isa-bridge first, if it has no address assigned, we want to reserve + PCI slot 1 for it before it's used by some other device */ + for (i = 0; i < def->ncontrollers; i++) { + if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) && + (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE) && + virDeviceInfoPCIAddressIsWanted(&def->controllers[i]->info)) { + virPCIDeviceAddress lpc_addr; + memset(&lpc_addr, 0, sizeof(lpc_addr)); + lpc_addr.slot = 0x1; + + if (virDomainPCIAddressSlotInUse(addrs, &lpc_addr)) { + lpc_addr.slot = 0x1f; + + if (virDomainPCIAddressSlotInUse(addrs, &lpc_addr)) { + VIR_WARN("Cannot use PCI slots 1 and 31 for LPC PCI-ISA bridge " + "as they are already reserved, using the next available " + "address"); + continue; + } + } + + if (virDomainPCIAddressReserveAddr(addrs, &lpc_addr, + VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { + goto error; + } - if (virDomainPCIAddressReserveAddr(addrs, &lpc_addr, - VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { - goto error; + def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + def->controllers[i]->info.addr.pci = lpc_addr; + } } for (i = 0; i < def->ncontrollers; i++) { diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 79cf103d28..6e09cbc484 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -73,6 +73,12 @@ bhyveDomainDefPostParse(virDomainDefPtr def, VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0) return -1; + if ((def->os.bootloader == NULL && def->os.loader) || + (def->nconsoles || def->nserials) || (def->ngraphics && def->nvideos)) + if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1, + VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE) < 0) + return -1; + return 0; } diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args b/tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args index e71ceec84f..9a754f08da 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args @@ -7,5 +7,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:81:c4:b1 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args index d7917bd8f3..ce90d51311 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img,\ +-s 1:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img,\ hd:/tmp/freebsd4.img,hd:/tmp/freebsd5.img,hd:/tmp/freebsd6.img,\ hd:/tmp/freebsd7.img,hd:/tmp/freebsd8.img,hd:/tmp/freebsd9.img,\ hd:/tmp/freebsd10.img,hd:/tmp/freebsd11.img,hd:/tmp/freebsd12.img,\ @@ -16,6 +16,6 @@ hd:/tmp/freebsd21.img,hd:/tmp/freebsd22.img,hd:/tmp/freebsd23.img,\ hd:/tmp/freebsd24.img,hd:/tmp/freebsd25.img,hd:/tmp/freebsd26.img,\ hd:/tmp/freebsd27.img,hd:/tmp/freebsd28.img,hd:/tmp/freebsd29.img,\ hd:/tmp/freebsd30.img \ --s 3:0,ahci,hd:/tmp/freebsd31.img,hd:/tmp/freebsd32.img,hd:/tmp/freebsd33.img,\ +-s 2:0,ahci,hd:/tmp/freebsd31.img,hd:/tmp/freebsd32.img,hd:/tmp/freebsd33.img,\ hd:/tmp/freebsd34.img,hd:/tmp/freebsd35.img \ --s 4:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve +-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args index 5665842b84..ab06f070be 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd2.img \ --s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve +-s 1:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd2.img \ +-s 2:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-virtio-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-virtio-disks.args index 8cc1668949..d5abc6e181 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-virtio-disks.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-virtio-disks.args @@ -6,6 +6,6 @@ -P \ -s 0:0,hostbridge \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:bc:85:fe \ --s 2:0,virtio-blk,/tmp/freebsd.img \ --s 4:0,virtio-blk,/tmp/test.img \ --s 5:0,virtio-blk,/tmp/test2.img bhyve +-s 1:0,virtio-blk,/tmp/freebsd.img \ +-s 2:0,virtio-blk,/tmp/test.img \ +-s 4:0,virtio-blk,/tmp/test2.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args index 03bf381ffb..927ae7c026 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci-hd,/tmp/freebsd1.img \ +-s 1:0,ahci-hd,/tmp/freebsd1.img \ +-s 2:0,ahci-hd,/tmp/freebsd2.img \ -s 3:0,ahci-hd,/tmp/freebsd2.img \ --s 4:0,ahci-hd,/tmp/freebsd2.img \ --s 5:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve +-s 4:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args index d519241359..ee209efc14 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci-hd,/tmp/freebsd.img \ --s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve +-s 1:0,ahci-hd,/tmp/freebsd.img \ +-s 2:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args index 547485ba5d..d707d64089 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ --s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve +-s 1:0,ahci,hd:/tmp/freebsd.img \ +-s 2:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-virtio-disk.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-virtio-disk.args index 4dcc40404b..e9121a1227 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-virtio-disk.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-virtio-disk.args @@ -6,4 +6,4 @@ -P \ -s 0:0,hostbridge \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:bc:85:fe \ --s 2:0,virtio-blk,/tmp/freebsd.img bhyve +-s 1:0,virtio-blk,/tmp/freebsd.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args new file mode 100644 index 0000000000..6aa0393037 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args @@ -0,0 +1,10 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,lpc \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ +-s 31:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs new file mode 100644 index 0000000000..32538b558e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs @@ -0,0 +1,3 @@ +/usr/sbin/bhyveload \ +-m 214 \ +-d /tmp/freebsd.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml new file mode 100644 index 0000000000..78cfbe220b --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml @@ -0,0 +1,27 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <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> + <controller type='pci' index='1' model='isa-bridge'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <model type='virtio'/> + <source bridge="virbr0"/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args new file mode 100644 index 0000000000..22becbc9ca --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args @@ -0,0 +1,10 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 31:0,lpc \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ +-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs new file mode 100644 index 0000000000..32538b558e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs @@ -0,0 +1,3 @@ +/usr/sbin/bhyveload \ +-m 214 \ +-d /tmp/freebsd.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml new file mode 100644 index 0000000000..630c898c25 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml @@ -0,0 +1,27 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <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> + <controller type='pci' index='1' model='isa-bridge'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <model type='virtio'/> + <source bridge="virbr0"/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-base.args b/tests/bhyvexml2argvdata/bhyvexml2argv-base.args index 547485ba5d..f350590aa6 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-base.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-base.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.args b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.args index 4d7c7c92a8..9ac476e0dd 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ +-s 1:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:8d:10:e1 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.args b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.args index 8ec9799ccd..241ad4da75 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ +-s 1:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:92:68:0e bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.args b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.args index f1c0bf3987..0658357e4e 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ +-s 1:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:7a:f5:a4 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args index 17a1c83809..11f0fa390d 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:11:bd:26 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-commandline.args b/tests/bhyvexml2argvdata/bhyvexml2argv-commandline.args index cb21b99cd6..5d8b820074 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-commandline.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-commandline.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 ARGUMENT1 ARGUMENT2 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-console.args b/tests/bhyvexml2argvdata/bhyvexml2argv-console.args index 6ab91ae7e4..25fbd4727e 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-console.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-console.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:b1:42:eb \ --s 1,lpc \ -l com1,/dev/nmdm0A bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-cputopology.args b/tests/bhyvexml2argvdata/bhyvexml2argv-cputopology.args index 2d175a4178..4e643a7809 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-cputopology.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-cputopology.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args b/tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args index f6bfc78374..32c31e7f09 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:35:99:c2 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args index 72f1d3538c..1b14ff7680 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,cd:/tmp/cdrom.iso \ +-s 1:0,ahci,cd:/tmp/cdrom.iso \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:6f:6a:53 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.args b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.args index 3e61b8fc8a..d6fe24e042 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,cd:/tmp/cdrom.iso \ +-s 1:0,ahci,cd:/tmp/cdrom.iso \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:e3:ec:9b bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args new file mode 100644 index 0000000000..22becbc9ca --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args @@ -0,0 +1,10 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 31:0,lpc \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ +-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs new file mode 100644 index 0000000000..32538b558e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs @@ -0,0 +1,3 @@ +/usr/sbin/bhyveload \ +-m 214 \ +-d /tmp/freebsd.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml new file mode 100644 index 0000000000..cd1c4b5be7 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml @@ -0,0 +1,26 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </controller> + <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> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <model type='virtio'/> + <source bridge="virbr0"/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.args b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.args index e64e67b39d..395769ff2a 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img \ +-s 1:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:f4:6c:be bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.args b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.args index 872a69df3b..f0dbeabfc4 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img \ +-s 1:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:0e:d2:6f bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args index 3ba5c11608..ee1edb5bbf 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:ee:f5:79 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-input-xhci-tablet.args b/tests/bhyvexml2argvdata/bhyvexml2argv-input-xhci-tablet.args index b1c0c94d03..9d15ff1d7c 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-input-xhci-tablet.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-input-xhci-tablet.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,xhci,tablet \ --s 3:0,ahci-hd,/tmp/freebsd.img bhyve +-s 1:0,xhci,tablet \ +-s 2:0,ahci-hd,/tmp/freebsd.img bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args b/tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args index 307d888c1f..d38aefd393 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args @@ -4,5 +4,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:82:ca:a3 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args b/tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args index 5e13a9742d..9da11060c9 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:22:ee:11 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-net-e1000.args b/tests/bhyvexml2argvdata/bhyvexml2argv-net-e1000.args index 09e30db46e..05fddf011d 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-net-e1000.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-net-e1000.args @@ -5,5 +5,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,e1000,faketapdev,mac=52:54:00:00:00:00 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args index 42a278208d..02846cb893 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ +-s 1:0,lpc \ -s 2:0,ahci-hd,/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:a7:cd:5b \ --s 1,lpc \ -l com1,/dev/nmdm0A bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args index 313724dc90..e4712b448c 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:f0:72:11 \ --s 1,lpc \ -l com1,/dev/nmdm0A bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args index 059e457072..f45a190137 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args @@ -5,7 +5,7 @@ -H \ -P \ -s 0:0,hostbridge \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:4f:f3:5b \ --s 1,lpc \ -l com1,/dev/nmdm0A bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args index 8ff8673ed4..937b066e8c 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args @@ -6,6 +6,6 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ --s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 1,lpc bhyve +-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args index 039526ff35..551469dabe 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args @@ -6,7 +6,7 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 4:0,fbuf,tcp=127.0.0.1:5900 \ --s 1,lpc bhyve +-s 4:0,fbuf,tcp=127.0.0.1:5900 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args index da37971009..47022e84cf 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args @@ -6,7 +6,7 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 4:0,fbuf,tcp=127.0.0.1:5904,vga=io \ --s 1,lpc bhyve +-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=io bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args index 70347ee0b6..923098f3db 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args @@ -6,7 +6,7 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 4:0,fbuf,tcp=127.0.0.1:5904,vga=off \ --s 1,lpc bhyve +-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=off bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args index d0e1d81e2a..9225f5d133 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args @@ -6,7 +6,7 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 4:0,fbuf,tcp=127.0.0.1:5904,vga=on \ --s 1,lpc bhyve +-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=on bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args index 90889b8f39..cd7a543265 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args @@ -6,7 +6,7 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ -s 2:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \ --s 4:0,fbuf,tcp=127.0.0.1:5904 \ --s 1,lpc bhyve +-s 4:0,fbuf,tcp=127.0.0.1:5904 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-wired.args b/tests/bhyvexml2argvdata/bhyvexml2argv-wired.args index 13d4f49095..ae750335a9 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-wired.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-wired.args @@ -6,5 +6,5 @@ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 4a7f65a8e2..78e4f9a68c 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -211,6 +211,7 @@ mymain(void) DO_TEST("cputopology"); DO_TEST_FAILURE("cputopology-nvcpu-mismatch"); DO_TEST("commandline"); + DO_TEST("explicit-lpc"); /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); @@ -218,6 +219,8 @@ mymain(void) DO_TEST("addr-more-than-32-sata-disks"); DO_TEST("addr-single-virtio-disk"); DO_TEST("addr-multiple-virtio-disks"); + DO_TEST("addr-slot-1-not-lpc"); + DO_TEST("addr-slot-1-and-31-not-lpc"); /* The same without 32 devs per controller support */ driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT; diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-acpiapic.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-acpiapic.xml index 0a9b284ffb..ffcc6912a1 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-acpiapic.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-acpiapic.xml @@ -25,7 +25,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:81:c4:b1'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml index ac3799936f..99fdcb69fd 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml @@ -231,16 +231,16 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='sata' index='1'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml index ac4cbb4ea2..757661a9cc 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml @@ -33,13 +33,13 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-virtio-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-virtio-disks.xml index 542bff121c..6cf4aec932 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-virtio-disks.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-virtio-disks.xml @@ -17,19 +17,19 @@ <driver name='file' type='raw'/> <source file='/tmp/freebsd.img'/> <target dev='vda' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='file' type='raw'/> <source file='/tmp/test.img'/> <target dev='vdb' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='file' type='raw'/> <source file='/tmp/test2.img'/> <target dev='vdc' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <controller type='pci' index='0' model='pci-root'/> <interface type='bridge'> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml index e4be4b9a40..da0f39731b 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml @@ -33,19 +33,19 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='sata' index='1'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> <controller type='sata' index='2'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml index 53fa67a3ed..22fd2a29cb 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml @@ -21,13 +21,13 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml index 53fa67a3ed..22fd2a29cb 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml @@ -21,13 +21,13 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-virtio-disk.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-virtio-disk.xml index d7abb5abcd..d16f8d814d 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-virtio-disk.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-virtio-disk.xml @@ -17,7 +17,7 @@ <driver name='file' type='raw'/> <source file='/tmp/freebsd.img'/> <target dev='vda' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </disk> <controller type='pci' index='0' model='pci-root'/> <interface type='bridge'> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml new file mode 100644 index 0000000000..66ba229336 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml @@ -0,0 +1,36 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</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='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <source bridge='virbr0'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml new file mode 100644 index 0000000000..7f229a28d7 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml @@ -0,0 +1,36 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</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='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <source bridge='virbr0'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-base.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-base.xml index 56ff3bd14b..5943b3549e 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-base.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-base.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder.xml index c4705d9a8b..6718603be8 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder.xml @@ -28,7 +28,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:8d:10:e1'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder1.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder1.xml index ebc781e740..a3dbb6cce7 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder1.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder1.xml @@ -28,7 +28,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:92:68:0e'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder2.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder2.xml index 389355f913..719c2600bb 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder2.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder2.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:1e:63:25'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder3.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder3.xml index 10ba217934..5e6ecd8992 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder3.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder3.xml @@ -28,7 +28,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:7a:f5:a4'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder4.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder4.xml index 2215c7327e..6fa65f5ff3 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder4.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder4.xml @@ -29,7 +29,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:fe:97:82'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-explicitargs.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-explicitargs.xml index 6c6ed114d9..7af3fba221 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-explicitargs.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-explicitargs.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:11:bd:26'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-commandline.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-commandline.xml index 7e6b0e430f..40fc11c898 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-commandline.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-commandline.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml index 78d4d30016..c819a8ee76 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml @@ -20,6 +20,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-custom-loader.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-custom-loader.xml index 8bb0d53b76..d861f7651a 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-custom-loader.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-custom-loader.xml @@ -22,7 +22,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:35:99:c2'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom-grub.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom-grub.xml index b624f3d973..65a9e45d99 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom-grub.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom-grub.xml @@ -22,7 +22,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:6f:6a:53'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom.xml index ef3cd9fff2..6de2cd5b98 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom.xml @@ -22,7 +22,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:e3:ec:9b'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml new file mode 100644 index 0000000000..76814bf2b5 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml @@ -0,0 +1,36 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</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='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <interface type='bridge'> + <mac address='52:54:00:b9:94:02'/> + <source bridge='virbr0'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder.xml index da55c0aaef..0c88805f00 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder.xml @@ -34,7 +34,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:f4:6c:be'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder2.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder2.xml index 3974d5bc58..e12e04921b 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder2.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder2.xml @@ -36,7 +36,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:0e:d2:6f'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-defaults.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-defaults.xml index 270d41c831..019b802ee9 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-defaults.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-defaults.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:ee:f5:79'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-input-xhci-tablet.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-input-xhci-tablet.xml index 797868e7f2..9a062f97b0 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-input-xhci-tablet.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-input-xhci-tablet.xml @@ -20,11 +20,11 @@ <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='usb' index='0' model='nec-xhci'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='sata' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> <input type='tablet' bus='usb'/> </devices> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-localtime.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-localtime.xml index 2d1b729e69..c956f70dd0 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-localtime.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-localtime.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:82:ca:a3'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-macaddr.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-macaddr.xml index 6710818ee8..e7c3217dc6 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-macaddr.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-macaddr.xml @@ -21,7 +21,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:22:ee:11'/> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-metadata.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-metadata.xml index 5c5109404d..9003e694b8 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-metadata.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-metadata.xml @@ -25,13 +25,13 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:ad:55:51'/> <source bridge='virbr0'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> </devices> </domain> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml index 845cb09e9f..ea7bd9e949 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml @@ -20,6 +20,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml index 6c8fda32af..237320874b 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml @@ -20,6 +20,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml index eb50cc05ad..431a169da2 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml @@ -20,6 +20,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml index d6cfe76b70..6f76f82233 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml @@ -21,6 +21,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml index 9e470e432e..54ea8fd3ea 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml @@ -21,6 +21,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml index 89c4ceac57..27d60ea9ec 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml @@ -21,6 +21,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml index 86d8939364..835f13ca34 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml @@ -21,6 +21,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml index 9e470e432e..54ea8fd3ea 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml @@ -21,6 +21,9 @@ <address type='drive' controller='0' bus='0' target='2' unit='0'/> </disk> <controller type='pci' index='0' model='pci-root'/> + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='sata' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-wired.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-wired.xml index ed564e2777..37e6bd14fd 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-wired.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-wired.xml @@ -24,7 +24,7 @@ </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'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:b9:94:02'/> diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index ed421b8839..ee0860948d 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -111,6 +111,7 @@ mymain(void) DO_TEST_DIFFERENT("vnc-vgaconf-io"); DO_TEST_DIFFERENT("vnc-autoport"); DO_TEST_DIFFERENT("commandline"); + DO_TEST_DIFFERENT("explicit-lpc"); /* Address allocation tests */ DO_TEST_DIFFERENT("addr-single-sata-disk"); @@ -118,6 +119,8 @@ mymain(void) DO_TEST_DIFFERENT("addr-more-than-32-sata-disks"); DO_TEST_DIFFERENT("addr-single-virtio-disk"); DO_TEST_DIFFERENT("addr-multiple-virtio-disks"); + DO_TEST_DIFFERENT("addr-slot-1-not-lpc"); + DO_TEST_DIFFERENT("addr-slot-1-and-31-not-lpc"); /* The same without 32 devs per controller support */ driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT; -- 2.20.1

On Sun, Feb 10, 2019 at 07:08:53PM +0400, Roman Bogorodskiy wrote:
bhyve(8) uses PCI ISA bridge to attach serial ports and a boot ROM. In the libvirt driver a PCI slot 1 was always reserved for that, and if a domain used serial ports or a boot ROM, then it would be added to the command line.
However, some guests require the ISA bridge to have PCI slot other than 1. To make things more flexible, explicitly model that in XML.
So now the behavior is as follows:
* The 'isa-bridge' PCI controller is added to the domain if it uses video or serial devices, or boot ROM * If user didn't assign a PCI address for that controller, slot 1 will reserved for it * If user did assign a PCI address for it, this address will be used, and PCI slot 1 will be free (available for reservation for other devices) * If user assigned slot 1 to other device, slot is checked. If it's also assigned already, then the next available PCI slot is used for LPC PCI-ISA bridge, and a warning about that is emitted
I suggests splitting this patch into: 1) Splitting out the condition for auto-adding the isa bridge (see comment below) 2) Formatting the controller for explicitly specified <controller type='isa'/> (with a temporary condition to skip bhyveBuildLPCArgStr in that case) 3) Auto-adding the controller when needed
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 32 +++++-------- src/bhyve/bhyve_device.c | 47 ++++++++++++------- src/bhyve/bhyve_domain.c | 6 +++ .../bhyvexml2argv-acpiapic.args | 2 +- ...xml2argv-addr-more-than-32-sata-disks.args | 6 +-- ...hyvexml2argv-addr-multiple-sata-disks.args | 4 +- ...vexml2argv-addr-multiple-virtio-disks.args | 6 +-- ...rgv-addr-no32devs-multiple-sata-disks.args | 6 +-- ...l2argv-addr-no32devs-single-sata-disk.args | 4 +- .../bhyvexml2argv-addr-single-sata-disk.args | 4 +- ...bhyvexml2argv-addr-single-virtio-disk.args | 2 +- ...vexml2argv-addr-slot-1-and-31-not-lpc.args | 10 ++++ ...xml2argv-addr-slot-1-and-31-not-lpc.ldargs | 3 ++ ...yvexml2argv-addr-slot-1-and-31-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argv-addr-slot-1-not-lpc.args | 10 ++++ .../bhyvexml2argv-addr-slot-1-not-lpc.ldargs | 3 ++ .../bhyvexml2argv-addr-slot-1-not-lpc.xml | 27 +++++++++++ .../bhyvexml2argvdata/bhyvexml2argv-base.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder1.args | 2 +- .../bhyvexml2argv-bhyveload-bootorder3.args | 2 +- .../bhyvexml2argv-bhyveload-explicitargs.args | 2 +- .../bhyvexml2argv-commandline.args | 2 +- .../bhyvexml2argv-console.args | 2 +- .../bhyvexml2argv-cputopology.args | 2 +- .../bhyvexml2argv-custom-loader.args | 2 +- .../bhyvexml2argv-disk-cdrom-grub.args | 2 +- .../bhyvexml2argv-disk-cdrom.args | 2 +- .../bhyvexml2argv-explicit-lpc.args | 10 ++++ .../bhyvexml2argv-explicit-lpc.ldargs | 3 ++ .../bhyvexml2argv-explicit-lpc.xml | 26 ++++++++++ .../bhyvexml2argv-grub-bootorder.args | 2 +- .../bhyvexml2argv-grub-bootorder2.args | 2 +- .../bhyvexml2argv-grub-defaults.args | 2 +- .../bhyvexml2argv-input-xhci-tablet.args | 4 +- .../bhyvexml2argv-localtime.args | 2 +- .../bhyvexml2argv-macaddr.args | 2 +- .../bhyvexml2argv-net-e1000.args | 2 +- .../bhyvexml2argv-serial-grub-nocons.args | 2 +- .../bhyvexml2argv-serial-grub.args | 2 +- .../bhyvexml2argv-serial.args | 2 +- .../bhyvexml2argvdata/bhyvexml2argv-uefi.args | 4 +- .../bhyvexml2argv-vnc-autoport.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-io.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-off.args | 4 +- .../bhyvexml2argv-vnc-vgaconf-on.args | 4 +- .../bhyvexml2argvdata/bhyvexml2argv-vnc.args | 4 +- .../bhyvexml2argv-wired.args | 2 +- tests/bhyvexml2argvtest.c | 3 ++ .../bhyvexml2xmlout-acpiapic.xml | 2 +- ...ml2xmlout-addr-more-than-32-sata-disks.xml | 6 +-- ...yvexml2xmlout-addr-multiple-sata-disks.xml | 4 +- ...exml2xmlout-addr-multiple-virtio-disks.xml | 6 +-- ...lout-addr-no32devs-multiple-sata-disks.xml | 8 ++-- ...2xmlout-addr-no32devs-single-sata-disk.xml | 4 +- .../bhyvexml2xmlout-addr-single-sata-disk.xml | 4 +- ...hyvexml2xmlout-addr-single-virtio-disk.xml | 2 +- ...exml2xmlout-addr-slot-1-and-31-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-addr-slot-1-not-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-base.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder1.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder2.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder3.xml | 2 +- .../bhyvexml2xmlout-bhyveload-bootorder4.xml | 2 +- ...bhyvexml2xmlout-bhyveload-explicitargs.xml | 2 +- .../bhyvexml2xmlout-commandline.xml | 2 +- .../bhyvexml2xmlout-console.xml | 3 ++ .../bhyvexml2xmlout-custom-loader.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom-grub.xml | 2 +- .../bhyvexml2xmlout-disk-cdrom.xml | 2 +- .../bhyvexml2xmlout-explicit-lpc.xml | 36 ++++++++++++++ .../bhyvexml2xmlout-grub-bootorder.xml | 2 +- .../bhyvexml2xmlout-grub-bootorder2.xml | 2 +- .../bhyvexml2xmlout-grub-defaults.xml | 2 +- .../bhyvexml2xmlout-input-xhci-tablet.xml | 4 +- .../bhyvexml2xmlout-localtime.xml | 2 +- .../bhyvexml2xmlout-macaddr.xml | 2 +- .../bhyvexml2xmlout-metadata.xml | 4 +- .../bhyvexml2xmlout-serial-grub-nocons.xml | 3 ++ .../bhyvexml2xmlout-serial-grub.xml | 3 ++ .../bhyvexml2xmlout-serial.xml | 3 ++ .../bhyvexml2xmlout-vnc-autoport.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-io.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-off.xml | 3 ++ .../bhyvexml2xmlout-vnc-vgaconf-on.xml | 3 ++ .../bhyvexml2xmlout-vnc.xml | 3 ++ .../bhyvexml2xmlout-wired.xml | 2 +- tests/bhyvexml2xmltest.c | 3 ++ 89 files changed, 400 insertions(+), 127 deletions(-) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-explicit-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-and-31-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-slot-1-not-lpc.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-explicit-lpc.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 1f215dac08..0842484086 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -325,14 +325,6 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED, return 0; }
-static int -bhyveBuildLPCArgStr(const virDomainDef *def ATTRIBUTE_UNUSED, - virCommandPtr cmd) -{ - virCommandAddArgList(cmd, "-s", "1,lpc", NULL); - return 0; -} - static int bhyveBuildGraphicsArgStr(const virDomainDef *def, virDomainGraphicsDefPtr graphics, @@ -460,7 +452,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, * vm0 */ size_t i; - bool add_lpc = false; int nusbcontrollers = 0; unsigned int nvcpus = virDomainDefGetVcpus(def);
@@ -549,7 +540,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM)) { virCommandAddArg(cmd, "-l"); virCommandAddArgFormat(cmd, "bootrom,%s", def->os.loader->path); - add_lpc = true; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " @@ -563,12 +553,20 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, virDomainControllerDefPtr controller = def->controllers[i]; switch (controller->type) { case VIR_DOMAIN_CONTROLLER_TYPE_PCI: - if (controller->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("unsupported PCI controller model: only PCI root supported")); - goto error; - } + switch (controller->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE: + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%d:0,lpc", + controller->info.addr.pci.slot); + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("unsupported PCI controller model: only PCI root supported")); + goto error; + } + break; case VIR_DOMAIN_CONTROLLER_TYPE_SATA: if (bhyveBuildAHCIControllerArgStr(def, controller, conn, cmd) < 0) goto error; @@ -613,7 +611,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->videos[0], conn, cmd, dryRun) < 0) goto error; - add_lpc = true; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Multiple graphics devices are not supported")); @@ -621,9 +618,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, } }
- if (add_lpc || def->nserials) - bhyveBuildLPCArgStr(def, cmd); - if (bhyveBuildConsoleArgStr(def, cmd) < 0) goto error;
diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 201044d9e6..d9ac1911a3 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -43,16 +43,8 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, virDomainPCIAddressSetPtr addrs = opaque; virPCIDeviceAddressPtr addr = &info->addr.pci;
- if (addr->domain == 0 && addr->bus == 0) { - if (addr->slot == 0) { - return 0; - } else if (addr->slot == 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("PCI bus 0 slot 1 is reserved for the implicit " - "LPC PCI-ISA bridge")); - return -1; - } - } + if (addr->domain == 0 && addr->bus == 0 && addr->slot == 0) + return 0;
if (virDomainPCIAddressReserveAddr(addrs, addr, VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { @@ -92,15 +84,36 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def, virDomainPCIAddressSetPtr addrs) { size_t i; - virPCIDeviceAddress lpc_addr;
- /* explicitly reserve slot 1 for LPC-ISA bridge */ - memset(&lpc_addr, 0, sizeof(lpc_addr)); - lpc_addr.slot = 0x1; + /* Look for isa-bridge first, if it has no address assigned, we want to reserve + PCI slot 1 for it before it's used by some other device */ + for (i = 0; i < def->ncontrollers; i++) { + if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) && + (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ISA_BRIDGE) && + virDeviceInfoPCIAddressIsWanted(&def->controllers[i]->info)) { + virPCIDeviceAddress lpc_addr; + memset(&lpc_addr, 0, sizeof(lpc_addr)); + lpc_addr.slot = 0x1; + + if (virDomainPCIAddressSlotInUse(addrs, &lpc_addr)) { + lpc_addr.slot = 0x1f; + + if (virDomainPCIAddressSlotInUse(addrs, &lpc_addr)) { + VIR_WARN("Cannot use PCI slots 1 and 31 for LPC PCI-ISA bridge " + "as they are already reserved, using the next available " + "address"); + continue; + } + } + + if (virDomainPCIAddressReserveAddr(addrs, &lpc_addr, + VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { + goto error; + }
This does not reserve the 0x01 address in case the domain has no ISA bridge. Even if you do not intend to keep it reserved for future use (i.e. keep address 0x1 free unless the user explicitly assigned a device on that slot), consider reserving it here temporarily to reduce noise in the test suite.
- if (virDomainPCIAddressReserveAddr(addrs, &lpc_addr, - VIR_PCI_CONNECT_TYPE_PCI_DEVICE, 0) < 0) { - goto error; + def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + def->controllers[i]->info.addr.pci = lpc_addr; + } }
for (i = 0; i < def->ncontrollers; i++) { diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 79cf103d28..6e09cbc484 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -73,6 +73,12 @@ bhyveDomainDefPostParse(virDomainDefPtr def, VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0) return -1;
+ if ((def->os.bootloader == NULL && def->os.loader) || + (def->nconsoles || def->nserials) || (def->ngraphics && def->nvideos))
This is the condition that could be put in a separate function first and used for bhyveBuildLPCArgStr in a preparatory patch, then reused here. e.g. bhyveDomainDefNeedsISAController Jano

Document ability to specify LCP PCI-ISA bridge PCI address. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- docs/drvbhyve.html.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/drvbhyve.html.in b/docs/drvbhyve.html.in index 2e9cf5551b..18bfb94b48 100644 --- a/docs/drvbhyve.html.in +++ b/docs/drvbhyve.html.in @@ -462,6 +462,28 @@ Example:</p> </domain> </pre> +<h3><a id="lpc">LPC PCI-ISA bridge address</a></h3> + +<p>LPC PCI-ISA bridge is used in bhyve to attach serial ports and a boot ROM. +By default, the bhyve driver assigns PCI slot 1 for it. +However, sometimes it may be necessary to use other slot for it. +For example, placing it on slot 31 instead of slot 1 will look like this:</p> + +<pre> +<domain type="bhyve"> + ... + <devices> + ... + <controller type='pci' index='1' model='isa-bridge'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/> + </controller> + ... + </devices> +</domain> +</pre> + +<p>This is supported <span class="since">since 5.1.0</span>.</p> + <h3><a id="bhyvecommand">Pass-through of arbitrary bhyve commands</a></h3> <p><span class="since">Since 5.1.0</span>, it's possible to pass additional command-line -- 2.20.1

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 8d6d58ae6a..e0c9c3590f 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -59,6 +59,16 @@ of the network's <code>bridge</code> element. </description> </change> + <change> + <summary> + bhyve: allow to configure LPC PCI address + </summary> + <description> + The bhyve driver now explicty models LPC PCI-ISA bridge, thus + allowing to specify PCI address for it instead of using + the default PCI slot 1. + </description> + </change> </section> <section title="Improvements"> </section> -- 2.20.1

On 2/10/19 10:08 AM, Roman Bogorodskiy wrote:
This adds modeling of the pci-isa bridge device for bhyve to make it possible to assign specific PCI address for instead of the default PCI slot 0.
I tried to keep the existing behaviour, i.e. the isa-bridge controller is automatically added to domain if it uses serial or video devices, or boot ROM. It also tries to assign pci slot 1 for it, that should not be a problem because previously that address was always reserved for the isa-bridge, so it definitely wasn't used by other devices.
Now, however, it's not always reserved. For example, if there are no devices in the domain configuration that require isa-bridge, and users didn't explicitly add it (or added that on a different slot), then PCI slot 1 is available for allocation. This probably can be a problem for users when they figure out that they still need to add the isa-bridge device on slot 1, but it's already used, but I'm not sure if it's worth to always reserve slot 1 for that purpose.
Anything that is <controller type='pci' ...> should provide PCI slots that other devices (including other PCI controllers) can be connected to. This isn't a PCI controller, it is an ISA controller that happens to plug into a PCI slot. So while it is a controller, it should have a different type (maybe <controller type='isa'...>)
participants (3)
-
Ján Tomko
-
Laine Stump
-
Roman Bogorodskiy