From: Igor Mammedov <imammedo@redhat.com>
To: Tang Chen <tangchen@cn.fujitsu.com>
Cc: zhugh.fnst@cn.fujitsu.com, mst@redhat.com, hutao@cn.fujitsu.com,
qemu-devel@nongnu.org, isimatu.yasuaki@jp.fujitsu.com,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RESEND PATCH v3 8/8] monitor: Add memory hot unplug support for device_del command.
Date: Thu, 4 Sep 2014 16:02:16 +0200 [thread overview]
Message-ID: <20140904160216.5ba9e3a8@nial.usersys.redhat.com> (raw)
In-Reply-To: <1409126919-22233-9-git-send-email-tangchen@cn.fujitsu.com>
On Wed, 27 Aug 2014 16:08:39 +0800
Tang Chen <tangchen@cn.fujitsu.com> wrote:
> From: Hu Tao <hutao@cn.fujitsu.com>
>
> Implement find_peripheral_device() to find bus-less device, and call it in
> qmp_device_del() so that device_del command will be able to remove memory
> device.
probably patch should go before 4/8
>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
> ---
> include/qom/object.h | 1 +
> qdev-monitor.c | 23 +++++++++++++++++++++++
> qom/object.c | 2 +-
> 3 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 8a05a81..a352beb 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -1300,5 +1300,6 @@ int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
> */
> Object *container_get(Object *root, const char *path);
>
> +bool object_property_is_child(ObjectProperty *prop);
>
> #endif
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index fb9ee24..effd928 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -24,6 +24,7 @@
> #include "qmp-commands.h"
> #include "sysemu/arch_init.h"
> #include "qemu/config-file.h"
> +#include "qom/object.h"
>
> /*
> * Aliases were a bad idea from the start. Let's keep them
> @@ -683,12 +684,34 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
> return 0;
> }
>
> +static DeviceState *find_peripheral_device(const char *id)
> +{
> + Object *peripheral = qdev_get_peripheral();
> + DeviceState *dev = NULL;
> + ObjectProperty *prop;
> +
> + QTAILQ_FOREACH(prop, &peripheral->properties, node) {
> + if (object_property_is_child(prop)) {
> + dev = DEVICE(prop->opaque);
> + if (!strcmp(dev->id, id)) {
> + return dev;
> + }
> + }
> + }
It's not permitted to access internal fields of Object outside of object.c
checkout usage of object_resolve_path()/object_resolve_path_type(),
that's what you need to use.
> +
> + return NULL;
> +}
> +
> void qmp_device_del(const char *id, Error **errp)
> {
> DeviceState *dev;
>
> dev = qdev_find_recursive(sysbus_get_default(), id);
> if (!dev) {
> + dev = find_peripheral_device(id);
> + }
> +
> + if (!dev) {
> error_set(errp, QERR_DEVICE_NOT_FOUND, id);
> return;
> }
> diff --git a/qom/object.c b/qom/object.c
> index 0e8267b..1183e5d 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -351,7 +351,7 @@ void object_initialize(void *data, size_t size, const char *typename)
> object_initialize_with_type(data, size, type);
> }
>
> -static inline bool object_property_is_child(ObjectProperty *prop)
> +bool object_property_is_child(ObjectProperty *prop)
> {
> return strstart(prop->type, "child<", NULL);
> }
prev parent reply other threads:[~2014-09-04 14:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 8:08 [Qemu-devel] [RESEND PATCH v3 0/8] QEmu memory hot unplug support Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 1/8] acpi, piix4: Add memory hot unplug support for piix4 Tang Chen
2014-09-04 12:15 ` Igor Mammedov
2014-09-16 3:17 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 2/8] acpi, ich9: Add memory hot unplug support for ich9 Tang Chen
2014-09-04 12:25 ` Igor Mammedov
2014-09-16 3:18 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 3/8] pc: Add memory hot unplug support for pc machine Tang Chen
2014-09-04 12:44 ` Igor Mammedov
2014-09-04 13:16 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 4/8] qdev: Add memory hot unplug support for bus-less devices Tang Chen
2014-09-04 13:22 ` Igor Mammedov
2014-09-16 8:42 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 5/8] pc-dimm: Add pc_dimm_unrealize() for memory hot unplug support Tang Chen
2014-09-04 13:28 ` Igor Mammedov
2014-09-12 5:30 ` zhanghailiang
2014-09-12 13:17 ` Igor Mammedov
2014-09-24 7:02 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 6/8] acpi: Add hardware implementation for memory hot unplug Tang Chen
2014-09-04 14:20 ` Igor Mammedov
2014-09-16 10:12 ` Tang Chen
2014-09-16 11:34 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 7/8] pc, acpi bios: Add memory hot unplug interface Tang Chen
2014-09-04 13:53 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 8/8] monitor: Add memory hot unplug support for device_del command Tang Chen
2014-09-04 14:02 ` Igor Mammedov [this message]
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=20140904160216.5ba9e3a8@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tangchen@cn.fujitsu.com \
--cc=zhugh.fnst@cn.fujitsu.com \
/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).