Skip to contentSkip to conversation

add hotplug opt-out option for pci devices.

PATCH In review Gerd Hoffmann 4 participants 11 messages Jan 6, 2011 – Jan 13, 2011

lore
Share & tools
lore
#0 lore raw

v2 cover add hotplug opt-out option for pci devices.

Hi,

This patch series adds a flag which allows pci devices being tagged as not hotpluggable. It also sets this flag for a number of devices.

[ v2: fix mips build failure ]
[ v2: add patch for qxl ]

Gerd Hoffmann (4):
pci: allow devices being tagged as not hotpluggable.
piix: tag as not hotpluggable.
vga: tag as not hotplugable.
qxl: tag as not hotpluggable

 hw/acpi_piix4.c |    2 ++
 hw/cirrus_vga.c |    1 +
 hw/ide/piix.c   |    2 ++
 hw/pci.c        |   10 ++++++++++
 hw/pci.h        |    3 +++
 hw/piix4.c      |    1 +
 hw/piix_pci.c   |    2 ++
 hw/qxl.c        |    1 +
 hw/vga-pci.c    |    1 +
 hw/vmware_vga.c |    1 +
 qerror.c        |    4 ++++
 qerror.h        |    3 +++
 12 files changed, 31 insertions(+), 0 deletions(-)
#10 lore raw

PATCH v2 4/4 qxl: tag as not hotpluggable

---
 hw/qxl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/qxl.c +1 -0
index 207aa63..bd71e58 100644
@@ -1546,6 +1546,7 @@ static PCIDeviceInfo qxl_info_primary = {
     .qdev.size    = sizeof(PCIQXLDevice),
     .qdev.reset   = qxl_reset_handler,
     .qdev.vmsd    = &qxl_vmstate,
+    .no_hotplug   = 1,
     .init         = qxl_init_primary,
     .config_write = qxl_write_config,
     .romfile      = "vgabios-qxl.bin",
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/4 pci: allow devices being tagged as not hotpluggable.

In reply to Gerd Hoffmann

This patch adds a field to PCIDeviceInfo to tag devices as being not hotpluggable. Any attempt to plug-in or -out such a device will throw an error.

---
 hw/pci.c |   10 ++++++++++
 hw/pci.h |    3 +++
 qerror.c |    4 ++++
 qerror.h |    3 +++
 4 files changed, 20 insertions(+), 0 deletions(-)
hw/pci.c +10 -0
index ef00d20..a4ae3b2 100644
@@ -1620,6 +1620,11 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
                                      info->is_bridge);
     if (pci_dev == NULL)
         return -1;
+    if (qdev->hotplugged && info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        do_pci_unregister_device(pci_dev);
+        return -1;
+    }
     rc = info->init(pci_dev);
     if (rc != 0) {
         do_pci_unregister_device(pci_dev);
@@ -1652,7 +1657,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
 static int pci_unplug_device(DeviceState *qdev)
 {
     PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
+    PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev);
 
+    if (info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        return -1;
+    }
     return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
                              PCI_HOTPLUG_DISABLED);
 }
hw/pci.h +3 -0
index 17744dc..6b4bd3e 100644
@@ -434,6 +434,9 @@ typedef struct {
     /* pcie stuff */
     int is_express;   /* is this device pci express? */
 
+    /* device isn't hot-pluggable */
+    int no_hotplug;
+
     /* rom bar */
     const char *romfile;
 } PCIDeviceInfo;
qerror.c +4 -0
index ac2cdaf..9d0cdeb 100644
@@ -101,6 +101,10 @@ static const QErrorStringTable qerror_table[] = {
         .desc      = "Device '%(device)' has no child bus",
     },
     {
+        .error_fmt = QERR_DEVICE_NO_HOTPLUG,
+        .desc      = "Device '%(device)' does not support hotplugging",
+    },
+    {
         .error_fmt = QERR_DUPLICATE_ID,
         .desc      = "Duplicate ID '%(id)' for %(object)",
     },
qerror.h +3 -0
index 943a24b..b0f69da 100644
@@ -90,6 +90,9 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_DEVICE_NO_BUS \
     "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
 
+#define QERR_DEVICE_NO_HOTPLUG \
+    "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
+
 #define QERR_DUPLICATE_ID \
     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
 
Signature · 1 line
1.7.1
#9 lore raw

PATCH v2 3/4 vga: tag as not hotplugable.

In reply to Gerd Hoffmann

This patch tags all vga cards as not hotpluggable. The qemu standard vga will never ever be hotpluggable. For cirrus + vmware it might be possible to get that work some day. Todays we can't handle that for a number of reasons though.

---
 hw/cirrus_vga.c |    1 +
 hw/vga-pci.c    |    1 +
 hw/vmware_vga.c |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
hw/cirrus_vga.c +1 -0
index 4f5040c..0d522a0 100644
@@ -3227,6 +3227,7 @@ static PCIDeviceInfo cirrus_vga_info = {
     .qdev.desc    = "Cirrus CLGD 54xx VGA",
     .qdev.size    = sizeof(PCICirrusVGAState),
     .qdev.vmsd    = &vmstate_pci_cirrus_vga,
+    .no_hotplug   = 1,
     .init         = pci_cirrus_vga_initfn,
     .romfile      = VGABIOS_CIRRUS_FILENAME,
     .config_write = pci_cirrus_write_config,
hw/vga-pci.c +1 -0
index 791ca22..ce9ec45 100644
@@ -110,6 +110,7 @@ static PCIDeviceInfo vga_info = {
     .qdev.name    = "VGA",
     .qdev.size    = sizeof(PCIVGAState),
     .qdev.vmsd    = &vmstate_vga_pci,
+    .no_hotplug   = 1,
     .init         = pci_vga_initfn,
     .config_write = pci_vga_write_config,
     .romfile      = "vgabios-stdvga.bin",
hw/vmware_vga.c +1 -0
index d9dd52f..6c59053 100644
@@ -1318,6 +1318,7 @@ static PCIDeviceInfo vmsvga_info = {
     .qdev.name    = "vmware-svga",
     .qdev.size    = sizeof(struct pci_vmsvga_state_s),
     .qdev.vmsd    = &vmstate_vmware_vga,
+    .no_hotplug   = 1,
     .init         = pci_vmsvga_initfn,
     .romfile      = "vgabios-vmware.bin",
 };
Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 2/4 piix: tag as not hotpluggable.

In reply to Gerd Hoffmann

This patch tags all pci devices which belong to the piix3/4 chipsets as not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).

---
 hw/acpi_piix4.c |    2 ++
 hw/ide/piix.c   |    2 ++
 hw/piix4.c      |    1 +
 hw/piix_pci.c   |    2 ++
 4 files changed, 7 insertions(+), 0 deletions(-)
hw/acpi_piix4.c +2 -0
index 173d781..273097d 100644
@@ -428,6 +428,8 @@ static PCIDeviceInfo piix4_pm_info = {
     .qdev.desc          = "PM",
     .qdev.size          = sizeof(PIIX4PMState),
     .qdev.vmsd          = &vmstate_acpi,
+    .qdev.no_user       = 1,
+    .no_hotplug         = 1,
     .init               = piix4_pm_initfn,
     .config_write       = pm_write_config,
     .qdev.props         = (Property[]) {
hw/ide/piix.c +2 -0
index 1cad906..d4289af 100644
@@ -194,11 +194,13 @@ static PCIDeviceInfo piix_ide_info[] = {
         .qdev.name    = "piix3-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix3_ide_initfn,
     },{
         .qdev.name    = "piix4-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix4_ide_initfn,
     },{
         /* end of list */
hw/piix4.c +1 -0
index 5489386..72073cd 100644
@@ -113,6 +113,7 @@ static PCIDeviceInfo piix4_info[] = {
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PCIDevice),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix4_initfn,
     },{
         /* end of list */
hw/piix_pci.c +2 -0
index 38f9d9e..358da58 100644
@@ -348,6 +348,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PCII440FXState),
         .qdev.vmsd    = &vmstate_i440fx,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = i440fx_initfn,
         .config_write = i440fx_write_config,
     },{
@@ -356,6 +357,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PIIX3State),
         .qdev.vmsd    = &vmstate_piix3,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix3_initfn,
     },{
         /* end of list */
Signature · 1 line
1.7.1
Acked-by on v2 1/4
#2 lore raw

[Qemu-devel] Re: [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.

In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann

This patch adds a field to PCIDeviceInfo to tag devices as being not hotpluggable. Any attempt to plug-in or -out such a device will throw an error.

Quoted 82 lines
---
 hw/pci.c |   10 ++++++++++
 hw/pci.h |    3 +++
 qerror.c |    4 ++++
 qerror.h |    3 +++
 4 files changed, 20 insertions(+), 0 deletions(-)
hw/pci.c +10 -0
index ef00d20..a4ae3b2 100644
@@ -1620,6 +1620,11 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
                                      info->is_bridge);
     if (pci_dev == NULL)
         return -1;
+    if (qdev->hotplugged && info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        do_pci_unregister_device(pci_dev);
+        return -1;
+    }
     rc = info->init(pci_dev);
     if (rc != 0) {
         do_pci_unregister_device(pci_dev);
@@ -1652,7 +1657,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
 static int pci_unplug_device(DeviceState *qdev)
 {
     PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
+    PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev);
 
+    if (info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        return -1;
+    }
     return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
                              PCI_HOTPLUG_DISABLED);
 }
hw/pci.h +3 -0
index 17744dc..6b4bd3e 100644
@@ -434,6 +434,9 @@ typedef struct {
     /* pcie stuff */
     int is_express;   /* is this device pci express? */
 
+    /* device isn't hot-pluggable */
+    int no_hotplug;
+
     /* rom bar */
     const char *romfile;
 } PCIDeviceInfo;
qerror.c +4 -0
index ac2cdaf..9d0cdeb 100644
@@ -101,6 +101,10 @@ static const QErrorStringTable qerror_table[] = {
         .desc      = "Device '%(device)' has no child bus",
     },
     {
+        .error_fmt = QERR_DEVICE_NO_HOTPLUG,
+        .desc      = "Device '%(device)' does not support hotplugging",
+    },
+    {
         .error_fmt = QERR_DUPLICATE_ID,
         .desc      = "Duplicate ID '%(id)' for %(object)",
     },
qerror.h +3 -0
index 943a24b..b0f69da 100644
@@ -90,6 +90,9 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_DEVICE_NO_BUS \
     "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
 
+#define QERR_DEVICE_NO_HOTPLUG \
+    "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
+
 #define QERR_DUPLICATE_ID \
     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
 
Signature · 1 line
1.7.1
Acked-by on v2 2/4
#6 lore raw

Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.

In reply to Gerd Hoffmann
Quoted 10 lines · Gerd Hoffmann

This patch tags all pci devices which belong to the piix3/4 chipsets as not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).

---
 hw/acpi_piix4.c |    2 ++
 hw/ide/piix.c   |    2 ++
 hw/piix4.c      |    1 +
 hw/piix_pci.c   |    2 ++
 4 files changed, 7 insertions(+), 0 deletions(-)

I don't know a lot about piix4, but the change looks sane. I have verified it doesn't break the MIPS malta target.

Quoted 68 lines
hw/acpi_piix4.c +2 -0
index 173d781..273097d 100644
@@ -428,6 +428,8 @@ static PCIDeviceInfo piix4_pm_info = {
     .qdev.desc          = "PM",
     .qdev.size          = sizeof(PIIX4PMState),
     .qdev.vmsd          = &vmstate_acpi,
+    .qdev.no_user       = 1,
+    .no_hotplug         = 1,
     .init               = piix4_pm_initfn,
     .config_write       = pm_write_config,
     .qdev.props         = (Property[]) {
hw/ide/piix.c +2 -0
index 1cad906..d4289af 100644
@@ -194,11 +194,13 @@ static PCIDeviceInfo piix_ide_info[] = {
         .qdev.name    = "piix3-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix3_ide_initfn,
     },{
         .qdev.name    = "piix4-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix4_ide_initfn,
     },{
         /* end of list */
hw/piix4.c +1 -0
index 5489386..72073cd 100644
@@ -113,6 +113,7 @@ static PCIDeviceInfo piix4_info[] = {
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PCIDevice),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix4_initfn,
     },{
         /* end of list */
hw/piix_pci.c +2 -0
index 38f9d9e..358da58 100644
@@ -348,6 +348,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PCII440FXState),
         .qdev.vmsd    = &vmstate_i440fx,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = i440fx_initfn,
         .config_write = i440fx_write_config,
     },{
@@ -356,6 +357,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PIIX3State),
         .qdev.vmsd    = &vmstate_piix3,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix3_initfn,
     },{
         /* end of list */
Signature · 1 line
1.7.1
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw

Re: [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.

In reply to Gerd Hoffmann
Quoted 17 lines · Gerd Hoffmann

This patch adds a field to PCIDeviceInfo to tag devices as being not hotpluggable. Any attempt to plug-in or -out such a device will throw an error.

---
 hw/pci.c |   10 ++++++++++
 hw/pci.h |    3 +++
 qerror.c |    4 ++++
 qerror.h |    3 +++
 4 files changed, 20 insertions(+), 0 deletions(-)
hw/pci.c +0 -0
index ef00d20..a4ae3b2 100644

hw/pci.c static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) · line 1627

Quoted 8 lines
hw/pci.c +5 -0
@@ -1620,6 +1620,11 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
                                      info->is_bridge);
     if (pci_dev == NULL)
         return -1;
+    if (qdev->hotplugged && info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        do_pci_unregister_device(pci_dev);
+        return -1;
+    }

Any particular reason for not check this before
do_pci_register_device()?

Quoted 3 lines
hw/pci.c +0 -0
     rc = info->init(pci_dev);
     if (rc != 0) {
         do_pci_unregister_device(pci_dev);

[...]

Quoted 32 lines
hw/pci.c +5 -0
@@ -1652,7 +1657,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
 static int pci_unplug_device(DeviceState *qdev)
 {
     PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
+    PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev);
 
+    if (info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        return -1;
+    }
     return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
                              PCI_HOTPLUG_DISABLED);
 }
hw/pci.h +3 -0
index 17744dc..6b4bd3e 100644
@@ -434,6 +434,9 @@ typedef struct {
     /* pcie stuff */
     int is_express;   /* is this device pci express? */
 
+    /* device isn't hot-pluggable */
+    int no_hotplug;
+
     /* rom bar */
     const char *romfile;
 } PCIDeviceInfo;
qerror.c +0 -0
index ac2cdaf..9d0cdeb 100644

qerror.c static const QErrorStringTable qerror_table[] = { · line 107

Quoted 7 lines
qerror.c +4 -0
@@ -101,6 +101,10 @@ static const QErrorStringTable qerror_table[] = {
         .desc      = "Device '%(device)' has no child bus",
     },
     {
+        .error_fmt = QERR_DEVICE_NO_HOTPLUG,
+        .desc      = "Device '%(device)' does not support hotplugging",
+    },
+    {

I'd prefer "can't be hot-plugged", but I doubt it's worth a respin.

Quoted 16 lines
qerror.c +0 -0
         .error_fmt = QERR_DUPLICATE_ID,
         .desc      = "Duplicate ID '%(id)' for %(object)",
     },
qerror.h +3 -0
index 943a24b..b0f69da 100644
@@ -90,6 +90,9 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_DEVICE_NO_BUS \
     "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
 
+#define QERR_DEVICE_NO_HOTPLUG \
+    "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
+
 #define QERR_DUPLICATE_ID \
     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
#7 lore raw

Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.

In reply to Gerd Hoffmann
Quoted 16 lines · Gerd Hoffmann

This patch tags all pci devices which belong to the piix3/4 chipsets as not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).

---
 hw/acpi_piix4.c |    2 ++
 hw/ide/piix.c   |    2 ++
 hw/piix4.c      |    1 +
 hw/piix_pci.c   |    2 ++
 4 files changed, 7 insertions(+), 0 deletions(-)
hw/acpi_piix4.c +0 -0
index 173d781..273097d 100644

hw/acpi_piix4.c static PCIDeviceInfo piix4_pm_info = { · line 431

Quoted 4 lines
hw/acpi_piix4.c +1 -0
@@ -428,6 +428,8 @@ static PCIDeviceInfo piix4_pm_info = {
     .qdev.desc          = "PM",
     .qdev.size          = sizeof(PIIX4PMState),
     .qdev.vmsd          = &vmstate_acpi,
+    .qdev.no_user       = 1,

Makes sense, but the commit message doesn't mention it.

Quoted 47 lines
hw/acpi_piix4.c +1 -0
+    .no_hotplug         = 1,
     .init               = piix4_pm_initfn,
     .config_write       = pm_write_config,
     .qdev.props         = (Property[]) {
hw/ide/piix.c +2 -0
index 1cad906..d4289af 100644
@@ -194,11 +194,13 @@ static PCIDeviceInfo piix_ide_info[] = {
         .qdev.name    = "piix3-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix3_ide_initfn,
     },{
         .qdev.name    = "piix4-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = pci_piix4_ide_initfn,
     },{
         /* end of list */
hw/piix4.c +1 -0
index 5489386..72073cd 100644
@@ -113,6 +113,7 @@ static PCIDeviceInfo piix4_info[] = {
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PCIDevice),
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix4_initfn,
     },{
         /* end of list */
hw/piix_pci.c +1 -0
index 38f9d9e..358da58 100644
@@ -348,6 +348,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PCII440FXState),
         .qdev.vmsd    = &vmstate_i440fx,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = i440fx_initfn,
         .config_write = i440fx_write_config,
     },{

hw/piix_pci.c static PCIDeviceInfo i440fx_info[] = { · line 363

Quoted 7 lines
hw/piix_pci.c +1 -0
@@ -356,6 +357,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .qdev.size    = sizeof(PIIX3State),
         .qdev.vmsd    = &vmstate_piix3,
         .qdev.no_user = 1,
+        .no_hotplug   = 1,
         .init         = piix3_initfn,
     },{
         /* end of list */

What about "piix3-usb-uhci" & friends?

#4 lore raw

Re: [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.

In reply to Markus Armbruster
Quoted 4 lines
Quoted 4 lines
hw/pci.c +0 -0
@@ -1620,6 +1620,11 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
                                       info->is_bridge);
      if (pci_dev == NULL)
          return -1;
Quoted 8 lines

hw/pci.c static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) · line 1627

Quoted 5 lines
hw/pci.c +5 -0
+    if (qdev->hotplugged&&  info->no_hotplug) {
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
+        do_pci_unregister_device(pci_dev);
+        return -1;
+    }

Any particular reason for not check this before
do_pci_register_device()?

Don't remember, probably not. I think can could be moved up (and loose the unregister call) and behavior will not change.

cheers,
Gerd

#8 lore raw

Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.

In reply to Markus Armbruster

Hi,

Quoted 3 lines
Quoted 1 line

+ .no_hotplug = 1,

What about "piix3-usb-uhci"& friends?

Hmm. Good question. UHCI controllers are hotpluggable. But of course it isn't when it is a function of the chipset because pci can hotplug slots only.

Guess the best way to handle this for now is to just disable hotplugging for multifunction slots+devices as qemu currently lacks the infrastructure to handle this correctly.

cheers,
Gerd