Skip to contentSkip to conversation

pc: piix4_pm: init legacy PCI hotplug when running on Xen

PATCH In review Igor Mammedov 5 participants 9 messages May 23, 2014 – Nov 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc: piix4_pm: init legacy PCI hotplug when running on Xen

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would
cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property,
just use the fact that xen doesn't use QEMU's
fw_cfg/acpi tables to switch piix4_pm into legacy
PCI hotplug mode when Xen is enabled.

---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +3 -0
index 227ea30..12542c3 100644
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
 
hw/i386/pc_piix.c +0 -11
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 22 lines · Igor Mammedov

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would
cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property,
just use the fact that xen doesn't use QEMU's
fw_cfg/acpi tables to switch piix4_pm into legacy
PCI hotplug mode when Xen is enabled.

 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +0 -0
index 227ea30..12542c3 100644

hw/acpi/piix4.c I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, · line 508

Quoted 8 lines
hw/acpi/piix4.c +3 -0
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);

This seems like a good change to have regardless of everything else. I am not sure I would remove the default off for acpi-pci-hotplug-with-bridge-support on xenfv but I underestand it wouldn't be needed anyway.

So the patch is fine by me.

Quoted 25 lines
hw/i386/pc_piix.c +0 -11
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
Signature · 1 line
1.9.0
#2 lore raw
In reply to Igor Mammedov

I still see this error in the latest QEMU. I find that this patch is not merged in. Anybody knows why?

Thanks,
Feng

Quoted 68 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Igor Mammedov
Sent: Friday, May 23, 2014 8:04 PM
To: [email protected]
Cc: [email protected]; Chen, Tiejun; [email protected]; [email protected]; [email protected]
Subject: [Qemu-devel] [PATCH] pc: piix4_pm: init legacy PCI hotplug when running on Xen

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would
cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property,
just use the fact that xen doesn't use QEMU's
fw_cfg/acpi tables to switch piix4_pm into legacy
PCI hotplug mode when Xen is enabled.

---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +3 -0
index 227ea30..12542c3 100644
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn,
 uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c +0 -12
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
--

1.9.0

#3 lore raw

Feng, thanks for the email.

I was assuming that one of the other maintainers would take care of the patch, but I am happy to submit a pull request for it too.

Paolo, Michael?

Quoted 74 lines · Feng

I still see this error in the latest QEMU. I find that this patch is not merged in. Anybody knows why?

Thanks,
Feng

Quoted 68 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Igor Mammedov
Sent: Friday, May 23, 2014 8:04 PM
To: [email protected]
Cc: [email protected]; Chen, Tiejun; [email protected]; [email protected]; [email protected]
Subject: [Qemu-devel] [PATCH] pc: piix4_pm: init legacy PCI hotplug when running on Xen

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would
cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property,
just use the fact that xen doesn't use QEMU's
fw_cfg/acpi tables to switch piix4_pm into legacy
PCI hotplug mode when Xen is enabled.

---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +3 -0
index 227ea30..12542c3 100644
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn,
 uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c +0 -12
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
--

1.9.0

#4 lore raw
Quoted 6 lines · Stefano Stabellini

Feng, thanks for the email.

I was assuming that one of the other maintainers would take care of the patch, but I am happy to submit a pull request for it too.

Paolo, Michael?

I think this patch is not okay, because Xen does use fw_cfg when you have -kernel. So I think you should really use "if (xen_enabled())".

Paolo

Quoted 41 lines
Quoted 41 lines
Quoted 40 lines
hw/acpi/piix4.c +3 -0
index 227ea30..12542c3 100644
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn,
 uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c +0 -12
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
--

1.9.0

#5 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines · Stefano Stabellini

Feng, thanks for the email.

I was assuming that one of the other maintainers would take care of the patch, but I am happy to submit a pull request for it too.

Paolo, Michael?

I think this patch is not okay, because Xen does use fw_cfg when you have -kernel. So I think you should really use "if (xen_enabled())".

Well spotted! The original patch was submitted before we introduced -kernel to hvm guests.

If (xen_enabled()) would work.

Quoted 42 lines
Quoted 41 lines
Quoted 41 lines
Quoted 40 lines
hw/acpi/piix4.c +3 -0
index 227ea30..12542c3 100644
@@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn,
 uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c +0 -12
index a13e8d6..067ff0c 100644
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif
 
--

1.9.0

#6 lore raw
In reply to Igor Mammedov

Igor Mammedov wrote on 2014-05-23:

Quoted 8 lines

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property, just use the fact that xen doesn't use QEMU's fw_cfg/acpi tables to switch piix4_pm into legacy PCI hotplug mode when Xen is enabled.

I am wondering why Xen cannot use new mechanism to do the hotplug.

Quoted 26 lines
---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c index 227ea30..12542c3 renamed from hw/acpi/piix4.c +0 -0

100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,

     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
hw/acpi/piix4.c index 227ea30..12542c3 renamed from hw/acpi/piix4.c +3 -0
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -0

a13e8d6..067ff0c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c

hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -3
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.

hw/i386/pc_piix.c index static QEMUMachine xenfv_machine = { · line 844

Quoted 10 lines
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -8
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif

Best regards,
Yang

#7 lore raw
Quoted 11 lines · Yang Z

Igor Mammedov wrote on 2014-05-23:

Quoted 8 lines

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property, just use the fact that xen doesn't use QEMU's fw_cfg/acpi tables to switch piix4_pm into legacy PCI hotplug mode when Xen is enabled.

I am wondering why Xen cannot use new mechanism to do the hotplug.

If I recall correctly the new mechanism is based on fw_cfg, right? Xen doesn't have fw_cfg and it uses a different set of ACPI table, built by one additional piece of firmware call "hvmloader" that KVM or QEMU don't use.

Quoted 40 lines
Quoted 25 lines
---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-)
hw/acpi/piix4.c index 227ea30..12542c3 renamed from hw/acpi/piix4.c +0 -0

100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -501,6 +501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,

     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
hw/acpi/piix4.c index 227ea30..12542c3 renamed from hw/acpi/piix4.c +3 -0
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -0

a13e8d6..067ff0c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c

hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -3
@@ -840,17 +840,6 @@ static QEMUMachine xenfv_machine = {
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
     .hot_add_cpu = pc_hot_add_cpu,
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.

hw/i386/pc_piix.c index static QEMUMachine xenfv_machine = { · line 844

Quoted 10 lines
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -8
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif

Best regards,
Yang

#8 lore raw

Stefano Stabellini wrote on 2014-11-10:

Quoted 11 lines · Yang Z
Quoted 10 lines

Igor Mammedov wrote on 2014-05-23:

Quoted 8 lines

if user starts QEMU with "-machine pc,accel=xen", then compat property in xenfv won't work and it would cause error:
"Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set" when PCI device is added with -device on QEMU CLI.

In case of Xen instead of using compat property, just use the fact that xen doesn't use QEMU's fw_cfg/acpi tables to switch piix4_pm into legacy PCI hotplug mode when Xen is enabled.

Quoted 5 lines
Quoted 1 line

I am wondering why Xen cannot use new mechanism to do the hotplug.

If I recall correctly the new mechanism is based on fw_cfg, right?
Xen doesn't have fw_cfg and it uses a different set of ACPI table,
built by one additional piece of firmware call "hvmloader" that KVM or QEMU don't use.

Right. I forget that ACPI is built by hvmloader in Xen. :)

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
---
 hw/acpi/piix4.c   |  3 +++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 3 insertions(+), 11 deletions(-) diff --git
a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 227ea30..12542c3
100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -501,6
+501,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
     s->irq = sci_irq;
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
hw/acpi/piix4.c +3 -0
+    if (!fw_cfg) {
+        s->use_acpi_pci_hotplug = false;
+    }
Quoted 26 lines
Quoted 4 lines
Quoted 4 lines
     qdev_init_nofail(dev);
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -0

a13e8d6..067ff0c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -840,17 +840,6 @@ static QEMUMachine

xenfv_machine = {

Quoted 21 lines
Quoted 6 lines

.max_cpus = HVM_MAX_VCPUS,
.default_machine_opts = "accel=xen",
.hot_add_cpu = pc_hot_add_cpu,

hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -3
-    .compat_props = (GlobalProperty[]) {
-        /* xenfv has no fwcfg and so does not load acpi from QEMU.
-         * as such new acpi features don't work.

hw/i386/pc_piix.c index

Quoted 10 lines
hw/i386/pc_piix.c index renamed from hw/i386/pc_piix.c +0 -8
-         */
-        {
-            .driver   = "PIIX4_PM",
-            .property = "acpi-pci-hotplug-with-bridge-support",
-            .value    = "off",
-        },
-        { /* end of list */ }
-    },
 };
 #endif

Best regards,
Yang

Best regards,
Yang