[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/4] cpu: Clarify TODO comment in cpu_generic_new()

From: Peter Maydell
Subject: [Qemu-devel] [PATCH 2/4] cpu: Clarify TODO comment in cpu_generic_new()
Date: Mon, 13 Feb 2017 14:28:17 +0000

The TODO comment in cpu_generic_new() suggests that we want to
move to having all callers do the parse_features work by hand.
In fact the intention is that we would prefer to have this
happen automatically via machine core work or similar common
code changes. In the meantime boards should use the
cpu_generic_new() wrapper rather than calling parse_features
themselves, because this means we only need to change one
place in future if we change how parse_features gets called.

Signed-off-by: Peter Maydell <address@hidden>
Change based on email conversation with Eduardo...hopefully
I have understood the intention here correctly.
 qom/cpu.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/qom/cpu.c b/qom/cpu.c
index a783aec..eacce5e 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -80,8 +80,14 @@ CPUState *cpu_generic_new(const char *typename, const char 
     cc = CPU_CLASS(oc);
     featurestr = strtok(NULL, ",");
-    /* TODO: all callers of cpu_generic_init() need to be converted to
-     * call parse_features() only once, before calling cpu_generic_init().
+    /* TODO: we should really arrange to have parse_features() called
+     * only once, since it needs only to be called once per CPU class
+     * rather than once per instance of that class. Perhaps this would
+     * be done by changes to how machine core code works or by doing
+     * something in main(). In the meantime, board code should prefer
+     * to use this function rather than calling parse_features()
+     * manually, so that refactoring how we handle this is easier in
+     * future.
     cc->parse_features(object_class_get_name(oc), featurestr, &err);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]