hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine
PATCH 1/1 hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine
A couple of distributors are compiling their distributions with "-mcpu=power8" for ppc64le these days, so the user sooner or later runs into a crash there when not explicitely specifying the "-cpu POWER8" option to QEMU. Due to this reason, the linux-user target already switched to POWER8 by default a while ago (see commit de3f1b98410e0d5b406a0df3a48547b559d18602). Since the softmmu target of course has the same problem, we should switch there to POWER8 by default for the newer machine types, too.
---
Note: This patch should be applied on top of David's ppc-for-2.8 tree, since the pseries-2.8 machine has just been added there recently.
hw/ppc/spapr.c | 11 ++++++++++- include/hw/ppc/spapr.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +10 -1
@@ -1775,7 +1775,13 @@ static void ppc_spapr_init(MachineState *machine)/* init CPUs */ if (machine->cpu_model ==NULL ) { - machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; +if (kvm_enabled ()) { + machine->cpu_model ="host" ; + }else if (smc->tcg_default_cpu) { + machine->cpu_model = smc->tcg_default_cpu; + }else { + machine->cpu_model ="POWER8" ; + } }ppc_cpu_parse_features (machine->cpu_model);
@@ -2478,7 +2484,10 @@ static void spapr_machine_2_7_instance_options(MachineState *machine)static void spapr_machine_2_7_class_options (MachineClass *mc) { +sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); +spapr_machine_2_8_class_options (mc); + smc->tcg_default_cpu ="POWER7" ;SET_MACHINE_COMPAT (mc,SPAPR_COMPAT_2_7 ); }
include/hw/ppc/spapr.h +1 -0
@@ -39,6 +39,7 @@ struct sPAPRMachineClass {/*< public >*/ bool dr_lmb_enabled;/* enable dynamic-reconfig/hotplug of LMBs */ bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */ +const char *tcg_default_cpu;/* which (TCG) CPU to simulate by default */ };/**
Signature · 1 line
1.8.3.1
Quoted 11 lines · Thomas Huth
A couple of distributors are compiling their distributions with "-mcpu=power8" for ppc64le these days, so the user sooner or later runs into a crash there when not explicitely specifying the "-cpu POWER8" option to QEMU. Due to this reason, the linux-user target already switched to POWER8 by default a while ago (see commit
de3f1b98410e0d5b406a0df3a48547b559d18602). Since the softmmu target of course has the same problem, we should switch there to POWER8 by default for the newer machine types, too.Signed-off-by Thomas Huth <[email protected]>
Sounds good, one detail..
Quoted 15 lines
---
Note: This patch should be applied on top of David's ppc-for-2.8 tree, since the pseries-2.8 machine has just been added there recently.hw/ppc/spapr.c | 11 ++++++++++- include/hw/ppc/spapr.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)hw/ppc/spapr.c +0
-0@@ -1775,7 +1775,13 @@ static void ppc_spapr_init(MachineState *machine)
hw/ppc/spapr.c static void ppc_spapr_init(MachineState *machine) · line 1784
Quoted 10 lines
hw/ppc/spapr.c +7
-1/* init CPUs */ if (machine->cpu_model ==NULL ) { - machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; +if (kvm_enabled ()) { + machine->cpu_model ="host" ; + }else if (smc->tcg_default_cpu) { + machine->cpu_model = smc->tcg_default_cpu; + }else { + machine->cpu_model ="POWER8" ; + }
You can avoid the last if branch if you initialize tcg_default_cpu to POWER8 in spapr_machine_class_init().
Quoted 26 lines
hw/ppc/spapr.c +3
-0}ppc_cpu_parse_features (machine->cpu_model);@@ -2478,7 +2484,10 @@ static void spapr_machine_2_7_instance_options(MachineState *machine)static void spapr_machine_2_7_class_options (MachineClass *mc) { +sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); +spapr_machine_2_8_class_options (mc); + smc->tcg_default_cpu ="POWER7" ;SET_MACHINE_COMPAT (mc,SPAPR_COMPAT_2_7 ); }include/hw/ppc/spapr.h +1
-0@@ -39,6 +39,7 @@ struct sPAPRMachineClass {/*< public >*/ bool dr_lmb_enabled;/* enable dynamic-reconfig/hotplug of LMBs */ bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */ +const char *tcg_default_cpu;/* which (TCG) CPU to simulate by default */ };/**
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 30 lines · David Gibson
Quoted 11 lines · Thomas Huth
A couple of distributors are compiling their distributions with "-mcpu=power8" for ppc64le these days, so the user sooner or later runs into a crash there when not explicitely specifying the "-cpu POWER8" option to QEMU. Due to this reason, the linux-user target already switched to POWER8 by default a while ago (see commit
de3f1b98410e0d5b406a0df3a48547b559d18602). Since the softmmu target of course has the same problem, we should switch there to POWER8 by default for the newer machine types, too.Signed-off-by Thomas Huth <[email protected]>Sounds good, one detail..
Quoted 15 lines
---
Note: This patch should be applied on top of David's ppc-for-2.8 tree, since the pseries-2.8 machine has just been added there recently.hw/ppc/spapr.c | 11 ++++++++++- include/hw/ppc/spapr.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)hw/ppc/spapr.c +0
-0@@ -1775,7 +1775,13 @@ static void ppc_spapr_init(MachineState *machine)
Quoted 13 lines
hw/ppc/spapr.c static void ppc_spapr_init(MachineState *machine) · line 1784
Quoted 10 lines
hw/ppc/spapr.c +7
-1/* init CPUs */ if (machine->cpu_model ==NULL ) { - machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; +if (kvm_enabled ()) { + machine->cpu_model ="host" ; + }else if (smc->tcg_default_cpu) { + machine->cpu_model = smc->tcg_default_cpu; + }else { + machine->cpu_model ="POWER8" ; + }You can avoid the last if branch if you initialize
tcg_default_cputo POWER8 inspapr_machine_class_init().
You're right, that sounds better. I'll send a v2 ...
Thomas