Skip to contentSkip to conversation

hw/pci: disable pci-bridge's shpc by default

PATCH Superseded Marcel Apfelbaum 7 participants 22 messages Nov 2, 2016 – Jan 10, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pci: disable pci-bridge's shpc by default

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
Signature · 1 line
2.5.5
#1 lore raw
Quoted 5 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

From libvirt's POV, changing qemu's default for shpc in qemu only serves to confuse; since we have no way to discover what is the default setting (especially problematic since it is different for different machinetype versions), we now either need to keep a table of what the setting is for various machinetypes, or we need to just always set it whether it's on or off.

So for us, the simplest thing is for the default to remain the same (since for so long we haven't set this option as we didn't even know what it did, or indeed even that it existed), and for libvirt to learn about the option, make its default in the config files "on", but begin setting it to "off" in all newly defined machines.

(The change to the default for virtio devices' disable-legacy depending on where the device was connected could also have been problematic, except that the change in default value of that has no direct consequences on the rest of the configuration - libvirt will still use the controllers in exactly the same way, and the same commandlines for the same machinetype/versions will still result in identical behavior (so it's not possible for libvirt to know whether or not IO is enabled for the virtio device, nor to know what is the device's . In the case of pci-bridge's shpc though, the whole point of disabling shpc is to make another slot available for libvirt to use for a device, so presumably the config *beyond the pci-bridge device* needs to change as a result of this change in default setting, so libvirt needs to know the setting and behave differently.)

Quoted 36 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
#6 lore raw
In reply to Marcel Apfelbaum
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

at the cost of breaking all hotplug for all non-acpi users.

Quoted 4 lines

and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Is an extra slot such a big deal? You can always add more bridges ...

Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
Signature · 1 line
2.5.5
#7 lore raw
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Do we have a non-acpi user that is able to use the shpc component as-is today? I remember we need to even tweak QEMU before it can be used, but I might be wrong.

And we don't touch the current machines < 2.8 .

Quoted 7 lines
Quoted 4 lines

and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Is an extra slot such a big deal? You can always add more bridges ...

It is not only about the slot itself, but more about the usage model. The PCIe Upstream ports/DMI-PCI devices are also pci-bridges, but for them slot 0 is allowed.
And what about the hotplug? Slot 0 is not usable at boot, but then is usable again (for ACPI users) making people wondering:
https://bugzilla.redhat.com/show_bug.cgi?id=1175113

My point is - can shpc be used as-is today? Even so, I suspect there are much (much) less users using SHPC than ACPI based hotplug. If this is the case, why bother the majority of the users? And for the shpc users, they can keep the prev machines or change the command line, I think changes like this happens over the time.

Adding Markus for his opinion on command line changes.

Thanks,
Marcel

Quoted 35 lines
Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -1
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
--

2.5.5

#2 lore raw
In reply to Laine Stump
Quoted 7 lines · Laine Stump
Quoted 5 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Quoted 6 lines

From libvirt's POV, changing qemu's default for shpc in qemu only serves to confuse; since we have no way to discover what is the default setting (especially problematic since it is different for different machinetype versions), we now either need to keep a table of what the setting is for various machinetypes, or we need to just always set it whether it's on or off.

So for us, the simplest thing is for the default to remain the same (since for so long we haven't set this option as we didn't even know what it did, or indeed even that it existed), and for libvirt to learn about the option, make its default in the config files "on", but begin setting it to "off" in all newly defined machines.

Hi Laine,

Please see my reply to Michael regarding the "why", anyway, can't libvirt deal with it? Start use the shpc parameter no matter what QEMU does by default while keeping it 'on' for machines < 2.8. (this is only a suggestion, of course...)

Thanks,
Marcel

Quoted 43 lines

(The change to the default for virtio devices' disable-legacy depending on where the device was connected could also have been problematic, except that the change in default value of that has no direct consequences on the rest of the configuration - libvirt will still use the controllers in exactly the same way, and the same commandlines for the same machinetype/versions will still result in identical behavior (so it's not possible for libvirt to know whether or not IO is enabled for the virtio device, nor to know what is the device's . In the case of pci-bridge's shpc though, the whole point of disabling shpc is to make another slot available for libvirt to use for a device, so presumably the config *beyond the pci-bridge device* needs to change as a result of this change in default setting, so libvirt needs to know the setting and behave differently.)

Quoted 36 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
#3 lore raw
Quoted 22 lines · Marcel Apfelbaum
Quoted 14 lines · Laine Stump
Quoted 5 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

From libvirt's POV, changing qemu's default for shpc in qemu only serves to confuse; since we have no way to discover what is the default setting (especially problematic since it is different for different machinetype versions), we now either need to keep a table of what the setting is for various machinetypes, or we need to just always set it whether it's on or off.

Quoted 6 lines

So for us, the simplest thing is for the default to remain the same (since for so long we haven't set this option as we didn't even know what it did, or indeed even that it existed), and for libvirt to learn about the option, make its default in the config files "on", but begin setting it to "off" in all newly defined machines.

Quoted 7 lines

Hi Laine,

Please see my reply to Michael regarding the "why", anyway, can't libvirt deal with it?
Start use the shpc parameter no matter what QEMU does by default while keeping it 'on' for machines < 2.8.
(this is only a suggestion, of course...)

We greatly dislike coding in behavior changes to libvirt based on machinetype/version or qemu version since a version number is a very broad and inaccurate sword. The best behavior changes are those that can be discovered by querying something specific to that behavior, which can't be done in this case, as there is no way to query *anything* specific to a machinetype without instantiating a virtual machine of that machinetype (if it's even queryable then, which is anyway irrelevant to libvirt, since our queries to qemu are done with -machine none).

libvirt can of course deal with such a change in default behavior by qemu, but the way it will deal with it is by removing all assumptions about the default of shpc from the code, and replacing those assumptions with explicit setting of the option in the xml and on the qemu command line all the time.

In the end, libvirt wouldn't gain anything from this change in qemu's default behavior - it would be more work than just adding a setting for shpc to libvirt and having *libvirt* change its default setting (which has the same ultimate results). Of course that's a relatively selfish (libvirt-centric) view, and I suppose direct users of the qemu commandline might get some benefit from changing the qemu default, but anyone concerned enough about the exact commandline contents to be running qemu directly would probably also not have a problem adding an option to the commandline if they really wanted a 1/32 increase in the number of available slots.

Quoted 58 lines

Thanks,
Marcel

Quoted 52 lines

(The change to the default for virtio devices' disable-legacy depending on where the device was connected could also have been problematic, except that the change in default value of that has no direct consequences on the rest of the configuration - libvirt will still use the controllers in exactly the same way, and the same commandlines for the same machinetype/versions will still result in identical behavior (so it's not possible for libvirt to know whether or not IO is enabled for the virtio device, nor to know what is the device's . In the case of pci-bridge's shpc though, the whole point of disabling shpc is to make another slot available for libvirt to use for a device, so presumably the config *beyond the pci-bridge device* needs to change as a result of this change in default setting, so libvirt needs to know the setting and behave differently.)

Quoted 37 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
#4 lore raw
Quoted 32 lines · Laine Stump
Quoted 22 lines · Marcel Apfelbaum
Quoted 14 lines · Laine Stump
Quoted 5 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

From libvirt's POV, changing qemu's default for shpc in qemu only serves to confuse; since we have no way to discover what is the default setting (especially problematic since it is different for different machinetype versions), we now either need to keep a table of what the setting is for various machinetypes, or we need to just always set it whether it's on or off.

Quoted 6 lines

So for us, the simplest thing is for the default to remain the same (since for so long we haven't set this option as we didn't even know what it did, or indeed even that it existed), and for libvirt to learn about the option, make its default in the config files "on", but begin setting it to "off" in all newly defined machines.

Quoted 7 lines

Hi Laine,

Please see my reply to Michael regarding the "why", anyway, can't libvirt deal with it?
Start use the shpc parameter no matter what QEMU does by default while keeping it 'on' for machines < 2.8.
(this is only a suggestion, of course...)

Quoted 4 lines

We greatly dislike coding in behavior changes to libvirt based on machinetype/version or qemu version since a version number is a very broad and inaccurate sword. The best behavior changes are those that can be discovered by querying something specific to that behavior, which can't be done in this case, as there is no way to query *anything* specific to a machinetype without instantiating a virtual machine of that machinetype (if it's even queryable then, which is anyway irrelevant to libvirt, since our queries to qemu are done with -machine none).

+Eduardo

Hi Eduardo,
Can your work can help on this specific case?

Quoted 8 lines

libvirt can of course deal with such a change in default behavior by qemu, but the way it will deal with it is by removing all assumptions about the default of shpc from the code, and replacing those assumptions with explicit setting of the option in the xml and on the qemu command line all the time.

In the end, libvirt wouldn't gain anything from this change in qemu's default behavior - it would be more work than just adding a setting for shpc to libvirt and having *libvirt* change its default setting (which has the same ultimate results). Of course that's a relatively selfish (libvirt-centric) view, and I suppose direct users of the qemu commandline might get some benefit from changing the qemu default, but anyone concerned enough about the exact commandline contents to be running qemu directly would probably also not have a problem adding an option to the commandline if they really wanted a 1/32 increase in the number of available slots.

As I explained to Michael, this is not only about the extra slot, but more about the usage model.
I do understand the libvirt point of view, on the other hand why should we use a default QEMU value that the majority of users don't need?

Thanks,
Marcel

Quoted 60 lines
Quoted 59 lines

Thanks,
Marcel

Quoted 52 lines

(The change to the default for virtio devices' disable-legacy depending on where the device was connected could also have been problematic, except that the change in default value of that has no direct consequences on the rest of the configuration - libvirt will still use the controllers in exactly the same way, and the same commandlines for the same machinetype/versions will still result in identical behavior (so it's not possible for libvirt to know whether or not IO is enabled for the virtio device, nor to know what is the device's . In the case of pci-bridge's shpc though, the whole point of disabling shpc is to make another slot available for libvirt to use for a device, so presumably the config *beyond the pci-bridge device* needs to change as a result of this change in default setting, so libvirt needs to know the setting and behave differently.)

Quoted 37 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
#5 lore raw
Quoted 45 lines · Marcel Apfelbaum
Quoted 32 lines · Laine Stump
Quoted 22 lines · Marcel Apfelbaum
Quoted 14 lines · Laine Stump
Quoted 5 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

From libvirt's POV, changing qemu's default for shpc in qemu only serves to confuse; since we have no way to discover what is the default setting (especially problematic since it is different for different machinetype versions), we now either need to keep a table of what the setting is for various machinetypes, or we need to just always set it whether it's on or off.

Quoted 6 lines

So for us, the simplest thing is for the default to remain the same (since for so long we haven't set this option as we didn't even know what it did, or indeed even that it existed), and for libvirt to learn about the option, make its default in the config files "on", but begin setting it to "off" in all newly defined machines.

Quoted 7 lines

Hi Laine,

Please see my reply to Michael regarding the "why", anyway, can't libvirt deal with it?
Start use the shpc parameter no matter what QEMU does by default while keeping it 'on' for machines < 2.8.
(this is only a suggestion, of course...)

Quoted 11 lines

We greatly dislike coding in behavior changes to libvirt based on machinetype/version or qemu version since a version number is a very broad and inaccurate sword. The best behavior changes are those that can be discovered by querying something specific to that behavior, which can't be done in this case, as there is no way to query *anything* specific to a machinetype without instantiating a virtual machine of that machinetype (if it's even queryable then, which is anyway irrelevant to libvirt, since our queries to qemu are done with -machine none).

Quoted 4 lines

+Eduardo

Hi Eduardo,
Can your work can help on this specific case?

In this cases, the needed mechanisms already exist. We just need to encode that info in the MachineInfo struct, so that it gets returned by the "query-machines" QMP command. (But making QEMU maintainers agree on how to encode stuff in QMP is always a challenge.)

Quoted 11 lines
Quoted 10 lines

libvirt can of course deal with such a change in default behavior by qemu, but the way it will deal with it is by removing all assumptions about the default of shpc from the code, and replacing those assumptions with explicit setting of the option in the xml and on the qemu command line all the time.

In the end, libvirt wouldn't gain anything from this change in qemu's default behavior - it would be more work than just adding a setting for shpc to libvirt and having *libvirt* change its default setting (which has the same ultimate results). Of course that's a relatively selfish (libvirt-centric) view, and I suppose direct users of the qemu commandline might get some benefit from changing the qemu default, but anyone concerned enough about the exact commandline contents to be running qemu directly would probably also not have a problem adding an option to the commandline if they really wanted a 1/32 increase in the number of available slots.

Quoted 4 lines

As I explained to Michael, this is not only about the extra slot, but more about the usage model.
I do understand the libvirt point of view, on the other hand why should we use a default QEMU value that the majority of users don't need?

This is a common problem: sometimes we want to make the default behavior saner on new machine-types, but changing the default behavior often doesn't help libvirt (and makes life more difficult for everybody).

I hope this will become easier over time, once we start making machine-type info easily discoverable by libvirt.

Signature · 1 line
Eduardo
#8 lore raw
In reply to Marcel Apfelbaum
Quoted 6 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Quoted 7 lines

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Quoted 7 lines

I remember we need to even tweak QEMU before it can be used, but I might be wrong.

And we don't touch the current machines < 2.8 .

Quoted 3 lines
Quoted 3 lines

and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is an extra slot such a big deal? You can always add more bridges ...

It is not only about the slot itself, but more about the usage model. The PCIe Upstream ports/DMI-PCI devices are also pci-bridges, but for them slot 0 is allowed.

The reason is that these devices are not themselves hotpluggable. Isn't there a flag that allows adding
a non hotpluggable device? Allowing these would be one solution.

Quoted 3 lines

And what about the hotplug? Slot 0 is not usable at boot, but then is usable again (for ACPI users) making people wondering:
https://bugzilla.redhat.com/show_bug.cgi?id=1175113

Let's just disallow that then for consistency?

Quoted 44 lines

My point is - can shpc be used as-is today? Even so, I suspect there are much (much) less users using SHPC than ACPI based hotplug. If this is the case, why bother the majority of the users? And for the shpc users, they can keep the prev machines or change the command line, I think changes like this happens over the time.

Adding Markus for his opinion on command line changes.

Thanks,
Marcel

Quoted 35 lines
Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -1
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
--

2.5.5

#9 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

at the cost of breaking all hotplug for all non-acpi users.

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Anybody else can help answering this?

Quoted 20 lines
Quoted 7 lines

I remember we need to even tweak QEMU before it can be used, but I might be wrong.

And we don't touch the current machines < 2.8 .

Quoted 3 lines
Quoted 3 lines

and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is an extra slot such a big deal? You can always add more bridges ...

It is not only about the slot itself, but more about the usage model. The PCIe Upstream ports/DMI-PCI devices are also pci-bridges, but for them slot 0 is allowed.

The reason is that these devices are not themselves hotpluggable. Isn't there a flag that allows adding
a non hotpluggable device? Allowing these would be one solution.

Quoted 6 lines
Quoted 3 lines

And what about the hotplug? Slot 0 is not usable at boot, but then is usable again (for ACPI users) making people wondering:
https://bugzilla.redhat.com/show_bug.cgi?id=1175113

Let's just disallow that then for consistency?

I suppose we can do that... not sure if it worth it.

Thanks,
Marcel

Quoted 45 lines
Quoted 45 lines

My point is - can shpc be used as-is today? Even so, I suspect there are much (much) less users using SHPC than ACPI based hotplug. If this is the case, why bother the majority of the users? And for the shpc users, they can keep the prev machines or change the command line, I think changes like this happens over the time.

Adding Markus for his opinion on command line changes.

Thanks,
Marcel

Quoted 35 lines
Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -1
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
--

2.5.5

#10 lore raw
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Thanks,
drew

Quoted 82 lines

Anybody else can help answering this?

Quoted 20 lines
Quoted 7 lines

I remember we need to even tweak QEMU before it can be used, but I might be wrong.

And we don't touch the current machines < 2.8 .

Quoted 3 lines
Quoted 3 lines

and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is an extra slot such a big deal? You can always add more bridges ...

It is not only about the slot itself, but more about the usage model. The PCIe Upstream ports/DMI-PCI devices are also pci-bridges, but for them slot 0 is allowed.

The reason is that these devices are not themselves hotpluggable. Isn't there a flag that allows adding
a non hotpluggable device? Allowing these would be one solution.

Quoted 6 lines
Quoted 3 lines

And what about the hotplug? Slot 0 is not usable at boot, but then is usable again (for ACPI users) making people wondering:
https://bugzilla.redhat.com/show_bug.cgi?id=1175113

Let's just disallow that then for consistency?

I suppose we can do that... not sure if it worth it.

Thanks,
Marcel

Quoted 45 lines
Quoted 45 lines

My point is - can shpc be used as-is today? Even so, I suspect there are much (much) less users using SHPC than ACPI based hotplug. If this is the case, why bother the majority of the users? And for the shpc users, they can keep the prev machines or change the command line, I think changes like this happens over the time.

Adding Markus for his opinion on command line changes.

Thanks,
Marcel

Quoted 35 lines
Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -1
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
--

2.5.5

#11 lore raw
Quoted 22 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 8 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio' with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

BTW, will an ARM guest run 'fast' enough to be usable on a x86 machine? If yes, any pointers on how to create such a guest?

Thanks,
Marcel

Quoted 3 lines

Thanks,
drew

[...]

#12 lore raw
Quoted 35 lines · Marcel Apfelbaum
Quoted 22 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 8 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 7 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio' with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 4 lines

BTW, will an ARM guest run 'fast' enough to be usable on a x86 machine? If yes, any pointers on how to create such a guest?

You can run AArch64 guests on x86 machines. It's not super fast though... Certainly I wouldn't want to create my guest image using TCG. So, assuming you acquire an image somewhere (or create it on a real machine), then you can use the above command line, just change

ACCEL=kvm CPU=host to ACCEL=tcg CPU=cortex-a57

Thanks,
drew

#13 lore raw
Quoted 88 lines · Andrew Jones
Quoted 35 lines · Marcel Apfelbaum
Quoted 22 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 8 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 7 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio' with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 4 lines

BTW, will an ARM guest run 'fast' enough to be usable on a x86 machine? If yes, any pointers on how to create such a guest?

You can run AArch64 guests on x86 machines. It's not super fast though... Certainly I wouldn't want to create my guest image using TCG. So, assuming you acquire an image somewhere (or create it on a real machine), then you can use the above command line, just change

Quoted 4 lines

ACCEL=kvm CPU=host to ACCEL=tcg CPU=cortex-a57

Thanks,
drew

http://wiki.qemu.org/Testing/System_Images

has some images.
If you have a better one to contribute, upload it there.

Signature · 1 line
MST
#14 lore raw
In reply to Andrew Jones
Quoted 70 lines · Andrew Jones
Quoted 35 lines · Marcel Apfelbaum
Quoted 22 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 8 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 7 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio' with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

Your help would be very much appreciated.

Thanks,
Marcel

Quoted 15 lines
Quoted 4 lines

BTW, will an ARM guest run 'fast' enough to be usable on a x86 machine? If yes, any pointers on how to create such a guest?

You can run AArch64 guests on x86 machines. It's not super fast though... Certainly I wouldn't want to create my guest image using TCG. So, assuming you acquire an image somewhere (or create it on a real machine), then you can use the above command line, just change

ACCEL=kvm CPU=host to ACCEL=tcg CPU=cortex-a57

Thanks,
drew

#20 lore raw
In reply to Andrew Jones
Quoted 70 lines · Andrew Jones
Quoted 35 lines · Marcel Apfelbaum
Quoted 22 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 8 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy to help with an experiment though. Can you give me command line arguments, qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 7 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio' with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 7 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Yes - I just realized people seem to disable CONFIG_HOTPLUG_PCI_SHPC there. I don't know why really - want to try rebuilding the kernel and seeing if there's any change?

Quoted 14 lines
Quoted 4 lines

BTW, will an ARM guest run 'fast' enough to be usable on a x86 machine? If yes, any pointers on how to create such a guest?

You can run AArch64 guests on x86 machines. It's not super fast though... Certainly I wouldn't want to create my guest image using TCG. So, assuming you acquire an image somewhere (or create it on a real machine), then you can use the above command line, just change

ACCEL=kvm CPU=host to ACCEL=tcg CPU=cortex-a57

Thanks,
drew

#15 lore raw
In reply to Marcel Apfelbaum
Quoted 84 lines · Marcel Apfelbaum
Quoted 74 lines · Andrew Jones
Quoted 38 lines · Marcel Apfelbaum
Quoted 23 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 10 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy
to help with an experiment though. Can you give me command line arguments,
qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 8 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio'
with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 8 lines

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

With this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Bus 'bridge1' does not support hotplugging
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
Bus 'bridge1' does not support hotplugging

Without this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Unsupported PCI slot 0 for standard hotplug controller. Valid slots are
between 1 and 31.
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
(qemu) [   37.342908] shpchp 0000:00:00.0: Latch close on Slot(3)
[   37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   37.343003] shpchp 0000:00:00.0: Card present on Slot(3)
[   37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   43.361827] shpchp 0000:00:00.0: No new device found
[   43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03
[   43.363277] shpchp 0000:00:00.0: Latch open on Slot(3)
[   43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   43.363360] shpchp 0000:00:00.0: Card not present on Slot(3)
[   43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   48.371835] shpchp 0000:00:00.0: No adapter on slot(3)

Laurent

#16 lore raw
Quoted 109 lines · Laurent Vivier
Quoted 84 lines · Marcel Apfelbaum
Quoted 74 lines · Andrew Jones
Quoted 38 lines · Marcel Apfelbaum
Quoted 23 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 10 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy
to help with an experiment though. Can you give me command line arguments,
qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 8 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio'
with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 8 lines

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

With this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Bus 'bridge1' does not support hotplugging
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
Bus 'bridge1' does not support hotplugging

Without this patch:

Quoted 14 lines
# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Unsupported PCI slot 0 for standard hotplug controller. Valid slots are
between 1 and 31.
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
(qemu) [   37.342908] shpchp 0000:00:00.0: Latch close on Slot(3)
[   37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   37.343003] shpchp 0000:00:00.0: Card present on Slot(3)
[   37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   43.361827] shpchp 0000:00:00.0: No new device found

Hi Laurrent,
Thank you for the fast reply!

What I see from the log is that ppc does use the shpc for hotplug, but there is some implementation bug preventing it to work.

Drew, may I trouble one last time for the dmesg?
I think we would see exactly the same log.

Thanks,
Marcel

Quoted 10 lines
[   43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03
[   43.363277] shpchp 0000:00:00.0: Latch open on Slot(3)
[   43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   43.363360] shpchp 0000:00:00.0: Card not present on Slot(3)
[   43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   48.371835] shpchp 0000:00:00.0: No adapter on slot(3)

Laurent

#17 lore raw
Quoted 126 lines · Marcel Apfelbaum
Quoted 109 lines · Laurent Vivier
Quoted 84 lines · Marcel Apfelbaum
Quoted 74 lines · Andrew Jones
Quoted 38 lines · Marcel Apfelbaum
Quoted 23 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 10 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy
to help with an experiment though. Can you give me command line arguments,
qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 8 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio'
with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 8 lines

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

With this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Bus 'bridge1' does not support hotplugging
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
Bus 'bridge1' does not support hotplugging

Without this patch:

Quoted 14 lines
# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Unsupported PCI slot 0 for standard hotplug controller. Valid slots are
between 1 and 31.
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
(qemu) [   37.342908] shpchp 0000:00:00.0: Latch close on Slot(3)
[   37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   37.343003] shpchp 0000:00:00.0: Card present on Slot(3)
[   37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   43.361827] shpchp 0000:00:00.0: No new device found
Quoted 5 lines

Hi Laurrent,
Thank you for the fast reply!

What I see from the log is that ppc does use the shpc for hotplug, but there is some implementation bug preventing it to work.

That doesn't sound right. ppc, or more correctly the pseries machine type, has it's own hotplug notification mechanism. If we're trying to invoke shpc, I think something is wrong.

Quoted 18 lines

Drew, may I trouble one last time for the dmesg?
I think we would see exactly the same log.

Thanks,
Marcel

Quoted 10 lines
[   43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03
[   43.363277] shpchp 0000:00:00.0: Latch open on Slot(3)
[   43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   43.363360] shpchp 0000:00:00.0: Card not present on Slot(3)
[   43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   48.371835] shpchp 0000:00:00.0: No adapter on slot(3)

Laurent

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#18 lore raw
Quoted 130 lines · David Gibson
Quoted 129 lines · Marcel Apfelbaum
Quoted 109 lines · Laurent Vivier
Quoted 84 lines · Marcel Apfelbaum
Quoted 74 lines · Andrew Jones
Quoted 38 lines · Marcel Apfelbaum
Quoted 23 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 10 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy
to help with an experiment though. Can you give me command line arguments,
qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 8 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio'
with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 8 lines

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

With this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Bus 'bridge1' does not support hotplugging
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
Bus 'bridge1' does not support hotplugging

Without this patch:

Quoted 14 lines
# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Unsupported PCI slot 0 for standard hotplug controller. Valid slots are
between 1 and 31.
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
(qemu) [   37.342908] shpchp 0000:00:00.0: Latch close on Slot(3)
[   37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   37.343003] shpchp 0000:00:00.0: Card present on Slot(3)
[   37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   43.361827] shpchp 0000:00:00.0: No new device found

Hi Laurrent,
Thank you for the fast reply!

Quoted 7 lines
Quoted 2 lines

What I see from the log is that ppc does use the shpc for hotplug, but there is some implementation bug preventing it to work.

That doesn't sound right. ppc, or more correctly the pseries machine type, has it's own hotplug notification mechanism. If we're trying to invoke shpc, I think something is wrong.

Hi David,

As you can see the shpc driver claims the pci-bridge slots and it responds to the hot-plug events.

Anyway, what is the hotplug mechanism preferred by the pseries machine ?

Side note: what we want to understand is if using pci-bridges's shpc by default would help non x86 archs (since QEMU x86 machine uses ACPI based hot-plug).

Thanks,
Marcel

Quoted 19 lines
Quoted 18 lines

Drew, may I trouble one last time for the dmesg?
I think we would see exactly the same log.

Thanks,
Marcel

Quoted 10 lines
[   43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03
[   43.363277] shpchp 0000:00:00.0: Latch open on Slot(3)
[   43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   43.363360] shpchp 0000:00:00.0: Card not present on Slot(3)
[   43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   48.371835] shpchp 0000:00:00.0: No adapter on slot(3)

Laurent

#19 lore raw
Quoted 139 lines · Marcel Apfelbaum
Quoted 130 lines · David Gibson
Quoted 129 lines · Marcel Apfelbaum
Quoted 109 lines · Laurent Vivier
Quoted 84 lines · Marcel Apfelbaum
Quoted 74 lines · Andrew Jones
Quoted 38 lines · Marcel Apfelbaum
Quoted 23 lines · Andrew Jones
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Marcel Apfelbaum
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used
for hot-plugging PCI devices into a PCI-PCI bridge.
Disabling the shpc by default will make slot 0 usable at boot time

Hi Michael

Quoted 3 lines

at the cost of breaking all hotplug for all non-acpi users.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Do we have a non-acpi user that is able to use the shpc component as-is today?

power and some arm systems I guess?

Adding Andrew , maybe he can give us an answer.

Quoted 10 lines

Not really :-) My lack of PCI knowledge makes that difficult. I'd be happy
to help with an experiment though. Can you give me command line arguments,
qmp commands, etc. that I should use to try it out? I imagine I should just boot an ARM guest using DT (instead of ACPI) and then attempt to hotplug a PCI device. I'm not sure, however, what, if any, special configuration I need in order to ensure I'm testing what you're interested in.

Hi Drew,

Quoted 8 lines

Just run QEMU with '-device pci-bridge,chassis_nr=1,id=bridge1 -monitor stdio'
with an ARM guest using DT and wait until the guest finish booting.

Then run at hmp:
device_add virtio-net-pci,bus=bridge1,id=net2

Next run lspci in the guest to see the new device.

Thanks for the instructions Marcel. Here's the results

 $QEMU -machine virt,accel=$ACCEL -cpu $CPU -nographic -m 4096 -smp 8 \
       -bios /usr/share/AAVMF/AAVMF_CODE.fd \
       -device pci-bridge,chassis_nr=1,id=bridge1 \
       -drive file=$FEDORA_IMG,if=none,id=dr0,format=qcow2 \
       -device virtio-blk-pci,bus=bridge1,addr=01,drive=dr0,id=disk0 \
       -netdev user,id=hostnet0 \
       -device virtio-net-pci,bus=bridge1,addr=02,netdev=hostnet0,id=net0
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2 Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.

(Tried again giving addr=03)

(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=03

(Seemed to work, but...)

Quoted 8 lines
 # lspci
 00:00.0 Host bridge: Red Hat, Inc. Device 0008
 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block device
 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device

(Doesn't show up in lscpi. So I guess it doesn't work)

Quoted 8 lines

Hi Drew,
Thanks for confirming that it doesn't work.

Michael asked if we can check the same for powerpc before disabling the shpc by default.

Adding David, Thomas and Laurrent, maybe they have time to check it for powerpc.

With this patch:

# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Bus 'bridge1' does not support hotplugging
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
Bus 'bridge1' does not support hotplugging

Without this patch:

Quoted 14 lines
# lspci
00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
[root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more information
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2
Unsupported PCI slot 0 for standard hotplug controller. Valid slots are
between 1 and 31.
(qemu) device_add virtio-net-pci,bus=bridge1,id=net2,addr=3
(qemu) [   37.342908] shpchp 0000:00:00.0: Latch close on Slot(3)
[   37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   37.343003] shpchp 0000:00:00.0: Card present on Slot(3)
[   37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   43.361827] shpchp 0000:00:00.0: No new device found

Hi Laurrent,
Thank you for the fast reply!

Quoted 7 lines
Quoted 2 lines

What I see from the log is that ppc does use the shpc for hotplug, but there is some implementation bug preventing it to work.

That doesn't sound right. ppc, or more correctly the pseries machine type, has it's own hotplug notification mechanism. If we're trying to invoke shpc, I think something is wrong.

Quoted 4 lines

Hi David,

As you can see the shpc driver claims the pci-bridge slots and it responds to the hot-plug events.

Yeah.. that's a bug of itself. shpc can't work properly on PAPR guests (or even on IBM POWER hardware hosts, for related though not identical reasons).

In addition to PAPR having its own hotplug mechanism, the shpc stuff apparently conflicts with the (also POWER specific) EEH error recovery mechanism.

Quoted 1 line

Anyway, what is the hotplug mechanism preferred by the pseries machine ?

The PAPR specification which defines the firmware and hypervisor interfaces that guests on POWER operate under, has its own hotplug mechanism, using hypervisor events to deliver updated device tree fragments to the guest.

Quoted 3 lines

Side note: what we want to understand is if using pci-bridges's shpc by default would help non x86 archs (since QEMU x86 machine uses ACPI based hot-plug).

Certainly not for pseries or powernv. It might be correct for (some?) embedded ppc machines with PCI-E

Quoted 24 lines

Thanks,
Marcel

Quoted 19 lines
Quoted 18 lines

Drew, may I trouble one last time for the dmesg?
I think we would see exactly the same log.

Thanks,
Marcel

Quoted 10 lines
[   43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03
[   43.363277] shpchp 0000:00:00.0: Latch open on Slot(3)
[   43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3)
[   43.363360] shpchp 0000:00:00.0: Card not present on Slot(3)
[   43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to
button press
[   48.371835] shpchp 0000:00:00.0: No adapter on slot(3)

Laurent

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#21 lore raw
In reply to Marcel Apfelbaum
Quoted 7 lines · Marcel Apfelbaum

The shpc component is optional while ACPI hotplug is used for hot-plugging PCI devices into a PCI-PCI bridge. Disabling the shpc by default will make slot 0 usable at boot time and not only for hot-plug, without loosing any functionality. Older machines will have shpc enabled for compatibility reasons.

Can you pls post a rebase since compat changed?

Quoted 35 lines
---
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 include/hw/compat.h            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/pci-bridge/pci_bridge_dev.c +1 -1
index 5dbd933..647ad80 100644
@@ -163,7 +163,7 @@ static Property pci_bridge_dev_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
                             ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
-                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
+                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/compat.h +4 -0
index 0f06e11..388b7ec 100644
@@ -18,6 +18,10 @@
         .driver   = "intel-iommu",\
         .property = "x-buggy-eim",\
         .value    = "true",\
+    },{\
+        .driver   = "pci-bridge",\
+        .property = "shpc",\
+        .value    = "on",\
     },
 
 #define HW_COMPAT_2_6 \
Signature · 1 line
2.5.5