All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support
@ 2014-10-21 11:46 Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 1/3] qdev: add qdev_build_hotpluggable_device_list helper Zhu Guihua
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Zhu Guihua @ 2014-10-21 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Zhu Guihua, mst, hutao, armbru, lcapitulino,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

After inputting device_del command in monitor, we expect to list all
hotpluggable devices automatically by pressing tab key. This patchset provides
the function to list all peripheral devices such as memory devices.

v5:
- In patch 2, make list to free (Marcel)

v4:
- Delete unused device_del_bus_completion (Igor)
- Modify the way to get value of hotpluggable property (Igor)

v3:
- Commit message changes (Igor)
- Rename function in patch 1 (Igor)
- Use 'hotpluggable' property to discard non-hotpluggable devices (Igor)

v2:
- Use object_child_foreach() to simplify the implementation (Andreas)


Zhu Guihua (3):
  qdev: add qdev_build_hotpluggable_device_list helper
  monitor: add del completion for peripheral device
  monitor: delete device_del_bus_completion

 hw/core/qdev.c         | 13 +++++++++++++
 include/hw/qdev-core.h |  2 ++
 monitor.c              | 28 +++++++++++++++++-----------
 3 files changed, 32 insertions(+), 11 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v5 1/3] qdev: add qdev_build_hotpluggable_device_list helper
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
@ 2014-10-21 11:46 ` Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 2/3] monitor: add del completion for peripheral device Zhu Guihua
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Zhu Guihua @ 2014-10-21 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Zhu Guihua, mst, hutao, armbru, lcapitulino,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

For peripheral device del completion, add a function to build a list for
hotpluggable devices.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
 hw/core/qdev.c         | 13 +++++++++++++
 include/hw/qdev-core.h |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index a1e9247..9357aba 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -866,6 +866,19 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
     } while (class != object_class_by_name(TYPE_DEVICE));
 }
 
+int qdev_build_hotpluggable_device_list(Object *obj, void *opaque)
+{
+    GSList **list = opaque;
+    DeviceState *dev = DEVICE(obj);
+
+    if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+        *list = g_slist_append(*list, dev);
+    }
+
+    object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque);
+    return 0;
+}
+
 static bool device_get_realized(Object *obj, Error **errp)
 {
     DeviceState *dev = DEVICE(obj);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1fca75c..22820fe 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -360,6 +360,8 @@ extern int qdev_hotplug;
 
 char *qdev_get_dev_path(DeviceState *dev);
 
+int qdev_build_hotpluggable_device_list(Object *obj, void *opaque);
+
 void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler,
                               Error **errp);
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v5 2/3] monitor: add del completion for peripheral device
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 1/3] qdev: add qdev_build_hotpluggable_device_list helper Zhu Guihua
@ 2014-10-21 11:46 ` Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 3/3] monitor: delete device_del_bus_completion Zhu Guihua
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Zhu Guihua @ 2014-10-21 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Zhu Guihua, mst, hutao, armbru, lcapitulino,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

Add peripheral_device_del_completion() to let peripheral device del completion
be possible.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
 monitor.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/monitor.c b/monitor.c
index 2d14f39..ac41fa3 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4359,6 +4359,31 @@ static void device_del_bus_completion(ReadLineState *rs,  BusState *bus,
     }
 }
 
+static void peripheral_device_del_completion(ReadLineState *rs,
+                                             const char *str, size_t len)
+{
+    Object *peripheral;
+    GSList *list = NULL, *item;
+
+    peripheral = object_resolve_path("/machine/peripheral/", NULL);
+    if (peripheral == NULL) {
+        return;
+    }
+
+    object_child_foreach(peripheral, qdev_build_hotpluggable_device_list,
+                         &list);
+
+    for (item = list; item; item = g_slist_next(item)) {
+        DeviceState *dev = item->data;
+
+        if (dev->id && !strncmp(str, dev->id, len)) {
+            readline_add_completion(rs, dev->id);
+        }
+    }
+
+    g_slist_free(list);
+}
+
 void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str)
 {
     size_t len;
@@ -4432,6 +4457,7 @@ void device_del_completion(ReadLineState *rs, int nb_args, const char *str)
     len = strlen(str);
     readline_set_completion_index(rs, len);
     device_del_bus_completion(rs, sysbus_get_default(), str, len);
+    peripheral_device_del_completion(rs, str, len);
 }
 
 void object_del_completion(ReadLineState *rs, int nb_args, const char *str)
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v5 3/3] monitor: delete device_del_bus_completion
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 1/3] qdev: add qdev_build_hotpluggable_device_list helper Zhu Guihua
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 2/3] monitor: add del completion for peripheral device Zhu Guihua
@ 2014-10-21 11:46 ` Zhu Guihua
  2014-10-22 12:47 ` [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Luiz Capitulino
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Zhu Guihua @ 2014-10-21 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Zhu Guihua, mst, hutao, armbru, lcapitulino,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

device_del_bus_completion() that gathers devices from buses is unused; delete
it.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
 monitor.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/monitor.c b/monitor.c
index ac41fa3..2cccd0a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4340,25 +4340,6 @@ void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
     g_slist_free(list);
 }
 
-static void device_del_bus_completion(ReadLineState *rs,  BusState *bus,
-                                      const char *str, size_t len)
-{
-    BusChild *kid;
-
-    QTAILQ_FOREACH(kid, &bus->children, sibling) {
-        DeviceState *dev = kid->child;
-        BusState *dev_child;
-
-        if (dev->id && !strncmp(str, dev->id, len)) {
-            readline_add_completion(rs, dev->id);
-        }
-
-        QLIST_FOREACH(dev_child, &dev->child_bus, sibling) {
-            device_del_bus_completion(rs, dev_child, str, len);
-        }
-    }
-}
-
 static void peripheral_device_del_completion(ReadLineState *rs,
                                              const char *str, size_t len)
 {
@@ -4456,7 +4437,6 @@ void device_del_completion(ReadLineState *rs, int nb_args, const char *str)
 
     len = strlen(str);
     readline_set_completion_index(rs, len);
-    device_del_bus_completion(rs, sysbus_get_default(), str, len);
     peripheral_device_del_completion(rs, str, len);
 }
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
                   ` (2 preceding siblings ...)
  2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 3/3] monitor: delete device_del_bus_completion Zhu Guihua
@ 2014-10-22 12:47 ` Luiz Capitulino
  2014-10-22 13:52   ` Marcel Apfelbaum
  2014-10-22 15:48 ` Igor Mammedov
  2014-10-23 13:05 ` Luiz Capitulino
  5 siblings, 1 reply; 8+ messages in thread
From: Luiz Capitulino @ 2014-10-22 12:47 UTC (permalink / raw)
  To: Zhu Guihua
  Cc: peter.crosthwaite, mst, hutao, marcel.a, qemu-devel, armbru,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

On Tue, 21 Oct 2014 19:46:03 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> After inputting device_del command in monitor, we expect to list all
> hotpluggable devices automatically by pressing tab key. This patchset provides
> the function to list all peripheral devices such as memory devices.

Igor, Marcel, is this series OK now? If it is can you please add your
Reviewed-by?

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support
  2014-10-22 12:47 ` [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Luiz Capitulino
@ 2014-10-22 13:52   ` Marcel Apfelbaum
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Apfelbaum @ 2014-10-22 13:52 UTC (permalink / raw)
  To: Luiz Capitulino, Igor Mammedov
  Cc: Zhu Guihua, mst, hutao, qemu-devel, armbru, isimatu.yasuaki,
	peter.crosthwaite, pbonzini, tangchen, afaerber

On Wed, 2014-10-22 at 08:47 -0400, Luiz Capitulino wrote:
> On Tue, 21 Oct 2014 19:46:03 +0800
> Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:
> 
> > After inputting device_del command in monitor, we expect to list all
> > hotpluggable devices automatically by pressing tab key. This patchset provides
> > the function to list all peripheral devices such as memory devices.
> 
> Igor, Marcel, is this series OK now? If it is can you please add your
> Reviewed-by?

The series looks OK to me, I would prefer Igor to have a look too.

Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>

Thanks,
Marcel

> 
> Thanks.
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
                   ` (3 preceding siblings ...)
  2014-10-22 12:47 ` [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Luiz Capitulino
@ 2014-10-22 15:48 ` Igor Mammedov
  2014-10-23 13:05 ` Luiz Capitulino
  5 siblings, 0 replies; 8+ messages in thread
From: Igor Mammedov @ 2014-10-22 15:48 UTC (permalink / raw)
  To: Zhu Guihua
  Cc: peter.crosthwaite, mst, hutao, qemu-devel, armbru,
	isimatu.yasuaki, tangchen, pbonzini, lcapitulino, afaerber

On Tue, 21 Oct 2014 19:46:03 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> After inputting device_del command in monitor, we expect to list all
> hotpluggable devices automatically by pressing tab key. This patchset provides
> the function to list all peripheral devices such as memory devices.
> 
> v5:
> - In patch 2, make list to free (Marcel)
> 
> v4:
> - Delete unused device_del_bus_completion (Igor)
> - Modify the way to get value of hotpluggable property (Igor)
> 
> v3:
> - Commit message changes (Igor)
> - Rename function in patch 1 (Igor)
> - Use 'hotpluggable' property to discard non-hotpluggable devices (Igor)
> 
> v2:
> - Use object_child_foreach() to simplify the implementation (Andreas)
> 
> 
> Zhu Guihua (3):
>   qdev: add qdev_build_hotpluggable_device_list helper
>   monitor: add del completion for peripheral device
>   monitor: delete device_del_bus_completion
> 
>  hw/core/qdev.c         | 13 +++++++++++++
>  include/hw/qdev-core.h |  2 ++
>  monitor.c              | 28 +++++++++++++++++-----------
>  3 files changed, 32 insertions(+), 11 deletions(-)
> 
For series:

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support
  2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
                   ` (4 preceding siblings ...)
  2014-10-22 15:48 ` Igor Mammedov
@ 2014-10-23 13:05 ` Luiz Capitulino
  5 siblings, 0 replies; 8+ messages in thread
From: Luiz Capitulino @ 2014-10-23 13:05 UTC (permalink / raw)
  To: Zhu Guihua
  Cc: peter.crosthwaite, mst, hutao, qemu-devel, armbru,
	isimatu.yasuaki, imammedo, pbonzini, tangchen, afaerber

On Tue, 21 Oct 2014 19:46:03 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> After inputting device_del command in monitor, we expect to list all
> hotpluggable devices automatically by pressing tab key. This patchset provides
> the function to list all peripheral devices such as memory devices.

Applied to the qmp branch, thanks.

> 
> v5:
> - In patch 2, make list to free (Marcel)
> 
> v4:
> - Delete unused device_del_bus_completion (Igor)
> - Modify the way to get value of hotpluggable property (Igor)
> 
> v3:
> - Commit message changes (Igor)
> - Rename function in patch 1 (Igor)
> - Use 'hotpluggable' property to discard non-hotpluggable devices (Igor)
> 
> v2:
> - Use object_child_foreach() to simplify the implementation (Andreas)
> 
> 
> Zhu Guihua (3):
>   qdev: add qdev_build_hotpluggable_device_list helper
>   monitor: add del completion for peripheral device
>   monitor: delete device_del_bus_completion
> 
>  hw/core/qdev.c         | 13 +++++++++++++
>  include/hw/qdev-core.h |  2 ++
>  monitor.c              | 28 +++++++++++++++++-----------
>  3 files changed, 32 insertions(+), 11 deletions(-)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-23 13:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-21 11:46 [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Zhu Guihua
2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 1/3] qdev: add qdev_build_hotpluggable_device_list helper Zhu Guihua
2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 2/3] monitor: add del completion for peripheral device Zhu Guihua
2014-10-21 11:46 ` [Qemu-devel] [PATCH v5 3/3] monitor: delete device_del_bus_completion Zhu Guihua
2014-10-22 12:47 ` [Qemu-devel] [PATCH v5 0/3] monitor: add peripheral device del completion support Luiz Capitulino
2014-10-22 13:52   ` Marcel Apfelbaum
2014-10-22 15:48 ` Igor Mammedov
2014-10-23 13:05 ` Luiz Capitulino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.