]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Support booting from hostdev PCI devices
authorJiri Denemark <jdenemar@redhat.com>
Thu, 3 Feb 2011 14:09:17 +0000 (15:09 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 3 Feb 2011 21:20:30 +0000 (22:20 +0100)
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c

index 37a97aabad86e6460081c1cbd12231f7c18c8b44..fd46557be326101b6593813d6ae6ad44df984a25 100644 (file)
@@ -1088,8 +1088,11 @@ qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
     /* Features of given devices. */
     if (strstr(str, "pci-assign.configfd"))
         *flags |= QEMUD_CMD_FLAG_PCI_CONFIGFD;
-    if (strstr(str, "virtio-blk-pci.bootindex"))
+    if (strstr(str, "virtio-blk-pci.bootindex")) {
         *flags |= QEMUD_CMD_FLAG_BOOTINDEX;
+        if (strstr(str, "pci-assign.bootindex"))
+            *flags |= QEMUD_CMD_FLAG_PCI_BOOTINDEX;
+    }
 
     return 0;
 }
index e04f6a80e972ef25f118dbfab1762dfce50ce0c8..c2d09caf98e772c7d1bd4181ce145b9bc1b398c1 100644 (file)
@@ -87,6 +87,7 @@ enum qemuCapsFlags {
     QEMUD_CMD_FLAG_HDA_DUPLEX    = (1LL << 50), /* -device hda-duplex */
     QEMUD_CMD_FLAG_DRIVE_AIO     = (1LL << 51), /* -drive aio= supported */
     QEMUD_CMD_FLAG_PCI_MULTIBUS  = (1LL << 52), /* bus=pci.0 vs bus=pci */
+    QEMUD_CMD_FLAG_PCI_BOOTINDEX = (1LL << 53), /* pci-assign.bootindex */
 };
 
 virCapsPtr qemuCapsInit(virCapsPtr old_caps);
index ffbe276a4fcb684ae379eee269d0dfd07dbe8bc5..f57c9377f649e23294b0a4d8b3fa349f828a6ec2 100644 (file)
@@ -1917,6 +1917,8 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
     virBufferVSprintf(&buf, ",id=%s", dev->info.alias);
     if (configfd && *configfd)
         virBufferVSprintf(&buf, ",configfd=%s", configfd);
+    if (dev->bootIndex)
+        virBufferVSprintf(&buf, ",bootindex=%d", dev->bootIndex);
     if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCmdFlags) < 0)
         goto error;
 
@@ -3980,6 +3982,21 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainHostdevDefPtr hostdev = def->hostdevs[i];
         char *devstr;
 
+        if (hostdev->bootIndex) {
+            if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
+                hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
+                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                _("booting from assigned devices is only"
+                                  " supported for PCI devices"));
+                goto error;
+            } else if (!(qemuCmdFlags & QEMUD_CMD_FLAG_PCI_BOOTINDEX)) {
+                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                _("booting from assigned PCI devices is not"
+                                  " supported with this version of qemu"));
+                goto error;
+            }
+        }
+
         /* USB */
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {