]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyve: support 'isa' controller for LPC
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sun, 17 Feb 2019 13:04:00 +0000 (17:04 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 21 Sep 2020 16:03:00 +0000 (20:03 +0400)
Support modeling of the 'isa' controller for bhyve. User can manually
define any PCI slot for the 'isa' controller, including PCI slot 1,
but other devices are not allowed to use this address.

When domain configuration requires the 'isa' controller to be present,
automatically add it on domain post-parse stage.

Now, as this controller is always available when needed, it's not
necessary to implicitly add it to the bhyve command line, so remove
bhyveBuildLPCArgStr().

Also, make bhyveDomainDefNeedsISAController() static as it's no longer
used outside of bhyve_domain.c.

As more than one ISA controller is not supported by bhyve,
and multiple controllers with the same index are forbidden,
so forbid ISA controllers with non-zero index for bhyve.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
39 files changed:
src/bhyve/bhyve_command.c
src/bhyve/bhyve_device.c
src/bhyve/bhyve_domain.c
src/bhyve/bhyve_domain.h
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.args [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.ldargs [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.xml [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.args [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.ldargs [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.xml [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-addr-non-isa-controller-on-slot-1.xml [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-console.args
tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.args [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.ldargs [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.xml [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-isa-multiple-controllers.xml [new file with mode: 0644]
tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
tests/bhyvexml2argvdata/bhyvexml2argv-serial.args
tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args
tests/bhyvexml2argvtest.c
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-1.xml [new file with mode: 0644]
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-31.xml [new file with mode: 0644]
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-isa-controller.xml [new file with mode: 0644]
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml
tests/bhyvexml2xmltest.c

index 5289e409fadf60b189c496ae2ccb84acc37bfc85..4df5baabdf2b53c50ae43cff8519fef71cd4f40b 100644 (file)
@@ -329,7 +329,8 @@ bhyveBuildControllerArgStr(const virDomainDef *def,
                            virDomainControllerDefPtr controller,
                            bhyveConnPtr driver,
                            virCommandPtr cmd,
-                           unsigned *nusbcontrollers)
+                           unsigned *nusbcontrollers,
+                           unsigned *nisacontrollers)
 {
     switch (controller->type) {
     case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
@@ -354,18 +355,20 @@ bhyveBuildControllerArgStr(const virDomainDef *def,
         if (bhyveBuildUSBControllerArgStr(def, controller, cmd) < 0)
             return -1;
         break;
+    case VIR_DOMAIN_CONTROLLER_TYPE_ISA:
+        if (++*nisacontrollers > 1) {
+             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            "%s", _("only single ISA controller is supported"));
+             return -1;
+        }
+        virCommandAddArg(cmd, "-s");
+        virCommandAddArgFormat(cmd, "%d:0,lpc",
+                                controller->info.addr.pci.slot);
+        break;
     }
     return 0;
 }
 
-static int
-bhyveBuildLPCArgStr(const virDomainDef *def G_GNUC_UNUSED,
-                    virCommandPtr cmd)
-{
-    virCommandAddArgList(cmd, "-s", "1,lpc", NULL);
-    return 0;
-}
-
 static int
 bhyveBuildGraphicsArgStr(const virDomainDef *def,
                          virDomainGraphicsDefPtr graphics,
@@ -545,6 +548,7 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
     virCommandPtr cmd = virCommandNew(BHYVE);
     size_t i;
     unsigned nusbcontrollers = 0;
+    unsigned nisacontrollers = 0;
     unsigned nvcpus = virDomainDefGetVcpus(def);
 
     /* CPUs */
@@ -650,7 +654,7 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
     /* Devices */
     for (i = 0; i < def->ncontrollers; i++) {
         if (bhyveBuildControllerArgStr(def, def->controllers[i], driver, cmd,
-                                       &nusbcontrollers) < 0)
+                                       &nusbcontrollers, &nisacontrollers) < 0)
             goto error;
     }
     for (i = 0; i < def->nnets; i++) {
@@ -681,9 +685,6 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
             goto error;
     }
 
-    if (bhyveDomainDefNeedsISAController(def))
-        bhyveBuildLPCArgStr(def, cmd);
-
     if (bhyveBuildConsoleArgStr(def, cmd) < 0)
         goto error;
 
index 3c8ff587e092a700fca295afe2df7dfb3abf3661..2295acf5528fe01534b51ef5c85a7f0bff7e6f39 100644 (file)
@@ -46,10 +46,16 @@ bhyveCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED,
         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 (!(device->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
+                  device->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA)) {
+                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("PCI bus 0 slot 1 is reserved for the implicit "
+                                  "LPC PCI-ISA bridge"));
+                 return -1;
+            } else {
+                /* We reserve slot 1 for LPC in bhyveAssignDevicePCISlots(), so exit early */
+                return 0;
+            }
         }
     }
 
@@ -101,6 +107,15 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
         return -1;
     }
 
+    for (i = 0; i < def->ncontrollers; i++) {
+         if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA) &&
+              virDeviceInfoPCIAddressIsWanted(&def->controllers[i]->info)) {
+             def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
+             def->controllers[i]->info.addr.pci = lpc_addr;
+             break;
+         }
+    }
+
     for (i = 0; i < def->ncontrollers; i++) {
         if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) ||
             (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) ||
index 95d6ffd31c515376208da6982ef44b9441e557c6..91994c3da52143a13c79c3a8c6a36dc2e9e8f2be 100644 (file)
@@ -59,13 +59,13 @@ virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks = {
     .free = bhyveDomainObjPrivateFree,
 };
 
-bool
+static bool
 bhyveDomainDefNeedsISAController(virDomainDefPtr def)
 {
     if (def->os.bootloader == NULL && def->os.loader)
         return true;
 
-    if (def->nserials)
+    if (def->nserials || def->nconsoles)
         return true;
 
     if (def->ngraphics && def->nvideos)
@@ -95,6 +95,11 @@ bhyveDomainDefPostParse(virDomainDefPtr def,
                                        VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
         return -1;
 
+    if (bhyveDomainDefNeedsISAController(def))
+        if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_ISA, 0,
+                                           VIR_DOMAIN_CONTROLLER_MODEL_ISA_DEFAULT) < 0)
+            return -1;
+
     return 0;
 }
 
@@ -191,10 +196,26 @@ virBhyveDriverCreateXMLConf(bhyveConnPtr driver)
                                  NULL, NULL);
 }
 
+
+static int
+bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev,
+                             const virDomainDef *def G_GNUC_UNUSED,
+                             void *opaque G_GNUC_UNUSED)
+{
+    if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
+        dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA &&
+        dev->data.controller->idx != 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
 virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
     .devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
     .domainPostParseCallback = bhyveDomainDefPostParse,
     .assignAddressesCallback = bhyveDomainDefAssignAddresses,
+    .deviceValidateCallback = bhyveDomainDeviceDefValidate,
 };
 
 static void
index e985278041ba1d665e1e4aaf2607a59ad42ab234..4e2b11b8de7c6c81328245a787d08feace6943b1 100644 (file)
@@ -39,5 +39,3 @@ virDomainXMLOptionPtr virBhyveDriverCreateXMLConf(bhyveConnPtr);
 extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
 extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;
 extern virXMLNamespace virBhyveDriverDomainXMLNamespace;
-
-bool bhyveDomainDefNeedsISAController(virDomainDefPtr def);
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.args
new file mode 100644 (file)
index 0000000..910d1bb
--- /dev/null
@@ -0,0 +1,10 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-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:b9:94:02 bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.ldargs
new file mode 100644 (file)
index 0000000..32538b5
--- /dev/null
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-1.xml
new file mode 100644 (file)
index 0000000..4a72ca6
--- /dev/null
@@ -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='isa' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' 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-addr-isa-controller-on-slot-31.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.args
new file mode 100644 (file)
index 0000000..ee833eb
--- /dev/null
@@ -0,0 +1,10 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 31:0,lpc \
+-s 2: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-isa-controller-on-slot-31.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.ldargs
new file mode 100644 (file)
index 0000000..32538b5
--- /dev/null
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-isa-controller-on-slot-31.xml
new file mode 100644 (file)
index 0000000..3b8e8a3
--- /dev/null
@@ -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='isa' index='0'>
+      <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-addr-non-isa-controller-on-slot-1.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-non-isa-controller-on-slot-1.xml
new file mode 100644 (file)
index 0000000..88ad9ae
--- /dev/null
@@ -0,0 +1,23 @@
+<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>
+    <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='0x01' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
index 6ab91ae7e4e3fe4714a761b7cb748e7d2d8fc6d8..25fbd4727e4648a6cae02645f2672144be5c264c 100644 (file)
@@ -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-isa-controller.args b/tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.args
new file mode 100644 (file)
index 0000000..910d1bb
--- /dev/null
@@ -0,0 +1,10 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-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:b9:94:02 bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.ldargs
new file mode 100644 (file)
index 0000000..32538b5
--- /dev/null
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-isa-controller.xml
new file mode 100644 (file)
index 0000000..279ac66
--- /dev/null
@@ -0,0 +1,24 @@
+<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='isa' index='0'/>
+    <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-isa-multiple-controllers.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-isa-multiple-controllers.xml
new file mode 100644 (file)
index 0000000..d087d5f
--- /dev/null
@@ -0,0 +1,25 @@
+<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='isa' index='1'/>
+    <controller type='isa' index='2'/>
+    <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>
index 42a278208d0de6c5824bb4684a0de015fed9f98e..02846cb893a2ce4d34914b22282b7c453364cb2d 100644 (file)
@@ -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
index 313724dc9009fcb8f3eb08f7b92f2fa95fe596c8..e4712b448c325a86e9d614608de7375536b85fb9 100644 (file)
@@ -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
index 059e457072476896b0a31dbe131570a73ab6c133..f45a19013794ac5aa26b07a329f76d8850556e1d 100644 (file)
@@ -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
index 8ff8673ed4abfbf2bbd5f1c217d521bb940d59af..937b066e8c5e438bd766059d1ee2601f2c534c88 100644 (file)
@@ -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
index 039526ff3532e98ed3c2c517dd869f37ac43251d..551469dabece862e462c6ecc08f8456e518c95a4 100644 (file)
@@ -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
index da379710097286bd5f819ad4b899a463d3aa29a1..47022e84cf7b433ba65eac5df81185ebecc25707 100644 (file)
@@ -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
index 70347ee0b666dfe8ea2076a229d1823dd1d4b215..923098f3db2fd13ce5762830c26b3d595ebdfbfc 100644 (file)
@@ -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
index d0e1d81e2acba66236c10967550a9be2763e3693..9225f5d1334802689647a14b87aaee5761db3992 100644 (file)
@@ -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
index 90889b8f39a55b5fb98f2a620f91671873259722..cd7a543265e8fd678d0d224c5a148b32b2ff96d3 100644 (file)
@@ -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
index 0a05d6d89225823e6ed5bc0aba4a85165e107866..b86a4243c233b4a74ec6be5206ce909ee2cf9f14 100644 (file)
@@ -202,6 +202,8 @@ mymain(void)
     DO_TEST("commandline");
     DO_TEST("msrs");
     DO_TEST("sound");
+    DO_TEST("isa-controller");
+    DO_TEST_FAILURE("isa-multiple-controllers");
 
     /* Address allocation tests */
     DO_TEST("addr-single-sata-disk");
@@ -209,6 +211,9 @@ 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-isa-controller-on-slot-1");
+    DO_TEST("addr-isa-controller-on-slot-31");
+    DO_TEST_FAILURE("addr-non-isa-controller-on-slot-1");
 
     /* The same without 32 devs per controller support */
     driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT;
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-1.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-1.xml
new file mode 100644 (file)
index 0000000..c1424a6
--- /dev/null
@@ -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='isa' index='0'>
+      <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='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='0x03' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-31.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-isa-controller-on-slot-31.xml
new file mode 100644 (file)
index 0000000..f99c5b6
--- /dev/null
@@ -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='isa' index='0'>
+      <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='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='0x03' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
index 78d4d300167ef38a47f5bb2e9e83160717529580..5309bdc7cf9520202b886281603843d2ac46d6be 100644 (file)
@@ -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='isa' index='0'>
+      <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-isa-controller.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-isa-controller.xml
new file mode 100644 (file)
index 0000000..c1424a6
--- /dev/null
@@ -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='isa' index='0'>
+      <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='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='0x03' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
index 845cb09e9f0d1eada6b7005fc2a9c5f4488f9375..f89d678abd62f5ffe694ce37c3b2a359059396cc 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index 6c8fda32af1524ee0280edbb4dc67a86720e4d38..29a36499f59f7192bec7cf1d90050fdc367a0950 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index eb50cc05ad30442de7f9ef44ff903461a3b74aaa..ec03da2bfe0d215bd489838af33a4bfba7affe0b 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index d6cfe76b70b5f35704f0a59864ee25ece979cf87..041ab4e319cb2f9126af44a20d0843bf785c95ec 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index 9e470e432e04df55860f4c5e188bb3e2491c7d29..58e71282e7bfeba5ca4e6b465fd4606a984e4356 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index 89c4ceac57ee113563b5468479bdb4bba93b2651..2c37762edb78a53bd6957ce851ed81e15af9d6d6 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index 86d8939364bfd9c19987c9b3da3a938f3e50822a..a9f37dca66b091b6b8211a468bc2c429915a8949 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index 9e470e432e04df55860f4c5e188bb3e2491c7d29..58e71282e7bfeba5ca4e6b465fd4606a984e4356 100644 (file)
@@ -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='isa' index='0'>
+      <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>
index f9af1a364d2b3a81204625dbe98d82ccaf43ed48..3bf2187250e167971e094e75b81c8d3c51d60667 100644 (file)
@@ -109,6 +109,7 @@ mymain(void)
     DO_TEST_DIFFERENT("commandline");
     DO_TEST_DIFFERENT("msrs");
     DO_TEST_DIFFERENT("sound");
+    DO_TEST_DIFFERENT("isa-controller");
 
     /* Address allocation tests */
     DO_TEST_DIFFERENT("addr-single-sata-disk");
@@ -116,6 +117,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-isa-controller-on-slot-1");
+    DO_TEST_DIFFERENT("addr-isa-controller-on-slot-31");
 
     /* The same without 32 devs per controller support */
     driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT;