[Top][All Lists]
[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
- [Qemu-devel] [PATCH 13/37] target-i386: convert "level" to static property, (continued)
- [Qemu-devel] [PATCH 21/37] target-i386: convert 'hv_relaxed' to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 11/37] target-i386: introduce vendor-override static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 28/37] target-i386: convert "model-id" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 20/37] target-i386: convert 'hv_spinlocks' to static property,
Igor Mammedov <=
- [Qemu-devel] [PATCH 19/37] qdev: add DEFINE_ABSTRACT_PROP() helper, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 34/37] qdev: introduce QDEV_FIND_PROP_FROM_BIT and qdev_prop_find_bit(), Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 25/37] target-i386: replace uint32_t vendor fields by vendor string in x86_def_t, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 23/37] target-i386: convert 'check' and 'enforce' to static properties, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 36/37] target-i386: use static properties to list CPUID features, Igor Mammedov, 2012/10/22
- Re: [Qemu-devel] [PATCH 36/37] target-i386: use static properties to list CPUID features, Don Slutz, 2012/10/23