Patchwork [21/37] target-i386: convert 'hv_relaxed' to static property

login
register
mail settings
Submitter Igor Mammedov
Date Oct. 22, 2012, 3:03 p.m.
Message ID <1350918203-25198-22-git-send-email-imammedo@redhat.com>
Download mbox | patch
Permalink /patch/193221/
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 122e01a..029f28c 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -181,6 +181,34 @@  PropertyInfo qdev_prop_spinlocks = {
 #define DEFINE_PROP_HV_SPINLOCKS(_n)                                           \
     DEFINE_ABSTRACT_PROP(_n, qdev_prop_spinlocks)
 
+static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
+                                 const char *name, Error **errp)
+{
+    bool value = hyperv_relaxed_timing_enabled();
+
+    visit_type_bool(v, &value, name, errp);
+}
+
+static void x86_set_hv_relaxed(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_relaxed_timing(value);
+}
+
+PropertyInfo qdev_prop_hv_relaxed = {
+    .name  = "boolean",
+    .get   = x86_get_hv_relaxed,
+    .set   = x86_set_hv_relaxed,
+};
+#define DEFINE_PROP_HV_RELAXED(_n)                                             \
+    DEFINE_ABSTRACT_PROP(_n, qdev_prop_hv_relaxed)
+
 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),
@@ -296,6 +324,7 @@  static Property cpu_x86_properties[] = {
     DEFINE_PROP_UINT32("xlevel", X86CPU, env.cpuid_xlevel, 0),
     DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, 0),
     DEFINE_PROP_HV_SPINLOCKS("hv_spinlocks"),
+    DEFINE_PROP_HV_RELAXED("hv_relaxed"),
     DEFINE_PROP_END_OF_LIST(),
  };