Considering that CPU features are provided via command line, the
global_props are now all user-provided globals. No need to track this
anymore for qdev_prop_check_globals().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/hw/qdev-core.h | 3 --
hw/core/qdev-properties.c | 4 ---
tests/test-qdev-global-props.c | 57 ++++------------------------------
vl.c | 1 -
4 files changed, 6 insertions(+), 59 deletions(-)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index a24d0dd566..baaf097212 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -249,8 +249,6 @@ struct PropertyInfo {
/**
* GlobalProperty:
- * @user_provided: Set to true if property comes from user-provided config
- * (command-line or config file).
* @used: Set to true if property was used when initializing a device.
* @errp: Error destination, used like first argument of error_setg()
* in case property setting fails later. If @errp is NULL, we
@@ -262,7 +260,6 @@ typedef struct GlobalProperty {
const char *driver;
const char *property;
const char *value;
- bool user_provided;
bool used;
Error **errp;
} GlobalProperty;
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index bd84c4ea4c..43c30a57f4 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1192,9 +1192,6 @@ int qdev_prop_check_globals(void)
if (prop->used) {
continue;
}
- if (!prop->user_provided) {
- continue;
- }
oc = object_class_by_name(prop->driver);
oc = object_class_dynamic_cast(oc, TYPE_DEVICE);
if (!oc) {
@@ -1233,7 +1230,6 @@ void qdev_prop_set_globals(DeviceState *dev)
if (!dev->hotplugged && prop->errp) {
error_propagate(prop->errp, err);
} else {
- assert(prop->user_provided);
warn_report_err(err);
}
}
diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
index 3a8d3170a0..f49a1b70b5 100644
--- a/tests/test-qdev-global-props.c
+++ b/tests/test-qdev-global-props.c
@@ -215,12 +215,12 @@ static void test_dynamic_globalprop_subprocess(void)
{
MyType *mt;
static GlobalProperty props[] = {
- { TYPE_DYNAMIC_PROPS, "prop1", "101", true },
- { TYPE_DYNAMIC_PROPS, "prop2", "102", true },
- { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
- { TYPE_UNUSED_HOTPLUG, "prop4", "104", true },
- { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true },
- { TYPE_NONDEVICE, "prop6", "106", true },
+ { TYPE_DYNAMIC_PROPS, "prop1", "101", },
+ { TYPE_DYNAMIC_PROPS, "prop2", "102", },
+ { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", },
+ { TYPE_UNUSED_HOTPLUG, "prop4", "104", },
+ { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", },
+ { TYPE_NONDEVICE, "prop6", "106", },
{}
};
int global_error;
@@ -255,46 +255,6 @@ static void test_dynamic_globalprop(void)
g_test_trap_assert_stdout("");
}
-/* Test setting of dynamic properties using user_provided=false properties */
-static void test_dynamic_globalprop_nouser_subprocess(void)
-{
- MyType *mt;
- static GlobalProperty props[] = {
- { TYPE_DYNAMIC_PROPS, "prop1", "101" },
- { TYPE_DYNAMIC_PROPS, "prop2", "102" },
- { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103" },
- { TYPE_UNUSED_HOTPLUG, "prop4", "104" },
- { TYPE_UNUSED_NOHOTPLUG, "prop5", "105" },
- { TYPE_NONDEVICE, "prop6", "106" },
- {}
- };
- int global_error;
-
- register_global_properties(props);
-
- mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
- qdev_init_nofail(DEVICE(mt));
-
- g_assert_cmpuint(mt->prop1, ==, 101);
- g_assert_cmpuint(mt->prop2, ==, 102);
- global_error = qdev_prop_check_globals();
- g_assert_cmpuint(global_error, ==, 0);
- g_assert(props[0].used);
- g_assert(props[1].used);
- g_assert(!props[2].used);
- g_assert(!props[3].used);
- g_assert(!props[4].used);
- g_assert(!props[5].used);
-}
-
-static void test_dynamic_globalprop_nouser(void)
-{
- g_test_trap_subprocess("/qdev/properties/dynamic/global/nouser/subprocess", 0, 0);
- g_test_trap_assert_passed();
- g_test_trap_assert_stderr("");
- g_test_trap_assert_stdout("");
-}
-
/* Test if global props affecting subclasses are applied in the right order */
static void test_subclass_global_props(void)
{
@@ -344,11 +304,6 @@ int main(int argc, char **argv)
g_test_add_func("/qdev/properties/dynamic/global",
test_dynamic_globalprop);
- g_test_add_func("/qdev/properties/dynamic/global/nouser/subprocess",
- test_dynamic_globalprop_nouser_subprocess);
- g_test_add_func("/qdev/properties/dynamic/global/nouser",
- test_dynamic_globalprop_nouser);
-
g_test_add_func("/qdev/properties/global/subclass",
test_subclass_global_props);
diff --git a/vl.c b/vl.c
index 2aea884c9d..d11b070e70 100644
--- a/vl.c
+++ b/vl.c
@@ -2931,7 +2931,6 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp)
g->driver = qemu_opt_get(opts, "driver");
g->property = qemu_opt_get(opts, "property");
g->value = qemu_opt_get(opts, "value");
- g->user_provided = true;
g->errp = &error_fatal;
qdev_prop_register_global(g);
return 0;
--
2.19.1.708.g4ede3d42df
On Wed, 7 Nov 2018 16:36:45 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> Considering that CPU features are provided via command line, the
I can guess what it is about once I recall how -cpu foo,+-feat works,
but without that knowledge I don't get meaning behind the sentence.
Could you rephrase it?
> global_props are now all user-provided globals. No need to track this
> anymore for qdev_prop_check_globals().
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> include/hw/qdev-core.h | 3 --
> hw/core/qdev-properties.c | 4 ---
> tests/test-qdev-global-props.c | 57 ++++------------------------------
> vl.c | 1 -
> 4 files changed, 6 insertions(+), 59 deletions(-)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index a24d0dd566..baaf097212 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -249,8 +249,6 @@ struct PropertyInfo {
>
> /**
> * GlobalProperty:
> - * @user_provided: Set to true if property comes from user-provided config
> - * (command-line or config file).
> * @used: Set to true if property was used when initializing a device.
> * @errp: Error destination, used like first argument of error_setg()
> * in case property setting fails later. If @errp is NULL, we
> @@ -262,7 +260,6 @@ typedef struct GlobalProperty {
> const char *driver;
> const char *property;
> const char *value;
> - bool user_provided;
> bool used;
> Error **errp;
> } GlobalProperty;
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index bd84c4ea4c..43c30a57f4 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1192,9 +1192,6 @@ int qdev_prop_check_globals(void)
> if (prop->used) {
> continue;
> }
> - if (!prop->user_provided) {
> - continue;
> - }
> oc = object_class_by_name(prop->driver);
> oc = object_class_dynamic_cast(oc, TYPE_DEVICE);
> if (!oc) {
> @@ -1233,7 +1230,6 @@ void qdev_prop_set_globals(DeviceState *dev)
> if (!dev->hotplugged && prop->errp) {
> error_propagate(prop->errp, err);
> } else {
> - assert(prop->user_provided);
> warn_report_err(err);
> }
> }
> diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
> index 3a8d3170a0..f49a1b70b5 100644
> --- a/tests/test-qdev-global-props.c
> +++ b/tests/test-qdev-global-props.c
> @@ -215,12 +215,12 @@ static void test_dynamic_globalprop_subprocess(void)
> {
> MyType *mt;
> static GlobalProperty props[] = {
> - { TYPE_DYNAMIC_PROPS, "prop1", "101", true },
> - { TYPE_DYNAMIC_PROPS, "prop2", "102", true },
> - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
> - { TYPE_UNUSED_HOTPLUG, "prop4", "104", true },
> - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true },
> - { TYPE_NONDEVICE, "prop6", "106", true },
> + { TYPE_DYNAMIC_PROPS, "prop1", "101", },
> + { TYPE_DYNAMIC_PROPS, "prop2", "102", },
> + { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", },
> + { TYPE_UNUSED_HOTPLUG, "prop4", "104", },
> + { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", },
> + { TYPE_NONDEVICE, "prop6", "106", },
> {}
> };
> int global_error;
> @@ -255,46 +255,6 @@ static void test_dynamic_globalprop(void)
> g_test_trap_assert_stdout("");
> }
>
> -/* Test setting of dynamic properties using user_provided=false properties */
> -static void test_dynamic_globalprop_nouser_subprocess(void)
> -{
> - MyType *mt;
> - static GlobalProperty props[] = {
> - { TYPE_DYNAMIC_PROPS, "prop1", "101" },
> - { TYPE_DYNAMIC_PROPS, "prop2", "102" },
> - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103" },
> - { TYPE_UNUSED_HOTPLUG, "prop4", "104" },
> - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105" },
> - { TYPE_NONDEVICE, "prop6", "106" },
> - {}
> - };
> - int global_error;
> -
> - register_global_properties(props);
> -
> - mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
> - qdev_init_nofail(DEVICE(mt));
> -
> - g_assert_cmpuint(mt->prop1, ==, 101);
> - g_assert_cmpuint(mt->prop2, ==, 102);
> - global_error = qdev_prop_check_globals();
> - g_assert_cmpuint(global_error, ==, 0);
> - g_assert(props[0].used);
> - g_assert(props[1].used);
> - g_assert(!props[2].used);
> - g_assert(!props[3].used);
> - g_assert(!props[4].used);
> - g_assert(!props[5].used);
> -}
> -
> -static void test_dynamic_globalprop_nouser(void)
> -{
> - g_test_trap_subprocess("/qdev/properties/dynamic/global/nouser/subprocess", 0, 0);
> - g_test_trap_assert_passed();
> - g_test_trap_assert_stderr("");
> - g_test_trap_assert_stdout("");
> -}
> -
> /* Test if global props affecting subclasses are applied in the right order */
> static void test_subclass_global_props(void)
> {
> @@ -344,11 +304,6 @@ int main(int argc, char **argv)
> g_test_add_func("/qdev/properties/dynamic/global",
> test_dynamic_globalprop);
>
> - g_test_add_func("/qdev/properties/dynamic/global/nouser/subprocess",
> - test_dynamic_globalprop_nouser_subprocess);
> - g_test_add_func("/qdev/properties/dynamic/global/nouser",
> - test_dynamic_globalprop_nouser);
> -
> g_test_add_func("/qdev/properties/global/subclass",
> test_subclass_global_props);
>
> diff --git a/vl.c b/vl.c
> index 2aea884c9d..d11b070e70 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2931,7 +2931,6 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp)
> g->driver = qemu_opt_get(opts, "driver");
> g->property = qemu_opt_get(opts, "property");
> g->value = qemu_opt_get(opts, "value");
> - g->user_provided = true;
> g->errp = &error_fatal;
> qdev_prop_register_global(g);
> return 0;
© 2016 - 2026 Red Hat, Inc.