From e35704ba9ce0cd1e3c401f3bfbf3faf98b0b6885 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:16 -0200 Subject: numa: Move NUMA declarations from sysemu.h to numa.h Not all sysemu.h users need the NUMA declarations, and keeping them in a separate file makes it easier to see what are the interfaces provided by numa.c. Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numa.c') diff --git a/numa.c b/numa.c index afd28666b3..40f3d36472 100644 --- a/numa.c +++ b/numa.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include "sysemu/sysemu.h" +#include "sysemu/numa.h" #include "exec/cpu-common.h" #include "qemu/bitmap.h" #include "qom/cpu.h" -- cgit v1.2.1 From de1a7c84c49affff5884175d621c95196007ea23 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:18 -0200 Subject: numa: Move NUMA globals to numa.c Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'numa.c') diff --git a/numa.c b/numa.c index 40f3d36472..61531db5a1 100644 --- a/numa.c +++ b/numa.c @@ -45,6 +45,9 @@ QemuOptsList qemu_numa_opts = { }; static int have_memdevs = -1; +int nb_numa_nodes; +int max_numa_nodeid; +NodeInfo numa_info[MAX_NODES]; static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) { -- cgit v1.2.1 From 25712ffe8478a95abd7b82e2f085c7c929498643 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:19 -0200 Subject: numa: Make max_numa_nodeid static Now the only code that uses the variable is inside numa.c. Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numa.c') diff --git a/numa.c b/numa.c index 61531db5a1..84d4cb5d13 100644 --- a/numa.c +++ b/numa.c @@ -45,8 +45,10 @@ QemuOptsList qemu_numa_opts = { }; static int have_memdevs = -1; +static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one. + * For all nodes, nodeid < max_numa_nodeid + */ int nb_numa_nodes; -int max_numa_nodeid; NodeInfo numa_info[MAX_NODES]; static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) -- cgit v1.2.1 From 7dcd1d70fe2886a1e30d32678b795e6b9b6dd5c4 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:20 -0200 Subject: numa: Move QemuOpts parsing to set_numa_nodes() This allows us to make numa_init_func() static. Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'numa.c') diff --git a/numa.c b/numa.c index 84d4cb5d13..eb9259b66a 100644 --- a/numa.c +++ b/numa.c @@ -36,6 +36,8 @@ #include "sysemu/hostmem.h" #include "qmp-commands.h" #include "hw/mem/pc-dimm.h" +#include "qemu/option.h" +#include "qemu/config-file.h" QemuOptsList qemu_numa_opts = { .name = "numa", @@ -121,7 +123,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1); } -int numa_init_func(QemuOpts *opts, void *opaque) +static int numa_init_func(QemuOpts *opts, void *opaque) { NumaOptions *object = NULL; Error *err = NULL; @@ -168,6 +170,11 @@ void set_numa_nodes(void) { int i; + if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func, + NULL, 1) != 0) { + exit(1); + } + assert(max_numa_nodeid <= MAX_NODES); /* No support for sparse NUMA node IDs yet: */ -- cgit v1.2.1 From 1c1e6732786d46c7b0ab160cbf61122c53bb44cc Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:21 -0200 Subject: numa: Rename option parsing functions Renaming set_numa_nodes() and numa_init_func() to parse_numa_opts() and parse_numa() makes the purpose of those functions clearer. Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'numa.c') diff --git a/numa.c b/numa.c index eb9259b66a..d5b95e1a0a 100644 --- a/numa.c +++ b/numa.c @@ -123,7 +123,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1); } -static int numa_init_func(QemuOpts *opts, void *opaque) +static int parse_numa(QemuOpts *opts, void *opaque) { NumaOptions *object = NULL; Error *err = NULL; @@ -166,11 +166,11 @@ error: return -1; } -void set_numa_nodes(void) +void parse_numa_opts(void) { int i; - if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func, + if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, 1) != 0) { exit(1); } -- cgit v1.2.1 From dde11116782c1891a057165539efc014cf365026 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sun, 8 Feb 2015 16:51:22 -0200 Subject: numa: Rename set_numa_modes() to numa_post_machine_init() This function does some initialization that needs to be done after machine init. The function may be eventually removed if we move the CPUState.numa_node initialization to the CPU init code, but while the function exists, lets give it a name that makes sense. Reviewed-by: Paolo Bonzini Acked-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numa.c') diff --git a/numa.c b/numa.c index d5b95e1a0a..0d15375dfd 100644 --- a/numa.c +++ b/numa.c @@ -246,7 +246,7 @@ void parse_numa_opts(void) } } -void set_numa_modes(void) +void numa_post_machine_init(void) { CPUState *cpu; int i; -- cgit v1.2.1