[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH for-3.2 v3 04/14] accel: register global_props like ma
From: |
Marc-André Lureau |
Subject: |
[Qemu-ppc] [PATCH for-3.2 v3 04/14] accel: register global_props like machine globals |
Date: |
Wed, 7 Nov 2018 16:36:42 +0400 |
global_props is only used for Xen xen_compat_props. It's a static
array of GlobalProperty, like machine globals in SET_MACHINE_COMPAT().
Let's register the globals the same way, without extra copy allocation.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
---
include/hw/qdev-properties.h | 29 -----------------------------
accel/accel.c | 9 ++++++++-
hw/core/qdev-properties.c | 21 ---------------------
3 files changed, 8 insertions(+), 51 deletions(-)
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 4f60cc88f3..a95f4a73eb 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -255,35 +255,6 @@ void qdev_prop_set_globals(DeviceState *dev);
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
Property *prop, const char *value);
-/**
- * register_compat_prop:
- *
- * Register internal (not user-provided) global property, changing the
- * default value of a given property in a device type. This can be used
- * for enabling machine-type compatibility or for enabling
- * accelerator-specific defaults in devices.
- *
- * The property values set using this function must be always valid and
- * never report setter errors, as the property will have
- * GlobalProperty::errp set to &error_abort.
- *
- * User-provided global properties should override internal global
- * properties, so callers of this function should ensure that it is
- * called before user-provided global properties are registered.
- *
- * @driver: Device type to be affected
- * @property: Property whose default value is going to be changed
- * @value: New default value for the property
- */
-void register_compat_prop(const char *driver, const char *property,
- const char *value);
-/*
- * register_compat_props_array(): using register_compat_prop(), which
- * only registers internal global properties (which has lower priority
- * than user-provided global properties)
- */
-void register_compat_props_array(GlobalProperty *prop);
-
/**
* qdev_property_add_static:
* @dev: Device to add the property to.
diff --git a/accel/accel.c b/accel/accel.c
index 966b2d8f53..3da26eb90f 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -34,6 +34,7 @@
#include "qom/object.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
+#include "qapi/error.h"
static const TypeInfo accel_type = {
.name = TYPE_ACCEL,
@@ -121,7 +122,13 @@ void configure_accelerator(MachineState *ms)
void accel_register_compat_props(AccelState *accel)
{
AccelClass *class = ACCEL_GET_CLASS(accel);
- register_compat_props_array(class->global_props);
+ GlobalProperty *prop = class->global_props;
+
+ for (; prop && prop->driver; prop++) {
+ /* Any compat_props must never cause error */
+ prop->errp = &error_abort;
+ qdev_prop_register_global(prop);
+ }
}
void accel_setup_post(MachineState *ms)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 35072dec1e..ab61d502fd 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1180,27 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop)
global_props = g_list_append(global_props, prop);
}
-void register_compat_prop(const char *driver,
- const char *property,
- const char *value)
-{
- GlobalProperty *p = g_new0(GlobalProperty, 1);
-
- /* Any compat_props must never cause error */
- p->errp = &error_abort;
- p->driver = driver;
- p->property = property;
- p->value = value;
- qdev_prop_register_global(p);
-}
-
-void register_compat_props_array(GlobalProperty *prop)
-{
- for (; prop && prop->driver; prop++) {
- register_compat_prop(prop->driver, prop->property, prop->value);
- }
-}
-
void qdev_prop_register_global_list(GlobalProperty *props)
{
int i;
--
2.19.1.708.g4ede3d42df
- Re: [Qemu-ppc] [Qemu-devel] [PATCH for-3.2 v3 01/14] tests: qdev_prop_check_globals() doesn't return "all_used", (continued)
- [Qemu-ppc] [PATCH for-3.2 v3 05/14] qdev: move qdev_prop_register_global_list() to tests, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 04/14] accel: register global_props like machine globals,
Marc-André Lureau <=
- [Qemu-ppc] [PATCH for-3.2 v3 03/14] qom: make user_creatable_complete() specific to UserCreatable, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 06/14] qdev: do not mix compat props with global props, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 07/14] qdev: all globals are now user-provided, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 08/14] qdev-props: convert global_props to GArray, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 09/14] qdev-props: remove errp from GlobalProperty, Marc-André Lureau, 2018/11/07
- [Qemu-ppc] [PATCH for-3.2 v3 11/14] qom: teach interfaces to implement post-init, Marc-André Lureau, 2018/11/07