ppc: compute cpu_dt_id in the machine code
v4 cover ppc: compute cpu_dt_id in the machine code
Here's the current patchset I have before I go on vacation, in case it is needed. It is nearly the same as v3: I've just dropped patches that received a negative review, fixed a bug and rebased.
The patches are also available here:
git://github.com/gkurz/qemu.git ppc-vcpu-dt-id-rework
Cheers.
---
Greg Kurz (5):
ppc: different creation paths for cpus in system and user mode
ppc: parse cpu features once
ppc: open code cpu creation for machine types
ppc: each machine type to provide vcpu_dt_id
ppc: drop vcpu_idt_id bits from the target code
hw/ppc/e500.c | 4 ++- hw/ppc/mac_newworld.c | 3 +- hw/ppc/mac_oldworld.c | 3 +- hw/ppc/ppc.c | 66 +++++++++++++++++++++++++++++++++++++++++++ hw/ppc/ppc440_bamboo.c | 3 +- hw/ppc/ppc4xx_devs.c | 3 +- hw/ppc/prep.c | 3 +- hw/ppc/spapr.c | 7 ++++- hw/ppc/spapr_cpu_core.c | 7 +++-- hw/ppc/virtex_ml507.c | 3 +- include/hw/ppc/ppc.h | 2 + target-ppc/cpu.h | 5 ++- target-ppc/translate_init.c | 20 ------------- 13 files changed, 97 insertions(+), 32 deletions(-)
--
Greg
PATCH v4 1/5 ppc: different creation paths for cpus in system and user mode
The machine code currently uses the same cpu_ppc_init() function to create cpus as the user mode. This function also triggers the cpu realization.
It is okay for user mode but with system mode we may want to do other things between initialization and realization, like generating cpu ids for the DT for example.
With this patch, each mode has its own creation helper:
- ppc_cpu_init() is for system mode only
- cpu_init() is for user mode only
---
v4: added David's R-b tag
--- hw/ppc/e500.c | 2 +- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/ppc.c | 5 +++++ hw/ppc/ppc440_bamboo.c | 2 +- hw/ppc/ppc4xx_devs.c | 2 +- hw/ppc/prep.c | 2 +- hw/ppc/spapr.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- include/hw/ppc/ppc.h | 1 + target-ppc/cpu.h | 5 +++-- target-ppc/translate_init.c | 5 ----- 12 files changed, 17 insertions(+), 15 deletions(-)
hw/ppc/e500.c +1 -1
@@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)CPUState *cs;qemu_irq *input; - cpu =cpu_ppc_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
hw/ppc/mac_newworld.c +1 -1
@@ -193,7 +193,7 @@ static void ppc_core99_init(MachineState *machine)#endif }for (i =0 ; i < smp_cpus; i++) { - cpu =cpu_ppc_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/mac_oldworld.c +1 -1
@@ -113,7 +113,7 @@ static void ppc_heathrow_init(MachineState *machine)if (machine->cpu_model ==NULL ) machine->cpu_model ="G3" ;for (i =0 ; i < smp_cpus; i++) { - cpu =cpu_ppc_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/ppc.c +5 -0
@@ -1350,3 +1350,8 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)return NULL ; } + +PowerPCCPU *ppc_cpu_init (const char *cpu_model) +{ +return POWERPC_CPU (cpu_generic_init (TYPE_POWERPC_CPU , cpu_model)); +}
hw/ppc/ppc440_bamboo.c +1 -1
@@ -186,7 +186,7 @@ static void bamboo_init(MachineState *machine)if (machine->cpu_model ==NULL ) { machine->cpu_model ="440EP" ; } - cpu =cpu_ppc_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
hw/ppc/ppc4xx_devs.c +1 -1
@@ -56,7 +56,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,CPUPPCState *env;/* init CPUs */ - cpu =cpu_ppc_init (cpu_model); + cpu =ppc_cpu_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC %s CPU definition\n" , cpu_model);
hw/ppc/prep.c +1 -1
@@ -509,7 +509,7 @@ static void ppc_prep_init(MachineState *machine)if (machine->cpu_model ==NULL ) machine->cpu_model ="602" ;for (i =0 ; i < smp_cpus; i++) { - cpu =cpu_ppc_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/spapr.c +1 -1
@@ -1835,7 +1835,7 @@ static void ppc_spapr_init(MachineState *machine)g_free (type); }else {for (i =0 ; i < smp_cpus; i++) { -PowerPCCPU *cpu =cpu_ppc_init (machine->cpu_model); +PowerPCCPU *cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {error_report ("Unable to find PowerPC CPU definition" );exit (1 );
hw/ppc/virtex_ml507.c +1 -1
@@ -96,7 +96,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size,CPUPPCState *env;qemu_irq *irqs; - cpu =cpu_ppc_init (cpu_model); + cpu =ppc_cpu_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
include/hw/ppc/ppc.h +1 -0
@@ -106,4 +106,5 @@ enum {/* ppc_booke.c */ void ppc_booke_timers_init (PowerPCCPU *cpu,uint32_t freq,uint32_t flags); +PowerPCCPU *ppc_cpu_init (const char *cpu_model);#endif
target-ppc/cpu.h +3 -2
@@ -1198,7 +1198,6 @@ extern const struct VMStateDescription vmstate_ppc_cpu;#endif /*****************************************************************************/ -PowerPCCPU *cpu_ppc_init (const char *cpu_model);void ppc_translate_init (void );void gen_update_current_nip (void *opaque);/* you can call this signal handler from your SIGBUS and SIGSEGV
@@ -1277,7 +1276,9 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp);int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val); -#define cpu_init (cpu_model) CPU(cpu_ppc_init(cpu_model)) +#if defined(CONFIG_USER_ONLY ) +#define cpu_init (cpu_model) cpu_generic_init(TYPE_POWERPC_CPU, cpu_model) +#endif #define cpu_signal_handler cpu_ppc_signal_handler#define cpu_list ppc_cpu_list
target-ppc/translate_init.c +0 -5
@@ -10012,11 +10012,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)return NULL ; } -PowerPCCPU *cpu_ppc_init (const char *cpu_model) -{ -return POWERPC_CPU (cpu_generic_init (TYPE_POWERPC_CPU , cpu_model)); -} -/* Sort by PVR, ordering special case "host" last. */ static gint ppc_cpu_list_compare (gconstpointer a,gconstpointer b) {
PATCH v4 2/5 ppc: parse cpu features once
In reply to Greg KurzConsidering that features are converted to global properties and global properties are automatically applied to every new instance of created CPU (at object_new() time), there is no point in parsing cpu_model string every time a CPU created. So move parsing outside CPU creation loop and do it only once.
Parsing also should be done before any CPU is created so that features would affect the first CPU a well.
This patch does that for all PowerPC machine types.
It is based on previous work from Bharata:
https://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg07564.html
--- hw/ppc/e500.c | 2 ++ hw/ppc/mac_newworld.c | 1 + hw/ppc/mac_oldworld.c | 1 + hw/ppc/ppc.c | 26 ++++++++++++++++++++++++++ hw/ppc/ppc440_bamboo.c | 1 + hw/ppc/ppc4xx_devs.c | 1 + hw/ppc/prep.c | 1 + hw/ppc/spapr.c | 2 ++ hw/ppc/virtex_ml507.c | 1 + include/hw/ppc/ppc.h | 1 + 10 files changed, 37 insertions(+)
hw/ppc/e500.c +2 -0
@@ -814,6 +814,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) machine->cpu_model ="e500v2_v30" ; } +ppc_cpu_parse_features (machine->cpu_model); + irqs =g_malloc0 (smp_cpus *sizeof (qemu_irq *)); irqs[0 ] =g_malloc0 (smp_cpus *sizeof (qemu_irq) *OPENPIC_OUTPUT_NB );for (i =0 ; i < smp_cpus; i++) {
hw/ppc/mac_newworld.c +1 -0
@@ -192,6 +192,7 @@ static void ppc_core99_init(MachineState *machine) machine->cpu_model ="G4" ;#endif } +ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {
hw/ppc/mac_oldworld.c +1 -0
@@ -112,6 +112,7 @@ static void ppc_heathrow_init(MachineState *machine)/* init CPUs */ if (machine->cpu_model ==NULL ) machine->cpu_model ="G3" ; +ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {
hw/ppc/ppc.c +26 -0
@@ -33,6 +33,7 @@#include "hw/timer/m48t59.h" #include "qemu/log.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/loader.h" #include "sysemu/kvm.h" #include "kvm_ppc.h"
@@ -1355,3 +1356,28 @@ PowerPCCPU *ppc_cpu_init(const char *cpu_model) {return POWERPC_CPU (cpu_generic_init (TYPE_POWERPC_CPU , cpu_model)); } + +void ppc_cpu_parse_features (const char *cpu_model) +{ +CPUClass *cc; +ObjectClass *oc; +const char *typename; +gchar **model_pieces; + + model_pieces =g_strsplit (cpu_model,"," ,2 ); +if (!model_pieces[0 ]) { +error_report ("Invalid/empty CPU model name" ); +exit (1 ); + } + + oc =cpu_class_by_name (TYPE_POWERPC_CPU , model_pieces[0 ]); +if (oc ==NULL ) { +error_report ("Unable to find CPU definition: %s" , model_pieces[0 ]); +exit (1 ); + } + + typename =object_class_get_name (oc); + cc =CPU_CLASS (oc); + cc->parse_features (typename, model_pieces[1 ], &error_fatal); +g_strfreev (model_pieces); +}
hw/ppc/ppc440_bamboo.c +1 -0
@@ -186,6 +186,7 @@ static void bamboo_init(MachineState *machine)if (machine->cpu_model ==NULL ) { machine->cpu_model ="440EP" ; } +ppc_cpu_parse_features (machine->cpu_model); cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );
hw/ppc/ppc4xx_devs.c +1 -0
@@ -56,6 +56,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,CPUPPCState *env;/* init CPUs */ +ppc_cpu_parse_features (cpu_model); cpu =ppc_cpu_init (cpu_model);if (cpu ==NULL ) { fprintf(stderr, "Unable to find PowerPC %s CPU definition\n",
hw/ppc/prep.c +1 -0
@@ -508,6 +508,7 @@ static void ppc_prep_init(MachineState *machine)/* init CPUs */ if (machine->cpu_model ==NULL ) machine->cpu_model ="602" ; +ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { cpu =ppc_cpu_init (machine->cpu_model);if (cpu ==NULL ) {
hw/ppc/spapr.c +2 -0
@@ -1803,6 +1803,8 @@ static void ppc_spapr_init(MachineState *machine) machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; } +ppc_cpu_parse_features (machine->cpu_model); +if (smc->dr_cpu_enabled) {char *type =spapr_get_cpu_core_type (machine->cpu_model);
hw/ppc/virtex_ml507.c +1 -0
@@ -96,6 +96,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size,CPUPPCState *env;qemu_irq *irqs; +ppc_cpu_parse_features (cpu_model); cpu =ppc_cpu_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );
include/hw/ppc/ppc.h +1 -0
@@ -107,4 +107,5 @@ enum {void ppc_booke_timers_init (PowerPCCPU *cpu,uint32_t freq,uint32_t flags);PowerPCCPU *ppc_cpu_init (const char *cpu_model); +void ppc_cpu_parse_features (const char *cpu_model);#endif
PATCH v4 3/5 ppc: open code cpu creation for machine types
In reply to Greg KurzIf we want to generate cpu_dt_id in the machine code, this must occur before the cpu gets realized. We must open code the cpu creation to be able to do this.
This patch just does that.
---
v4: - fix potential access to uninitialized 'cpu' variable
- added David's R-b tag
--- hw/ppc/ppc.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
hw/ppc/ppc.c +33 -1
@@ -32,6 +32,7 @@#include "sysemu/cpus.h" #include "hw/timer/m48t59.h" #include "qemu/log.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "hw/loader.h"
@@ -1354,7 +1355,38 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)PowerPCCPU *ppc_cpu_init (const char *cpu_model) { -return POWERPC_CPU (cpu_generic_init (TYPE_POWERPC_CPU , cpu_model)); +PowerPCCPU *cpu =NULL ; +ObjectClass *oc; +gchar **model_pieces; +Error *err =NULL ; + + model_pieces =g_strsplit (cpu_model,"," ,2 ); +if (!model_pieces[0 ]) { +error_report ("Invalid/empty CPU model name" ); +return NULL ; + } + + oc =cpu_class_by_name (TYPE_POWERPC_CPU , model_pieces[0 ]); +if (oc ==NULL ) { +error_report ("Unable to find CPU definition: %s" , model_pieces[0 ]); + goto out; + } + + cpu =POWERPC_CPU (object_new (object_class_get_name (oc))); +object_property_set_bool (OBJECT (cpu), true,"realized" , &err); + +out: +g_strfreev (model_pieces); + +if (err !=NULL ) { +error_report_err (err); +if (cpu !=NULL ) { +object_unref (OBJECT (cpu)); + } +return NULL ; + } + +return cpu; }void ppc_cpu_parse_features (const char *cpu_model)
PATCH v4 4/5 ppc: each machine type to provide vcpu_dt_id
In reply to Greg KurzThis patch switches machine types to provide device-tree cpu ids.
We have three cases to handle:
- pseries < 2.7 call ppc_cpu_init() and should compute the DT id as it is currently done in the target code.
- pseries 2.7 don't call ppc_cpu_init() and compute the DT as the sum of the core DT id and the the thread index within the core
- all other machine types don't support SMT and just need to provide a different index for each vcpu
--- hw/ppc/e500.c | 2 +- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/ppc.c | 5 ++++- hw/ppc/ppc440_bamboo.c | 2 +- hw/ppc/ppc4xx_devs.c | 2 +- hw/ppc/prep.c | 2 +- hw/ppc/spapr.c | 5 ++++- hw/ppc/spapr_cpu_core.c | 7 +++++-- hw/ppc/virtex_ml507.c | 2 +- include/hw/ppc/ppc.h | 2 +- 11 files changed, 21 insertions(+), 12 deletions(-)
hw/ppc/e500.c +1 -1
@@ -823,7 +823,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)CPUState *cs;qemu_irq *input; - cpu =ppc_cpu_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model, i);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
hw/ppc/mac_newworld.c +1 -1
@@ -194,7 +194,7 @@ static void ppc_core99_init(MachineState *machine) }ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { - cpu =ppc_cpu_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model, i);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/mac_oldworld.c +1 -1
@@ -114,7 +114,7 @@ static void ppc_heathrow_init(MachineState *machine) machine->cpu_model ="G3" ;ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { - cpu =ppc_cpu_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model, i);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/ppc.c +4 -1
@@ -1353,7 +1353,7 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)return NULL ; } -PowerPCCPU *ppc_cpu_init (const char *cpu_model) +PowerPCCPU *ppc_cpu_init (const char *cpu_model,unsigned vcpu_dt_id) {PowerPCCPU *cpu =NULL ;ObjectClass *oc;
@@ -1373,6 +1373,9 @@ PowerPCCPU *ppc_cpu_init(const char *cpu_model) } cpu =POWERPC_CPU (object_new (object_class_get_name (oc))); + + cpu->cpu_dt_id = vcpu_dt_id; +object_property_set_bool (OBJECT (cpu), true,"realized" , &err); out:
hw/ppc/ppc440_bamboo.c +1 -1
@@ -187,7 +187,7 @@ static void bamboo_init(MachineState *machine) machine->cpu_model ="440EP" ; }ppc_cpu_parse_features (machine->cpu_model); - cpu =ppc_cpu_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model,0 );if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
hw/ppc/ppc4xx_devs.c +1 -1
@@ -57,7 +57,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,/* init CPUs */ ppc_cpu_parse_features (cpu_model); - cpu =ppc_cpu_init (cpu_model); + cpu =ppc_cpu_init (cpu_model,0 );if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC %s CPU definition\n" , cpu_model);
hw/ppc/prep.c +1 -1
@@ -510,7 +510,7 @@ static void ppc_prep_init(MachineState *machine) machine->cpu_model ="602" ;ppc_cpu_parse_features (machine->cpu_model);for (i =0 ; i < smp_cpus; i++) { - cpu =ppc_cpu_init (machine->cpu_model); + cpu =ppc_cpu_init (machine->cpu_model, i);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" );exit (1 );
hw/ppc/spapr.c +4 -1
@@ -1837,7 +1837,10 @@ static void ppc_spapr_init(MachineState *machine)g_free (type); }else {for (i =0 ; i < smp_cpus; i++) { -PowerPCCPU *cpu =ppc_cpu_init (machine->cpu_model); +unsigned core_index = i / smp_threads; +unsigned thread_index = i % smp_threads; +PowerPCCPU *cpu =ppc_cpu_init (machine->cpu_model, + core_index * smt + thread_index);if (cpu ==NULL ) {error_report ("Unable to find PowerPC CPU definition" );exit (1 );
hw/ppc/spapr_cpu_core.c +5 -2
@@ -259,13 +259,16 @@ out:error_propagate (errp, local_err); } -static void spapr_cpu_core_realize_child (Object *child,Error **errp) +static void spapr_cpu_core_realize_child (Object *child,unsigned vcpu_dt_id, +Error **errp) {Error *local_err =NULL ;sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());CPUState *cs =CPU (child);PowerPCCPU *cpu =POWERPC_CPU (cs); + cpu->cpu_dt_id = vcpu_dt_id; +object_property_set_bool (child, true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -306,7 +309,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)for (j =0 ; j < cc->nr_threads; j++) { obj = sc->threads + j * size; -spapr_cpu_core_realize_child (obj, &local_err); +spapr_cpu_core_realize_child (obj, cc->core_id + j, &local_err);if (local_err) { goto err; }
hw/ppc/virtex_ml507.c +1 -1
@@ -97,7 +97,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size,qemu_irq *irqs;ppc_cpu_parse_features (cpu_model); - cpu =ppc_cpu_init (cpu_model); + cpu =ppc_cpu_init (cpu_model,0 );if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
include/hw/ppc/ppc.h +1 -1
@@ -106,6 +106,6 @@ enum {/* ppc_booke.c */ void ppc_booke_timers_init (PowerPCCPU *cpu,uint32_t freq,uint32_t flags); -PowerPCCPU *ppc_cpu_init (const char *cpu_model); +PowerPCCPU *ppc_cpu_init (const char *cpu_model,unsigned vcpu_dt_id);void ppc_cpu_parse_features (const char *cpu_model);#endif
PATCH v4 5/5 ppc: drop vcpu_idt_id bits from the target code
In reply to Greg KurzNow that all machine types provide vcpu_dt_id, we can safely drop these bits from the target code.
---
v4: keep max_smt needed by smp_threads sanity checks
--- target-ppc/translate_init.c | 15 --------------- 1 file changed, 15 deletions(-)
target-ppc/translate_init.c +0 -15
@@ -9529,9 +9529,7 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)Error *local_err =NULL ;#if !defined(CONFIG_USER_ONLY )int max_smt =kvmppc_smt_threads (); -#endif -#if !defined(CONFIG_USER_ONLY )if (smp_threads > max_smt) {error_setg (errp,"Cannot support more than %d threads on PPC with %s" , max_smt,kvm_enabled () ?"KVM" :"TCG" );
@@ -9551,19 +9549,6 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)return ; } -#if !defined(CONFIG_USER_ONLY ) - cpu->cpu_dt_id = (cs->cpu_index / smp_threads) * max_smt - + (cs->cpu_index % smp_threads); - -if (kvm_enabled () && !kvm_vcpu_id_is_valid (cpu->cpu_dt_id)) { -error_setg (errp,"Can't create CPU with id %d in KVM" , cpu->cpu_dt_id); -error_append_hint (errp,"Adjust the number of cpus to %d " -"or try to raise the number of threads per core\n" , - cpu->cpu_dt_id * smp_threads / max_smt); -return ; - } -#endif -if (tcg_enabled ()) {if (ppc_fixup_cpu (cpu) !=0 ) {error_setg (errp,"Unable to emulate selected CPU with TCG" );