x86/cpu/numa queue, 2017-10-27
Change in v2:
* Include sh4-linux-user fixup sent by Igor (at: "sh4: simplify superh_cpu_class_by_name()")
The following changes since commit 74d7fc7f6385158b8a5c524c61baaef1b66f3dac:
tcg: Avoid setting tcg_initialize if !CONFIG_TCG (2017-10-26 17:47:36 +0100)
are available in the git repository at:
git://github.com/ehabkost/qemu.git tags/x86-and-machine-pull-request
for you to fetch changes up to 1a26f46692320f1981c95967e0d5af4443b5f0b1:
x86: Skip check apic_id_limit for Xen (2017-10-27 16:04:28 +0200)
----------------------------------------------------------------
x86/cpu/numa queue, 2017-10-27
----------------------------------------------------------------
Igor Mammedov (38):
alpha: cleanup cpu type name composition
alpha: use generic cpu_model parsing
cris: cleanup cpu type name composition
cris: use generic cpu_model parsing
lm32: cleanup cpu type name composition
lm32: milkymist: use generic cpu_model parsing
lm32: lm32_boards: use generic cpu_model parsing
m68k: cleanup cpu type name composition
m68k: an5206: use generic cpu_model parsing
m68k: mcf5208: use generic cpu_model parsing
moxie: fix qemu-system-moxie failing to start with CLI "-cpu
MoxieLite"
moxie: cleanup cpu type name composition
moxie: use generic cpu_model parsing
openrisc: cleanup cpu type name composition
openrisc: use generic cpu_model parsing
sh4: r2d: use generic cpu_model parsing
sh4: shix: use generic cpu_model parsing
sh4: cleanup cpu type name composition
sh4: simplify superh_cpu_class_by_name()
sh4: remove SuperHCPUClass::name field
xtensa: cleanup cpu type name composition
xtensa: sim: use generic cpu_model parsing
xtensa: lx60/lx200/ml605/kc705: use generic cpu_model parsing
unicore32: cleanup cpu type name composition
unicore32: use generic cpu_model parsing
tricore: cleanup cpu type name composition
tricore: use generic cpu_model parsing
sparc: cleanup cpu type name composition
sparc: sun4u/sun4v/niagara: use generic cpu_model parsing
sparc: sparc: use generic cpu_model parsing
sparc: leon3: use generic cpu_model parsing
mips: use object_new() instead of gnew()+object_initialize()
mips: malta/boston: replace cpu_model with cpu_type
mips: fulong2e: replace cpu_model with cpu_type
mips: Magnum/Acer Pica 61: replace cpu_model with cpu_type
mips: mipssim: replace cpu_model with cpu_type
mips: r4k: replace cpu_model with cpu_type
numa: fixup parsed NumaNodeOptions earlier
Lan Tianyu (1):
x86: Skip check apic_id_limit for Xen
include/hw/mips/cps.h | 2 +- include/hw/sparc/sparc64.h | 3 +- target/alpha/cpu.h | 3 ++ target/cris/cpu.h | 3 ++ target/lm32/cpu.h | 3 ++ target/m68k/cpu.h | 3 ++ target/mips/cpu.h | 8 ++- target/moxie/cpu.h | 3 ++ target/openrisc/cpu.h | 3 ++ target/sh4/cpu-qom.h | 8 ++- target/sh4/cpu.h | 3 ++ target/sparc/cpu.h | 3 ++ target/tricore/cpu.h | 2 + target/unicore32/cpu.h | 3 ++ target/xtensa/cpu.h | 4 ++ hw/alpha/dp264.c | 4 +- hw/cris/axis_dev88.c | 7 +-- hw/i386/pc.c | 2 +- hw/lm32/lm32_boards.c | 14 ++---- hw/lm32/milkymist.c | 7 +-- hw/m68k/an5206.c | 7 +-- hw/m68k/mcf5208.c | 7 +-- hw/mips/boston.c | 14 +++--- hw/mips/cps.c | 4 +- hw/mips/mips_fulong2e.c | 7 +-- hw/mips/mips_jazz.c | 8 ++- hw/mips/mips_malta.c | 36 ++++++-------- hw/mips/mips_mipssim.c | 15 +++--- hw/mips/mips_r4k.c | 16 +++--- hw/moxie/moxiesim.c | 7 +-- hw/openrisc/openrisc_sim.c | 8 +-- hw/sh4/r2d.c | 8 +-- hw/sh4/shix.c | 7 +-- hw/sparc/leon3.c | 8 +-- hw/sparc/sun4m.c | 29 +++++------ hw/sparc64/niagara.c | 4 +- hw/sparc64/sparc64.c | 8 +-- hw/sparc64/sun4u.c | 8 ++- hw/tricore/tricore_testboard.c | 6 +-- hw/unicore32/puv3.c | 8 +-- hw/xtensa/sim.c | 8 +-- hw/xtensa/xtfpga.c | 11 ++--- linux-user/main.c | 2 +- numa.c | 19 ++++---- target/alpha/cpu.c | 107 +++++++++++++---------------------------- target/cris/cpu.c | 81 +++++++++++-------------------- target/lm32/cpu.c | 74 +++++++++------------------- target/m68k/cpu.c | 75 +++++++++++------------------ target/mips/cpu.c | 2 +- target/mips/translate.c | 20 +++----- target/mips/translate_init.c | 12 ----- target/moxie/cpu.c | 61 +++++++++-------------- target/openrisc/cpu.c | 69 +++++++++----------------- target/sh4/cpu.c | 107 +++++++++++++++-------------------------- target/sparc/cpu.c | 2 +- target/tricore/cpu.c | 68 ++++++++------------------ target/unicore32/cpu.c | 61 ++++++++--------------- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- 59 files changed, 397 insertions(+), 689 deletions(-)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 01/39] alpha: cleanup cpu type name composition
From: Igor Mammedov <[email protected]>
Introduce ALPHA_CPU_TYPE_NAME macro to replace rather ununique TYPE macro that alpha uses. With new macro it will follow the same naming convention as other targets.
While at it put scattered TypeInfo into one array which places type desriptions at one place and reduces code a bit.
Message-Id: <[email protected]>
--- target/alpha/cpu.h | 3 ++ target/alpha/cpu.c | 107 +++++++++++++++++------------------------------------ 2 files changed, 37 insertions(+), 73 deletions(-)
target/alpha/cpu.h +3 -0
@@ -470,6 +470,9 @@ void alpha_translate_init(void);#define cpu_init (cpu_model) cpu_generic_init(TYPE_ALPHA_CPU, cpu_model) +#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU +#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX +void alpha_cpu_list (FILE *f,fprintf_function cpu_fprintf);/* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero
target/alpha/cpu.c +34 -73
172 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 02/39] alpha: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/alpha/dp264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/alpha/dp264.c +2 -2
@@ -51,7 +51,6 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num)static void clipper_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model ? machine->cpu_model :"ev67" ;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -67,7 +66,7 @@ static void clipper_init(MachineState *machine)/* Create up to 4 cpus. */ memset (cpus,0 ,sizeof (cpus));for (i =0 ; i < smp_cpus; ++i) { - cpus[i] =ALPHA_CPU (cpu_generic_init (TYPE_ALPHA_CPU , cpu_model)); + cpus[i] =ALPHA_CPU (cpu_create (machine->cpu_type)); } cpus[0 ]->env.trap_arg0 = ram_size;
@@ -179,6 +178,7 @@ static void clipper_machine_init(MachineClass *mc) mc->block_default_type =IF_IDE ; mc->max_cpus =4 ; mc->is_default =1 ; + mc->default_cpu_type =ALPHA_CPU_TYPE_NAME ("ev67" ); }DEFINE_MACHINE ("clipper" , clipper_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 03/39] cris: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
replace ambiguous TYPE macro with a new CRIS_CPU_TYPE_NAME and use it consistently in the code.
Message-Id: <[email protected]>
--- target/cris/cpu.h | 3 +++ target/cris/cpu.c | 81 +++++++++++++++++++------------------------------------ 2 files changed, 30 insertions(+), 54 deletions(-)
target/cris/cpu.h +3 -0
@@ -269,6 +269,9 @@ enum {#define cpu_init (cpu_model) cpu_generic_init(TYPE_CRIS_CPU, cpu_model) +#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU +#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX) +#define cpu_signal_handler cpu_cris_signal_handler/* MMU modes definitions */
target/cris/cpu.c +27 -54
107 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 04/39] cris: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/cris/axis_dev88.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/cris/axis_dev88.c +2 -5
@@ -251,7 +251,6 @@ staticvoid axisdev88_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;CRISCPU *cpu;
@@ -268,10 +267,7 @@ void axisdev88_init(MachineState *machine)MemoryRegion *phys_intmem =g_new (MemoryRegion,1 );/* init CPUs */ -if (cpu_model ==NULL ) { - cpu_model ="crisv32" ; - } - cpu =CRIS_CPU (cpu_generic_init (TYPE_CRIS_CPU , cpu_model)); + cpu =CRIS_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;/* allocate RAM */
@@ -359,6 +355,7 @@ static void axisdev88_machine_init(MachineClass *mc) mc->desc ="AXIS devboard 88" ; mc->init = axisdev88_init; mc->is_default =1 ; + mc->default_cpu_type =CRIS_CPU_TYPE_NAME ("crisv32" ); }DEFINE_MACHINE ("axis-dev88" , axisdev88_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 05/39] lm32: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
introduce LM32_CPU_TYPE_NAME macro and consistently use it to construct cpu type names. While at it replace dynamic cpu type name composition with static data.
Message-Id: <[email protected]>
--- target/lm32/cpu.h | 3 +++ target/lm32/cpu.c | 74 +++++++++++++++++-------------------------------------- 2 files changed, 25 insertions(+), 52 deletions(-)
target/lm32/cpu.h +3 -0
@@ -257,6 +257,9 @@ bool lm32_cpu_do_semihosting(CPUState *cs);#define cpu_init (cpu_model) cpu_generic_init(TYPE_LM32_CPU, cpu_model) +#define LM32_CPU_TYPE_SUFFIX "-" TYPE_LM32_CPU +#define LM32_CPU_TYPE_NAME (model) model LM32_CPU_TYPE_SUFFIX +#define cpu_list lm32_cpu_list#define cpu_signal_handler cpu_lm32_signal_handler
target/lm32/cpu.c +22 -52
97 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 06/39] lm32: milkymist: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/lm32/milkymist.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/lm32/milkymist.c +2 -5
@@ -80,7 +80,6 @@ static void main_cpu_reset(void *opaque)static void milkymist_init (MachineState *machine) { -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -108,10 +107,7 @@ milkymist_init(MachineState *machine) reset_info =g_malloc0 (sizeof (ResetInfo)); -if (cpu_model ==NULL ) { - cpu_model ="lm32-full" ; - } - cpu =LM32_CPU (cpu_generic_init (TYPE_LM32_CPU , cpu_model)); + cpu =LM32_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info->cpu = cpu;
@@ -216,6 +212,7 @@ static void milkymist_machine_init(MachineClass *mc) mc->desc ="Milkymist One" ; mc->init = milkymist_init; mc->is_default =0 ; + mc->default_cpu_type =LM32_CPU_TYPE_NAME ("lm32-full" ); }DEFINE_MACHINE ("milkymist" , milkymist_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 07/39] lm32: lm32_boards: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/lm32/lm32_boards.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
hw/lm32/lm32_boards.c +4 -10
@@ -75,7 +75,6 @@ static void main_cpu_reset(void *opaque)static void lm32_evr_init (MachineState *machine) { -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;LM32CPU *cpu;CPULM32State *env;
@@ -101,10 +100,7 @@ static void lm32_evr_init(MachineState *machine) reset_info =g_malloc0 (sizeof (ResetInfo)); -if (cpu_model ==NULL ) { - cpu_model ="lm32-full" ; - } - cpu =LM32_CPU (cpu_generic_init (TYPE_LM32_CPU , cpu_model)); + cpu =LM32_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info->cpu = cpu;
@@ -163,7 +159,6 @@ static void lm32_evr_init(MachineState *machine)static void lm32_uclinux_init (MachineState *machine) { -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -198,10 +193,7 @@ static void lm32_uclinux_init(MachineState *machine) reset_info =g_malloc0 (sizeof (ResetInfo)); -if (cpu_model ==NULL ) { - cpu_model ="lm32-full" ; - } - cpu =LM32_CPU (cpu_generic_init (TYPE_LM32_CPU , cpu_model)); + cpu =LM32_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info->cpu = cpu;
@@ -295,6 +287,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data) mc->desc ="LatticeMico32 EVR32 eval system" ; mc->init = lm32_evr_init; mc->is_default =1 ; + mc->default_cpu_type =LM32_CPU_TYPE_NAME ("lm32-full" ); }static const TypeInfo lm32_evr_type = {
@@ -310,6 +303,7 @@ static void lm32_uclinux_class_init(ObjectClass *oc, void *data) mc->desc ="lm32 platform for uClinux and u-boot by Theobroma Systems" ; mc->init = lm32_uclinux_init; mc->is_default =0 ; + mc->default_cpu_type =LM32_CPU_TYPE_NAME ("lm32-full" ); }static const TypeInfo lm32_uclinux_type = {
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 08/39] m68k: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
use new M68K_CPU_TYPE_NAME to compose CPU type names and get rid of intermediate M68kCPUInfo/register_cpu_type() which is replaced by static TypeInfo array.
Message-Id: <[email protected]>
--- target/m68k/cpu.h | 3 +++ target/m68k/cpu.c | 75 ++++++++++++++++++++----------------------------------- 2 files changed, 30 insertions(+), 48 deletions(-)
target/m68k/cpu.h +3 -0
@@ -323,6 +323,9 @@ void register_m68k_insns (CPUM68KState *env);#define cpu_init (cpu_model) cpu_generic_init(TYPE_M68K_CPU, cpu_model) +#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU +#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX +#define cpu_signal_handler cpu_m68k_signal_handler#define cpu_list m68k_cpu_list
target/m68k/cpu.c +27 -48
93 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 09/39] m68k: an5206: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/m68k/an5206.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/m68k/an5206.c +2 -5
@@ -28,7 +28,6 @@static void an5206_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;M68kCPU *cpu;CPUM68KState *env;
@@ -39,10 +38,7 @@ static void an5206_init(MachineState *machine)MemoryRegion *ram =g_new (MemoryRegion,1 );MemoryRegion *sram =g_new (MemoryRegion,1 ); -if (!cpu_model) { - cpu_model ="m5206" ; - } - cpu =M68K_CPU (cpu_generic_init (TYPE_M68K_CPU , cpu_model)); + cpu =M68K_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;/* Initialize CPU registers. */
@@ -94,6 +90,7 @@ static void an5206_machine_init(MachineClass *mc) { mc->desc ="Arnewsh 5206" ; mc->init = an5206_init; + mc->default_cpu_type =M68K_CPU_TYPE_NAME ("m5206" ); }DEFINE_MACHINE ("an5206" , an5206_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 10/39] m68k: mcf5208: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/m68k/mcf5208.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/m68k/mcf5208.c +2 -5
@@ -218,7 +218,6 @@ static void mcf_fec_init(MemoryRegion *sysmem, NICInfo *nd, hwaddr base,static void mcf5208evb_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;M68kCPU *cpu;CPUM68KState *env;
@@ -230,10 +229,7 @@ static void mcf5208evb_init(MachineState *machine)MemoryRegion *ram =g_new (MemoryRegion,1 );MemoryRegion *sram =g_new (MemoryRegion,1 ); -if (!cpu_model) { - cpu_model ="m5208" ; - } - cpu =M68K_CPU (cpu_generic_init (TYPE_M68K_CPU , cpu_model)); + cpu =M68K_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;/* Initialize CPU registers. */
@@ -322,6 +318,7 @@ static void mcf5208evb_machine_init(MachineClass *mc) mc->desc ="MCF5206EVB" ; mc->init = mcf5208evb_init; mc->is_default =1 ; + mc->default_cpu_type =M68K_CPU_TYPE_NAME ("m5208" ); }DEFINE_MACHINE ("mcf5208evb" , mcf5208evb_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 11/39] moxie: fix qemu-system-moxie failing to start with CLI "-cpu MoxieLite"
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
It 'works' with default CPU only because of bug in moxie_cpu_class_by_name() where it treats cpu_model as type name and default cpu_model also happens to be type name. But specifying explicitly cpu on CLI,
ex: '-cpu MoxieLite', makes QEMU fail since moxie_cpu_class_by_name() doesn't traslate cpu_model to cpu type and fails to find corresponding object class.
Fix moxie_cpu_class_by_name() to do proper
cpu_model -> cpu type
translation and fix default cpu_model to be cpu_model instead of being typename.
Message-Id: <[email protected]>
--- hw/moxie/moxiesim.c | 2 +- target/moxie/cpu.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
hw/moxie/moxiesim.c +1 -1
@@ -116,7 +116,7 @@ static void moxiesim_init(MachineState *machine)/* Init CPUs. */ if (cpu_model ==NULL ) { - cpu_model ="MoxieLite-moxie-cpu" ; + cpu_model ="MoxieLite" ; } cpu =MOXIE_CPU (cpu_generic_init (TYPE_MOXIE_CPU , cpu_model)); env = &cpu->env;
target/moxie/cpu.c +6 -1
@@ -83,7 +83,12 @@ static void moxie_cpu_initfn(Object *obj)static ObjectClass *moxie_cpu_class_by_name (const char *cpu_model) { -ObjectClass *oc =object_class_by_name (cpu_model); +ObjectClass *oc; +char *typename; + + typename =g_strdup_printf ("%s-" TYPE_MOXIE_CPU , cpu_model); + oc =object_class_by_name (typename); +g_free (typename);if (oc !=NULL && (!object_class_dynamic_cast (oc,TYPE_MOXIE_CPU ) ||object_class_is_abstract (oc))) {return NULL ;
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 12/39] moxie: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
introduce MOXIE_CPU_TYPE_NAME macro and consistently use it to construct cpu type names. While at it replace dynamic cpu type name composition with static data.
Message-Id: <[email protected]>
--- target/moxie/cpu.h | 3 +++ target/moxie/cpu.c | 56 +++++++++++++++++------------------------------------- 2 files changed, 20 insertions(+), 39 deletions(-)
target/moxie/cpu.h +3 -0
@@ -122,6 +122,9 @@ int cpu_moxie_signal_handler(int host_signum, void *pinfo,#define cpu_init (cpu_model) cpu_generic_init(TYPE_MOXIE_CPU, cpu_model) +#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU +#define MOXIE_CPU_TYPE_NAME (model) model MOXIE_CPU_TYPE_SUFFIX +#define cpu_signal_handler cpu_moxie_signal_handlerstatic inline int cpu_mmu_index (CPUMoxieState *env,bool ifetch)
target/moxie/cpu.c +17 -39
70 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 13/39] moxie: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/moxie/moxiesim.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/moxie/moxiesim.c +2 -5
@@ -103,7 +103,6 @@ static void moxiesim_init(MachineState *machine) {MoxieCPU *cpu =NULL ;ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -115,10 +114,7 @@ static void moxiesim_init(MachineState *machine)LoaderParams loader_params;/* Init CPUs. */ -if (cpu_model ==NULL ) { - cpu_model ="MoxieLite" ; - } - cpu =MOXIE_CPU (cpu_generic_init (TYPE_MOXIE_CPU , cpu_model)); + cpu =MOXIE_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;qemu_register_reset (main_cpu_reset, cpu);
@@ -150,6 +146,7 @@ static void moxiesim_machine_init(MachineClass *mc) mc->desc ="Moxie simulator platform" ; mc->init = moxiesim_init; mc->is_default =1 ; + mc->default_cpu_type =MOXIE_CPU_TYPE_NAME ("MoxieLite" ); }DEFINE_MACHINE ("moxiesim" , moxiesim_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 14/39] openrisc: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
use new OPENRISC_CPU_TYPE_NAME to compose CPU type name and get rid of intermediate OpenRISCCPUInfo/openrisc_cpu_register_types() which is replaced by static TypeInfo array.
Message-Id: <[email protected]>
--- target/openrisc/cpu.h | 3 +++ target/openrisc/cpu.c | 69 +++++++++++++++++---------------------------------- 2 files changed, 26 insertions(+), 46 deletions(-)
target/openrisc/cpu.h +3 -0
@@ -392,6 +392,9 @@ int cpu_openrisc_get_phys_data(OpenRISCCPU *cpu,#define cpu_init (cpu_model) cpu_generic_init(TYPE_OPENRISC_CPU, cpu_model) +#define OPENRISC_CPU_TYPE_SUFFIX "-" TYPE_OPENRISC_CPU +#define OPENRISC_CPU_TYPE_NAME (model) model OPENRISC_CPU_TYPE_SUFFIX +#include "exec/cpu-all.h" #define TB_FLAGS_DFLAG 1
target/openrisc/cpu.c +23 -46
90 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 15/39] openrisc: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/openrisc/openrisc_sim.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/openrisc/openrisc_sim.c +2 -6
@@ -125,7 +125,6 @@ static void openrisc_load_kernel(ram_addr_t ram_size,static void openrisc_sim_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;OpenRISCCPU *cpu =NULL ;MemoryRegion *ram;
@@ -133,12 +132,8 @@ static void openrisc_sim_init(MachineState *machine)qemu_irq serial_irq;int n; -if (!cpu_model) { - cpu_model ="or1200" ; - } -for (n =0 ; n < smp_cpus; n++) { - cpu =OPENRISC_CPU (cpu_generic_init (TYPE_OPENRISC_CPU , cpu_model)); + cpu =OPENRISC_CPU (cpu_create (machine->cpu_type));if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition!\n" );exit (1 );
@@ -180,6 +175,7 @@ static void openrisc_sim_machine_init(MachineClass *mc) mc->init = openrisc_sim_init; mc->max_cpus =2 ; mc->is_default =1 ; + mc->default_cpu_type =OPENRISC_CPU_TYPE_NAME ("or1200" ); }DEFINE_MACHINE ("or1k-sim" , openrisc_sim_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 16/39] sh4: r2d: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/sh4/r2d.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/sh4/r2d.c +2 -6
@@ -225,7 +225,6 @@ static struct QEMU_PACKEDstatic void r2d_init (MachineState *machine) { -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -242,11 +241,7 @@ static void r2d_init(MachineState *machine)MemoryRegion *address_space_mem =get_system_memory ();PCIBus *pci_bus; -if (cpu_model ==NULL ) { - cpu_model ="SH7751R" ; - } - - cpu =SUPERH_CPU (cpu_generic_init (TYPE_SUPERH_CPU , cpu_model)); + cpu =SUPERH_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info =g_malloc0 (sizeof (ResetData));
@@ -365,6 +360,7 @@ static void r2d_machine_init(MachineClass *mc) mc->desc ="r2d-plus board" ; mc->init = r2d_init; mc->block_default_type =IF_IDE ; + mc->default_cpu_type =TYPE_SH7751R_CPU ; }DEFINE_MACHINE ("r2d" , r2d_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 17/39] sh4: shix: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
default cpu model 'any' resolves to type TYPE_SH7750R_CPU in superh_cpu_class_by_name(), so use it directly.
Message-Id: <[email protected]>
--- hw/sh4/shix.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/sh4/shix.c +2 -5
@@ -45,7 +45,6 @@static void shix_init (MachineState *machine) { -const char *cpu_model = machine->cpu_model;int ret;SuperHCPU *cpu;struct SH7750State *s;
@@ -53,10 +52,7 @@ static void shix_init(MachineState *machine)MemoryRegion *rom =g_new (MemoryRegion,1 );MemoryRegion *sdram =g_new (MemoryRegion,2 ); -if (!cpu_model) - cpu_model ="any" ; - - cpu =SUPERH_CPU (cpu_generic_init (TYPE_SUPERH_CPU , cpu_model)); + cpu =SUPERH_CPU (cpu_create (machine->cpu_type));/* Allocate memory space */ memory_region_init_ram (rom,NULL ,"shix.rom" ,0x4000 , &error_fatal);
@@ -89,6 +85,7 @@ static void shix_machine_init(MachineClass *mc) mc->desc ="shix card" ; mc->init = shix_init; mc->is_default =1 ; + mc->default_cpu_type =TYPE_SH7750R_CPU ; }DEFINE_MACHINE ("shix" , shix_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 18/39] sh4: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
introduce SUPERH_CPU_TYPE_NAME macro and use it to construct cpu type names. While at it move cpu type_infos into one array and register it directly with type_init_from_array() instead of custom superh_cpu_register_types()
Message-Id: <[email protected]>
--- target/sh4/cpu-qom.h | 6 ++--- target/sh4/cpu.h | 3 +++ target/sh4/cpu.c | 63 +++++++++++++++++++++------------------------------- 3 files changed, 31 insertions(+), 41 deletions(-)
target/sh4/cpu-qom.h +3 -3
@@ -24,9 +24,9 @@#define TYPE_SUPERH_CPU "superh-cpu" -#define TYPE_SH7750R_CPU "sh7750r-" TYPE_SUPERH_CPU -#define TYPE_SH7751R_CPU "sh7751r-" TYPE_SUPERH_CPU -#define TYPE_SH7785_CPU "sh7785-" TYPE_SUPERH_CPU +#define TYPE_SH7750R_CPU SUPERH_CPU_TYPE_NAME("sh7750r") +#define TYPE_SH7751R_CPU SUPERH_CPU_TYPE_NAME("sh7751r") +#define TYPE_SH7785_CPU SUPERH_CPU_TYPE_NAME("sh7785")#define SUPERH_CPU_CLASS (klass) \ OBJECT_CLASS_CHECK(SuperHCPUClass, (klass), TYPE_SUPERH_CPU)
target/sh4/cpu.h +3 -0
@@ -274,6 +274,9 @@ void cpu_load_tlb(CPUSH4State * env);#define cpu_init (cpu_model) cpu_generic_init(TYPE_SUPERH_CPU, cpu_model) +#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU +#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX +#define cpu_signal_handler cpu_sh4_signal_handler#define cpu_list sh4_cpu_list
target/sh4/cpu.c +25 -38
86 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 19/39] sh4: simplify superh_cpu_class_by_name()
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
currently for sh4 cpu_model argument for '-cpu' option could be either 'cpu model' name or cpu_typename.
however typically '-cpu' takes 'cpu model' name and cpu type for sh4 target isn't advertised publicly ('-cpu help' prints only 'cpu model' names) so we shouldn't care about this use case (it's more of a bug).
1. Drop '-cpu cpu_typename' to align with the rest of targets.
2. Compose searched for typename from cpu model and use it with object_class_by_name() directly instead of over-complicated
object_class_get_list() g_slist_find_custom() + superh_cpu_name_compare()
With #1 droped, #2 could be used for both lookups which simplifies superh_cpu_class_by_name() quite a bit.
Message-Id: <[email protected]>
--- linux-user/main.c | 2 +- target/sh4/cpu.c | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-)
linux-user/main.c +1 -1
@@ -4331,7 +4331,7 @@ int main(int argc, char **argv, char **envp) cpu_model ="750" ;# endif #elif defined TARGET_SH4 - cpu_model =TYPE_SH7785_CPU ; + cpu_model ="sh7785" ;#elif defined TARGET_S390X cpu_model ="qemu" ;#else
target/sh4/cpu.c +12 -22
@@ -120,36 +120,26 @@ void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf)g_slist_free (list); } -static gint superh_cpu_name_compare (gconstpointer a,gconstpointer b) -{ -const SuperHCPUClass *scc =SUPERH_CPU_CLASS (a); -const char *name = b; - -return strcasecmp (scc->name, name); -} -static ObjectClass *superh_cpu_class_by_name (const char *cpu_model) {ObjectClass *oc; -GSList *list, *item; +char *s, *typename =NULL ; -if (strcasecmp (cpu_model,"any" ) ==0 ) { -return object_class_by_name (TYPE_SH7750R_CPU ); + s =g_ascii_strdown (cpu_model,-1 ); +if (strcmp (s,"any" ) ==0 ) { + oc =object_class_by_name (TYPE_SH7750R_CPU ); + goto out; } - oc =object_class_by_name (cpu_model); -if (oc !=NULL &&object_class_dynamic_cast (oc,TYPE_SUPERH_CPU ) !=NULL - && !object_class_is_abstract (oc)) { -return oc; + typename =g_strdup_printf (SUPERH_CPU_TYPE_NAME ("%s" ), s); + oc =object_class_by_name (typename); +if (oc !=NULL &&object_class_is_abstract (oc)) { + oc =NULL ; } - oc =NULL ; - list =object_class_get_list (TYPE_SUPERH_CPU , false); - item =g_slist_find_custom (list, cpu_model, superh_cpu_name_compare); -if (item !=NULL ) { - oc = item->data; - } -g_slist_free (list); +out: +g_free (s); +g_free (typename);return oc; }
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 20/39] sh4: remove SuperHCPUClass::name field
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
the field contains upper-cased cpu model name and is used for printing supported cpu model names for '-cpu help'.
Considering that cpu model lookup in superh_cpu_class_by_name() is case-insensitive, we can drop upper-casing when printing supported cpus list and use cpu type directly to do the same by cutting out SUPERH_CPU_TYPE_SUFFIX from typename.
It allows to remove SuperHCPUClass::name, which practically duplicates names defined by TYPE_SH*_CPU definitions and simplify sh*_class_init()/SuperHCPUClass a bit.
Message-Id: <[email protected]>
--- target/sh4/cpu-qom.h | 2 -- target/sh4/cpu.c | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-)
target/sh4/cpu-qom.h +0 -2
@@ -39,7 +39,6 @@* SuperHCPUClass: * @parent_realize: The parent class' realize handler. * @parent_reset: The parent class' reset handler. -* @name: The name. * @pvr: Processor Version Register * @prr: Processor Revision Register * @cvr: Cache Version Register
@@ -54,7 +53,6 @@ typedef struct SuperHCPUClass {DeviceRealize parent_realize;void (*parent_reset)(CPUState *cpu); -const char *name;uint32_t pvr;uint32_t prr;uint32_t cvr;
target/sh4/cpu.c +3 -7
@@ -98,12 +98,11 @@ static gint superh_cpu_list_compare(gconstpointer a, gconstpointer b)static void superh_cpu_list_entry (gpointer data,gpointer user_data) { -ObjectClass *oc = data; -SuperHCPUClass *scc =SUPERH_CPU_CLASS (oc);SuperHCPUListState *s = user_data; +const char *typename =object_class_get_name (OBJECT_CLASS (data)); +int len =strlen (typename) -strlen (SUPERH_CPU_TYPE_SUFFIX ); - (*s->cpu_fprintf)(s->file,"%s\n" , - scc->name); + (*s->cpu_fprintf)(s->file,"%.*s\n" , len, typename); }void sh4_cpu_list (FILE *f,fprintf_function cpu_fprintf)
@@ -156,7 +155,6 @@ static void sh7750r_class_init(ObjectClass *oc, void *data) {SuperHCPUClass *scc =SUPERH_CPU_CLASS (oc); - scc->name ="SH7750R" ; scc->pvr =0x00050000 ; scc->prr =0x00000100 ; scc->cvr =0x00110000 ;
@@ -175,7 +173,6 @@ static void sh7751r_class_init(ObjectClass *oc, void *data) {SuperHCPUClass *scc =SUPERH_CPU_CLASS (oc); - scc->name ="SH7751R" ; scc->pvr =0x04050005 ; scc->prr =0x00000113 ; scc->cvr =0x00110000 ;/* Neutered caches, should be 0x20480000 */
@@ -194,7 +191,6 @@ static void sh7785_class_init(ObjectClass *oc, void *data) {SuperHCPUClass *scc =SUPERH_CPU_CLASS (oc); - scc->name ="SH7785" ; scc->pvr =0x10300700 ; scc->prr =0x00000200 ; scc->cvr =0x71440211 ;
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 21/39] xtensa: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
use new XTENSA_CPU_TYPE_NAME to compose CPU type name to bring xtensa in line with all other targets that will similar macro.
Message-Id: <[email protected]>
--- target/xtensa/cpu.h | 4 ++++ target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
target/xtensa/cpu.h +4 -0
@@ -469,11 +469,15 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,#define cpu_signal_handler cpu_xtensa_signal_handler#define cpu_list xtensa_cpu_list +#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU +#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX +#ifdef TARGET_WORDS_BIGENDIAN #define XTENSA_DEFAULT_CPU_MODEL "fsf"#else #define XTENSA_DEFAULT_CPU_MODEL "dc232b"#endif +#define XTENSA_DEFAULT_CPU_TYPE XTENSA_CPU_TYPE_NAME(XTENSA_DEFAULT_CPU_MODEL)#define cpu_init (cpu_model) cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)
target/xtensa/cpu.c +1 -1
@@ -83,7 +83,7 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model)ObjectClass *oc;char *typename; - typename =g_strdup_printf ("%s-" TYPE_XTENSA_CPU , cpu_model); + typename =g_strdup_printf (XTENSA_CPU_TYPE_NAME ("%s" ), cpu_model); oc =object_class_by_name (typename);g_free (typename); if (oc == NULL || !object_class_dynamic_cast(oc, TYPE_XTENSA_CPU) ||
target/xtensa/helper.c +1 -1
@@ -76,7 +76,7 @@ void xtensa_register_core(XtensaConfigList *node) node->next = xtensa_cores; xtensa_cores = node; - type.name =g_strdup_printf ("%s-" TYPE_XTENSA_CPU , node->config->name); + type.name =g_strdup_printf (XTENSA_CPU_TYPE_NAME ("%s" ), node->config->name);type_register (&type);g_free ((gpointer )type.name); }
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 22/39] xtensa: sim: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/xtensa/sim.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/xtensa/sim.c +2 -6
@@ -75,16 +75,11 @@ static void xtensa_sim_init(MachineState *machine)XtensaCPU *cpu =NULL ;CPUXtensaState *env =NULL ;ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;int n; -if (!cpu_model) { - cpu_model =XTENSA_DEFAULT_CPU_MODEL ; - } -for (n =0 ; n < smp_cpus; n++) { - cpu =XTENSA_CPU (cpu_generic_init (TYPE_XTENSA_CPU , cpu_model)); + cpu =XTENSA_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; env->sregs[PRID ] = n;
@@ -133,6 +128,7 @@ static void xtensa_sim_machine_init(MachineClass *mc) mc->init = xtensa_sim_init; mc->max_cpus =4 ; mc->no_serial =1 ; + mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; }DEFINE_MACHINE ("sim" , xtensa_sim_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 23/39] xtensa: lx60/lx200/ml605/kc705: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/xtensa/xtfpga.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
hw/xtensa/xtfpga.c +5 -6
@@ -220,19 +220,14 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)DriveInfo *dinfo;pflash_t *flash =NULL ;QemuOpts *machine_opts =qemu_get_machine_opts (); -const char *cpu_model = machine->cpu_model;const char *kernel_filename =qemu_opt_get (machine_opts,"kernel" );const char *kernel_cmdline =qemu_opt_get (machine_opts,"append" );const char *dtb_filename =qemu_opt_get (machine_opts,"dtb" );const char *initrd_filename =qemu_opt_get (machine_opts,"initrd" );int n; -if (!cpu_model) { - cpu_model =XTENSA_DEFAULT_CPU_MODEL ; - } -for (n =0 ; n < smp_cpus; n++) { - cpu =XTENSA_CPU (cpu_generic_init (TYPE_XTENSA_CPU , cpu_model)); + cpu =XTENSA_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; env->sregs[PRID ] = n;
@@ -454,6 +449,7 @@ static void xtensa_lx60_class_init(ObjectClass *oc, void *data) mc->desc ="lx60 EVB (" XTENSA_DEFAULT_CPU_MODEL ")" ; mc->init = xtensa_lx60_init; mc->max_cpus =4 ; + mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; }static const TypeInfo xtensa_lx60_type = {
@@ -469,6 +465,7 @@ static void xtensa_lx200_class_init(ObjectClass *oc, void *data) mc->desc ="lx200 EVB (" XTENSA_DEFAULT_CPU_MODEL ")" ; mc->init = xtensa_lx200_init; mc->max_cpus =4 ; + mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; }static const TypeInfo xtensa_lx200_type = {
@@ -484,6 +481,7 @@ static void xtensa_ml605_class_init(ObjectClass *oc, void *data) mc->desc ="ml605 EVB (" XTENSA_DEFAULT_CPU_MODEL ")" ; mc->init = xtensa_ml605_init; mc->max_cpus =4 ; + mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; }static const TypeInfo xtensa_ml605_type = {
@@ -499,6 +497,7 @@ static void xtensa_kc705_class_init(ObjectClass *oc, void *data) mc->desc ="kc705 EVB (" XTENSA_DEFAULT_CPU_MODEL ")" ; mc->init = xtensa_kc705_init; mc->max_cpus =4 ; + mc->default_cpu_type =XTENSA_DEFAULT_CPU_TYPE ; }static const TypeInfo xtensa_kc705_type = {
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 24/39] unicore32: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
use new UNICORE32_CPU_TYPE_NAME to compose CPU type name and get rid of intermediate
UniCore32CPUInfo/uc32_cpu_register_types()
which is replaced by static TypeInfo array and type_init_from_array()
Message-Id: <[email protected]>
--- target/unicore32/cpu.h | 3 +++ target/unicore32/cpu.c | 61 +++++++++++++++++--------------------------------- 2 files changed, 23 insertions(+), 41 deletions(-)
target/unicore32/cpu.h +3 -0
@@ -167,6 +167,9 @@ static inline int cpu_mmu_index(CPUUniCore32State *env, bool ifetch)#define cpu_init (cpu_model) cpu_generic_init(TYPE_UNICORE32_CPU, cpu_model) +#define UNICORE32_CPU_TYPE_SUFFIX "-" TYPE_UNICORE32_CPU +#define UNICORE32_CPU_TYPE_NAME (model) model UNICORE32_CPU_TYPE_SUFFIX +static inline void cpu_get_tb_cpu_state (CPUUniCore32State *env,target_ulong *pc,target_ulong *cs_base,uint32_t *flags) {
target/unicore32/cpu.c +20 -41
85 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 25/39] unicore32: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/unicore32/puv3.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/unicore32/puv3.c +2 -6
@@ -112,7 +112,6 @@ static void puv3_load_kernel(const char *kernel_filename)static void puv3_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *initrd_filename = machine->initrd_filename;CPUUniCore32State *env;
@@ -123,11 +122,7 @@ static void puv3_init(MachineState *machine)exit (1 ); } -if (!cpu_model) { - cpu_model ="UniCore-II" ; - } - - cpu =UNICORE32_CPU (cpu_generic_init (TYPE_UNICORE32_CPU , cpu_model)); + cpu =UNICORE32_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;puv3_soc_init (env);
@@ -140,6 +135,7 @@ static void puv3_machine_init(MachineClass *mc) mc->desc ="PKUnity Version-3 based on UniCore32" ; mc->init = puv3_init; mc->is_default =1 ; + mc->default_cpu_type =UNICORE32_CPU_TYPE_NAME ("UniCore-II" ); }DEFINE_MACHINE ("puv3" , puv3_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 26/39] tricore: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
introduce TRICORE_CPU_TYPE_NAME macro and use it to construct cpu type names. While at it move cpu type_infos into one array and register it directly with type_init_from_array() instead of custom tricore_cpu_register_types()/cpu_register()
Message-Id: <[email protected]>
--- target/tricore/cpu.h | 2 ++ target/tricore/cpu.c | 68 ++++++++++++++++------------------------------------ 2 files changed, 22 insertions(+), 48 deletions(-)
target/tricore/cpu.h +2 -0
@@ -413,6 +413,8 @@ static inline void cpu_get_tb_cpu_state(CPUTriCoreState *env, target_ulong *pc,#define cpu_init (cpu_model) cpu_generic_init(TYPE_TRICORE_CPU, cpu_model) +#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU +#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX/* helpers.c */ int cpu_tricore_handle_mmu_fault(CPUState *cpu, target_ulong address,
target/tricore/cpu.c +20 -48
87 lines not on this page · raw message
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 27/39] tricore: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/tricore/tricore_testboard.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/tricore/tricore_testboard.c +2 -4
@@ -71,10 +71,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id)MemoryRegion *pcp_data =g_new (MemoryRegion,1 );MemoryRegion *pcp_text =g_new (MemoryRegion,1 ); -if (!machine->cpu_model) { - machine->cpu_model ="tc1796" ; - } - cpu =TRICORE_CPU (cpu_generic_init (TYPE_TRICORE_CPU , machine->cpu_model)); + cpu =TRICORE_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;memory_region_init_ram (ext_cram,NULL ,"powerlink_ext_c.ram" ,2 *1024 *1024 , &error_fatal);
@@ -114,6 +111,7 @@ static void ttb_machine_init(MachineClass *mc) mc->desc ="a minimal TriCore board" ; mc->init = tricoreboard_init; mc->is_default =0 ; + mc->default_cpu_type =TRICORE_CPU_TYPE_NAME ("tc1796" ); }DEFINE_MACHINE ("tricore_testboard" , ttb_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 28/39] sparc: cleanup cpu type name composition
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
introduce SPARC_CPU_TYPE_NAME macro and use it to construct cpu type names.
Message-Id: <[email protected]>
--- target/sparc/cpu.h | 3 +++ target/sparc/cpu.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
target/sparc/cpu.h +3 -0
@@ -658,6 +658,9 @@ int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);#define cpu_init (cpu_model) cpu_generic_init(TYPE_SPARC_CPU, cpu_model)#endif +#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU +#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX +#define cpu_signal_handler cpu_sparc_signal_handler#define cpu_list sparc_cpu_list
target/sparc/cpu.c +1 -1
@@ -712,7 +712,7 @@ static bool sparc_cpu_has_work(CPUState *cs)static char *sparc_cpu_type_name (const char *cpu_model) { -char *name =g_strdup_printf ("%s-" TYPE_SPARC_CPU , cpu_model); +char *name =g_strdup_printf (SPARC_CPU_TYPE_NAME ("%s" ), cpu_model);char *s = name;/* SPARC cpu model names happen to have whitespaces,
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 29/39] sparc: sun4u/sun4v/niagara: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- include/hw/sparc/sparc64.h | 3 +-- hw/sparc64/niagara.c | 4 ++-- hw/sparc64/sparc64.c | 8 ++------ hw/sparc64/sun4u.c | 8 +++----- 4 files changed, 8 insertions(+), 15 deletions(-)
include/hw/sparc/sparc64.h +1 -2
@@ -1,5 +1,4 @@ -SPARCCPU *sparc64_cpu_devinit (const char *cpu_model, -const char *dflt_cpu_model,uint64_t prom_addr); +SPARCCPU *sparc64_cpu_devinit (const char *cpu_type,uint64_t prom_addr);void sparc64_cpu_set_ivec_irq (void *opaque,int irq,int level);
hw/sparc64/niagara.c +2 -2
@@ -106,8 +106,7 @@ static void niagara_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();/* init CPUs */ -sparc64_cpu_devinit (machine->cpu_model,"Sun UltraSparc T1" , -NIAGARA_PROM_BASE ); +sparc64_cpu_devinit (machine->cpu_type,NIAGARA_PROM_BASE );/* set up devices */ memory_region_allocate_system_memory (&s->hv_ram,NULL ,"sun4v-hv.ram" ,NIAGARA_HV_RAM_SIZE );
@@ -174,6 +173,7 @@ static void niagara_class_init(ObjectClass *oc, void *data) mc->init = niagara_init; mc->max_cpus =1 ;/* XXX for now */ mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("Sun-UltraSparc-T1" ); }static const TypeInfo niagara_type = {
hw/sparc64/sparc64.c +2 -6
@@ -339,8 +339,7 @@ void cpu_tick_set_limit(CPUTimer *timer, uint64_t limit) } } -SPARCCPU *sparc64_cpu_devinit (const char *cpu_model, -const char *default_cpu_model,uint64_t prom_addr) +SPARCCPU *sparc64_cpu_devinit (const char *cpu_type,uint64_t prom_addr) {SPARCCPU *cpu;CPUSPARCState *env;
@@ -350,10 +349,7 @@ SPARCCPU *sparc64_cpu_devinit(const char *cpu_model,uint32_t stick_frequency =100 *1000000 ;uint32_t hstick_frequency =100 *1000000 ; -if (cpu_model ==NULL ) { - cpu_model = default_cpu_model; - } - cpu =SPARC_CPU (cpu_generic_init (TYPE_SPARC_CPU , cpu_model)); + cpu =SPARC_CPU (cpu_create (cpu_type)); env = &cpu->env; env->tick = cpu_timer_create("tick", cpu, tick_irq,
hw/sparc64/sun4u.c +3 -5
@@ -75,7 +75,6 @@#define IVEC_MAX 0x40struct hwdef { -const char *const default_cpu_model;uint16_t machine_id;uint64_t prom_addr;uint64_t console_serial_base;
@@ -446,8 +445,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,bool onboard_nic;/* init CPUs */ - cpu =sparc64_cpu_devinit (machine->cpu_model, hwdef->default_cpu_model, - hwdef->prom_addr); + cpu =sparc64_cpu_devinit (machine->cpu_type, hwdef->prom_addr);/* set up devices */ ram_init (0 , machine->ram_size);
@@ -599,14 +597,12 @@ enum {static const struct hwdef hwdefs[] = {/* Sun4u generic PC-like machine */ { - .default_cpu_model ="TI UltraSparc IIi" , .machine_id = sun4u_id, .prom_addr =0x1fff0000000ULL , .console_serial_base =0 , },/* Sun4v generic PC-like machine */ { - .default_cpu_model ="Sun UltraSparc T1" , .machine_id = sun4v_id, .prom_addr =0x1fff0000000ULL , .console_serial_base =0 ,
@@ -635,6 +631,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data) mc->max_cpus =1 ;/* XXX for now */ mc->is_default =1 ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-UltraSparc-IIi" ); }static const TypeInfo sun4u_type = {
@@ -652,6 +649,7 @@ static void sun4v_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_IDE ; mc->max_cpus =1 ;/* XXX for now */ mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("Sun-UltraSparc-T1" ); }static const TypeInfo sun4v_type = {
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 30/39] sparc: sparc: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/sparc/sun4m.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
hw/sparc/sun4m.c +12 -17
@@ -94,7 +94,6 @@ struct sun4m_hwdef { } vsimm[MAX_VSIMMS ];hwaddr ecc_base;uint64_t max_mem; -const char *const default_cpu_model;uint32_t ecc_version;uint32_t iommu_version;uint16_t machine_id;
@@ -790,14 +789,14 @@ static const TypeInfo ram_info = { .class_init = ram_class_init, }; -static void cpu_devinit (const char *cpu_model,unsigned int id, +static void cpu_devinit (const char *cpu_type,unsigned int id,uint64_t prom_addr,qemu_irq **cpu_irqs) {CPUState *cs;SPARCCPU *cpu;CPUSPARCState *env; - cpu =SPARC_CPU (cpu_generic_init (TYPE_SPARC_CPU , cpu_model)); + cpu =SPARC_CPU (cpu_create (cpu_type)); env = &cpu->env;cpu_sparc_set_id (env, id);
@@ -820,7 +819,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, MachineState *machine) {DeviceState *slavio_intctl; -const char *cpu_model = machine->cpu_model;unsigned int i;void *iommu, *espdma, *ledma, *nvram; qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS],
@@ -833,11 +831,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,unsigned int num_vsimms;/* init CPUs */ -if (!cpu_model) - cpu_model = hwdef->default_cpu_model; -for (i =0 ; i < smp_cpus; i++) { -cpu_devinit (cpu_model, i, hwdef->slavio_base, &cpu_irqs[i]); +cpu_devinit (machine->cpu_type, i, hwdef->slavio_base, &cpu_irqs[i]); }for (i = smp_cpus; i <MAX_CPUS ; i++)
@@ -1074,7 +1069,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = ss5_id, .iommu_version = 0x05000000, .max_mem = 0x10000000, - .default_cpu_model = "Fujitsu MB86904", },/* SS-10 */ {
@@ -1100,7 +1094,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = ss10_id, .iommu_version = 0x03000000, .max_mem = 0xf00000000ULL, - .default_cpu_model = "TI SuperSparc II", },/* SS-600MP */ {
@@ -1124,7 +1117,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = ss600mp_id, .iommu_version = 0x01000000, .max_mem = 0xf00000000ULL, - .default_cpu_model = "TI SuperSparc II", },/* SS-20 */ {
@@ -1166,7 +1158,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = ss20_id, .iommu_version = 0x13000000, .max_mem = 0xf00000000ULL, - .default_cpu_model = "TI SuperSparc II", },/* Voyager */ {
@@ -1190,7 +1181,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = vger_id, .iommu_version = 0x05000000, .max_mem = 0x10000000, - .default_cpu_model = "Fujitsu MB86904", },/* LX */ {
@@ -1215,7 +1205,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = lx_id, .iommu_version = 0x04000000, .max_mem = 0x10000000, - .default_cpu_model = "TI MicroSparc I", },/* SS-4 */ {
@@ -1240,7 +1229,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = ss4_id, .iommu_version = 0x05000000, .max_mem = 0x10000000, - .default_cpu_model = "Fujitsu MB86904", },/* SPARCClassic */ {
@@ -1264,7 +1252,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = scls_id, .iommu_version = 0x05000000, .max_mem = 0x10000000, - .default_cpu_model = "TI MicroSparc I", },/* SPARCbook */ {
@@ -1288,7 +1275,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = { .machine_id = sbook_id, .iommu_version = 0x05000000, .max_mem = 0x10000000, - .default_cpu_model = "TI MicroSparc I", }, };
@@ -1355,6 +1341,7 @@ static void ss5_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_SCSI ; mc->is_default =1 ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("Fujitsu-MB86904" ); }static const TypeInfo ss5_type = {
@@ -1372,6 +1359,7 @@ static void ss10_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_SCSI ; mc->max_cpus =4 ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-SuperSparc-II" ); }static const TypeInfo ss10_type = {
@@ -1389,6 +1377,7 @@ static void ss600mp_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_SCSI ; mc->max_cpus =4 ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-SuperSparc-II" ); }static const TypeInfo ss600mp_type = {
@@ -1406,6 +1395,7 @@ static void ss20_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_SCSI ; mc->max_cpus =4 ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-SuperSparc-II" ); }static const TypeInfo ss20_type = {
@@ -1422,6 +1412,7 @@ static void voyager_class_init(ObjectClass *oc, void *data) mc->init = vger_init; mc->block_default_type =IF_SCSI ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("Fujitsu-MB86904" ); }static const TypeInfo voyager_type = {
@@ -1438,6 +1429,7 @@ static void ss_lx_class_init(ObjectClass *oc, void *data) mc->init = ss_lx_init; mc->block_default_type =IF_SCSI ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-MicroSparc-I" ); }static const TypeInfo ss_lx_type = {
@@ -1454,6 +1446,7 @@ static void ss4_class_init(ObjectClass *oc, void *data) mc->init = ss4_init; mc->block_default_type =IF_SCSI ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("Fujitsu-MB86904" ); }static const TypeInfo ss4_type = {
@@ -1470,6 +1463,7 @@ static void scls_class_init(ObjectClass *oc, void *data) mc->init = scls_init; mc->block_default_type =IF_SCSI ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-MicroSparc-I" ); }static const TypeInfo scls_type = {
@@ -1486,6 +1480,7 @@ static void sbook_class_init(ObjectClass *oc, void *data) mc->init = sbook_init; mc->block_default_type =IF_SCSI ; mc->default_boot_order ="c" ; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("TI-MicroSparc-I" ); }static const TypeInfo sbook_type = {
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 31/39] sparc: leon3: use generic cpu_model parsing
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/sparc/leon3.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/sparc/leon3.c +2 -6
@@ -107,7 +107,6 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)static void leon3_generic_hw_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;SPARCCPU *cpu;CPUSPARCState *env;
@@ -122,11 +121,7 @@ static void leon3_generic_hw_init(MachineState *machine)ResetData *reset_info;/* Init CPU */ -if (!cpu_model) { - cpu_model ="LEON3" ; - } - - cpu =SPARC_CPU (cpu_generic_init (TYPE_SPARC_CPU , cpu_model)); + cpu =SPARC_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;cpu_sparc_set_id (env,0 );
@@ -222,6 +217,7 @@ static void leon3_generic_machine_init(MachineClass *mc) { mc->desc ="Leon-3 generic" ; mc->init = leon3_generic_hw_init; + mc->default_cpu_type =SPARC_CPU_TYPE_NAME ("LEON3" ); }DEFINE_MACHINE ("leon3_generic" , leon3_generic_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 32/39] mips: use object_new() instead of gnew()+object_initialize()
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
object_initialize() is intended for inplace initialization of objects, but here it's first allocated with g_new0() and then initialized with object_initialize(). QEMU already has API to do this (object_new), so do object creation with suitable for usecase API.
Message-Id: <[email protected]>
--- hw/mips/boston.c | 3 +-- hw/mips/mips_malta.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
hw/mips/boston.c +1 -2
@@ -460,7 +460,6 @@ static void boston_mach_init(MachineState *machine) s =BOSTON (dev); s->mach = machine; - s->cps =g_new0 (MIPSCPSState,1 );if (!cpu_supports_cps_smp (cpu_model)) {error_report ("Boston requires CPUs which support CPS" );
@@ -469,7 +468,7 @@ static void boston_mach_init(MachineState *machine) is_64b =cpu_supports_isa (cpu_model,ISA_MIPS64 ); -object_initialize (s->cps,sizeof (MIPSCPSState),TYPE_MIPS_CPS ); + s->cps =MIPS_CPS (object_new (TYPE_MIPS_CPS ));qdev_set_parent_bus (DEVICE (s->cps),sysbus_get_default ());object_property_set_str (OBJECT (s->cps), cpu_model,"cpu-model" , &err);
hw/mips/mips_malta.c +1 -2
@@ -949,9 +949,8 @@ static void create_cps(MaltaState *s, const char *cpu_model, qemu_irq *cbus_irq, qemu_irq *i8259_irq) {Error *err =NULL ; - s->cps =g_new0 (MIPSCPSState,1 ); -object_initialize (s->cps,sizeof (MIPSCPSState),TYPE_MIPS_CPS ); + s->cps =MIPS_CPS (object_new (TYPE_MIPS_CPS ));qdev_set_parent_bus (DEVICE (s->cps),sysbus_get_default ());object_property_set_str (OBJECT (s->cps), cpu_model,"cpu-model" , &err);
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 33/39] mips: malta/boston: replace cpu_model with cpu_type
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- include/hw/mips/cps.h | 2 +- target/mips/cpu.h | 8 ++++++-- hw/mips/boston.c | 11 +++++------ hw/mips/cps.c | 4 ++-- hw/mips/mips_malta.c | 33 +++++++++++++++------------------ target/mips/cpu.c | 2 +- target/mips/translate.c | 20 ++++++-------------- target/mips/translate_init.c | 12 ------------ 8 files changed, 36 insertions(+), 56 deletions(-)
include/hw/mips/cps.h +1 -1
@@ -34,7 +34,7 @@ typedef struct MIPSCPSState {uint32_t num_vp;uint32_t num_irq; -char *cpu_model; +char *cpu_type;MemoryRegion container;MIPSGCRState gcr;
target/mips/cpu.h +6 -2
@@ -740,8 +740,12 @@ enum {int cpu_mips_signal_handler (int host_signum,void *pinfo,void *puc);#define cpu_init (cpu_model) cpu_generic_init(TYPE_MIPS_CPU, cpu_model) -bool cpu_supports_cps_smp (const char *cpu_model); -bool cpu_supports_isa (const char *cpu_model,unsigned int isa); + +#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU +#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX + +bool cpu_supports_cps_smp (const char *cpu_type); +bool cpu_supports_isa (const char *cpu_type,unsigned int isa);void cpu_set_exception_base (int vp_index,target_ulong address);/* mips_int.c */
hw/mips/boston.c +5 -6
@@ -437,7 +437,6 @@ static void boston_mach_init(MachineState *machine)DeviceState *dev;BostonState *s;Error *err =NULL ; -const char *cpu_model;MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;MemoryRegion *sys_mem =get_system_memory ();XilinxPCIEHost *pcie2;
@@ -453,25 +452,24 @@ static void boston_mach_init(MachineState *machine)exit (1 ); } - cpu_model = machine->cpu_model ?:"I6400" ; - dev =qdev_create (NULL ,TYPE_MIPS_BOSTON );qdev_init_nofail (dev); s =BOSTON (dev); s->mach = machine; -if (!cpu_supports_cps_smp (cpu_model)) { +if (!cpu_supports_cps_smp (machine->cpu_type)) {error_report ("Boston requires CPUs which support CPS" );exit (1 ); } - is_64b =cpu_supports_isa (cpu_model,ISA_MIPS64 ); + is_64b =cpu_supports_isa (machine->cpu_type,ISA_MIPS64 ); s->cps =MIPS_CPS (object_new (TYPE_MIPS_CPS ));qdev_set_parent_bus (DEVICE (s->cps),sysbus_get_default ()); -object_property_set_str (OBJECT (s->cps), cpu_model,"cpu-model" , &err); +object_property_set_str (OBJECT (s->cps), machine->cpu_type,"cpu-type" , + &err);object_property_set_int (OBJECT (s->cps), smp_cpus,"num-vp" , &err);object_property_set_bool (OBJECT (s->cps), true,"realized" , &err);
@@ -571,6 +569,7 @@ static void boston_mach_class_init(MachineClass *mc) mc->block_default_type =IF_IDE ; mc->default_ram_size =1 *G_BYTE ; mc->max_cpus =16 ; + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("I6400" ); }DEFINE_MACHINE ("boston" , boston_mach_class_init)
hw/mips/cps.c +2 -2
@@ -71,7 +71,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)bool itu_present = false;for (i =0 ; i < s->num_vp; i++) { - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , s->cpu_model)); + cpu =MIPS_CPU (cpu_create (s->cpu_type));/* Init internal devices */ cpu_mips_irq_init_cpu (cpu);
@@ -160,7 +160,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)static Property mips_cps_properties[] = {DEFINE_PROP_UINT32 ("num-vp" , MIPSCPSState, num_vp,1 ),DEFINE_PROP_UINT32 ("num-irq" , MIPSCPSState, num_irq,256 ), -DEFINE_PROP_STRING ("cpu-model" , MIPSCPSState, cpu_model), +DEFINE_PROP_STRING ("cpu-type" , MIPSCPSState, cpu_type),DEFINE_PROP_END_OF_LIST () };
hw/mips/mips_malta.c +15 -18
@@ -923,7 +923,7 @@ static void main_cpu_reset(void *opaque) } } -static void create_cpu_without_cps (const char *cpu_model, +static void create_cpu_without_cps (const char *cpu_type,qemu_irq *cbus_irq,qemu_irq *i8259_irq) {CPUMIPSState *env;
@@ -931,7 +931,7 @@ static void create_cpu_without_cps(const char *cpu_model,int i;for (i =0 ; i < smp_cpus; i++) { - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , cpu_model)); + cpu =MIPS_CPU (cpu_create (cpu_type));/* Init internal devices */ cpu_mips_irq_init_cpu (cpu);
@@ -945,7 +945,7 @@ static void create_cpu_without_cps(const char *cpu_model, *cbus_irq = env->irq[4 ]; } -static void create_cps (MaltaState *s,const char *cpu_model, +static void create_cps (MaltaState *s,const char *cpu_type,qemu_irq *cbus_irq,qemu_irq *i8259_irq) {Error *err =NULL ;
@@ -953,7 +953,7 @@ static void create_cps(MaltaState *s, const char *cpu_model, s->cps =MIPS_CPS (object_new (TYPE_MIPS_CPS ));qdev_set_parent_bus (DEVICE (s->cps),sysbus_get_default ()); -object_property_set_str (OBJECT (s->cps), cpu_model,"cpu-model" , &err); +object_property_set_str (OBJECT (s->cps), cpu_type,"cpu-type" , &err);object_property_set_int (OBJECT (s->cps), smp_cpus,"num-vp" , &err);object_property_set_bool (OBJECT (s->cps), true,"realized" , &err);if (err !=NULL ) {
@@ -967,21 +967,13 @@ static void create_cps(MaltaState *s, const char *cpu_model, *cbus_irq =NULL ; } -static void create_cpu (MaltaState *s,const char *cpu_model, -qemu_irq *cbus_irq,qemu_irq *i8259_irq) +static void mips_create_cpu (MaltaState *s,const char *cpu_type, +qemu_irq *cbus_irq,qemu_irq *i8259_irq) { -if (cpu_model ==NULL ) { -#ifdef TARGET_MIPS64 - cpu_model ="20Kc" ; -#else - cpu_model ="24Kf" ; -#endif - } - -if ((smp_cpus >1 ) &&cpu_supports_cps_smp (cpu_model)) { -create_cps (s, cpu_model, cbus_irq, i8259_irq); +if ((smp_cpus >1 ) &&cpu_supports_cps_smp (cpu_type)) { +create_cps (s, cpu_type, cbus_irq, i8259_irq); }else { -create_cpu_without_cps (cpu_model, cbus_irq, i8259_irq); +create_cpu_without_cps (cpu_type, cbus_irq, i8259_irq); } }
@@ -1038,7 +1030,7 @@ void mips_malta_init(MachineState *machine) }/* create CPU */ -create_cpu (s, machine->cpu_model, &cbus_irq, &i8259_irq); +mips_create_cpu (s, machine->cpu_type, &cbus_irq, &i8259_irq);/* allocate RAM */ if (ram_size > (2048u <<20 )) {
@@ -1264,6 +1256,11 @@ static void mips_malta_machine_init(MachineClass *mc) mc->block_default_type =IF_IDE ; mc->max_cpus =16 ; mc->is_default =1 ; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("20Kc" ); +#else + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("24Kf" ); +#endif }DEFINE_MACHINE ("malta" , mips_malta_machine_init)
target/mips/cpu.c +1 -1
@@ -154,7 +154,7 @@ static void mips_cpu_initfn(Object *obj)static char *mips_cpu_type_name (const char *cpu_model) { -return g_strdup_printf ("%s-" TYPE_MIPS_CPU , cpu_model); +return g_strdup_printf (MIPS_CPU_TYPE_NAME ("%s" ), cpu_model); }static ObjectClass *mips_cpu_class_by_name (const char *cpu_model)
target/mips/translate.c +6 -14
@@ -20512,24 +20512,16 @@ void cpu_mips_realize_env(CPUMIPSState *env)mvp_init (env, env->cpu_model); } -bool cpu_supports_cps_smp (const char *cpu_model) +bool cpu_supports_cps_smp (const char *cpu_type) { -const mips_def_t *def =cpu_mips_find_by_name (cpu_model); -if (!def) { -return false; - } - -return (def->CP0_Config3 & (1 <<CP0C3_CMGCR )) !=0 ; +const MIPSCPUClass *mcc =MIPS_CPU_CLASS (object_class_by_name (cpu_type)); +return (mcc->cpu_def->CP0_Config3 & (1 <<CP0C3_CMGCR )) !=0 ; } -bool cpu_supports_isa (const char *cpu_model,unsigned int isa) +bool cpu_supports_isa (const char *cpu_type,unsigned int isa) { -const mips_def_t *def =cpu_mips_find_by_name (cpu_model); -if (!def) { -return false; - } - -return (def->insn_flags & isa) !=0 ; +const MIPSCPUClass *mcc =MIPS_CPU_CLASS (object_class_by_name (cpu_type)); +return (mcc->cpu_def->insn_flags & isa) !=0 ; }void cpu_set_exception_base (int vp_index,target_ulong address)
target/mips/translate_init.c +0 -12
@@ -755,18 +755,6 @@ const mips_def_t mips_defs[] = };const int mips_defs_number =ARRAY_SIZE (mips_defs); -static const mips_def_t *cpu_mips_find_by_name (const char *name) -{ -int i; - -for (i =0 ; i <ARRAY_SIZE (mips_defs); i++) { -if (strcasecmp (name, mips_defs[i].name) ==0 ) { -return &mips_defs[i]; - } - } -return NULL ; -} -void mips_cpu_list (FILE *f,fprintf_function cpu_fprintf) {int i;
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 34/39] mips: fulong2e: replace cpu_model with cpu_type
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/mips/mips_fulong2e.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/mips/mips_fulong2e.c +2 -5
@@ -258,7 +258,6 @@ static void network_init (PCIBus *pci_bus)static void mips_fulong2e_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -277,10 +276,7 @@ static void mips_fulong2e_init(MachineState *machine)CPUMIPSState *env;/* init CPUs */ -if (cpu_model ==NULL ) { - cpu_model ="Loongson-2E" ; - } - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , cpu_model)); + cpu =MIPS_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;qemu_register_reset (main_cpu_reset, cpu);
@@ -385,6 +381,7 @@ static void mips_fulong2e_machine_init(MachineClass *mc) mc->desc ="Fulong 2e mini pc" ; mc->init = mips_fulong2e_init; mc->block_default_type =IF_IDE ; + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("Loongson-2E" ); }DEFINE_MACHINE ("fulong2e" , mips_fulong2e_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 35/39] mips: Magnum/Acer Pica 61: replace cpu_model with cpu_type
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/mips/mips_jazz.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
hw/mips/mips_jazz.c +3 -5
@@ -122,7 +122,6 @@ static void mips_jazz_init(MachineState *machine, enum jazz_model_e jazz_model) {MemoryRegion *address_space =get_system_memory (); -const char *cpu_model = machine->cpu_model;char *filename;int bios_size, n;MIPSCPU *cpu;
@@ -148,10 +147,7 @@ static void mips_jazz_init(MachineState *machine,MemoryRegion *bios2 =g_new (MemoryRegion,1 );/* init CPUs */ -if (cpu_model ==NULL ) { - cpu_model ="R4000" ; - } - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , cpu_model)); + cpu =MIPS_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;qemu_register_reset (main_cpu_reset, cpu);
@@ -349,6 +345,7 @@ static void mips_magnum_class_init(ObjectClass *oc, void *data) mc->desc ="MIPS Magnum" ; mc->init = mips_magnum_init; mc->block_default_type =IF_SCSI ; + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("R4000" ); }static const TypeInfo mips_magnum_type = {
@@ -364,6 +361,7 @@ static void mips_pica61_class_init(ObjectClass *oc, void *data) mc->desc ="Acer Pica 61" ; mc->init = mips_pica61_init; mc->block_default_type =IF_SCSI ; + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("R4000" ); }static const TypeInfo mips_pica61_type = {
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 36/39] mips: mipssim: replace cpu_model with cpu_type
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/mips/mips_mipssim.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
hw/mips/mips_mipssim.c +6 -9
@@ -141,7 +141,6 @@ static void mips_mipssim_init(MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -156,14 +155,7 @@ mips_mipssim_init(MachineState *machine)int bios_size;/* Init CPUs. */ -if (cpu_model ==NULL ) { -#ifdef TARGET_MIPS64 - cpu_model ="5Kf" ; -#else - cpu_model ="24Kf" ; -#endif - } - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , cpu_model)); + cpu =MIPS_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info =g_malloc0 (sizeof (ResetData));
@@ -235,6 +227,11 @@ static void mips_mipssim_machine_init(MachineClass *mc) { mc->desc ="MIPS MIPSsim platform" ; mc->init = mips_mipssim_init; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("5Kf" ); +#else + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("24Kf" ); +#endif }DEFINE_MACHINE ("mipssim" , mips_mipssim_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 37/39] mips: r4k: replace cpu_model with cpu_type
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/mips/mips_r4k.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
hw/mips/mips_r4k.c +7 -9
@@ -163,7 +163,6 @@ staticvoid mips_r4k_init (MachineState *machine) {ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename;
@@ -186,14 +185,7 @@ void mips_r4k_init(MachineState *machine)int be;/* init CPUs */ -if (cpu_model ==NULL ) { -#ifdef TARGET_MIPS64 - cpu_model ="R4000" ; -#else - cpu_model ="24Kf" ; -#endif - } - cpu =MIPS_CPU (cpu_generic_init (TYPE_MIPS_CPU , cpu_model)); + cpu =MIPS_CPU (cpu_create (machine->cpu_type)); env = &cpu->env; reset_info =g_malloc0 (sizeof (ResetData));
@@ -303,6 +295,12 @@ static void mips_machine_init(MachineClass *mc) mc->desc ="mips r4k platform" ; mc->init = mips_r4k_init; mc->block_default_type =IF_IDE ; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("R4000" ); +#else + mc->default_cpu_type =MIPS_CPU_TYPE_NAME ("24Kf" ); +#endif + }DEFINE_MACHINE ("mips" , mips_machine_init)
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 38/39] numa: fixup parsed NumaNodeOptions earlier
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
numa 'mem' option with suffix or without one is possible only on CLI/HMP. Instead of fixing up special suffix less CLI case deep in parse_numa_node() do it earlier right after option is parsed into NumaNodeOptions with OptVisistor so that the rest of the code would use valid values in NumaNodeOptions and won't have to reparse QemuOpts.
It will help to isolate CLI/HMP parts in parse_numa() and split out parsed NumaNodeOptions processing into separate function that could be reused by QMP handler where we have only NumaNodeOptions and don't need any fixups.
While at it reuse qemu_strtosz_MiB() instead of manually checking for suffixes.
Message-Id: <[email protected]>
--- numa.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
numa.c +10 -9
@@ -38,6 +38,7 @@#include "hw/mem/pc-dimm.h" #include "qemu/option.h" #include "qemu/config-file.h" +#include "qemu/cutils.h" QemuOptsList qemu_numa_opts = { .name ="numa" ,
@@ -142,7 +143,7 @@ uint32_t numa_get_node(ram_addr_t addr, Error **errp) }static void parse_numa_node (MachineState *ms,NumaNodeOptions *node, -QemuOpts *opts,Error **errp) +Error **errp) {uint16_t nodenr;uint16List *cpus =NULL ;
@@ -199,13 +200,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, }if (node->has_mem) { -uint64_t mem_size = node->mem; -const char *mem_str =qemu_opt_get (opts,"mem" ); -/* Fix up legacy suffix-less format */ -if (g_ascii_isdigit (mem_str[strlen (mem_str) -1 ])) { - mem_size <<=20 ; - } - numa_info[nodenr].node_mem = mem_size; + numa_info[nodenr].node_mem = node->mem; }if (node->has_memdev) {Object *o;
@@ -275,9 +270,15 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) goto end; } +/* Fix up legacy suffix-less format */ +if ((object->type ==NUMA_OPTIONS_TYPE_NODE ) && object->u.node.has_mem) { +const char *mem_str =qemu_opt_get (opts,"mem" ); +qemu_strtosz_MiB (mem_str,NULL , &object->u.node.mem); + } +switch (object->type) {case NUMA_OPTIONS_TYPE_NODE : -parse_numa_node (ms, &object->u.node, opts, &err); +parse_numa_node (ms, &object->u.node, &err);if (err) { goto end; }
Signature · 1 line
2.13.6
[Qemu-devel] [PULL v2 39/39] x86: Skip check apic_id_limit for Xen
In reply to Eduardo HabkostFrom: Lan Tianyu <[email protected]>
Xen vIOMMU device model will be in Xen hypervisor. Skip vIOMMU check for Xen here when vcpu number is more than 255.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc.c +1 -1
@@ -1228,7 +1228,7 @@ void pc_machine_done(Notifier *notifier, void *data)fw_cfg_modify_i16 (pcms->fw_cfg,FW_CFG_NB_CPUS , pcms->boot_cpus); } -if (pcms->apic_id_limit >255 ) { +if (pcms->apic_id_limit >255 && !xen_enabled ()) {IntelIOMMUState *iommu =INTEL_IOMMU_DEVICE (x86_iommu_get_default ()); if (!iommu || !iommu->x86_iommu.intr_supported ||
Signature · 1 line
2.13.6
Peter Maydell
AppliedQuoted 10 lines · Eduardo Habkost
Change in v2:
* Include sh4-linux-user fixup sent by Igor (at: "sh4: simplifysuperh_cpu_class_by_name()")The following changes since commit
74d7fc7f6385158b8a5c524c61baaef1b66f3dac:tcg: Avoid setting
tcg_initializeif !CONFIG_TCG (2017-10-26 17:47:36 +0100)are available in the git repository at:
Quoted 9 lines
git://github.com/ehabkost/qemu.gittags/x86-and-machine-pull-requestfor you to fetch changes up to
1a26f46692320f1981c95967e0d5af4443b5f0b1:x86: Skip check
apic_id_limitfor Xen (2017-10-27 16:04:28 +0200)----------------------------------------------------------------
x86/cpu/numa queue, 2017-10-27
Applied, thanks.
-- PMM