Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- target-i386/cpu-qom.h | 1 + target-i386/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index cb75017..7b09fa5 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -101,6 +101,7 @@ typedef struct X86CPU { bool migratable; bool host_features; int64_t apic_id; + int64_t numa_node; /* default: -1: not configured */ /* if true the CPUID code directly forward host cache leaves to the guest */ bool cache_info_passthrough; diff --git a/target-i386/cpu.c b/target-i386/cpu.c index d0b5b69..060131a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1802,6 +1802,44 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, const char *name, cpu->apic_id = value; } +static void x86_cpu_get_numa_node(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + int64_t value = cpu->numa_node; + + if (value == -1) { + error_setg(errp, "Attempt to get not initialized property '%s' on '%s'", + name, object_get_typename(obj)); + return; + } + + visit_type_int(v, name, &value, errp); +} + +static void x86_cpu_set_numa_node(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + DeviceState *dev = DEVICE(obj); + Error *error = NULL; + int64_t value; + + if (dev->realized) { + error_setg(errp, "Attempt to set property '%s' on '%s' after " + "it was realized", name, object_get_typename(obj)); + return; + } + + visit_type_int(v, name, &value, &error); + if (error) { + error_propagate(errp, error); + return; + } + cpu->numa_node = value; +} + + /* Generic getter for "feature-words" and "filtered-features" properties */ static void x86_cpu_get_feature_words(Object *obj, Visitor *v, const char *name, void *opaque, @@ -3133,6 +3171,10 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features, NULL); + cpu->numa_node = -1; + object_property_add(obj, "node", "int", + x86_cpu_get_numa_node, + x86_cpu_set_numa_node, NULL, NULL, NULL); cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY; -- 1.8.3.1