diff mbox

[v4,12/17] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge

Message ID 1419337831-16552-13-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Dec. 23, 2014, 12:30 p.m. UTC
This option enables/disables PCI hotplug for a particular PHB.

Also add machine compatibility code to disable it by default for machine
types prior to pseries-2.3.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c              | 21 +++++++++++++++++++++
 hw/ppc/spapr_pci.c          |  2 ++
 include/hw/pci-host/spapr.h |  1 +
 3 files changed, 24 insertions(+)

Comments

David Gibson Jan. 19, 2015, 5:18 a.m. UTC | #1
On Tue, Dec 23, 2014 at 06:30:26AM -0600, Michael Roth wrote:
> This option enables/disables PCI hotplug for a particular PHB.
> 
> Also add machine compatibility code to disable it by default for machine
> types prior to pseries-2.3.
> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9eb0a94..4478fa7 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1752,11 +1752,27 @@  static const TypeInfo spapr_machine_info = {
     },
 };
 
+/* pSeries-specific hardware compatibility properties
+ *
+ * As with PC machines and general hardware properties, older
+ * machine types inherit backward-compability properties needed
+ * for subsequent machine types.
+ */
+#define PPC_HW_COMPAT_2_2 \
+        {\
+            .driver   = "spapr-pci-host-bridge",\
+            .property = "dynamic-reconfiguration",\
+            .value    = "off",\
+        }
+
+#define PPC_HW_COMPAT_2_1 PPC_HW_COMPAT_2_2
+
 static void spapr_machine_2_1_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     static GlobalProperty compat_props[] = {
         HW_COMPAT_2_1,
+        PPC_HW_COMPAT_2_1,
         { /* end of list */ }
     };
 
@@ -1774,9 +1790,14 @@  static const TypeInfo spapr_machine_2_1_info = {
 static void spapr_machine_2_2_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    static GlobalProperty compat_props[] = {
+        PPC_HW_COMPAT_2_2,
+        { /* end of list */ }
+    };
 
     mc->name = "pseries-2.2";
     mc->desc = "pSeries Logical Partition (PAPR compliant) v2.2";
+    mc->compat_props = compat_props;
 }
 
 static const TypeInfo spapr_machine_2_2_info = {
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 21b95b3..4850f9a 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -678,6 +678,8 @@  static Property spapr_phb_properties[] = {
     DEFINE_PROP_UINT64("io_win_addr", sPAPRPHBState, io_win_addr, -1),
     DEFINE_PROP_UINT64("io_win_size", sPAPRPHBState, io_win_size,
                        SPAPR_PCI_IO_WIN_SIZE),
+    DEFINE_PROP_BOOL("dynamic-reconfiguration", sPAPRPHBState, dr_enabled,
+                     true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 4ea2a0d..ba0f3cc 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -67,6 +67,7 @@  struct sPAPRPHBState {
     int32_t index;
     uint64_t buid;
     char *dtbusname;
+    bool dr_enabled;
 
     MemoryRegion memspace, iospace;
     hwaddr mem_win_addr, mem_win_size, io_win_addr, io_win_size;