Skip to contentSkip to conversation

target/ppc: fix CPU hotplug when radix is enabled (TCG)

PATCH Applied Cédric Le Goater 3 participants 3 messages Jul 14, 2017 – Jul 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: fix CPU hotplug when radix is enabled (TCG)

But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same setting under KVM but not under TCG. So, Let's check for radix and update the default LPCR to keep new CPUs in sync.

---
 target/ppc/translate_init.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
target/ppc/translate_init.c +9 -1
index 8b9807665dd5..8776e9b0f8fa 100644
@@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
         /* By default we choose legacy mode and switch to new hash or radix
          * when a register process table hcall is made. So disable process
          * tables and guest translation shootdown by default
+         *
+         * Hot-plugged CPUs inherit from the guest radix setting under
+         * KVM but not under TCG. Update the default LPCR to keep new
+         * CPUs in sync when radix is enabled.
          */
-        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        if (ppc64_radix_guest(cpu)) {
+            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;
+        } else {
+            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        }
         lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE |
                                LPCR_OEE;
         break;
Signature · 1 line
2.7.5
Applied
#1 lore raw
Quoted 6 lines · Cédric Le Goater

But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same setting under KVM but not under TCG. So, Let's check for radix and update the default LPCR to keep new CPUs in sync.

Applied to ppc-for-2.10, thanks.

Quoted 26 lines
---
 target/ppc/translate_init.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
target/ppc/translate_init.c +9 -1
index 8b9807665dd5..8776e9b0f8fa 100644
@@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
         /* By default we choose legacy mode and switch to new hash or radix
          * when a register process table hcall is made. So disable process
          * tables and guest translation shootdown by default
+         *
+         * Hot-plugged CPUs inherit from the guest radix setting under
+         * KVM but not under TCG. Update the default LPCR to keep new
+         * CPUs in sync when radix is enabled.
          */
-        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        if (ppc64_radix_guest(cpu)) {
+            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;
+        } else {
+            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        }
         lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE |
                                LPCR_OEE;
         break;
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
Reviewed-by on v1 1/1
#2 lore raw
In reply to Cédric Le Goater
Quoted 9 lines · Cédric Le Goater

But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL
to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same
setting under KVM but not under TCG. So, Let's check for radix and update
the default LPCR to keep new CPUs in sync.

Quoted 18 lines

---
 target/ppc/translate_init.c | 10 +++++++++-

 1 file changed, 9 insertions(+), 1 deletion(-)
target/ppc/translate_init.c +0 -0
index 8b9807665dd5..8776e9b0f8fa 100644
@@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu,
 PPCVirtualHypervisor *vhyp)
          /* By default we choose legacy mode and switch to new hash

or radix
          * when a register process table hcall is made. So disable process
          * tables and guest translation shootdown by default +         *
+         * Hot-plugged CPUs inherit from the guest radix setting

Quoted 8 lines

under
+         * KVM but not under TCG. Update the default LPCR to keep new
+         * CPUs in sync when radix is enabled.
          */
-        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE); +        if (ppc64_radix_guest(cpu)) {
+            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;

Since we can't do radix without GTSE, I guess for now at least RADIX implies GTSE.

Quoted 7 lines

+        } else {
+            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE); +        }
         lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE |
                                LPCR_OEE;
         break;