qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 20/37] target-i386: convert 'hv_spinlocks' to static


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH 20/37] target-i386: convert 'hv_spinlocks' to static property
Date: Mon, 22 Oct 2012 17:03:06 +0200

Signed-off-by: Igor Mammedov <address@hidden>
---
  * in addition use error_setg() instead of error_set()
---
 target-i386/cpu.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9cdcae8..122e01a 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -148,6 +148,39 @@ PropertyInfo qdev_prop_kvmclock = {
 
 #endif
 
+static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
+                                 const char *name, Error **errp)
+{
+    int64_t value = hyperv_get_spinlock_retries();
+
+    visit_type_int(v, &value, name, errp);
+}
+
+static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
+                                 const char *name, Error **errp)
+{
+    int64_t value;
+
+    visit_type_int(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+    if (!value) {
+        error_setg(errp, "Property '%s.%s' doesn't take value '%s'",
+                   object_get_typename(obj), name, "0");
+        return;
+    }
+    hyperv_set_spinlock_retries(value);
+}
+
+PropertyInfo qdev_prop_spinlocks = {
+    .name  = "int",
+    .get   = x86_get_hv_spinlocks,
+    .set   = x86_set_hv_spinlocks,
+};
+#define DEFINE_PROP_HV_SPINLOCKS(_n)                                           
\
+    DEFINE_ABSTRACT_PROP(_n, qdev_prop_spinlocks)
+
 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),
@@ -262,6 +295,7 @@ static Property cpu_x86_properties[] = {
     DEFINE_PROP_BIT("vendor-override", X86CPU, env.cpuid_vendor_override, 0, 
false),
     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_END_OF_LIST(),
  };
 
-- 
1.7.11.7




reply via email to

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