From 52924dea1761e329fb3a14a50f98a1cd161d68d5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 19 Jun 2019 22:10:43 +0200 Subject: hw/core: Collect QMP command handlers in hw/core/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The handlers for qapi/machine.json's QMP commands are spread over cpus.c, hw/core/numa.c, monitor/misc.c, monitor/qmp-cmds.c, and vl.c. Move them all to new hw/core/machine-qmp-cmds.c, where they are covered by MAINTAINERS section "Machine core", just like qapi/machine.json. Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Message-Id: <20190619201050.19040-11-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé --- hw/core/numa.c | 62 ---------------------------------------------------------- 1 file changed, 62 deletions(-) (limited to 'hw/core/numa.c') diff --git a/hw/core/numa.c b/hw/core/numa.c index 6f85407c46..76c447f90a 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -27,14 +27,10 @@ #include "exec/cpu-common.h" #include "exec/ramlist.h" #include "qemu/bitmap.h" -#include "qom/cpu.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" -#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-visit-machine.h" -#include "hw/boards.h" -#include "sysemu/hostmem.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/memory-device.h" #include "qemu/option.h" @@ -174,7 +170,6 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp) have_numa_distance = true; } -static void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) { Error *err = NULL; @@ -447,17 +442,6 @@ void parse_numa_opts(MachineState *ms) qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal); } -void qmp_set_numa_node(NumaOptions *cmd, Error **errp) -{ - if (!runstate_check(RUN_STATE_PRECONFIG)) { - error_setg(errp, "The command is permitted only in '%s' state", - RunState_str(RUN_STATE_PRECONFIG)); - return; - } - - set_numa_options(MACHINE(qdev_get_machine()), cmd, errp); -} - void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp) { int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort); @@ -592,52 +576,6 @@ void query_numa_node_mem(NumaNodeMem node_mem[]) } } -static int query_memdev(Object *obj, void *opaque) -{ - MemdevList **list = opaque; - MemdevList *m = NULL; - - if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { - m = g_malloc0(sizeof(*m)); - - m->value = g_malloc0(sizeof(*m->value)); - - m->value->id = object_get_canonical_path_component(obj); - m->value->has_id = !!m->value->id; - - m->value->size = object_property_get_uint(obj, "size", - &error_abort); - m->value->merge = object_property_get_bool(obj, "merge", - &error_abort); - m->value->dump = object_property_get_bool(obj, "dump", - &error_abort); - m->value->prealloc = object_property_get_bool(obj, - "prealloc", - &error_abort); - m->value->policy = object_property_get_enum(obj, - "policy", - "HostMemPolicy", - &error_abort); - object_property_get_uint16List(obj, "host-nodes", - &m->value->host_nodes, - &error_abort); - - m->next = *list; - *list = m; - } - - return 0; -} - -MemdevList *qmp_query_memdev(Error **errp) -{ - Object *obj = object_get_objects_root(); - MemdevList *list = NULL; - - object_child_foreach(obj, query_memdev, &list); - return list; -} - void ram_block_notifier_add(RAMBlockNotifier *n) { QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next); -- cgit v1.2.3