* [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices.
@ 2011-01-06 14:14 Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-06 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.
2011-01-06 14:14 [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices Gerd Hoffmann
@ 2011-01-06 14:14 ` Gerd Hoffmann
2011-01-06 17:52 ` [Qemu-devel] " Michael S. Tsirkin
2011-01-12 12:19 ` [Qemu-devel] " Markus Armbruster
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 2/4] piix: tag " Gerd Hoffmann
` (2 subsequent siblings)
3 siblings, 2 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-06 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: 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.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pci.c | 10 ++++++++++
hw/pci.h | 3 +++
qerror.c | 4 ++++
qerror.h | 3 +++
4 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index ef00d20..a4ae3b2 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -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);
}
diff --git a/hw/pci.h b/hw/pci.h
index 17744dc..6b4bd3e 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -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;
diff --git a/qerror.c b/qerror.c
index ac2cdaf..9d0cdeb 100644
--- a/qerror.c
+++ b/qerror.c
@@ -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)",
},
diff --git a/qerror.h b/qerror.h
index 943a24b..b0f69da 100644
--- a/qerror.h
+++ b/qerror.h
@@ -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 } }"
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.
2011-01-06 14:14 [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
@ 2011-01-06 14:14 ` Gerd Hoffmann
2011-01-07 14:42 ` Aurelien Jarno
2011-01-12 12:22 ` Markus Armbruster
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 3/4] vga: tag as not hotplugable Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 4/4] qxl: tag as not hotpluggable Gerd Hoffmann
3 siblings, 2 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-06 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: 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).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 173d781..273097d 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -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[]) {
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 1cad906..d4289af 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -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 */
diff --git a/hw/piix4.c b/hw/piix4.c
index 5489386..72073cd 100644
--- a/hw/piix4.c
+++ b/hw/piix4.c
@@ -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 */
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 38f9d9e..358da58 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -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 */
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH v2 3/4] vga: tag as not hotplugable.
2011-01-06 14:14 [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 2/4] piix: tag " Gerd Hoffmann
@ 2011-01-06 14:14 ` Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 4/4] qxl: tag as not hotpluggable Gerd Hoffmann
3 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-06 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: 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.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/cirrus_vga.c | 1 +
hw/vga-pci.c | 1 +
hw/vmware_vga.c | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 4f5040c..0d522a0 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -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,
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 791ca22..ce9ec45 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -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",
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index d9dd52f..6c59053 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -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",
};
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH v2 4/4] qxl: tag as not hotpluggable
2011-01-06 14:14 [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices Gerd Hoffmann
` (2 preceding siblings ...)
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 3/4] vga: tag as not hotplugable Gerd Hoffmann
@ 2011-01-06 14:14 ` Gerd Hoffmann
3 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-06 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index 207aa63..bd71e58 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -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",
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] Re: [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
@ 2011-01-06 17:52 ` Michael S. Tsirkin
2011-01-12 12:19 ` [Qemu-devel] " Markus Armbruster
1 sibling, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2011-01-06 17:52 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Thu, Jan 06, 2011 at 03:14:37PM +0100, Gerd Hoffmann wrote:
> 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.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/pci.c | 10 ++++++++++
> hw/pci.h | 3 +++
> qerror.c | 4 ++++
> qerror.h | 3 +++
> 4 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index ef00d20..a4ae3b2 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -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);
> }
> diff --git a/hw/pci.h b/hw/pci.h
> index 17744dc..6b4bd3e 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -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;
> diff --git a/qerror.c b/qerror.c
> index ac2cdaf..9d0cdeb 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -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)",
> },
> diff --git a/qerror.h b/qerror.h
> index 943a24b..b0f69da 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -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 } }"
>
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 2/4] piix: tag " Gerd Hoffmann
@ 2011-01-07 14:42 ` Aurelien Jarno
2011-01-12 12:22 ` Markus Armbruster
1 sibling, 0 replies; 11+ messages in thread
From: Aurelien Jarno @ 2011-01-07 14:42 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Thu, Jan 06, 2011 at 03:14:38PM +0100, Gerd Hoffmann wrote:
> This patch tags all pci devices which belong to the piix3/4 chipsets as
> not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> 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.
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index 173d781..273097d 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -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[]) {
> diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> index 1cad906..d4289af 100644
> --- a/hw/ide/piix.c
> +++ b/hw/ide/piix.c
> @@ -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 */
> diff --git a/hw/piix4.c b/hw/piix4.c
> index 5489386..72073cd 100644
> --- a/hw/piix4.c
> +++ b/hw/piix4.c
> @@ -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 */
> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> index 38f9d9e..358da58 100644
> --- a/hw/piix_pci.c
> +++ b/hw/piix_pci.c
> @@ -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 */
> --
> 1.7.1
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
2011-01-06 17:52 ` [Qemu-devel] " Michael S. Tsirkin
@ 2011-01-12 12:19 ` Markus Armbruster
2011-01-13 12:12 ` Gerd Hoffmann
1 sibling, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2011-01-12 12:19 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> 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.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/pci.c | 10 ++++++++++
> hw/pci.h | 3 +++
> qerror.c | 4 ++++
> qerror.h | 3 +++
> 4 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index ef00d20..a4ae3b2 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -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()?
> 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);
> }
> diff --git a/hw/pci.h b/hw/pci.h
> index 17744dc..6b4bd3e 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -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;
> diff --git a/qerror.c b/qerror.c
> index ac2cdaf..9d0cdeb 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -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.
> .error_fmt = QERR_DUPLICATE_ID,
> .desc = "Duplicate ID '%(id)' for %(object)",
> },
> diff --git a/qerror.h b/qerror.h
> index 943a24b..b0f69da 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -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 } }"
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 2/4] piix: tag " Gerd Hoffmann
2011-01-07 14:42 ` Aurelien Jarno
@ 2011-01-12 12:22 ` Markus Armbruster
2011-01-13 12:19 ` Gerd Hoffmann
1 sibling, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2011-01-12 12:22 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> This patch tags all pci devices which belong to the piix3/4 chipsets as
> not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> 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(-)
>
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index 173d781..273097d 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -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.
> + .no_hotplug = 1,
> .init = piix4_pm_initfn,
> .config_write = pm_write_config,
> .qdev.props = (Property[]) {
> diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> index 1cad906..d4289af 100644
> --- a/hw/ide/piix.c
> +++ b/hw/ide/piix.c
> @@ -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 */
> diff --git a/hw/piix4.c b/hw/piix4.c
> index 5489386..72073cd 100644
> --- a/hw/piix4.c
> +++ b/hw/piix4.c
> @@ -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 */
> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> index 38f9d9e..358da58 100644
> --- a/hw/piix_pci.c
> +++ b/hw/piix_pci.c
> @@ -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 */
What about "piix3-usb-uhci" & friends?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable.
2011-01-12 12:19 ` [Qemu-devel] " Markus Armbruster
@ 2011-01-13 12:12 ` Gerd Hoffmann
0 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-13 12:12 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
>> @@ -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()?
Don't remember, probably not. I think can could be moved up (and loose
the unregister call) and behavior will not change.
cheers,
Gerd
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/4] piix: tag as not hotpluggable.
2011-01-12 12:22 ` Markus Armbruster
@ 2011-01-13 12:19 ` Gerd Hoffmann
0 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2011-01-13 12:19 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
Hi,
>> + .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
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-01-13 12:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 14:14 [Qemu-devel] [PATCH v2 0/4] add hotplug opt-out option for pci devices Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 1/4] pci: allow devices being tagged as not hotpluggable Gerd Hoffmann
2011-01-06 17:52 ` [Qemu-devel] " Michael S. Tsirkin
2011-01-12 12:19 ` [Qemu-devel] " Markus Armbruster
2011-01-13 12:12 ` Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 2/4] piix: tag " Gerd Hoffmann
2011-01-07 14:42 ` Aurelien Jarno
2011-01-12 12:22 ` Markus Armbruster
2011-01-13 12:19 ` Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 3/4] vga: tag as not hotplugable Gerd Hoffmann
2011-01-06 14:14 ` [Qemu-devel] [PATCH v2 4/4] qxl: tag as not hotpluggable Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).