diff mbox series

[for-2.12,v3,2/3] spapr/rtas: fix reboot of a a SMP TCG guest

Message ID 20171120100347.8601-3-clg@kaod.org
State New
Headers show
Series disable the decrementer interrupt when a CPU is unplugged | expand

Commit Message

Cédric Le Goater Nov. 20, 2017, 10:03 a.m. UTC
Just like for hot unplug CPUs, when a guest is rebooted, the secondary
CPUs can be awaken by the decrementer and start entering SLOF at the
same time the boot CPU is.

To be safe, let's disable on the secondaries all the exceptions which
can cause an exit while the CPU is in power-saving mode.

Based on previous work from Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

Changes in v3:

 - used the cpu_ppc_papr_pece_bits() helper 

 hw/ppc/spapr_cpu_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

David Gibson Nov. 22, 2017, 2:34 a.m. UTC | #1
On Mon, Nov 20, 2017 at 11:03:46AM +0100, Cédric Le Goater wrote:
> Just like for hot unplug CPUs, when a guest is rebooted, the secondary
> CPUs can be awaken by the decrementer and start entering SLOF at the
> same time the boot CPU is.
> 
> To be safe, let's disable on the secondaries all the exceptions which
> can cause an exit while the CPU is in power-saving mode.
> 
> Based on previous work from Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

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

but not applying pending an update on 1/3.

> ---
> 
> Changes in v3:
> 
>  - used the cpu_ppc_papr_pece_bits() helper 
> 
>  hw/ppc/spapr_cpu_core.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 3a4c17401226..4ba8563d49e4 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -35,6 +35,13 @@ static void spapr_cpu_reset(void *opaque)
>      cs->halted = 1;
>  
>      env->spr[SPR_HIOR] = 0;
> +
> +    /* Disable Power-saving mode Exit Cause exceptions for the CPU.
> +     * This can cause issues when rebooting the guest if a secondary
> +     * is awaken */
> +    if (cs != first_cpu) {
> +        env->spr[SPR_LPCR] &= ~cpu_ppc_papr_pece_bits(env);
> +    }
>  }
>  
>  static void spapr_cpu_destroy(PowerPCCPU *cpu)
diff mbox series

Patch

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 3a4c17401226..4ba8563d49e4 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -35,6 +35,13 @@  static void spapr_cpu_reset(void *opaque)
     cs->halted = 1;
 
     env->spr[SPR_HIOR] = 0;
+
+    /* Disable Power-saving mode Exit Cause exceptions for the CPU.
+     * This can cause issues when rebooting the guest if a secondary
+     * is awaken */
+    if (cs != first_cpu) {
+        env->spr[SPR_LPCR] &= ~cpu_ppc_papr_pece_bits(env);
+    }
 }
 
 static void spapr_cpu_destroy(PowerPCCPU *cpu)