Skip to contentSkip to conversation

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

PATCH Stefano Stabellini 3 participants 6 messages Nov 14, 2014 – Nov 17, 2014 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

I think we should have it in 4.5. What do you think?

- Stefano

Quoted 70 lines · Paolo Bonzini
Quoted 52 lines · Li Liang

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.

[[email protected]: use "xen_enabled()" instead of "!fw_cfg"]
---
 hw/acpi/piix4.c   |  4 ++++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 4 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +4 -0
index 78c0a6d..481a16c 100644
@@ -36,6 +36,7 @@
 #include "hw/mem/pc-dimm.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
+#include "hw/xen/xen.h"
 
 //#define DEBUG
 
@@ -501,6 +502,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 (xen_enabled()) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
 
hw/i386/pc_piix.c +0 -4
index b559181..7bb97a4 100644
@@ -916,17 +916,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 static QEMUMachine xenfv_machine = { · line 921

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

Stefano, are you going to send the pull request yourself?

Paolo

#3 lore raw
Quoted 3 lines · Stefano Stabellini

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

Yes.

Quoted 2 lines

I think we should have it in 4.5. What do you think?

Do you believe we should first get an Tested-by from the Intel QA folks?

Thanks.

Quoted 74 lines

- Stefano

Quoted 70 lines · Paolo Bonzini
Quoted 52 lines · Li Liang

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.

[[email protected]: use "xen_enabled()" instead of "!fw_cfg"]
---
 hw/acpi/piix4.c   |  4 ++++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 4 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +4 -0
index 78c0a6d..481a16c 100644
@@ -36,6 +36,7 @@
 #include "hw/mem/pc-dimm.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
+#include "hw/xen/xen.h"
 
 //#define DEBUG
 
@@ -501,6 +502,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 (xen_enabled()) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
 
hw/i386/pc_piix.c +0 -4
index b559181..7bb97a4 100644
@@ -916,17 +916,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 static QEMUMachine xenfv_machine = { · line 921

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

Stefano, are you going to send the pull request yourself?

Paolo

#4 lore raw
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Stefano Stabellini

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

Yes.

Quoted 2 lines

I think we should have it in 4.5. What do you think?

Do you believe we should first get an Tested-by from the Intel QA folks?

Liang at Intel was the one to fix and resend. Liang, could you please test this patch on qemu-xen on xen-unstable? Thanks!

Quoted 76 lines

Thanks.

Quoted 74 lines

- Stefano

Quoted 70 lines · Paolo Bonzini
Quoted 52 lines · Li Liang

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.

[[email protected]: use "xen_enabled()" instead of "!fw_cfg"]
---
 hw/acpi/piix4.c   |  4 ++++
 hw/i386/pc_piix.c | 11 -----------
 2 files changed, 4 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +4 -0
index 78c0a6d..481a16c 100644
@@ -36,6 +36,7 @@
 #include "hw/mem/pc-dimm.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
+#include "hw/xen/xen.h"
 
 //#define DEBUG
 
@@ -501,6 +502,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 (xen_enabled()) {
+        s->use_acpi_pci_hotplug = false;
+    }
 
     qdev_init_nofail(dev);
 
hw/i386/pc_piix.c +0 -4
index b559181..7bb97a4 100644
@@ -916,17 +916,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 static QEMUMachine xenfv_machine = { · line 921

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

Stefano, are you going to send the pull request yourself?

Paolo

#5 lore raw
Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

Yes.

Quoted 2 lines

I think we should have it in 4.5. What do yo think?

Do you believe we should first get an Tested-by from the Intel QA folks?

Liang at Intel was the one to fix and resend. Liang, could you please test this patch on qemu-xen on xen-unstable? Thanks!

I have verified this patch can fix the bug for QEMU: pci hotplug doesn't work when xen_platform_pci=0, my original intention was to fix this bug, so I resent the patch.

Liang

#6 lore raw
Quoted 6 lines · Liang Z
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

Yes.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I think we should have it in 4.5. What do yo think?

Do you believe we should first get an Tested-by from the Intel QA folks?

Liang at Intel was the one to fix and resend. Liang, could you please test this patch on qemu-xen on xen-unstable? Thanks!

I have verified this patch can fix the bug for QEMU: pci hotplug doesn't work when xen_platform_pci=0, my original intention was to fix this bug, so I resent the patch.

In that case I'll go ahead and backport it to qemu-xen for 4.5.

#7 lore raw
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Liang Z
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Konrad,
this is another bug fix for QEMU: pci hotplug doesn't work when xen_platform_pci=0 without this.

Yes.

Quoted 2 lines

I think we should have it in 4.5. What do yo think?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Do you believe we should first get an Tested-by from the Intel QA folks?

Liang at Intel was the one to fix and resend. Liang, could you please test this patch on qemu-xen on xen-unstable? Thanks!

I have verified this patch can fix the bug for QEMU: pci hotplug doesn't work when xen_platform_pci=0, my original intention was to fix this bug, so I resent the patch.

In that case I'll go ahead and backport it to qemu-xen for 4.5.

Thank you!