]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve: fix SATA address allocation
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 5 Jan 2017 12:51:25 +0000 (16:51 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 30 Jan 2017 16:48:42 +0000 (20:48 +0400)
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:

 2:0,ahci-hd,somedisk.img

This no longer makes sense because:

 1. After commit c07d1c1c4f it's not possible to assign
    PCI addresses to disks
 2. Bhyve now supports multiple disk drives for a controller,
    so it's going away from 1:1 controller:disk mapping, so
    the controller object starts to make more sense now

So, this patch does the following:

 - Assign PCI address to SATA controllers (previously we didn't do this)
 - Assign disk addresses instead of PCI addresses for disks. Now, when
   building a bhyve command, we take PCI address not from the disk
   itself but from its controller
 - Assign addresses at XML parsing time using the
   assignAddressesCallback. This is done mainly for being able to
   verify address allocation via xml2xml tests
 - Adjust existing bhyvexml2{xml,argv} tests to chase the new
   address allocation

This patch is largely based on work of Fabian Freyer.

45 files changed:
po/POTFILES.in
src/bhyve/bhyve_command.c
src/bhyve/bhyve_device.c
src/bhyve/bhyve_domain.c
tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args
tests/bhyvexml2argvdata/bhyvexml2argv-base.args
tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.args
tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.args
tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.args
tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args
tests/bhyvexml2argvdata/bhyvexml2argv-console.args
tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args
tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args
tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.args
tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.args
tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.args
tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args
tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args
tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args
tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
tests/bhyvexml2argvdata/bhyvexml2argv-serial.args
tests/bhyvexml2argvtest.c
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-acpiapic.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-base.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder1.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder2.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder3.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-bootorder4.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-bhyveload-explicitargs.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-custom-loader.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom-grub.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-disk-cdrom.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-bootorder2.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-defaults.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-localtime.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-macaddr.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-metadata.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml
tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml
tests/bhyvexml2xmltest.c

index 5a02d73265edf48abcf27e1cdb39f501adb692a2..365ea662fd8ae010ce43024956ff8f29d9f33841 100644 (file)
@@ -14,6 +14,7 @@ src/access/viraccessdriverpolkit.c
 src/access/viraccessmanager.c
 src/bhyve/bhyve_command.c
 src/bhyve/bhyve_device.c
+src/bhyve/bhyve_domain.c
 src/bhyve/bhyve_driver.c
 src/bhyve/bhyve_monitor.c
 src/bhyve/bhyve_parse_command.c
index 8a29977ff1f17a54d50c240c2222e94cecd22975..a50bd106604f7fe9957c6f56b3d558c16c0d9817 100644 (file)
@@ -148,40 +148,97 @@ bhyveBuildConsoleArgStr(const virDomainDef *def, virCommandPtr cmd)
 }
 
 static int
-bhyveBuildDiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
-                     virDomainDiskDefPtr disk,
-                     virCommandPtr cmd)
+bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
+                               virDomainControllerDefPtr controller,
+                               virConnectPtr conn,
+                               virCommandPtr cmd)
 {
-    const char *bus_type;
+    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    virBuffer device = VIR_BUFFER_INITIALIZER;
     const char *disk_source;
+    size_t i;
+    int ret = -1;
+
+    for (i = 0; i < def->ndisks; i++) {
+        virDomainDiskDefPtr disk = def->disks[i];
+        if (disk->bus != VIR_DOMAIN_DISK_BUS_SATA)
+            continue;
+
+        if (disk->info.addr.drive.controller != controller->idx)
+            continue;
+
+        VIR_DEBUG("disk %zu controller %d", i, controller->idx);
+
+        if ((virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) &&
+            (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_VOLUME)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("unsupported disk type"));
+            goto error;
+        }
+
+        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+            goto error;
+
+        disk_source = virDomainDiskGetSource(disk);
+
+        if ((disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
+            (disk_source == NULL)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("cdrom device without source path "
+                                 "not supported"));
+                goto error;
+        }
 
-    switch (disk->bus) {
-    case VIR_DOMAIN_DISK_BUS_SATA:
         switch (disk->device) {
         case VIR_DOMAIN_DISK_DEVICE_DISK:
-            bus_type = "ahci-hd";
+            if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_AHCI32SLOT))
+                virBufferAsprintf(&device, ",hd:%s", disk_source);
+            else
+                virBufferAsprintf(&device, "-hd,%s", disk_source);
             break;
         case VIR_DOMAIN_DISK_DEVICE_CDROM:
-            bus_type = "ahci-cd";
+            if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_AHCI32SLOT))
+                virBufferAsprintf(&device, ",cd:%s", disk_source);
+            else
+                virBufferAsprintf(&device, "-cd,%s", disk_source);
             break;
         default:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("unsupported disk device"));
-            return -1;
-        }
-        break;
-    case VIR_DOMAIN_DISK_BUS_VIRTIO:
-        if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-            bus_type = "virtio-blk";
-        } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("unsupported disk device"));
-            return -1;
+            goto error;
         }
-        break;
-    default:
+        virBufferAddBuffer(&buf, &device);
+        virBufferFreeAndReset(&device);
+    }
+
+    if (virBufferCheckError(&buf) < 0)
+        goto error;
+
+    virCommandAddArg(cmd, "-s");
+    virCommandAddArgFormat(cmd, "%d:0,ahci%s",
+                           controller->info.addr.pci.slot,
+                           virBufferCurrentContent(&buf));
+
+    ret = 0;
+ error:
+    virBufferFreeAndReset(&buf);
+    return ret;
+}
+
+static int
+bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
+                     virDomainDiskDefPtr disk,
+                     virConnectPtr conn,
+                     virCommandPtr cmd)
+{
+    const char *disk_source;
+
+    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+        return -1;
+
+    if (disk->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("unsupported disk bus type"));
+                       _("unsupported disk device"));
         return -1;
     }
 
@@ -194,17 +251,9 @@ bhyveBuildDiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
 
     disk_source = virDomainDiskGetSource(disk);
 
-    if ((disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
-        (disk_source == NULL)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("cdrom device without source path "
-                             "not supported"));
-            return -1;
-    }
-
     virCommandAddArg(cmd, "-s");
-    virCommandAddArgFormat(cmd, "%d:0,%s,%s",
-                           disk->info.addr.pci.slot, bus_type,
+    virCommandAddArgFormat(cmd, "%d:0,virtio-blk,%s",
+                           disk->info.addr.pci.slot,
                            disk_source);
 
     return 0;
@@ -278,6 +327,22 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
 
     virCommandAddArgList(cmd, "-s", "0:0,hostbridge", NULL);
     /* Devices */
+    for (i = 0; i < def->ncontrollers; i++) {
+        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;
+                }
+                break;
+        case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
+                if (bhyveBuildAHCIControllerArgStr(def, controller, conn, cmd) < 0)
+                    goto error;
+                break;
+        }
+    }
     for (i = 0; i < def->nnets; i++) {
         virDomainNetDefPtr net = def->nets[i];
         if (bhyveBuildNetArgStr(def, net, cmd, dryRun) < 0)
@@ -286,11 +351,19 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
     for (i = 0; i < def->ndisks; i++) {
         virDomainDiskDefPtr disk = def->disks[i];
 
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
-            goto error;
-
-        if (bhyveBuildDiskArgStr(def, disk, cmd) < 0)
+        switch (disk->bus) {
+        case VIR_DOMAIN_DISK_BUS_SATA:
+            /* Handled by bhyveBuildAHCIControllerArgStr() */
+            break;
+        case VIR_DOMAIN_DISK_BUS_VIRTIO:
+            if (bhyveBuildVirtIODiskArgStr(def, disk, conn, cmd) < 0)
+                goto error;
+            break;
+        default:
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("unsupported disk device"));
             goto error;
+        }
     }
     if (bhyveBuildConsoleArgStr(def, cmd) < 0)
         goto error;
index 97e81e196194bed7f8e7b93066673573173eb713..29528230fd9e495f2f6078eb50ac689a70261085 100644 (file)
@@ -39,6 +39,9 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
                        void *opaque)
 {
     int ret = -1;
+    if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE)
+        return 0;
+
     virDomainPCIAddressSetPtr addrs = opaque;
     virPCIDeviceAddressPtr addr = &info->addr.pci;
 
@@ -101,28 +104,9 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
         goto error;
     }
 
-    for (i = 0; i < def->nnets; i++) {
-        if (!virDeviceInfoPCIAddressWanted(&def->nets[i]->info))
-            continue;
-        if (virDomainPCIAddressReserveNextAddr(addrs, &def->nets[i]->info,
-                                               VIR_PCI_CONNECT_TYPE_PCI_DEVICE,
-                                               -1) < 0) {
-            goto error;
-        }
-    }
-
-    for (i = 0; i < def->ndisks; i++) {
-        if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
-            !virPCIDeviceAddressIsEmpty(&def->disks[i]->info.addr.pci))
-            continue;
-        if (virDomainPCIAddressReserveNextAddr(addrs, &def->disks[i]->info,
-                                               VIR_PCI_CONNECT_TYPE_PCI_DEVICE,
-                                               -1) < 0)
-            goto error;
-    }
-
     for (i = 0; i < def->ncontrollers; i++) {
-        if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
+        if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) ||
+            (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA)) {
             if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
                 !virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
                 continue;
@@ -133,7 +117,16 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
                                                    -1) < 0)
                 goto error;
         }
+    }
 
+    for (i = 0; i < def->nnets; i++) {
+        if (!virDeviceInfoPCIAddressWanted(&def->nets[i]->info))
+            continue;
+        if (virDomainPCIAddressReserveNextAddr(addrs,
+                                               &def->nets[i]->info,
+                                               VIR_PCI_CONNECT_TYPE_PCI_DEVICE,
+                                               -1) < 0)
+            goto error;
     }
 
     return 0;
index b4dc26767c1e907f620b32d95946186109bf91a3..76b4fac2c47cb5e7bc9955056c0433927a830ecf 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "bhyve_device.h"
 #include "bhyve_domain.h"
+#include "bhyve_capabilities.h"
 #include "viralloc.h"
 #include "virlog.h"
 
@@ -73,13 +74,67 @@ bhyveDomainDefPostParse(virDomainDefPtr def,
 }
 
 static int
-bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
-                              const virDomainDef *def ATTRIBUTE_UNUSED,
+bhyveDomainDiskDefAssignAddress(bhyveConnPtr driver,
+                                virDomainDiskDefPtr def,
+                                const virDomainDef *vmdef ATTRIBUTE_UNUSED)
+{
+    int idx = virDiskNameToIndex(def->dst);
+
+    if (idx < 0) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("Unknown disk name '%s' and no address specified"),
+                       def->dst);
+        return -1;
+    }
+
+    switch (def->bus) {
+    case VIR_DOMAIN_DISK_BUS_SATA:
+        def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
+
+        if ((driver->bhyvecaps & BHYVE_CAP_AHCI32SLOT) != 0) {
+            def->info.addr.drive.controller = idx / 32;
+            def->info.addr.drive.unit = idx % 32;
+        } else {
+            def->info.addr.drive.controller = idx;
+            def->info.addr.drive.unit = 0;
+        }
+
+        def->info.addr.drive.bus = 0;
+        break;
+    }
+    return 0;
+}
+
+static int
+bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
+                              const virDomainDef *def,
+                              virCapsPtr caps ATTRIBUTE_UNUSED,
+                              unsigned int parseFlags ATTRIBUTE_UNUSED,
+                              void *opaque,
+                              void *parseOpaque ATTRIBUTE_UNUSED)
+{
+    bhyveConnPtr driver = opaque;
+
+    if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+        virDomainDiskDefPtr disk = dev->data.disk;
+
+        if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+            bhyveDomainDiskDefAssignAddress(driver, disk, def) < 0)
+            return -1;
+    }
+    return 0;
+}
+
+static int
+bhyveDomainDefAssignAddresses(virDomainDef *def,
                               virCapsPtr caps ATTRIBUTE_UNUSED,
                               unsigned int parseFlags ATTRIBUTE_UNUSED,
                               void *opaque ATTRIBUTE_UNUSED,
                               void *parseOpaque ATTRIBUTE_UNUSED)
 {
+    if (bhyveDomainAssignAddresses(def, NULL) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -95,4 +150,5 @@ virBhyveDriverCreateXMLConf(bhyveConnPtr driver)
 virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
     .devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
     .domainPostParseCallback = bhyveDomainDefPostParse,
+    .assignAddressesCallback = bhyveDomainDefAssignAddresses,
 };
index 930166f073f66b894ef93f02fe500dadaed9b40e..e71ceec84f3df2d7f554d8842cd5e799ea5fb4cf 100644 (file)
@@ -7,5 +7,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:81:c4:b1 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:81:c4:b1 bhyve
index 76d597cc6ec557ad28f8bfb1a1bfa51048d2388b..547485ba5d66de773f4597051e341706b2eddb62 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve
index a303ee3c5b5a32932acfb0e104885005c27fe3fe..4d7c7c92a8846cb8de8ef10944ea32a179777a23 100644 (file)
@@ -5,6 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:8d:10:e1 \
--s 2:0,ahci-hd,/tmp/freebsd.img \
--s 4:0,ahci-cd,/tmp/cdrom.iso bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:8d:10:e1 bhyve
index 04601319bc025e3c215765bab925da4aa4cb7d64..8ec9799ccd917e9b41016b8f106579732ace6bf7 100644 (file)
@@ -5,6 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:92:68:0e \
--s 2:0,ahci-hd,/tmp/freebsd.img \
--s 4:0,ahci-cd,/tmp/cdrom.iso bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:92:68:0e bhyve
index 79631c3a66426a9057342bba1d3b5265b705de6c..f1c0bf3987b0ef215e1f7da41ef10e0f90cd4456 100644 (file)
@@ -5,6 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:7a:f5:a4 \
--s 2:0,ahci-hd,/tmp/freebsd.img \
--s 4:0,ahci-cd,/tmp/cdrom.iso bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img,cd:/tmp/cdrom.iso \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:7a:f5:a4 bhyve
index e80ff026a95dd3691cb1ff8070eb002171b0091d..17a1c8380950c454b440125684cf076583f9f1c1 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:11:bd:26 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:11:bd:26 bhyve
index bd2892c4728fc50211e5416a99be7b5aeaf6d11a..6ab91ae7e4e3fe4714a761b7cb748e7d2d8fc6d8 100644 (file)
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:b1:42:eb \
--s 2:0,ahci-hd,/tmp/freebsd.img \
 -s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
index 7a0eeb2fcdd6139c0504342158776cdc88e244c0..f6bfc783747b42358aeb026b8eed86f49338064e 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:35:99:c2 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:35:99:c2 bhyve
index 907751c6c93e0ee5527c53529827ffba6c338155..72f1d3538cee8bd1a3549ed0c3b683deaab9e197 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:6f:6a:53 \
--s 2:0,ahci-cd,/tmp/cdrom.iso bhyve
+-s 2:0,ahci,cd:/tmp/cdrom.iso \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:6f:6a:53 bhyve
index 1806505559bd8267c09645c396cbc57228dfdaf4..3e61b8fc8a47692094c73a6742c949bd41f83d8d 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:e3:ec:9b \
--s 2:0,ahci-cd,/tmp/cdrom.iso bhyve
+-s 2:0,ahci,cd:/tmp/cdrom.iso \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:e3:ec:9b bhyve
index 1b38be1ab47065bd7dde7545ccddb34e0ffaee94..e64e67b39d9234d3536e25625255eb431ed6ed55 100644 (file)
@@ -5,7 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:f4:6c:be \
--s 2:0,ahci-hd,/tmp/freebsd1.img \
--s 4:0,ahci-hd,/tmp/freebsd2.img \
--s 6:0,ahci-hd,/tmp/freebsd3.img bhyve
+-s 2: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
index ae510d50d6b3e5178c9913129fe609293844fd45..872a69df3ba1e2c66db285c7654c14ba4df060aa 100644 (file)
@@ -5,7 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:0e:d2:6f \
--s 2:0,ahci-hd,/tmp/freebsd1.img \
--s 4:0,ahci-hd,/tmp/freebsd2.img \
--s 6:0,ahci-hd,/tmp/freebsd3.img bhyve
+-s 2: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
index 9457ce955079e2813c9a52a7be3bcee7a803060a..3ba5c116089677d735e65974ce74e1761a8566bb 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:ee:f5:79 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:ee:f5:79 bhyve
index 3f62aa7fbef0ba15bf00941392b22bf4c4e09aeb..307d888c1f2d385f3a2fa16e0223d8a7c27b70b0 100644 (file)
@@ -4,5 +4,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:82:ca:a3 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:82:ca:a3 bhyve
index 677a466babde0c3f8bfbfd05d8f82af09d8e7251..5e13a9742d3b1a22f7d826c6f748d23f365ca348 100644 (file)
@@ -5,5 +5,5 @@
 -H \
 -P \
 -s 0:0,hostbridge \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:22:ee:11 \
--s 2:0,ahci-hd,/tmp/freebsd.img bhyve
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:22:ee:11 bhyve
index 4811d491b7d9f8becddf2d4703400d11baba0790..ff69ed3a7df057072bafd1e350127ccfeb810129 100644 (file)
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:a7:cd:5b \
--s 2:0,ahci-hd,/tmp/freebsd.img \
 -s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
index efdbd63a569a9f951735c151c62a4e992af91bc7..313724dc9009fcb8f3eb08f7b92f2fa95fe596c8 100644 (file)
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:f0:72:11 \
--s 2:0,ahci-hd,/tmp/freebsd.img \
 -s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
index ccce5826334aa5d88776c75059445b1e4000386b..059e457072476896b0a31dbe131570a73ab6c133 100644 (file)
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:4f:f3:5b \
--s 2:0,ahci-hd,/tmp/freebsd.img \
 -s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
index a615c8ca146fcf97201ed5805a26a5eaa0285573..6d0a9e1f8088f656555a065f4360fe1fdc4e184a 100644 (file)
@@ -155,7 +155,7 @@ mymain(void)
     DO_TEST_FULL(name, FLAG_EXPECT_PARSE_ERROR)
 
     driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV;
-    driver.bhyvecaps = BHYVE_CAP_RTC_UTC;
+    driver.bhyvecaps = BHYVE_CAP_RTC_UTC | BHYVE_CAP_AHCI32SLOT;
 
     DO_TEST("base");
     DO_TEST("acpiapic");
index ef57e0be69a811162ffaa08c45701ae16c00d264..0a9b284ffbe6a114e828e3813cb1fbefa9a3e9d4 100644 (file)
@@ -24,7 +24,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:81:c4:b1'/>
       <source bridge='virbr0'/>
index 0ff1a3c6b3d3c389f092b7531bf4eaade5b658a6..56ff3bd14b2f555cfaaef3d0d07ecc0225325901 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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'/>
index 6c092bb8d418c3aaf2ad57e143d1cc5ec564a092..c4705d9a8b3dba83cfd9edf284836210a90df226 100644 (file)
@@ -27,7 +27,9 @@
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:8d:10:e1'/>
       <source bridge='virbr0'/>
index f9e55d6e3367cfb9ca7cf8cc786c0d734da16f06..ebc781e740ef62a8db3b48488520c6372634067c 100644 (file)
@@ -27,7 +27,9 @@
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:92:68:0e'/>
       <source bridge='virbr0'/>
index f75471f8491f20ab67bf13da06362fbf95fb8ba7..389355f91363aeffd7f7d4a8c217628e1fd2446e 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:1e:63:25'/>
       <source bridge='virbr0'/>
index 8b9aeea1860656936bf44d9e87e168f3e2d94b26..10ba2179343e82fe9a16f1b1df3c562c6cf86f28 100644 (file)
@@ -27,7 +27,9 @@
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:7a:f5:a4'/>
       <source bridge='virbr0'/>
index a688d8a76fc2ebc7049a3abd9d0c5123154f611f..2215c7327e778cad4f5f118ecf75aa96422d8ddf 100644 (file)
@@ -28,7 +28,9 @@
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:fe:97:82'/>
       <source bridge='virbr0'/>
index bb7193037221855fe32e6933d8bd4f0d7021f744..6c6ed114d9bef4036972098d6b0dd754f186f334 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:11:bd:26'/>
       <source bridge='virbr0'/>
index bf9d6ad8af29aa270ce367a0b7601e34e97e364c..78d4d300167ef38a47f5bb2e9e83160717529580 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:b1:42:eb'/>
       <source bridge='virbr0'/>
index 53fd6b54b071f64819caa7e729c765d3727d2afd..8bb0d53b76dd936eafba19717ac4805baca471fe 100644 (file)
@@ -21,7 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:35:99:c2'/>
       <source bridge='virbr0'/>
index acdc4badb5ba5e69b7ed8f5a7448a891e3484e71..b624f3d973bab0528ef2654ac9d3352a08c89856 100644 (file)
@@ -21,7 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:6f:6a:53'/>
       <source bridge='virbr0'/>
index 23f3f6f47484a9c283fc4362aab66c0ffeb00add..ef3cd9fff298f62e0c528b5b8a08264ec8360160 100644 (file)
@@ -21,7 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:e3:ec:9b'/>
       <source bridge='virbr0'/>
index f36daae10e599223364f5c97b0a21518dd62f780..da55c0aaefcbc5cfa4287a99ef6822f28604135a 100644 (file)
@@ -33,7 +33,9 @@
       <address type='drive' controller='0' bus='0' target='6' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:f4:6c:be'/>
       <source bridge='virbr0'/>
index 825ccd78f40bc855888091cd4f42a24bf50dc04b..3974d5bc5849b1ad6069d5be92e7645542e9e9dd 100644 (file)
@@ -35,7 +35,9 @@
       <address type='drive' controller='0' bus='0' target='6' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:0e:d2:6f'/>
       <source bridge='virbr0'/>
index b7f0a488643988dd04645521f03a61254be80556..270d41c8318620915d9692fdb121e91f0070ffa9 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:ee:f5:79'/>
       <source bridge='virbr0'/>
index 95b01db2fb7d5b36954b2bb8ee05113073dbc236..2d1b729e69efb892b7132f6313a8b24934aa67c7 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:82:ca:a3'/>
       <source bridge='virbr0'/>
index 842194caa3a66d980ce35d8f86b624ad7e4d30a7..6710818ee82950d4f2cbb951ce407a57689af595 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:22:ee:11'/>
       <source bridge='virbr0'/>
index b44b6bd9e1ece73ede9b982be52dffedd2290a72..5c5109404d0f665664a8bdbf5ba08bc96220d93e 100644 (file)
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:ad:55:51'/>
       <source bridge='virbr0'/>
       <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
   </devices>
 </domain>
index f4ace3979884da608ebf0999e495e9badaa99d52..845cb09e9f0d1eada6b7005fc2a9c5f4488f9375 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:a7:cd:5b'/>
       <source bridge='virbr0'/>
index f404ee7e3830fbb2a95faf36b4bd27cfc38b0802..6c8fda32af1524ee0280edbb4dc67a86720e4d38 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:f0:72:11'/>
       <source bridge='virbr0'/>
index d713deaee4066d4076605f981a77d62c41b688ca..eb50cc05ad30442de7f9ef44ff903461a3b74aaa 100644 (file)
@@ -20,7 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='sata' index='0'/>
+    <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:4f:f3:5b'/>
       <source bridge='virbr0'/>
index 641ddb33e37a104f690ce41e40c0970358f24499..93ab3800ced3c4356e236236c92f4742365e468c 100644 (file)
@@ -64,6 +64,8 @@ mymain(void)
 # define DO_TEST_DIFFERENT(name) \
     DO_TEST_FULL(name, true)
 
+    driver.bhyvecaps = BHYVE_CAP_AHCI32SLOT;
+
     DO_TEST_DIFFERENT("acpiapic");
     DO_TEST_DIFFERENT("base");
     DO_TEST_DIFFERENT("bhyveload-bootorder");