From 7ea6e0671754330510bcdde2e7f5b5f2db426472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Fri, 3 Mar 2017 13:51:03 +0100 Subject: ppc/xics: register reset handlers for the ICP and ICS objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recent changes on the XICS layer removed the XICSState object to let the sPAPR machine handle the ICP and ICS directly. The reset of these objects was previously handled by XICSState, which was a SysBus device, and to keep the same behavior, the ICP and ICS were assigned to SysbBus. But that broke the 'info qtree' command in the monitor. 'qtree' performs a loop on the children of a bus to print their properties and SysBus devices are expected to be found under SysBus, which is not the case anymore. The fix for this problem is to register reset handlers for the ICP and ICS objects and stop using SysBus for such devices. Signed-off-by: Cédric Le Goater Reviewed-by: Thomas Huth Tested-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/spapr.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'hw/ppc') diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 14192accf4..c3bb991605 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -106,7 +106,6 @@ static int try_create_xics(sPAPRMachineState *spapr, const char *type_ics, int i; ics = ICS_SIMPLE(object_new(type_ics)); - qdev_set_parent_bus(DEVICE(ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(ics), NULL); object_property_set_int(OBJECT(ics), nr_irqs, "nr-irqs", &err); object_property_add_const_link(OBJECT(ics), "xics", OBJECT(xi), NULL); @@ -123,7 +122,6 @@ static int try_create_xics(sPAPRMachineState *spapr, const char *type_ics, ICPState *icp = &spapr->icps[i]; object_initialize(icp, sizeof(*icp), type_icp); - qdev_set_parent_bus(DEVICE(icp), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "icp[*]", OBJECT(icp), NULL); object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xi), NULL); object_property_set_bool(OBJECT(icp), true, "realized", &err); -- cgit v1.2.3 From 17b7c39e275ecacae1416bc164189d6ddd116c57 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Fri, 24 Feb 2017 10:26:56 +0100 Subject: spapr: ensure that all threads within core are on the same NUMA node Threads within a core shouldn't be on different NUMA nodes, so if user has misconfgured command line, fail QEMU at start up to force user fix it. For now use the first thread on the core as source of core's node-id. Later when cpu-numa refactoring lands it will be switched to core's node-id from possible_cpus[]. This prevents the same problems as commit 20bb648d "spapr: Fix default NUMA node allocation for threads", but for the case of manually configured NUMA node mappings, instead of just the default case. Signed-off-by: Igor Mammedov Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'hw/ppc') diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index d37832d0e3..6883f0991a 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -63,8 +63,6 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp) { CPUPPCState *env = &cpu->env; - CPUState *cs = CPU(cpu); - int i; /* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ); @@ -82,12 +80,6 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, } } - /* Set NUMA node for the added CPUs */ - i = numa_get_node_for_cpu(cs->cpu_index); - if (i < nb_numa_nodes) { - cs->numa_node = i; - } - xics_cpu_setup(XICS_FABRIC(spapr), cpu); qemu_register_reset(spapr_cpu_reset, cpu); @@ -171,11 +163,13 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp) const char *typename = object_class_get_name(scc->cpu_class); size_t size = object_type_get_instance_size(typename); Error *local_err = NULL; + int core_node_id = numa_get_node_for_cpu(cc->core_id);; void *obj; int i, j; sc->threads = g_malloc0(size * cc->nr_threads); for (i = 0; i < cc->nr_threads; i++) { + int node_id; char id[32]; CPUState *cs; @@ -184,6 +178,19 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp) object_initialize(obj, size, typename); cs = CPU(obj); cs->cpu_index = cc->core_id + i; + + /* Set NUMA node for the added CPUs */ + node_id = numa_get_node_for_cpu(cs->cpu_index); + if (node_id != core_node_id) { + error_setg(&local_err, "Invalid node-id=%d of thread[cpu-index: %d]" + " on CPU[core-id: %d, node-id: %d], node-id must be the same", + node_id, cs->cpu_index, cc->core_id, core_node_id); + goto err; + } + if (node_id < nb_numa_nodes) { + cs->numa_node = node_id; + } + snprintf(id, sizeof(id), "thread[%d]", i); object_property_add_child(OBJECT(sc), id, obj, &local_err); if (local_err) { -- cgit v1.2.3