spapr: Correct compatibility mode setting for hotplugged CPUs
PATCH 1/1 spapr: Correct compatibility mode setting for hotplugged CPUs
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);
hw/ppc/spapr_rtas.c +8 -0
@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );
@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs); +/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err); +if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Signature · 1 line
2.14.3
Quoted 8 lines · David Gibson
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
Quoted 6 lines
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>
Quoted 45 lines
--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +8
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs); +/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err); +if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Signature · 1 line
Alexey
Quoted 45 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 5 lines
hw/ppc/spapr_rtas.c +2
-0@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs); +/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);
Is it okay to report a simple HW error to the guest here instead of aborting like we do with first_cpu at reset time ?
Quoted 8 lines
hw/ppc/spapr_rtas.c +5
-0+if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Quoting Greg Kurz (2018-01-04 11:47:18)
Quoted 51 lines
Quoted 48 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs);
Quoted 5 lines
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);Is it okay to report a simple HW error to the guest here instead of aborting like we do with
first_cpuat reset time ?
And if we don't opt for &error_fatal, we need an error_free() below.
Quoted 10 lines
Quoted 9 lines
hw/ppc/spapr_rtas.c +5
-0+if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Quoted 52 lines · Michael Roth
Quoting Greg Kurz (2018-01-04 11:47:18)
Quoted 51 lines
Quoted 48 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs);
Quoted 7 lines
Quoted 5 lines
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);Is it okay to report a simple HW error to the guest here instead of aborting like we do with
first_cpuat reset time ?And if we don't opt for
&error_fatal, we need anerror_free()below.
Or better yet an error_report_err() which will display it and free it. I'll make that change.
Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
hw/ppc/spapr_rtas.c +5
-0+if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
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
Quoted 51 lines · Greg Kurz
Quoted 48 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs);
Quoted 5 lines
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);Is it okay to report a simple HW error to the guest here instead of aborting like we do with
first_cpuat reset time ?
Should be: this happens before we turn the cpu on, so the effect will be that the guest fails to online the cpu. That seems like a better failure mode than killing the already running guest.
Quoted 10 lines
Quoted 9 lines
hw/ppc/spapr_rtas.c +5
-0+if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
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
Quoted 58 lines · On Fri, 5 Jan 2018 14:07:29 +1100 David Gibson <[email protected]>…
Quoted 51 lines · Greg Kurz
Quoted 48 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs);Quoted 5 lines
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);Is it okay to report a simple HW error to the guest here instead of aborting like we do with
first_cpuat reset time ?
Quoted 4 lines
Should be: this happens before we turn the cpu on, so the effect will be that the guest fails to online the cpu. That seems like a better failure mode than killing the already running guest.
Of course, I generally agree with the "better failure mode". My point was just that if we managed to set the compat mode with the first cpu but we fail to propagate the same compat mode to subsequent cpus, then this is a bug in QEMU or KVM.
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
hw/ppc/spapr_rtas.c +5
-0+if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Quoted 66 lines · Greg Kurz
Quoted 58 lines · On Fri, 5 Jan 2018 14:07:29 +1100 David Gibson <[email protected]>…
Quoted 51 lines · Greg Kurz
Quoted 48 lines · On Thu, 4 Jan 2018 15:24:05 +1100 David Gibson <[email protected]>…
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +1
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs);Quoted 5 lines
hw/ppc/spapr_rtas.c static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, · line 179
Quoted 2 lines
hw/ppc/spapr_rtas.c +2
-0+/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err);Is it okay to report a simple HW error to the guest here instead of aborting like we do with
first_cpuat reset time ?Quoted 4 lines
Should be: this happens before we turn the cpu on, so the effect will be that the guest fails to online the cpu. That seems like a better failure mode than killing the already running guest.
Quoted 4 lines
Of course, I generally agree with the "better failure mode". My point was just that if we managed to set the compat mode with the first cpu but we fail to propagate the same compat mode to subsequent cpus, then this is a bug in QEMU or KVM.
Ah, I see your point. Yes, I guess that's true. Nonetheless, I think the better failure mode is still a better idea, even if something goes wrong elsewhere.
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
Quoted 5 lines · David Gibson
Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then
s/compatiblity/compatibility
Quoted 10 lines
hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
Signed-off-by David Gibson <[email protected]>---
Quoted 43 lines
hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);hw/ppc/spapr_rtas.c +8
-0@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );@@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs); +/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err); +if (local_err) { +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */