Core based CPU hotplug for PowerPC sPAPR
v4 cover Core based CPU hotplug for PowerPC sPAPR
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu) device_add POWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu) device_add host-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu) device_add POWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]
Changes in v4
-------------
- Rebased against David Gibson's ppc-cpu-hotplug and hence dropped those patches that are already part of that tree.
- We were assuming the CPU thread to be always of type PowerPCCPU which needn't be true. Hence use actual CPU type's instance_size when object_initialize'ing the threads as per David's suggestion. This requires us to know the instance_size for a given type for which a new QOM API object_type_get_size() has been introduced in this version.
- Consolidate CPU init related routines in spapr_cpu_core.c. As part of this move spapr_cpu_init() and its dependencies to spapr_cpu_core.c.
- Got rid of the temporary unplug list when removing CPU cores.
- Folded spapr_cpu_core_create_threads() into spapr_cpu_core_realize() and fixed the error path in in spapr_cpu_core_realize().
- Add support for -cpu host.
TODOs remaining
---------------
- Work on David's suggestion of intializing CPU's ObjectClass in class_init rather than instance_init.
- Use object_initialize_with_type instead of object_initialize when creating CPU threads of a core.
- Use vcpu_dt_id logic when populating core id in spapr_query_hotpluggable_cpus().
- Handle CPU compat properly (-cpu host,compat=POWER7)
v3: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg01829.html
Bharata B Rao (7):
qom: API to get instance_size of a type
spapr: Abstract CPU core device and type specific core devices
spapr: Move spapr_cpu_init() to spapr_cpu_core.c
spapr: convert boot CPUs into CPU core devices
spapr: CPU hotplug support
spapr: CPU hot unplug support
hmp: Add 'info hotpluggable-cpus' HMP command
Igor Mammedov (2):
QMP: Add query-hotpluggable-cpus
spapr: implement query-hotpluggable-cpus callback
hmp-commands-info.hx | 14 ++ hmp.c | 41 ++++ hmp.h | 1 + hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 215 +++++++++++++++------ hw/ppc/spapr_cpu_core.c | 405 ++++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_events.c | 3 + hw/ppc/spapr_rtas.c | 24 +++ include/hw/boards.h | 5 + include/hw/ppc/spapr.h | 7 + include/hw/ppc/spapr_cpu_core.h | 36 ++++ include/qom/object.h | 8 +- monitor.c | 13 ++ qapi-schema.json | 55 ++++++ qmp-commands.hx | 23 +++ qom/object.c | 8 + target-ppc/kvm.c | 28 +++ 17 files changed, 828 insertions(+), 59 deletions(-) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.h
Signature · 1 line
2.1.0
PATCH v4 2/9 spapr: Abstract CPU core device and type specific core devices
Add sPAPR specific abastract CPU core device that is based on generic CPU core device. Use this as base type to create sPAPR CPU specific core devices.
TODO:
- Add core types for other remaining CPU types
- Handle CPU model alias correctly
--- hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 3 +- hw/ppc/spapr_cpu_core.c | 160 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 1 + include/hw/ppc/spapr_cpu_core.h | 29 ++++++++ target-ppc/kvm.c | 28 +++++++ 6 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.h
hw/ppc/Makefile.objs +1 -0
@@ -4,6 +4,7 @@ obj-y += ppc.o ppc_booke.o obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o +obj-$(CONFIG_PSERIES) += spapr_cpu_core.o ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) obj-y += spapr_pci_vfio.o endif
hw/ppc/spapr.c +1 -2
@@ -1606,8 +1606,7 @@ static void spapr_boot_set(void *opaque, const char *boot_device, machine->boot_order =g_strdup (boot_device); } -static void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu, -Error **errp) +void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp) {CPUPPCState *env = &cpu->env;
hw/ppc/spapr_cpu_core.c new file +160 -0
160 lines not on this page · raw message
include/hw/ppc/spapr.h +1 -0
@@ -582,6 +582,7 @@ void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type, uint32_t count);void spapr_hotplug_req_remove_by_count (sPAPRDRConnectorType drc_type,uint32_t count); +void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp);/* rtas-configure-connector state */ struct sPAPRConfigureConnectorState {
include/hw/ppc/spapr_cpu_core.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* sPAPR CPU core device. +* +* Copyright (C) 2016 Bharata B Rao <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef HW_SPAPR_CPU_CORE_H +#define HW_SPAPR_CPU_CORE_H + +#include "hw/qdev.h" +#include "hw/cpu/core.h" +#include "target-ppc/cpu-qom.h" + +#define TYPE_SPAPR_CPU_CORE "spapr-cpu-core" +#define SPAPR_CPU_CORE (obj) \ + OBJECT_CHECK(sPAPRCPUCore, (obj), TYPE_SPAPR_CPU_CORE) + +typedef struct sPAPRCPUCore { +/*< private >*/ +CPUCore parent_obj; + +/*< public >*/ +void *threads; +ObjectClass *cpu_class; +}sPAPRCPUCore ; + +#endif
target-ppc/kvm.c +28 -0
@@ -43,6 +43,9 @@#include "exec/memattrs.h" #include "sysemu/hostmem.h" #include "qemu/cutils.h" +#if defined(TARGET_PPC64 ) +#include "hw/ppc/spapr_cpu_core.h" +#endif //#define DEBUG_KVM
@@ -2329,6 +2332,19 @@ static PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)return POWERPC_CPU_CLASS (oc); } +#if defined(TARGET_PPC64 ) +static void spapr_cpu_core_host_initfn (Object *obj) +{ +sPAPRCPUCore *core =SPAPR_CPU_CORE (obj); +char *name =g_strdup_printf ("%s-" TYPE_POWERPC_CPU ,"host" ); +ObjectClass *oc =object_class_by_name (name); + +g_assert (oc); +g_free ((void *)name); + core->cpu_class = oc; +} +#endif +static int kvm_ppc_register_host_cpu_type (void ) {TypeInfo type_info = {
@@ -2350,6 +2366,18 @@ static int kvm_ppc_register_host_cpu_type(void) type_info.parent =object_class_get_name (OBJECT_CLASS (pvr_pcc));type_register (&type_info); +#if defined(TARGET_PPC64 ) + type_info.name =g_strdup_printf ("%s-" TYPE_SPAPR_CPU_CORE ,"host" ); + type_info.parent =TYPE_SPAPR_CPU_CORE , + type_info.instance_size =sizeof (sPAPRCPUCore), + type_info.instance_init = spapr_cpu_core_host_initfn, + type_info.class_init =NULL ; +type_register (&type_info); +g_free ((void *)type_info.name); + type_info.instance_size =0 ; + type_info.instance_init =NULL ; +#endif +/* Register generic family CPU class for a family */ pvr_pcc =ppc_cpu_get_family_class (pvr_pcc); dc =DEVICE_CLASS (pvr_pcc);
Signature · 1 line
2.1.0
PATCH v4 1/9 qom: API to get instance_size of a type
In reply to Bharata B RaoAdd an API object_type_get_size(const char *typename) that returns the instance_size of the give typename.
--- include/qom/object.h | 8 +++++++- qom/object.c | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
include/qom/object.h +7 -1
@@ -1608,5 +1608,11 @@ int object_child_foreach_recursive(Object *obj,*/ Object *container_get (Object *root,const char *path); - +/** +* object_type_get_size: +* @typename: Name of the Type whose instance_size is required +* +* Returns the instance_size of the given @typename. +*/ +size_t object_type_get_size (const char *typename);#endif
qom/object.c +8 -0
@@ -202,6 +202,14 @@ static size_t type_object_get_size(TypeImpl *ti)return 0 ; } +size_t object_type_get_size (const char *typename) +{ +TypeImpl *type =type_get_by_name (typename); + +g_assert (type !=NULL ); +return type_object_get_size (type); +} +static bool type_is_ancestor (TypeImpl *type,TypeImpl *target_type) {assert (target_type);
Signature · 1 line
2.1.0
PATCH v4 5/9 spapr: CPU hotplug support
In reply to Bharata B RaoSet up device tree entries for the hotplugged CPU core and use the exising RTAS event logging infrastructure to send CPU hotplug notification to the guest.
--- hw/ppc/spapr.c | 78 +++++++++++++++++++++++++++++++++------- hw/ppc/spapr_cpu_core.c | 80 +++++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_events.c | 3 ++ hw/ppc/spapr_rtas.c | 24 +++++++++++++ include/hw/ppc/spapr.h | 2 ++ include/hw/ppc/spapr_cpu_core.h | 2 ++ 6 files changed, 176 insertions(+), 13 deletions(-)
hw/ppc/spapr.c +65 -13
@@ -604,6 +604,16 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,size_t page_sizes_prop_size;uint32_t vcpus_per_socket = smp_threads * smp_cores;uint32_t pft_size_prop[] = {0 ,cpu_to_be32 (spapr->htab_shift)}; +sPAPRDRConnector *drc; +sPAPRDRConnectorClass *drck; +int drc_index; + + drc =spapr_dr_connector_by_id (SPAPR_DR_CONNECTOR_TYPE_CPU , index); +if (drc) { + drck =SPAPR_DR_CONNECTOR_GET_CLASS (drc); + drc_index = drck->get_index (drc); +_FDT ((fdt_setprop_cell (fdt, offset,"ibm,my-drc-index" , drc_index))); + }/* Note: we keep CI large pages off for now because a 64K capable guest * provisioned with large pages might otherwise try to map a qemu
@@ -987,6 +997,16 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,_FDT (spapr_drc_populate_dt (fdt,0 ,NULL ,SPAPR_DR_CONNECTOR_TYPE_LMB )); } +if (smc->dr_cpu_enabled) { +int offset =fdt_path_offset (fdt,"/cpus" ); + ret =spapr_drc_populate_dt (fdt, offset,NULL , +SPAPR_DR_CONNECTOR_TYPE_CPU ); +if (ret <0 ) { +error_report ("Couldn't set up CPU DR device tree properties" ); +exit (1 ); + } + } +_FDT ((fdt_pack (fdt)));if (fdt_totalsize (fdt) >FDT_MAX_SIZE ) {
@@ -1757,21 +1777,30 @@ static void ppc_spapr_init(MachineState *machine)char *type =spapr_get_cpu_core_type (machine->cpu_model); spapr->cores = g_new0(Object *, spapr_max_cores); -for (i =0 ; i < spapr_cores; i++) { +for (i =0 ; i < spapr_max_cores; i++) {int core_dt_id = i * smt; -Object *core; - -if (!object_class_by_name (type)) { -error_report ("Unable to find sPAPR CPU Core definition" ); -exit (1 ); +sPAPRDRConnector *drc = +spapr_dr_connector_new (OBJECT (spapr), +SPAPR_DR_CONNECTOR_TYPE_CPU , core_dt_id); + +qemu_register_reset (spapr_drc_reset, drc); + +if (i < spapr_cores) { +char *type =spapr_get_cpu_core_type (machine->cpu_model); +Object *core; + +if (!object_class_by_name (type)) { +error_report ("Unable to find sPAPR CPU Core definition" ); +exit (1 ); + } + + core =object_new (type); +object_property_set_int (core, smp_threads,"nr-threads" , + &error_fatal); +object_property_set_int (core, core_dt_id,CPU_CORE_PROP_CORE_ID , + &error_fatal); +object_property_set_bool (core, true,"realized" , &error_fatal); } - - core =object_new (type); -object_property_set_int (core, smp_threads,"nr-threads" , - &error_fatal); -object_property_set_int (core, core_dt_id,CPU_CORE_PROP_CORE_ID , - &error_fatal); -object_property_set_bool (core, true,"realized" , &error_fatal); }g_free (type); }else {
@@ -2193,6 +2222,27 @@ out:error_propagate (errp, local_err); } +void *spapr_populate_hotplug_cpu_dt (CPUState *cs,int *fdt_offset, +sPAPRMachineState *spapr) +{ +PowerPCCPU *cpu =POWERPC_CPU (cs); +DeviceClass *dc =DEVICE_GET_CLASS (cs); +int id =ppc_get_vcpu_dt_id (cpu); +void *fdt; +int offset, fdt_size; +char *nodename; + + fdt =create_device_tree (&fdt_size); + nodename =g_strdup_printf ("%s@%x" , dc->fw_name, id); + offset =fdt_add_subnode (fdt,0 , nodename); + +spapr_populate_cpu_dt (cs, fdt, offset, spapr); +g_free (nodename); + + *fdt_offset = offset; +return fdt; +} +static void spapr_machine_device_plug (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) {
@@ -2237,6 +2287,8 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev, }spapr_memory_plug (hotplug_dev, dev, node, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_CPU_CORE )) { +spapr_core_plug (hotplug_dev, dev, errp); } }
hw/ppc/spapr_cpu_core.c +80 -0
111 lines not on this page · raw message
hw/ppc/spapr_events.c +3 -0
@@ -449,6 +449,9 @@ static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action,case SPAPR_DR_CONNECTOR_TYPE_LMB : hp->hotplug_type =RTAS_LOG_V6_HP_TYPE_MEMORY ;break ; +case SPAPR_DR_CONNECTOR_TYPE_CPU : + hp->hotplug_type =RTAS_LOG_V6_HP_TYPE_CPU ; +break ;default :/* we shouldn't be signaling hotplug events for resources * that don't support them
hw/ppc/spapr_rtas.c +24 -0
@@ -36,6 +36,7 @@#include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" +#include "hw/ppc/ppc.h" #include "qapi-event.h" #include "hw/boards.h"
@@ -164,6 +165,27 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); } +/* +* Set the timebase offset of the CPU to that of first CPU. +* This helps hotplugged CPU to have the correct timebase offset. +*/ +static void spapr_cpu_update_tb_offset (PowerPCCPU *cpu) +{ +PowerPCCPU *fcpu =POWERPC_CPU (first_cpu); + + cpu->env.tb_env->tb_offset = fcpu->env.tb_env->tb_offset; +} + +static void spapr_cpu_set_endianness (PowerPCCPU *cpu) +{ +PowerPCCPU *fcpu =POWERPC_CPU (first_cpu); +PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (fcpu); + +if (!pcc->interrupts_big_endian (fcpu)) { + cpu->env.spr[SPR_LPCR ] |=LPCR_ILE ; + } +} + static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args,
@@ -200,6 +222,8 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr, env->nip = start; env->gpr[3 ] = r3; cs->halted =0 ; +spapr_cpu_set_endianness (cpu); +spapr_cpu_update_tb_offset (cpu);qemu_cpu_kick (cs);
include/hw/ppc/spapr.h +2 -0
@@ -587,6 +587,8 @@ void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type,void spapr_hotplug_req_remove_by_count (sPAPRDRConnectorType drc_type,uint32_t count);void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp); +void *spapr_populate_hotplug_cpu_dt (CPUState *cs,int *fdt_offset, +sPAPRMachineState *spapr);/* rtas-configure-connector state */ struct sPAPRConfigureConnectorState {
include/hw/ppc/spapr_cpu_core.h +2 -0
@@ -29,4 +29,6 @@ typedef struct sPAPRCPUCore {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);#endif
Signature · 1 line
2.1.0
PATCH v4 3/9 spapr: Move spapr_cpu_init() to spapr_cpu_core.c
In reply to Bharata B RaoStart consolidating CPU init related routines in spapr_cpu_core.c. As part of this, move spapr_cpu_init() and its dependencies from spapr.c to spapr_cpu_core.c
No functionality change in this patch.
--- hw/ppc/spapr.c | 47 ----------------------------------------------- hw/ppc/spapr_cpu_core.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 2 ++ 3 files changed, 50 insertions(+), 47 deletions(-)
hw/ppc/spapr.c +0 -47
@@ -89,8 +89,6 @@#define MIN_RMA_SLOF 128UL -#define TIMEBASE_FREQ 512000000ULL -#define PHANDLE_XICP 0x00001111#define HTAB_SIZE (spapr) (1ULL << ((spapr)->htab_shift))
@@ -1181,26 +1179,6 @@ static void ppc_spapr_reset(void) } -static void spapr_cpu_reset (void *opaque) -{ -sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); -PowerPCCPU *cpu = opaque; -CPUState *cs =CPU (cpu); -CPUPPCState *env = &cpu->env; - -cpu_reset (cs); - -/* All CPUs start halted. CPU0 is unhalted from the machine level -* reset code and the rest are explicitly started up by the guest -* using an RTAS call */ - cs->halted =1 ; - - env->spr[SPR_HIOR ] =0 ; - -ppc_hash64_set_external_hpt (cpu, spapr->htab, spapr->htab_shift, - &error_fatal); -} -static void spapr_create_nvram (sPAPRMachineState *spapr) {DeviceState *dev =qdev_create (&spapr->vio_bus->bus,"spapr-nvram" );
@@ -1606,31 +1584,6 @@ static void spapr_boot_set(void *opaque, const char *boot_device, machine->boot_order =g_strdup (boot_device); } -void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp) -{ -CPUPPCState *env = &cpu->env; - -/* Set time-base frequency to 512 MHz */ -cpu_ppc_tb_init (env,TIMEBASE_FREQ ); - -/* Enable PAPR mode in TCG or KVM */ -cpu_ppc_set_papr (cpu); - -if (cpu->max_compat) { -Error *local_err =NULL ; - -ppc_set_compat (cpu, cpu->max_compat, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } - } - -xics_cpu_setup (spapr->icp, cpu); - -qemu_register_reset (spapr_cpu_reset, cpu); -} -/* * Reset routine for LMB DR devices. *
hw/ppc/spapr_cpu_core.c +48 -0
54 lines not on this page · raw message
include/hw/ppc/spapr.h +2 -0
@@ -16,6 +16,8 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL#define SPAPR_ENTRY_POINT 0x100 +#define TIMEBASE_FREQ 512000000ULL +typedef struct sPAPRMachineClass sPAPRMachineClass ;typedef struct sPAPRMachineState sPAPRMachineState ;
Signature · 1 line
2.1.0
PATCH v4 4/9 spapr: convert boot CPUs into CPU core devices
In reply to Bharata B RaoIntroduce sPAPRMachineClass.dr_cpu_enabled to indicate support for CPU core hotplug. Initialize boot time CPUs as core deivces and prevent topologies that result in partially filled cores. Both of these are done only if CPU core hotplug is supported.
Note: An unrelated change in the call to xics_system_init() is done in this patch as it makes sense to use the local variable smt introduced in this patch instead of kvmppc_smt_threads() call here.
TODO: We derive sPAPR core type by looking at -cpu <model>. However we don't take care of "compat=" feature yet for boot time as well as hotplug CPUs.
--- hw/ppc/spapr.c | 73 +++++++++++++++++++++++++++++++++++------ hw/ppc/spapr_cpu_core.c | 58 ++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 2 ++ include/hw/ppc/spapr_cpu_core.h | 3 ++ 4 files changed, 126 insertions(+), 10 deletions(-)
hw/ppc/spapr.c +63 -10
@@ -66,6 +66,7 @@#include "hw/compat.h" #include "qemu/cutils.h" +#include "hw/ppc/spapr_cpu_core.h" #include <libfdt.h>
@@ -1665,7 +1666,6 @@ static void ppc_spapr_init(MachineState *machine)const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename; -PowerPCCPU *cpu;PCIHostState *phb;int i;MemoryRegion *sysmem =get_system_memory ();
@@ -1679,6 +1679,22 @@ static void ppc_spapr_init(MachineState *machine)long load_limit, fw_size;bool kernel_le = false;char *filename; +int smt =kvmppc_smt_threads (); +int spapr_cores = smp_cpus / smp_threads; +int spapr_max_cores = max_cpus / smp_threads; + +if (smc->dr_cpu_enabled) { +if (smp_cpus % smp_threads) { +error_report ("smp_cpus (%u) must be multiple of threads (%u)" , + smp_cpus, smp_threads); +exit (1 ); + } +if (max_cpus % smp_threads) { +error_report ("max_cpus (%u) must be multiple of threads (%u)" , + max_cpus, smp_threads); +exit (1 ); + } + } msi_nonbroken = true;
@@ -1725,8 +1741,7 @@ static void ppc_spapr_init(MachineState *machine)/* Set up Interrupt Controller before we create the VCPUs */ spapr->icp =xics_system_init (machine, -DIV_ROUND_UP (max_cpus *kvmppc_smt_threads (), - smp_threads), +DIV_ROUND_UP (max_cpus * smt, smp_threads),XICS_IRQS , &error_fatal);if (smc->dr_lmb_enabled) {
@@ -1737,13 +1752,37 @@ static void ppc_spapr_init(MachineState *machine)if (machine->cpu_model ==NULL ) { machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; } -for (i =0 ; i < smp_cpus; i++) { - cpu =cpu_ppc_init (machine->cpu_model); -if (cpu ==NULL ) { -error_report ("Unable to find PowerPC CPU definition" ); -exit (1 ); + +if (smc->dr_cpu_enabled) { +char *type =spapr_get_cpu_core_type (machine->cpu_model); + + spapr->cores = g_new0(Object *, spapr_max_cores); +for (i =0 ; i < spapr_cores; i++) { +int core_dt_id = i * smt; +Object *core; + +if (!object_class_by_name (type)) { +error_report ("Unable to find sPAPR CPU Core definition" ); +exit (1 ); + } + + core =object_new (type); +object_property_set_int (core, smp_threads,"nr-threads" , + &error_fatal); +object_property_set_int (core, core_dt_id,CPU_CORE_PROP_CORE_ID , + &error_fatal); +object_property_set_bool (core, true,"realized" , &error_fatal); } -spapr_cpu_init (spapr, cpu, &error_fatal); +g_free (type); + }else { +for (i =0 ; i < smp_cpus; i++) { +PowerPCCPU *cpu =cpu_ppc_init (machine->cpu_model); +if (cpu ==NULL ) { +error_report ("Unable to find PowerPC CPU definition" ); +exit (1 ); + } +spapr_cpu_init (spapr, cpu, &error_fatal); + } }if (kvm_enabled ()) {
@@ -2209,10 +2248,19 @@ static void spapr_machine_device_unplug(HotplugHandler *hotplug_dev, } } +static void spapr_machine_device_pre_plug (HotplugHandler *hotplug_dev, +DeviceState *dev,Error **errp) +{ +if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_CPU_CORE )) { +spapr_core_pre_plug (hotplug_dev, dev, errp); + } +} +static HotplugHandler *spapr_get_hotpug_handler (MachineState *machine,DeviceState *dev) { -if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM )) { +if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ) || +object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_CPU_CORE )) {return HOTPLUG_HANDLER (machine); }return NULL ;
@@ -2251,11 +2299,13 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->has_dynamic_sysbus = true; mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotpug_handler; + hc->pre_plug = spapr_machine_device_pre_plug; hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; smc->dr_lmb_enabled = true; + smc->dr_cpu_enabled = true; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi; }
@@ -2331,7 +2381,10 @@ static void spapr_machine_2_6_instance_options(MachineState *machine)static void spapr_machine_2_6_class_options (MachineClass *mc) { +sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); +spapr_machine_2_7_class_options (mc); + smc->dr_cpu_enabled = false;SET_MACHINE_COMPAT (mc,SPAPR_COMPAT_2_6 ); }
hw/ppc/spapr_cpu_core.c +58 -0
64 lines not on this page · raw message
include/hw/ppc/spapr.h +2 -0
@@ -38,6 +38,7 @@ struct sPAPRMachineClass {/*< public >*/ bool dr_lmb_enabled;/* enable dynamic-reconfig/hotplug of LMBs */ +bool dr_cpu_enabled;/* enable dynamic-reconfig/hotplug of CPUs */ bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */ };
@@ -81,6 +82,7 @@ struct sPAPRMachineState {/*< public >*/ char *kvm_type;MemoryHotplugState hotplug_memory; +Object **cores; };#define H_SUCCESS 0
include/hw/ppc/spapr_cpu_core.h +3 -0
@@ -26,4 +26,7 @@ typedef struct sPAPRCPUCore { ObjectClass *cpu_class; } sPAPRCPUCore; +void spapr_core_pre_plug (HotplugHandler *hotplug_dev,DeviceState *dev, +Error **errp); +char *spapr_get_cpu_core_type (const char *model);#endif
Signature · 1 line
2.1.0
PATCH v4 6/9 spapr: CPU hot unplug support
In reply to Bharata B RaoRemove the CPU core device by removing the underlying CPU thread devices. Hot removal of CPU for sPAPR guests is achieved by sending the hot unplug notification to the guest. Release the vCPU object after CPU hot unplug so that vCPU fd can be parked and reused.
--- hw/ppc/spapr.c | 8 ++++++ hw/ppc/spapr_cpu_core.c | 59 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_cpu_core.h | 2 ++ 3 files changed, 69 insertions(+)
hw/ppc/spapr.c +8 -0
@@ -2295,8 +2295,16 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,static void spapr_machine_device_unplug (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { +sPAPRMachineClass *smc =SPAPR_MACHINE_GET_CLASS (qdev_get_machine ()); +if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM )) {error_setg (errp,"Memory hot unplug not supported by sPAPR" ); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_CPU_CORE )) { +if (!smc->dr_cpu_enabled) { +error_setg (errp,"CPU hot unplug not supported on this machine" ); +return ; + } +spapr_core_unplug (hotplug_dev, dev, errp); } }
hw/ppc/spapr_cpu_core.c +59 -0
71 lines not on this page · raw message
include/hw/ppc/spapr_cpu_core.h +2 -0
@@ -31,4 +31,6 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,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);#endif
Signature · 1 line
2.1.0
PATCH v4 8/9 hmp: Add 'info hotpluggable-cpus' HMP command
In reply to Bharata B RaoThis is the HMP equivalent for QMP query-hotpluggable-cpus.
--- hmp-commands-info.hx | 14 ++++++++++++++ hmp.c | 41 +++++++++++++++++++++++++++++++++++++++++ hmp.h | 1 + 3 files changed, 56 insertions(+)
hmp-commands-info.hx +14 -0
@@ -800,6 +800,20 @@ STEXI Display the latest dump status. ETEXI + { + .name = "hotpluggable-cpus", + .args_type = "", + .params = "", + .help = "Show information about hotpluggable CPUs", + .mhandler.cmd = hmp_hotpluggable_cpus, + }, + +STEXI +@item info hotpluggable-cpus +@findex hotpluggable-cpus +Show information about hotpluggable CPUs +ETEXI + STEXI @end table ETEXI
hmp.c +41 -0
44 lines not on this page · raw message
hmp.h +1 -0
@@ -132,5 +132,6 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict);void hmp_rocker_of_dpa_flows (Monitor *mon,const QDict *qdict);void hmp_rocker_of_dpa_groups (Monitor *mon,const QDict *qdict);void hmp_info_dump (Monitor *mon,const QDict *qdict); +void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);#endif
Signature · 1 line
2.1.0
PATCH v4 7/9 QMP: Add query-hotpluggable-cpus
In reply to Bharata B RaoFrom: Igor Mammedov <[email protected]>
It will allow mgmt to query present and hotpluggable CPU objects, it is required from a target platform that wishes to support command to implement and set MachineClass.query_hotpluggable_cpus callback, which will return a list of possible CPU objects with options that would be needed for hotplugging possible CPU objects.
There are:
'type': 'str' - QOM CPU object type for usage with device_add 'vcpus-count': 'int' - number of logical VCPU threads per
CPU object (mgmt needs to know)
and a set of optional fields that are to used for hotplugging a CPU objects and would allows mgmt tools to know what/where it could be hotplugged;
[node],[socket],[core],[thread]
For present CPUs there is a 'qom-path' field which would allow mgmt to inspect whatever object/abstraction the target platform considers as CPU object.
--- include/hw/boards.h | 5 +++++ monitor.c | 13 +++++++++++++ qapi-schema.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 23 ++++++++++++++++++++++ 4 files changed, 96 insertions(+)
include/hw/boards.h +5 -0
@@ -81,6 +81,10 @@ 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. */ struct MachineClass {/*< private >*/
@@ -124,6 +128,7 @@ struct MachineClass { DeviceState *dev);unsigned (*cpu_index_to_socket_id)(unsigned cpu_index); CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); + HotpluggableCPUList *(*query_hotpluggable_cpus)(MachineState *machine); };/**
monitor.c +13 -0
@@ -4273,3 +4273,16 @@ GICCapabilityList *qmp_query_gic_capabilities(Error **errp) return NULL; }#endif + +HotpluggableCPUList *qmp_query_hotpluggable_cpus (Error **errp) +{ +MachineState *ms =MACHINE (qdev_get_machine ()); +MachineClass *mc =MACHINE_GET_CLASS (ms); + +if (!mc->query_hotpluggable_cpus) { +error_setg (errp,QERR_FEATURE_DISABLED ,"query-hotpluggable-cpus" ); +return NULL ; + } + +return mc->query_hotpluggable_cpus (ms); +}
qapi-schema.json +55 -0
58 lines not on this page · raw message
qmp-commands.hx +23 -0
@@ -4933,3 +4933,26 @@ Example: { "version": 3, "emulated": false, "kernel": true } ] } EQMP + + { + .name = "query-hotpluggable-cpus", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_query_hotpluggable_cpus, + }, + +SQMP +Show existing/possible CPUs +--------------------------- + +Arguments: None. + +Example for pseries machine type started with +-smp 2,cores=2,maxcpus=4 -cpu POWER8: + +-> { "execute": "query-hotpluggable-cpus" } +<- {"return": [ + { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", + "vcpus-count": 1 }, + { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", + "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} + ]}'
Signature · 1 line
2.1.0
PATCH v4 9/9 spapr: implement query-hotpluggable-cpus callback
In reply to Bharata B RaoFrom: Igor Mammedov <[email protected]>
It returns a list of present/possible to hotplug CPU objects with a list of properties to use with device_add.
in spapr case returned list would looks like:
-> { "execute": "query-hotpluggable-cpus" }
<- {"return": [
{ "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
"vcpus-count": 2 },
{ "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
"vcpus-count": 2,
"qom-path": "/machine/unattached/device[0]"}]}'
TODO:
add 'node' property for core <-> numa node mapping
--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
hw/ppc/spapr.c +34 -0
@@ -67,6 +67,7 @@#include "hw/compat.h" #include "qemu/cutils.h" #include "hw/ppc/spapr_cpu_core.h" +#include "qmp-commands.h" #include <libfdt.h>
@@ -2333,6 +2334,38 @@ static unsigned spapr_cpu_index_to_socket_id(unsigned cpu_index)return cpu_index / smp_threads / smp_cores; } +static HotpluggableCPUList *spapr_query_hotpluggable_cpus (MachineState *machine) +{ +int i; +HotpluggableCPUList *head =NULL ; +sPAPRMachineState *spapr =SPAPR_MACHINE (machine); +int spapr_max_cores = max_cpus / smp_threads; +int smt =kvmppc_smt_threads (); + +for (i =0 ; i < spapr_max_cores; i++) { +HotpluggableCPUList *list_item =g_new0 (typeof (*list_item),1 ); +HotpluggableCPU *cpu_item =g_new0 (typeof (*cpu_item),1 ); +CpuInstanceProperties *cpu_props =g_new0 (typeof (*cpu_props),1 ); + + cpu_item->type =spapr_get_cpu_core_type (machine->cpu_model); + cpu_item->vcpus_count = smp_threads; + cpu_props->has_core = true; + cpu_props->core = i * smt; +/* TODO: add 'has_node/node' here to describe +to which node core belongs */ + + cpu_item->props = cpu_props; +if (spapr->cores[i]) { + cpu_item->has_qom_path = true; + cpu_item->qom_path =object_get_canonical_path (spapr->cores[i]); + } + list_item->value = cpu_item; + list_item->next = head; + head = list_item; + } +return head; +} +static void spapr_machine_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -2363,6 +2396,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; + mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; smc->dr_lmb_enabled = true; smc->dr_cpu_enabled = true;
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH v4 2/9] spapr: Abstract CPU core device and type specific core devices
In reply to Bharata B RaoQuoted 137 lines · Bharata B Rao
Add sPAPR specific abastract CPU core device that is based on generic CPU core device. Use this as base type to create sPAPR CPU specific core devices.
TODO:
- Add core types for other remaining CPU types
- Handle CPU model alias correctlySigned-off-by Bharata B Rao <[email protected]>--- hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 3 +- hw/ppc/spapr_cpu_core.c | 160 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 1 + include/hw/ppc/spapr_cpu_core.h | 29 ++++++++ target-ppc/kvm.c | 28 +++++++ 6 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.hhw/ppc/Makefile.objs +1
-0@@ -4,6 +4,7 @@ obj-y += ppc.o ppc_booke.o obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o +obj-$(CONFIG_PSERIES) += spapr_cpu_core.o ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) obj-y += spapr_pci_vfio.o endifhw/ppc/spapr.c +1
-2@@ -1606,8 +1606,7 @@ static void spapr_boot_set(void *opaque, const char *boot_device, machine->boot_order =g_strdup (boot_device); } -static void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu, -Error **errp) +void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp) {CPUPPCState *env = &cpu->env;hw/ppc/spapr_cpu_core.c new file +85
-0@@ -0,0 +1,160 @@ +/* +* sPAPR CPU core device, acts as container of CPU thread devices. +* +* Copyright (C) 2016 Bharata B Rao <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "hw/cpu/core.h" +#include "hw/ppc/spapr_cpu_core.h" +#include "target-ppc/cpu.h" +#include "hw/ppc/spapr.h" +#include "hw/boards.h" +#include "qapi/error.h" +#include <sysemu/cpus.h> +#include "target-ppc/kvm_ppc.h" + +static int spapr_cpu_core_realize_child (Object *child,void *opaque) +{ +Error **errp = opaque; +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +CPUState *cs =CPU (child); +PowerPCCPU *cpu =POWERPC_CPU (cs); + +object_property_set_bool (child, true,"realized" , errp); +if (*errp) { +return 1 ; + } + +spapr_cpu_init (spapr, cpu, errp); +if (*errp) { +return 1 ; + } +return 0 ; +} + +static void spapr_cpu_core_realize (DeviceState *dev,Error **errp) +{ +sPAPRCPUCore *sc =SPAPR_CPU_CORE (OBJECT (dev)); +CPUCore *cc =CPU_CORE (OBJECT (dev)); +const char *typename =object_class_get_name (sc->cpu_class); +size_t size =object_type_get_size (typename); +Error *local_err =NULL ; +Object *obj; +int i; + + sc->threads =g_malloc0 (size * cc->nr_threads); +for (i =0 ; i < cc->nr_threads; i++) { +char id[32 ]; +void *obj = sc->threads + i * size; + +object_initialize (obj, size, typename); +snprintf (id,sizeof (id),"thread[%d]" , i); +object_property_add_child (OBJECT (sc), id, obj, &local_err); +if (local_err) { + goto err; + } + } +object_child_foreach (OBJECT (dev), spapr_cpu_core_realize_child, &local_err); +if (local_err) { + goto err; + }else { +return ; + } + +err: +while (i >=0 ) { + obj = sc->threads + i * size; +object_unparent (obj); + i--; + } +g_free (sc->threads); +error_propagate (errp, local_err); +} + +static void spapr_cpu_core_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + dc->realize = spapr_cpu_core_realize; +} + +/* +* instance_init routines from different flavours of sPAPR CPU cores. +* TODO: Add support for 'host' core type. +*/
hw/ppc/spapr_cpu_core.c line 95
Quoted 10 lines
hw/ppc/spapr_cpu_core.c new file +10
-0+#define SPAPR_CPU_CORE_INITFN (_type, _fname) \ +static void glue(glue(spapr_cpu_core_, _fname), _initfn(Object *obj)) \ +{ \ + sPAPRCPUCore *core = SPAPR_CPU_CORE(obj); \ + char *name = g_strdup_printf("%s-" TYPE_POWERPC_CPU, stringify(_type)); \ + ObjectClass *oc = object_class_by_name(name); \ + g_assert(oc); \ + g_free((void *)name); \ + core->cpu_class = oc; \ +}
I still think this can be a class_init rather than instance_init function, but that's a nit we can fix later.
Quoted 151 lines
hw/ppc/spapr_cpu_core.c new file +65
-0+ +SPAPR_CPU_CORE_INITFN(POWER7_v2.3, POWER7); +SPAPR_CPU_CORE_INITFN(POWER7+_v2.1, POWER7plus); +SPAPR_CPU_CORE_INITFN(POWER8_v2.0, POWER8); +SPAPR_CPU_CORE_INITFN(POWER8E_v2.1, POWER8E); + +typedef struct SPAPRCoreInfo { +const char *name; +void (*initfn)(Object *obj); +}SPAPRCoreInfo ; + +static const SPAPRCoreInfo spapr_cores[] = { +/* POWER7 and aliases */ + { .name ="POWER7_v2.3" , .initfn = spapr_cpu_core_POWER7_initfn }, + { .name ="POWER7" , .initfn = spapr_cpu_core_POWER7_initfn }, + +/* POWER7+ and aliases */ + { .name ="POWER7+_v2.1" , .initfn = spapr_cpu_core_POWER7plus_initfn }, + { .name ="POWER7+" , .initfn = spapr_cpu_core_POWER7plus_initfn }, + +/* POWER8 and aliases */ + { .name ="POWER8_v2.0" , .initfn = spapr_cpu_core_POWER8_initfn }, + { .name ="POWER8" , .initfn = spapr_cpu_core_POWER8_initfn }, + { .name ="power8" , .initfn = spapr_cpu_core_POWER8_initfn }, + +/* POWER8E and aliases */ + { .name ="POWER8E_v2.1" , .initfn = spapr_cpu_core_POWER8E_initfn }, + { .name ="POWER8E" , .initfn = spapr_cpu_core_POWER8E_initfn }, + + { .name =NULL } +}; + +static void spapr_cpu_core_register (const SPAPRCoreInfo *info) +{ +TypeInfo type_info = { + .parent =TYPE_SPAPR_CPU_CORE , + .instance_size =sizeof (sPAPRCPUCore), + .instance_init = info->initfn, + }; + + type_info.name =g_strdup_printf ("%s-" TYPE_SPAPR_CPU_CORE , info->name); +type_register (&type_info); +g_free ((void *)type_info.name); +} + +static const TypeInfo spapr_cpu_core_type_info = { + .name =TYPE_SPAPR_CPU_CORE , + .parent =TYPE_CPU_CORE , + .abstract = true, + .instance_size =sizeof (sPAPRCPUCore), + .class_init = spapr_cpu_core_class_init, +}; + +static void spapr_cpu_core_register_types (void ) +{ +const SPAPRCoreInfo *info = spapr_cores; + +type_register_static (&spapr_cpu_core_type_info); +while (info->name) { +spapr_cpu_core_register (info); + info++; + } +} + +type_init (spapr_cpu_core_register_types)include/hw/ppc/spapr.h +1
-0@@ -582,6 +582,7 @@ void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type, uint32_t count);void spapr_hotplug_req_remove_by_count (sPAPRDRConnectorType drc_type,uint32_t count); +void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp);/* rtas-configure-connector state */ struct sPAPRConfigureConnectorState {include/hw/ppc/spapr_cpu_core.h new file +29
-0@@ -0,0 +1,29 @@ +/* +* sPAPR CPU core device. +* +* Copyright (C) 2016 Bharata B Rao <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef HW_SPAPR_CPU_CORE_H +#define HW_SPAPR_CPU_CORE_H + +#include "hw/qdev.h" +#include "hw/cpu/core.h" +#include "target-ppc/cpu-qom.h" + +#define TYPE_SPAPR_CPU_CORE "spapr-cpu-core" +#define SPAPR_CPU_CORE (obj) \ + OBJECT_CHECK(sPAPRCPUCore, (obj), TYPE_SPAPR_CPU_CORE) + +typedef struct sPAPRCPUCore { +/*< private >*/ +CPUCore parent_obj; + +/*< public >*/ +void *threads; +ObjectClass *cpu_class; +}sPAPRCPUCore ; + +#endif target-ppc/kvm.c +17
-0@@ -43,6 +43,9 @@#include "exec/memattrs.h" #include "sysemu/hostmem.h" #include "qemu/cutils.h" +#if defined(TARGET_PPC64 ) +#include "hw/ppc/spapr_cpu_core.h" +#endif //#define DEBUG_KVM @@ -2329,6 +2332,19 @@ static PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)return POWERPC_CPU_CLASS (oc); } +#if defined(TARGET_PPC64 ) +static void spapr_cpu_core_host_initfn (Object *obj) +{ +sPAPRCPUCore *core =SPAPR_CPU_CORE (obj); +char *name =g_strdup_printf ("%s-" TYPE_POWERPC_CPU ,"host" ); +ObjectClass *oc =object_class_by_name (name); + +g_assert (oc); +g_free ((void *)name); + core->cpu_class = oc; +} +#endif +static int kvm_ppc_register_host_cpu_type (void ) {TypeInfo type_info = {@@ -2350,6 +2366,18 @@ static int kvm_ppc_register_host_cpu_type(void) type_info.parent =object_class_get_name (OBJECT_CLASS (pvr_pcc));type_register (&type_info); +#if defined(TARGET_PPC64 )
target-ppc/kvm.c static int kvm_ppc_register_host_cpu_type(void) · line 2379
Quoted 10 lines
target-ppc/kvm.c +10
-0+ type_info.name =g_strdup_printf ("%s-" TYPE_SPAPR_CPU_CORE ,"host" ); + type_info.parent =TYPE_SPAPR_CPU_CORE , + type_info.instance_size =sizeof (sPAPRCPUCore), + type_info.instance_init = spapr_cpu_core_host_initfn, + type_info.class_init =NULL ; +type_register (&type_info); +g_free ((void *)type_info.name); + type_info.instance_size =0 ; + type_info.instance_init =NULL ; +#endif
I think this will fail compile if you have a 64bit build which doesn't have CONFIG_PSERIES. Since none of the default configs do that, we can probably get away with it for now.
Quoted 4 lines
target-ppc/kvm.c +1
-0+/* Register generic family CPU class for a family */ pvr_pcc =ppc_cpu_get_family_class (pvr_pcc); dc =DEVICE_CLASS (pvr_pcc);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v4 1/9] qom: API to get instance_size of a type
In reply to Bharata B RaoQuoted 4 lines · Bharata B Rao
Add an API
object_type_get_size(const char *typename)that returns theinstance_sizeof the give typename.Signed-off-by Bharata B Rao <[email protected]>
This looks sensible to me, it would be nice to have an ack or two from the qemu community at large.
Quoted 41 lines
--- include/qom/object.h | 8 +++++++- qom/object.c | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/qom/object.h +7
-1@@ -1608,5 +1608,11 @@ int object_child_foreach_recursive(Object *obj,*/ Object *container_get (Object *root,const char *path); - +/** +* object_type_get_size: +* @typename: Name of the Type whose instance_size is required +* +* Returns the instance_size of the given @typename. +*/ +size_t object_type_get_size (const char *typename);#endif qom/object.c +8
-0@@ -202,6 +202,14 @@ static size_t type_object_get_size(TypeImpl *ti)return 0 ; } +size_t object_type_get_size (const char *typename) +{ +TypeImpl *type =type_get_by_name (typename); + +g_assert (type !=NULL ); +return type_object_get_size (type); +} +static bool type_is_ancestor (TypeImpl *type,TypeImpl *target_type) {assert (target_type);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 9 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]
I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
Quoted 63 lines
Changes in v4
-------------
- Rebased against David Gibson's ppc-cpu-hotplug and hence dropped those patches that are already part of that tree.
- We were assuming the CPU thread to be always of type PowerPCCPU which needn't be true. Hence use actual CPU type'sinstance_sizewhen object_initialize'ing the threads as per David's suggestion. This requires us to know theinstance_sizefor a given type for which a new QOM APIobject_type_get_size()has been introduced in this version.
- Consolidate CPU init related routines inspapr_cpu_core.c. As part of this movespapr_cpu_init()and its dependencies tospapr_cpu_core.c.
- Got rid of the temporary unplug list when removing CPU cores.
- Foldedspapr_cpu_core_create_threads()intospapr_cpu_core_realize()and fixed the error path in inspapr_cpu_core_realize().
- Add support for -cpu host.TODOs remaining
---------------
- Work on David's suggestion of intializing CPU's ObjectClass inclass_initrather thaninstance_init.
- Useobject_initialize_with_typeinstead ofobject_initializewhen creating CPU threads of a core.
- Usevcpu_dt_idlogic when populating core id inspapr_query_hotpluggable_cpus().
- Handle CPU compat properly (-cpu host,compat=POWER7)v3: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg01829.html
Bharata B Rao (7):
qom: API to getinstance_sizeof a type
spapr: Abstract CPU core device and type specific core devices
spapr: Movespapr_cpu_init()tospapr_cpu_core.c
spapr: convert boot CPUs into CPU core devices
spapr: CPU hotplug support
spapr: CPU hot unplug support
hmp: Add 'info hotpluggable-cpus' HMP commandIgor Mammedov (2):
QMP: Add query-hotpluggable-cpus
spapr: implement query-hotpluggable-cpus callbackhmp-commands-info.hx | 14 ++ hmp.c | 41 ++++ hmp.h | 1 + hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 215 +++++++++++++++------ hw/ppc/spapr_cpu_core.c | 405 ++++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_events.c | 3 + hw/ppc/spapr_rtas.c | 24 +++ include/hw/boards.h | 5 + include/hw/ppc/spapr.h | 7 + include/hw/ppc/spapr_cpu_core.h | 36 ++++ include/qom/object.h | 8 +- monitor.c | 13 ++ qapi-schema.json | 55 ++++++ qmp-commands.hx | 23 +++ qom/object.c | 8 + target-ppc/kvm.c | 28 +++ 17 files changed, 828 insertions(+), 59 deletions(-) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.h
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v4 3/9] spapr: Move spapr_cpu_init() to spapr_cpu_core.c
In reply to Bharata B RaoQuoted 7 lines · Bharata B Rao
Start consolidating CPU init related routines in
spapr_cpu_core.c. As part of this, movespapr_cpu_init()and its dependencies fromspapr.ctospapr_cpu_core.cNo functionality change in this patch.
Signed-off-by Bharata B Rao <[email protected]>
One nit..
Quoted 142 lines
--- hw/ppc/spapr.c | 47 ----------------------------------------------- hw/ppc/spapr_cpu_core.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 2 ++ 3 files changed, 50 insertions(+), 47 deletions(-)hw/ppc/spapr.c +0
-47@@ -89,8 +89,6 @@#define MIN_RMA_SLOF 128UL -#define TIMEBASE_FREQ 512000000ULL -#define PHANDLE_XICP 0x00001111#define HTAB_SIZE (spapr) (1ULL << ((spapr)->htab_shift))@@ -1181,26 +1179,6 @@ static void ppc_spapr_reset(void) } -static void spapr_cpu_reset (void *opaque) -{ -sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); -PowerPCCPU *cpu = opaque; -CPUState *cs =CPU (cpu); -CPUPPCState *env = &cpu->env; - -cpu_reset (cs); - -/* All CPUs start halted. CPU0 is unhalted from the machine level -* reset code and the rest are explicitly started up by the guest -* using an RTAS call */ - cs->halted =1 ; - - env->spr[SPR_HIOR ] =0 ; - -ppc_hash64_set_external_hpt (cpu, spapr->htab, spapr->htab_shift, - &error_fatal); -} -static void spapr_create_nvram (sPAPRMachineState *spapr) {DeviceState *dev =qdev_create (&spapr->vio_bus->bus,"spapr-nvram" );@@ -1606,31 +1584,6 @@ static void spapr_boot_set(void *opaque, const char *boot_device, machine->boot_order =g_strdup (boot_device); } -void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp) -{ -CPUPPCState *env = &cpu->env; - -/* Set time-base frequency to 512 MHz */ -cpu_ppc_tb_init (env,TIMEBASE_FREQ ); - -/* Enable PAPR mode in TCG or KVM */ -cpu_ppc_set_papr (cpu); - -if (cpu->max_compat) { -Error *local_err =NULL ; - -ppc_set_compat (cpu, cpu->max_compat, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } - } - -xics_cpu_setup (spapr->icp, cpu); - -qemu_register_reset (spapr_cpu_reset, cpu); -} -/* * Reset routine for LMB DR devices. * hw/ppc/spapr_cpu_core.c +48
-0@@ -14,6 +14,54 @@#include "qapi/error.h" #include <sysemu/cpus.h> #include "target-ppc/kvm_ppc.h" +#include "hw/ppc/ppc.h" +#include "target-ppc/mmu-hash64.h" +#include <sysemu/numa.h> + +static void spapr_cpu_reset (void *opaque) +{ +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +PowerPCCPU *cpu = opaque; +CPUState *cs =CPU (cpu); +CPUPPCState *env = &cpu->env; + +cpu_reset (cs); + +/* All CPUs start halted. CPU0 is unhalted from the machine level +* reset code and the rest are explicitly started up by the guest +* using an RTAS call */ + cs->halted =1 ; + + env->spr[SPR_HIOR ] =0 ; + +ppc_hash64_set_external_hpt (cpu, spapr->htab, spapr->htab_shift, + &error_fatal); +} + +void spapr_cpu_init (sPAPRMachineState *spapr,PowerPCCPU *cpu,Error **errp) +{ +CPUPPCState *env = &cpu->env; + +/* Set time-base frequency to 512 MHz */ +cpu_ppc_tb_init (env,TIMEBASE_FREQ ); + +/* Enable PAPR mode in TCG or KVM */ +cpu_ppc_set_papr (cpu); + +if (cpu->max_compat) { +Error *local_err =NULL ; + +ppc_set_compat (cpu, cpu->max_compat, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + } + +xics_cpu_setup (spapr->icp, cpu); + +qemu_register_reset (spapr_cpu_reset, cpu); +}static int spapr_cpu_core_realize_child (Object *child,void *opaque) {include/hw/ppc/spapr.h +0
-0
include/hw/ppc/spapr.h typedef struct sPAPREventLogEntry sPAPREventLogEntry; · line 20
Quoted 5 lines
include/hw/ppc/spapr.h +2
-0@@ -16,6 +16,8 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL#define SPAPR_ENTRY_POINT 0x100 +#define TIMEBASE_FREQ 512000000ULL +
Since this is now in a header which could be included anywhere, this really needs an SPAPR_PREFIX. I'll make that tweak myself when I merge it.
Quoted 3 lines
include/hw/ppc/spapr.h +0
-0typedef struct sPAPRMachineClass sPAPRMachineClass ;typedef struct sPAPRMachineState sPAPRMachineState ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v4 1/9] qom: API to get instance_size of a type
In reply to David GibsonQuoted 3 lines · On Fri, 10 Jun 2016 14:04:41 +1000 David Gibson <[email protected]>…
Quoted 2 lines · Bharata B Rao
Add an API
object_type_get_size(const char *typename)that returns theinstance_sizeof the give typename.
I'd rename it to
object_type_get_instance_size()
so it'd apparent what size is returned from name.
Quoted 50 lines
Quoted 2 lines
Signed-off-by Bharata B Rao <[email protected]>Reviewed-by David Gibson <[email protected]>This looks sensible to me, it would be nice to have an ack or two from the qemu community at large.
Quoted 41 lines
--- include/qom/object.h | 8 +++++++- qom/object.c | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/qom/object.h +7
-1@@ -1608,5 +1608,11 @@ int object_child_foreach_recursive(Object *obj,*/ Object *container_get (Object *root,const char *path); - +/** +* object_type_get_size: +* @typename: Name of the Type whose instance_size is required +* +* Returns the instance_size of the given @typename. +*/ +size_t object_type_get_size (const char *typename);#endif qom/object.c +8
-0@@ -202,6 +202,14 @@ static size_t type_object_get_size(TypeImpl *ti)return 0 ; } +size_t object_type_get_size (const char *typename) +{ +TypeImpl *type =type_get_by_name (typename); + +g_assert (type !=NULL ); +return type_object_get_size (type); +} +static bool type_is_ancestor (TypeImpl *type,TypeImpl *target_type) {assert (target_type);
Re: [Qemu-devel] [PATCH v4 8/9] hmp: Add 'info hotpluggable-cpus' HMP command
In reply to Bharata B RaoQuoted 4 lines · Bharata B Rao
This is the HMP equivalent for QMP query-hotpluggable-cpus.
Signed-off-by Bharata B Rao <[email protected]>Reviewed-by David Gibson <[email protected]>
This has a compile error on 32-bit host, because qapi 'int' values are actually uint64s. I've fixed it in my tree.
Quoted 91 lines
--- hmp-commands-info.hx | 14 ++++++++++++++ hmp.c | 41 +++++++++++++++++++++++++++++++++++++++++ hmp.h | 1 + 3 files changed, 56 insertions(+)hmp-commands-info.hx +14
-0@@ -800,6 +800,20 @@ STEXI Display the latest dump status. ETEXI + { + .name = "hotpluggable-cpus", + .args_type = "", + .params = "", + .help = "Show information about hotpluggable CPUs", + .mhandler.cmd = hmp_hotpluggable_cpus, + }, + +STEXI +@item info hotpluggable-cpus +@findex hotpluggable-cpus +Show information about hotpluggable CPUs +ETEXI + STEXI @end table ETEXIhmp.c +41
-0@@ -2424,3 +2424,44 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict)qapi_free_DumpQueryResult (result); } + +void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict) +{ +Error *err =NULL ; +HotpluggableCPUList *l =qmp_query_hotpluggable_cpus (&err); +HotpluggableCPUList *saved = l; +CpuInstanceProperties *c; + +if (err !=NULL ) { +hmp_handle_error (mon, &err); +return ; + } + +monitor_printf (mon,"Hotpluggable CPUs:\n" ); +while (l) { +monitor_printf (mon," type: \"%s\"\n" , l->value->type); +monitor_printf (mon," vcpus_count: \"%ld\"\n" , l->value->vcpus_count); +if (l->value->has_qom_path) { +monitor_printf (mon," qom_path: \"%s\"\n" , l->value->qom_path); + } + + c = l->value->props; +monitor_printf (mon," CPUInstance Properties:\n" ); +if (c->has_node) { +monitor_printf (mon," node: \"%ld\"\n" , c->node); + } +if (c->has_socket) { +monitor_printf (mon," socket: \"%ld\"\n" , c->socket); + } +if (c->has_core) { +monitor_printf (mon," core: \"%ld\"\n" , c->core); + } +if (c->has_thread) { +monitor_printf (mon," thread: \"%ld\"\n" , c->thread); + } + + l = l->next; + } + +qapi_free_HotpluggableCPUList (saved); +}hmp.h +1
-0@@ -132,5 +132,6 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict);void hmp_rocker_of_dpa_flows (Monitor *mon,const QDict *qdict);void hmp_rocker_of_dpa_groups (Monitor *mon,const QDict *qdict);void hmp_info_dump (Monitor *mon,const QDict *qdict); +void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);#endif
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v4 1/9] qom: API to get instance_size of a type
In reply to Igor MammedovQuoted 9 lines · Igor Mammedov
Quoted 3 lines · On Fri, 10 Jun 2016 14:04:41 +1000 David Gibson <[email protected]>…
Quoted 2 lines · Bharata B Rao
Add an API
object_type_get_size(const char *typename)that returns theinstance_sizeof the give typename.I'd rename it to
object_type_get_instance_size()
so it'd apparent what size is returned from name.
I'll make that change in my tree.
Quoted 52 lines
Quoted 51 lines
Quoted 3 lines
Signed-off-by Bharata B Rao <[email protected]>Reviewed-by David Gibson <[email protected]>This looks sensible to me, it would be nice to have an ack or two from the qemu community at large.
Quoted 41 lines
--- include/qom/object.h | 8 +++++++- qom/object.c | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/qom/object.h +7
-1@@ -1608,5 +1608,11 @@ int object_child_foreach_recursive(Object *obj,*/ Object *container_get (Object *root,const char *path); - +/** +* object_type_get_size: +* @typename: Name of the Type whose instance_size is required +* +* Returns the instance_size of the given @typename. +*/ +size_t object_type_get_size (const char *typename);#endif qom/object.c +8
-0@@ -202,6 +202,14 @@ static size_t type_object_get_size(TypeImpl *ti)return 0 ; } +size_t object_type_get_size (const char *typename) +{ +TypeImpl *type =type_get_by_name (typename); + +g_assert (type !=NULL ); +return type_object_get_size (type); +} +static bool type_is_ancestor (TypeImpl *type,TypeImpl *target_type) {assert (target_type);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 6 lines · David Gibson
Quoted 5 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
Quoted 7 lines
Quoted 4 lines
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
I've now merged this into my main ppc-for-2.7 branch. I'll be doing some testing, obviously, but I'd certain appreciate any other tests of this branch with the hotplug code.
Quoted 65 lines
Quoted 64 lines
Changes in v4
-------------
- Rebased against David Gibson's ppc-cpu-hotplug and hence dropped those patches that are already part of that tree.
- We were assuming the CPU thread to be always of type PowerPCCPU which needn't be true. Hence use actual CPU type'sinstance_sizewhen object_initialize'ing the threads as per David's suggestion. This requires us to know theinstance_sizefor a given type for which a new QOM APIobject_type_get_size()has been introduced in this version.
- Consolidate CPU init related routines inspapr_cpu_core.c. As part of this movespapr_cpu_init()and its dependencies tospapr_cpu_core.c.
- Got rid of the temporary unplug list when removing CPU cores.
- Foldedspapr_cpu_core_create_threads()intospapr_cpu_core_realize()and fixed the error path in inspapr_cpu_core_realize().
- Add support for -cpu host.TODOs remaining
---------------
- Work on David's suggestion of intializing CPU's ObjectClass inclass_initrather thaninstance_init.
- Useobject_initialize_with_typeinstead ofobject_initializewhen creating CPU threads of a core.
- Usevcpu_dt_idlogic when populating core id inspapr_query_hotpluggable_cpus().
- Handle CPU compat properly (-cpu host,compat=POWER7)v3: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg01829.html
Bharata B Rao (7):
qom: API to getinstance_sizeof a type
spapr: Abstract CPU core device and type specific core devices
spapr: Movespapr_cpu_init()tospapr_cpu_core.c
spapr: convert boot CPUs into CPU core devices
spapr: CPU hotplug support
spapr: CPU hot unplug support
hmp: Add 'info hotpluggable-cpus' HMP commandIgor Mammedov (2):
QMP: Add query-hotpluggable-cpus
spapr: implement query-hotpluggable-cpus callbackhmp-commands-info.hx | 14 ++ hmp.c | 41 ++++ hmp.h | 1 + hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 215 +++++++++++++++------ hw/ppc/spapr_cpu_core.c | 405 ++++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_events.c | 3 + hw/ppc/spapr_rtas.c | 24 +++ include/hw/boards.h | 5 + include/hw/ppc/spapr.h | 7 + include/hw/ppc/spapr_cpu_core.h | 36 ++++ include/qom/object.h | 8 +- monitor.c | 13 ++ qapi-schema.json | 55 ++++++ qmp-commands.hx | 23 +++ qom/object.c | 8 + target-ppc/kvm.c | 28 +++ 17 files changed, 828 insertions(+), 59 deletions(-) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.h
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 12 lines · David Gibson
Quoted 11 lines · David Gibson
Quoted 9 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]
Quoted 6 lines
Quoted 2 lines
I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
I've now merged this into my main ppc-for-2.7 branch. I'll be doing some testing, obviously, but I'd certain appreciate any other tests of this branch with the hotplug code.
David, I don't see the unplug patch in your tree, intentional ?
Also I am working on supporting the CPU compat settings with the following semantics:
-cpu host,power7 -device host-spapr-cpu-core,compat-cpu=power7
Whatever CPU compat level that is specifed with -cpu host is considered as base and the compat-cpu property specified with -device will be validated against the base compat level. And this property 'compat-cpu' will be supported only for host-spapr-cpu-core type.
Is this semantics fine ?
Regards,
Bharata.
Quoted 13 lines · Bharata B Rao
Quoted 12 lines · David Gibson
Quoted 11 lines · David Gibson
Quoted 9 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
I've now merged this into my main ppc-for-2.7 branch. I'll be doing some testing, obviously, but I'd certain appreciate any other tests of this branch with the hotplug code.
David, I don't see the unplug patch in your tree, intentional ?
Oops, no. I've added it now.
Quoted 11 lines
Also I am working on supporting the CPU compat settings with the following semantics:
-cpu host,power7 -device host-spapr-cpu-core,compat-cpu=power7
Whatever CPU compat level that is specifed with -cpu host is considered as base and the compat-cpu property specified with -device will be validated against the base compat level. And this property 'compat-cpu' will be supported only for host-spapr-cpu-core type.
Is this semantics fine ?
Uh.. I think so. The semantics of cpu compat modes have always confused me.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 20 lines · Bharata B Rao
Quoted 12 lines · David Gibson
Quoted 11 lines · David Gibson
Quoted 9 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]Quoted 6 lines
Quoted 2 lines
I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
I've now merged this into my main ppc-for-2.7 branch. I'll be doing some testing, obviously, but I'd certain appreciate any other tests of this branch with the hotplug code.
Quoted 6 lines
David, I don't see the unplug patch in your tree, intentional ?
Also I am working on supporting the CPU compat settings with the following semantics:
-cpu host,power7 -device host-spapr-cpu-core,compat-cpu=power7
I think the old syntax was something like:
-cpu POWER8,compat=power7
So maybe keep that "compat=" prefix for both options?
Thomas
Quoted 26 lines · On Thu, 16 Jun 2016 13:49:38 +0200 Thomas Huth <[email protected]> wrote:
Quoted 25 lines · Bharata B Rao
Quoted 12 lines · David Gibson
Quoted 11 lines · David Gibson
Quoted 9 lines · Bharata B Rao
Hi,
This is the next version of the CPU hotplug patchset for PowerPC sPAPR target. The hotplug semantics looks like this:
(qemu)
device_addPOWER8E-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addhost-spapr-cpu-core,id=core2,core-id=16[,threads=4] (qemu)device_addPOWER8E_v2.1-spapr-cpu-core,id=core2,core-id=16[,threads=4]Quoted 6 lines
Quoted 2 lines
I've merged these to my ppc-cpu-hotplug branch, and I'm doing some testing. It it checks out, I hope to send a pull request.
I've now merged this into my main ppc-for-2.7 branch. I'll be doing some testing, obviously, but I'd certain appreciate any other tests of this branch with the hotplug code.
David, I don't see the unplug patch in your tree, intentional ?
Also I am working on supporting the CPU compat settings with the following semantics:
Quoted 7 lines
Quoted 1 line
-cpu host,power7 -device host-spapr-cpu-core,compat-cpu=power7
I think the old syntax was something like:
-cpu POWER8,compat=power7
So maybe keep that "compat=" prefix for both options?
seconded,
it should be canonical property syntax "name=value"
Quoted 4 lines
Thomas