Patchwork [22/37] target-i386: convert 'hv_vapic' to static property

login
register
mail settings
Submitter Igor Mammedov
Date Oct. 22, 2012, 3:03 p.m.
Message ID <1350918203-25198-23-git-send-email-imammedo@redhat.com>
Download mbox | patch
Permalink /patch/193200/
State New
Headers show

Comments

Igor Mammedov - Oct. 22, 2012, 3:03 p.m.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 target-i386/cpu.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 029f28c..44cbf9c 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -209,6 +209,34 @@  PropertyInfo qdev_prop_hv_relaxed = {
 #define DEFINE_PROP_HV_RELAXED(_n)                                             \
     DEFINE_ABSTRACT_PROP(_n, qdev_prop_hv_relaxed)
 
+static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
+                                 const char *name, Error **errp)
+{
+    bool value = hyperv_vapic_recommended();
+
+    visit_type_bool(v, &value, name, errp);
+}
+
+static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
+                                 const char *name, Error **errp)
+{
+    bool value;
+
+    visit_type_bool(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+    hyperv_enable_vapic_recommended(value);
+}
+
+PropertyInfo qdev_prop_hv_vapic = {
+    .name  = "boolean",
+    .get   = x86_get_hv_vapic,
+    .set   = x86_set_hv_vapic,
+};
+#define DEFINE_PROP_HV_VAPIC(_n)                                               \
+    DEFINE_ABSTRACT_PROP(_n, qdev_prop_hv_vapic)
+
 static Property cpu_x86_properties[] = {
     DEFINE_PROP_BIT("f-fpu", X86CPU, env.cpuid_features,  0, false),
     DEFINE_PROP_BIT("f-vme", X86CPU, env.cpuid_features,  1, false),
@@ -325,6 +353,7 @@  static Property cpu_x86_properties[] = {
     DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, 0),
     DEFINE_PROP_HV_SPINLOCKS("hv_spinlocks"),
     DEFINE_PROP_HV_RELAXED("hv_relaxed"),
+    DEFINE_PROP_HV_VAPIC("hv_vapic"),
     DEFINE_PROP_END_OF_LIST(),
  };