From 2edd19dfc6c8773e56ac843140ba2955978adde8 Mon Sep 17 00:00:00 2001
From: Laurent Vivier <lvivier@redhat.com>
Date: Thu, 25 Jun 2015 13:44:37 +0200
Subject: [PATCH 012/100] spapr_pci: add dynamic-reconfiguration option for
 spapr-pci-host-bridge

Message-id: <1435239881-28541-11-git-send-email-lvivier@redhat.com>
Patchwork-id: 66492
O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH 10/14] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge
Bugzilla: 1172478
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>

From: Michael Roth <mdroth@linux.vnet.ibm.com>

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.4.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: move commas for compat fields]
Signed-off-by: Alexander Graf <agraf@suse.de>

(cherry picked from commit 7619c7b00c90a39243f1229facde8c53a8fba921)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

Conflicts:
	hw/ppc/spapr.c
conflict with missing SPAPR_COMPAT_2_3 definition, useless as we use
pseries-rhel7.2.0 machine and no other one is defined.
    38ff32c spapr: define SPAPR_COMPAT_2_3

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/ppc/spapr_pci.c          | 2 ++
 include/hw/pci-host/spapr.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 05f4fac..8b76017 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -936,6 +936,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 895d273..34ee4e0 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -71,6 +71,7 @@ struct sPAPRPHBState {
     uint32_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;
-- 
1.8.3.1

