From ff9006ddbfd194a946ce3ee46b175919beeaf160 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 2 Feb 2017 16:02:34 +0100 Subject: spapr: move spapr_core_[foo]plug() callbacks close to machine code in spapr.c spapr_core_pre_plug/spapr_core_plug/spapr_core_unplug() are managing wiring CPU core into spapr machine state and not internal CPU core state. So move them from spapr_cpu_core.c to spapr.c where other similar (spapr_memory_[foo]plug()) callbacks are located, which also matches x86 target practice. Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/ppc/spapr_cpu_core.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h index 50292f48b1..3c35665221 100644 --- a/include/hw/ppc/spapr_cpu_core.h +++ b/include/hw/ppc/spapr_cpu_core.h @@ -34,12 +34,6 @@ typedef struct sPAPRCPUCoreClass { ObjectClass *cpu_class; } sPAPRCPUCoreClass; -void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, - Error **errp); char *spapr_get_cpu_core_type(const char *model); -void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev, - Error **errp); -void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, - Error **errp); void spapr_cpu_core_class_init(ObjectClass *oc, void *data); #endif -- cgit v1.2.3 From 9ee6f678f473007e252934d6acd09c24490d9d42 Mon Sep 17 00:00:00 2001 From: Bharata B Rao Date: Fri, 10 Feb 2017 12:53:05 +0530 Subject: softfloat: Add round-to-odd rounding mode Power ISA 3.0 introduces a few quadruple precision floating point instructions that support round-to-odd rounding mode. The round-to-odd mode is explained as under: Let Z be the intermediate arithmetic result or the operand of a convert operation. If Z can be represented exactly in the target format, the result is Z. Otherwise the result is either Z1 or Z2 whichever is odd. Here Z1 and Z2 are the next larger and smaller numbers representable in the target format respectively. Signed-off-by: Bharata B Rao Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- include/fpu/softfloat.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 842ec6b22a..8a39028664 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -180,6 +180,8 @@ enum { float_round_up = 2, float_round_to_zero = 3, float_round_ties_away = 4, + /* Not an IEEE rounding mode: round to the closest odd mantissa value */ + float_round_to_odd = 5, }; /*---------------------------------------------------------------------------- -- cgit v1.2.3 From 2e6d85683576c970c714c1cc071dca742835b9d4 Mon Sep 17 00:00:00 2001 From: Bharata B Rao Date: Fri, 10 Feb 2017 12:53:06 +0530 Subject: softfloat: Add float128_to_uint64_round_to_zero() Implement float128_to_uint64() and use that to implement float128_to_uint64_round_to_zero() This is required by xscvqpudz instruction of PowerPC ISA 3.0. Signed-off-by: Bharata B Rao Reviewed-by: Peter Maydell Signed-off-by: David Gibson --- include/fpu/softfloat.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 8a39028664..a09ad0ea14 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -714,6 +714,8 @@ int32_t float128_to_int32(float128, float_status *status); int32_t float128_to_int32_round_to_zero(float128, float_status *status); int64_t float128_to_int64(float128, float_status *status); int64_t float128_to_int64_round_to_zero(float128, float_status *status); +uint64_t float128_to_uint64(float128, float_status *status); +uint64_t float128_to_uint64_round_to_zero(float128, float_status *status); float32 float128_to_float32(float128, float_status *status); float64 float128_to_float64(float128, float_status *status); floatx80 float128_to_floatx80(float128, float_status *status); -- cgit v1.2.3 From fd425037d25cecaaffdb3831697e0adc10ca2ba3 Mon Sep 17 00:00:00 2001 From: Bharata B Rao Date: Fri, 10 Feb 2017 12:53:07 +0530 Subject: softfloat: Add float128_to_uint32_round_to_zero() float128_to_uint32_round_to_zero() is needed by xscvqpuwz instruction of PowerPC ISA 3.0. Signed-off-by: Bharata B Rao Reviewed-by: Peter Maydell Signed-off-by: David Gibson --- include/fpu/softfloat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index a09ad0ea14..f1288efa87 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -716,6 +716,7 @@ int64_t float128_to_int64(float128, float_status *status); int64_t float128_to_int64_round_to_zero(float128, float_status *status); uint64_t float128_to_uint64(float128, float_status *status); uint64_t float128_to_uint64_round_to_zero(float128, float_status *status); +uint32_t float128_to_uint32_round_to_zero(float128, float_status *status); float32 float128_to_float32(float128, float_status *status); float64 float128_to_float64(float128, float_status *status); floatx80 float128_to_floatx80(float128, float_status *status); -- cgit v1.2.3 From 38690a1ca7cd4771800b1581329f09fafad3f2d6 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 9 Feb 2017 12:08:32 +0100 Subject: machine: move possible_cpus to MachineState so that it would be possible to reuse it with spapr/virt-aarch64 targets. Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/boards.h | 1 + include/hw/i386/pc.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index ac891a828b..64e8c07b0f 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -178,6 +178,7 @@ struct MachineState { char *initrd_filename; const char *cpu_model; AccelState *accelerator; + CPUArchIdList *possible_cpus; }; #define DEFINE_MACHINE(namestr, machine_initfn) \ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 079e8d9393..d1f45540a1 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -73,7 +73,6 @@ struct PCMachineState { /* CPU and apic information: */ bool apic_xrupt_override; unsigned apic_id_limit; - CPUArchIdList *possible_cpus; uint16_t boot_cpus; /* NUMA information: */ -- cgit v1.2.3 From c67ae9333cf94de2af043d65f3ce55ec26081c17 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 9 Feb 2017 12:08:34 +0100 Subject: pc: calculate topology only once when possible_cpus is initialised Fill in CpuInstanceProperties once at board init time and just copy them whenever query_hotpluggable_cpus() is called. It will keep topology info always available without need to recalculate it every time it's needed. Considering it has NUMA node id, it will be used to keep NUMA node to cpu mapping instead of numa_info[i].node_cpu bitmasks. Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/boards.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index 64e8c07b0f..4023b384f8 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -46,9 +46,11 @@ void machine_register_compat_props(MachineState *machine); * CPUArchId: * @arch_id - architecture-dependent CPU ID of present or possible CPU * @cpu - pointer to corresponding CPU object if it's present on NULL otherwise + * @props - CPU object properties, initialized by board */ typedef struct { uint64_t arch_id; + CpuInstanceProperties props; struct CPUState *cpu; } CPUArchId; -- cgit v1.2.3 From 8aba3842980954191a061d4618f80f368226ef5c Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 9 Feb 2017 12:08:36 +0100 Subject: change CPUArchId.cpu type to Object* so it could be reused for SPAPR cores as well Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/boards.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index 4023b384f8..60209df755 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -51,7 +51,7 @@ void machine_register_compat_props(MachineState *machine); typedef struct { uint64_t arch_id; CpuInstanceProperties props; - struct CPUState *cpu; + Object *cpu; } CPUArchId; /** -- cgit v1.2.3 From 535455fdee60e4e7979a5060ba7a4e4588ee1a1e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Fri, 10 Feb 2017 11:18:49 +0100 Subject: spapr: reuse machine->possible_cpus instead of cores[] Replace SPAPR specific cores[] array with generic machine->possible_cpus and store core objects there. It makes cores bookkeeping similar to x86 cpus and will allow to unify similar code. It would allow to replace cpu_index based NUMA node mapping with iproperty based one (for -device created cores) since possible_cpus carries board defined topology/layout. Signed-off-by: Igor Mammedov Acked-by: David Gibson Signed-off-by: David Gibson --- include/hw/ppc/spapr.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index a2d8964f7e..f9b17d860a 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -94,7 +94,6 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; MemoryHotplugState hotplug_memory; - Object **cores; }; #define H_SUCCESS 0 -- cgit v1.2.3 From f2d672c248e359dd36081bbebc8854609cc9f112 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 9 Feb 2017 12:08:38 +0100 Subject: machine: unify [pc_|spapr_]query_hotpluggable_cpus() callbacks All callbacks FOO_query_hotpluggable_cpus() are practically the same except of setting vcpus_count to different values. Convert them to a generic machine_query_hotpluggable_cpus() callback by moving vcpus_count initialization to per machine specific callback possible_cpu_arch_ids(). Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/boards.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index 60209df755..9040dbba06 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -41,15 +41,18 @@ int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); void machine_register_compat_props(MachineState *machine); +HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine); /** * CPUArchId: * @arch_id - architecture-dependent CPU ID of present or possible CPU * @cpu - pointer to corresponding CPU object if it's present on NULL otherwise * @props - CPU object properties, initialized by board + * #vcpus_count - number of threads provided by @cpu object */ typedef struct { uint64_t arch_id; + int64_t vcpus_count; CpuInstanceProperties props; Object *cpu; } CPUArchId; -- cgit v1.2.3 From c5514d0e4bafde751ec09439ba042b1f1cda37a7 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Fri, 10 Feb 2017 11:20:57 +0100 Subject: machine: replace query_hotpluggable_cpus() callback with has_hotpluggable_cpus flag Generic helper machine_query_hotpluggable_cpus() replaced target specific query_hotpluggable_cpus() callbacks so there is no need in it anymore. However inon NULL callback value is used to detect/report hotpluggable cpus support, therefore it can be removed completely. Replace it with MachineClass.has_hotpluggable_cpus boolean which is sufficient for the task. Suggested-by: David Gibson Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- include/hw/boards.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index 9040dbba06..269d0ba399 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -87,10 +87,8 @@ typedef struct { * Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. - * @query_hotpluggable_cpus: - * Returns a @HotpluggableCPUList, which describes CPUs objects which - * could be added with -device/device_add. - * Caller is responsible for freeing returned list. + * @has_hotpluggable_cpus: + * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits: * If non-zero, the board promises never to create a CPU with a page size * smaller than this, so QEMU can use a more efficient larger page @@ -136,12 +134,12 @@ struct MachineClass { bool option_rom_has_mr; bool rom_file_has_mr; int minimum_page_bits; + bool has_hotpluggable_cpus; HotplugHandler *(*get_hotplug_handler)(MachineState *machine, DeviceState *dev); unsigned (*cpu_index_to_socket_id)(unsigned cpu_index); const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); - HotpluggableCPUList *(*query_hotpluggable_cpus)(MachineState *machine); }; /** -- cgit v1.2.3