From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL v2 23/28] qdev: all globals are now user-provided
Date: Mon, 7 Jan 2019 16:22:59 +0400 [thread overview]
Message-ID: <20190107122304.22997-24-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20190107122304.22997-1-marcandre.lureau@redhat.com>
All globals are now either provided via -global or through -cpu
features (CPU features are implemented by registering globals).
If the global isn't being used, it should warn in either case.
We can thus consider that all global_props are "user-provided"
globals. No need to track this per-globals anymore.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@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 5989fb6565..86b05baeeb 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 943dc2654b..84df9c06a7 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 b1eb505442..60231b1372 100644
--- a/tests/test-qdev-global-props.c
+++ b/tests/test-qdev-global-props.c
@@ -216,12 +216,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;
@@ -256,46 +256,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)
{
@@ -345,11 +305,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 be986b12a9..2334d75159 100644
--- a/vl.c
+++ b/vl.c
@@ -2964,7 +2964,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.20.1.2.gb21ebb671b
next prev parent reply other threads:[~2019-01-07 12:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 12:22 [Qemu-devel] [PULL v2 00/28] Machine props patches Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 01/28] hw: apply accel compat properties without touching globals Marc-André Lureau
2019-01-14 15:50 ` Peter Maydell
2019-01-14 18:23 ` Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 02/28] machines: replace COMPAT define with a static array Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 03/28] hw: apply machine compat properties without touching globals Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 04/28] machine: move compat properties out of globals Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 05/28] hw: remove SET_MACHINE_COMPAT Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 06/28] compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 07/28] compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 08/28] compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 09/28] compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 11/28] compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 12/28] compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 14/28] compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 15/28] compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 20/28] include: remove compat.h Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 21/28] compat: remove remaining PC_COMPAT macros Marc-André Lureau
2019-01-07 12:22 ` [Qemu-devel] [PULL v2 22/28] qdev: make a separate helper function to apply compat properties Marc-André Lureau
2019-01-07 12:22 ` Marc-André Lureau [this message]
2019-01-07 12:23 ` [Qemu-devel] [PULL v2 24/28] qdev-props: convert global_props to GPtrArray Marc-André Lureau
2019-01-07 12:23 ` [Qemu-devel] [PULL v2 25/28] qdev-props: remove errp from GlobalProperty Marc-André Lureau
2019-01-07 12:23 ` [Qemu-devel] [PULL v2 26/28] qdev-props: call object_apply_global_props() Marc-André Lureau
2019-01-07 12:23 ` [Qemu-devel] [PULL v2 27/28] arm: replace instance_post_init() Marc-André Lureau
2019-01-07 12:23 ` [Qemu-devel] [PULL v2 28/28] hostmem: use object id for memory region name with >= 4.0 Marc-André Lureau
2019-01-07 16:56 ` [Qemu-devel] [PULL v2 00/28] Machine props patches Peter Maydell
2019-07-08 16:39 ` Peter Maydell
2019-07-08 20:50 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190107122304.22997-24-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).