diff mbox

[for-2.11,16/26] spapr: enable PHB hotplug for pseries-2.11

Message ID 150100568549.27487.11903027800624299907.stgit@bahia
State New
Headers show

Commit Message

Greg Kurz July 25, 2017, 6:01 p.m. UTC
From: Michael Roth <mdroth@linux.vnet.ibm.com>

The 'dr_phb_enabled' field of that class can be set as
part of machine-specific init code, and is then propagated
to sPAPREnvironment to conditionally enable creation of DRC
objects and device-tree description to facilitate hotplug
of PHBs.

Since we can't migrate this state to older machine types,
default the option to true and disable it for older machine
types.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
---
Changes since RFC:
- rebased against ppc-for-2.10
- updated changelog and title
- set default to true and disable for 2.10 and older
---
 hw/ppc/spapr.c         |    6 ++++++
 include/hw/ppc/spapr.h |    3 +++
 2 files changed, 9 insertions(+)

Comments

Alexey Kardashevskiy July 26, 2017, 4:42 a.m. UTC | #1
On 26/07/17 04:01, Greg Kurz wrote:
> From: Michael Roth <mdroth@linux.vnet.ibm.com>
> 
> The 'dr_phb_enabled' field of that class can be set as
> part of machine-specific init code, and is then propagated
> to sPAPREnvironment to conditionally enable creation of DRC
> objects and device-tree description to facilitate hotplug
> of PHBs.
> 
> Since we can't migrate this state to older machine types,
> default the option to true and disable it for older machine
> types.
> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> Changes since RFC:
> - rebased against ppc-for-2.10
> - updated changelog and title
> - set default to true and disable for 2.10 and older
> ---
>  hw/ppc/spapr.c         |    6 ++++++
>  include/hw/ppc/spapr.h |    3 +++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 277daa4f9645..8dc505343c0f 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2382,6 +2382,8 @@ static void ppc_spapr_init(MachineState *machine)
>      /* We always have at least the nvram device on VIO */
>      spapr_create_nvram(spapr);
>  
> +    spapr->dr_phb_enabled = smc->dr_phb_enabled;
> +
>      /* Set up PCI */
>      spapr_pci_rtas_init();
>  
> @@ -3482,6 +3484,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
>       * in which LMBs are represented and hot-added
>       */
>      mc->numa_mem_align_shift = 28;
> +    smc->dr_phb_enabled = true;
>  }
>  
>  static const TypeInfo spapr_machine_info = {
> @@ -3558,8 +3561,11 @@ static void spapr_machine_2_10_instance_options(MachineState *machine)
>  
>  static void spapr_machine_2_10_class_options(MachineClass *mc)
>  {
> +    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
> +
>      spapr_machine_2_11_class_options(mc);
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10);
> +    smc->dr_phb_enabled = false;
>  }
>  
>  DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 2a303a705c17..8004d9c2ab2c 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -59,6 +59,7 @@ struct sPAPRMachineClass {
>  
>      /*< public >*/
>      bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
> +    bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
>      bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
>      const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
>      bool pre_2_10_has_unused_icps;
> @@ -122,6 +123,8 @@ struct sPAPRMachineState {
>       * occurs during the unplug process. */
>      QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs;
>  
> +    bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */

The one in the class seems sufficient unless we are going to allow
disabling this via the command line.



> +
>      /*< public >*/
>      char *kvm_type;
>      MemoryHotplugState hotplug_memory;
> 
>
Greg Kurz July 26, 2017, 2:32 p.m. UTC | #2
On Wed, 26 Jul 2017 14:42:23 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> On 26/07/17 04:01, Greg Kurz wrote:
> > From: Michael Roth <mdroth@linux.vnet.ibm.com>
> > 
> > The 'dr_phb_enabled' field of that class can be set as
> > part of machine-specific init code, and is then propagated
> > to sPAPREnvironment to conditionally enable creation of DRC
> > objects and device-tree description to facilitate hotplug
> > of PHBs.
> > 
> > Since we can't migrate this state to older machine types,
> > default the option to true and disable it for older machine
> > types.
> > 
> > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > Changes since RFC:
> > - rebased against ppc-for-2.10
> > - updated changelog and title
> > - set default to true and disable for 2.10 and older
> > ---
> >  hw/ppc/spapr.c         |    6 ++++++
> >  include/hw/ppc/spapr.h |    3 +++
> >  2 files changed, 9 insertions(+)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 277daa4f9645..8dc505343c0f 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -2382,6 +2382,8 @@ static void ppc_spapr_init(MachineState *machine)
> >      /* We always have at least the nvram device on VIO */
> >      spapr_create_nvram(spapr);
> >  
> > +    spapr->dr_phb_enabled = smc->dr_phb_enabled;
> > +
> >      /* Set up PCI */
> >      spapr_pci_rtas_init();
> >  
> > @@ -3482,6 +3484,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
> >       * in which LMBs are represented and hot-added
> >       */
> >      mc->numa_mem_align_shift = 28;
> > +    smc->dr_phb_enabled = true;
> >  }
> >  
> >  static const TypeInfo spapr_machine_info = {
> > @@ -3558,8 +3561,11 @@ static void spapr_machine_2_10_instance_options(MachineState *machine)
> >  
> >  static void spapr_machine_2_10_class_options(MachineClass *mc)
> >  {
> > +    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
> > +
> >      spapr_machine_2_11_class_options(mc);
> >      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10);
> > +    smc->dr_phb_enabled = false;
> >  }
> >  
> >  DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
> > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> > index 2a303a705c17..8004d9c2ab2c 100644
> > --- a/include/hw/ppc/spapr.h
> > +++ b/include/hw/ppc/spapr.h
> > @@ -59,6 +59,7 @@ struct sPAPRMachineClass {
> >  
> >      /*< public >*/
> >      bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
> > +    bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
> >      bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
> >      const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
> >      bool pre_2_10_has_unused_icps;
> > @@ -122,6 +123,8 @@ struct sPAPRMachineState {
> >       * occurs during the unplug process. */
> >      QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs;
> >  
> > +    bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */  
> 
> The one in the class seems sufficient unless we are going to allow
> disabling this via the command line.
> 

I kept the original patch but you're right indeed. I don't see why
someone would want to disable this from the cmdline, so I guess I
should just drop the per-instance flag.

Mike, any thoughts ?

> 
> 
> > +
> >      /*< public >*/
> >      char *kvm_type;
> >      MemoryHotplugState hotplug_memory;
> > 
> >   
> 
>
Michael Roth July 27, 2017, 3:52 p.m. UTC | #3
Quoting Greg Kurz (2017-07-26 09:32:27)
> On Wed, 26 Jul 2017 14:42:23 +1000
> Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 
> > On 26/07/17 04:01, Greg Kurz wrote:
> > > From: Michael Roth <mdroth@linux.vnet.ibm.com>
> > > 
> > > The 'dr_phb_enabled' field of that class can be set as
> > > part of machine-specific init code, and is then propagated
> > > to sPAPREnvironment to conditionally enable creation of DRC
> > > objects and device-tree description to facilitate hotplug
> > > of PHBs.
> > > 
> > > Since we can't migrate this state to older machine types,
> > > default the option to true and disable it for older machine
> > > types.
> > > 
> > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > ---
> > > Changes since RFC:
> > > - rebased against ppc-for-2.10
> > > - updated changelog and title
> > > - set default to true and disable for 2.10 and older
> > > ---
> > >  hw/ppc/spapr.c         |    6 ++++++
> > >  include/hw/ppc/spapr.h |    3 +++
> > >  2 files changed, 9 insertions(+)
> > > 
> > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > > index 277daa4f9645..8dc505343c0f 100644
> > > --- a/hw/ppc/spapr.c
> > > +++ b/hw/ppc/spapr.c
> > > @@ -2382,6 +2382,8 @@ static void ppc_spapr_init(MachineState *machine)
> > >      /* We always have at least the nvram device on VIO */
> > >      spapr_create_nvram(spapr);
> > >  
> > > +    spapr->dr_phb_enabled = smc->dr_phb_enabled;
> > > +
> > >      /* Set up PCI */
> > >      spapr_pci_rtas_init();
> > >  
> > > @@ -3482,6 +3484,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
> > >       * in which LMBs are represented and hot-added
> > >       */
> > >      mc->numa_mem_align_shift = 28;
> > > +    smc->dr_phb_enabled = true;
> > >  }
> > >  
> > >  static const TypeInfo spapr_machine_info = {
> > > @@ -3558,8 +3561,11 @@ static void spapr_machine_2_10_instance_options(MachineState *machine)
> > >  
> > >  static void spapr_machine_2_10_class_options(MachineClass *mc)
> > >  {
> > > +    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
> > > +
> > >      spapr_machine_2_11_class_options(mc);
> > >      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10);
> > > +    smc->dr_phb_enabled = false;
> > >  }
> > >  
> > >  DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
> > > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> > > index 2a303a705c17..8004d9c2ab2c 100644
> > > --- a/include/hw/ppc/spapr.h
> > > +++ b/include/hw/ppc/spapr.h
> > > @@ -59,6 +59,7 @@ struct sPAPRMachineClass {
> > >  
> > >      /*< public >*/
> > >      bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
> > > +    bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
> > >      bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
> > >      const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
> > >      bool pre_2_10_has_unused_icps;
> > > @@ -122,6 +123,8 @@ struct sPAPRMachineState {
> > >       * occurs during the unplug process. */
> > >      QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs;
> > >  
> > > +    bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */  
> > 
> > The one in the class seems sufficient unless we are going to allow
> > disabling this via the command line.
> > 
> 
> I kept the original patch but you're right indeed. I don't see why
> someone would want to disable this from the cmdline, so I guess I
> should just drop the per-instance flag.
> 
> Mike, any thoughts ?

Not sure why I did it like that originally, and can't think of a good reason
we'd want to disable it specifically either, so I agree we should probably
just drop it.

> 
> > 
> > 
> > > +
> > >      /*< public >*/
> > >      char *kvm_type;
> > >      MemoryHotplugState hotplug_memory;
> > > 
> > >   
> > 
> > 
>
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 277daa4f9645..8dc505343c0f 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2382,6 +2382,8 @@  static void ppc_spapr_init(MachineState *machine)
     /* We always have at least the nvram device on VIO */
     spapr_create_nvram(spapr);
 
+    spapr->dr_phb_enabled = smc->dr_phb_enabled;
+
     /* Set up PCI */
     spapr_pci_rtas_init();
 
@@ -3482,6 +3484,7 @@  static void spapr_machine_class_init(ObjectClass *oc, void *data)
      * in which LMBs are represented and hot-added
      */
     mc->numa_mem_align_shift = 28;
+    smc->dr_phb_enabled = true;
 }
 
 static const TypeInfo spapr_machine_info = {
@@ -3558,8 +3561,11 @@  static void spapr_machine_2_10_instance_options(MachineState *machine)
 
 static void spapr_machine_2_10_class_options(MachineClass *mc)
 {
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
+
     spapr_machine_2_11_class_options(mc);
     SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10);
+    smc->dr_phb_enabled = false;
 }
 
 DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 2a303a705c17..8004d9c2ab2c 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -59,6 +59,7 @@  struct sPAPRMachineClass {
 
     /*< public >*/
     bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
+    bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
     bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
     const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
     bool pre_2_10_has_unused_icps;
@@ -122,6 +123,8 @@  struct sPAPRMachineState {
      * occurs during the unplug process. */
     QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs;
 
+    bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */
+
     /*< public >*/
     char *kvm_type;
     MemoryHotplugState hotplug_memory;