All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
@ 2013-12-11 10:22 Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table Alexey Kardashevskiy
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

With the great help from Paolo, I am presenting yet another try of bootindex
support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
Please, comment. Thanks.

Alexey Kardashevskiy (5):
  boot: extend get_boot_devices_list() to ignore suffixes
  spapr-llan: add to boot device list
  spapr-vio: fix firmware names
  qdev: introduce FWPathProvider interface
  spapr: define interface to fix device pathname

Hervé Poussineau (1):
  qom: detect bad reentrance during object_class_foreach

Paolo Bonzini (2):
  qom: do not register interface "types" in the type table
  vl: allow customizing the class of /machine

 hw/core/Makefile.objs         |  1 +
 hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
 hw/core/qdev.c                | 18 +++++++++-
 hw/net/spapr_llan.c           |  3 ++
 hw/nvram/fw_cfg.c             |  2 +-
 hw/ppc/spapr.c                | 80 ++++++++++++++++++++++++++++++++++++++++++-
 hw/ppc/spapr_vio.c            |  2 ++
 include/hw/boards.h           |  1 +
 include/hw/fw-path-provider.h | 31 +++++++++++++++++
 include/sysemu/sysemu.h       |  2 +-
 qom/object.c                  | 17 +++++++--
 tests/Makefile                |  1 +
 vl.c                          | 11 ++++--
 13 files changed, 193 insertions(+), 10 deletions(-)
 create mode 100644 hw/core/fw-path-provider.c
 create mode 100644 include/hw/fw-path-provider.h

-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 2/8] qom: detect bad reentrance during object_class_foreach Alexey Kardashevskiy
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: aik, Paolo Bonzini, qemu-ppc, Alexander Graf

From: Paolo Bonzini <pbonzini@redhat.com>

There should be no need to look them up nor enumerate the interface
"types", whose "classes" are really just vtables.  Just create the
types and add them to the interface list of the parent type.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 qom/object.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index fc19cf6..3a43186 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -88,7 +88,7 @@ static TypeImpl *type_table_lookup(const char *name)
     return g_hash_table_lookup(type_table_get(), name);
 }
 
-static TypeImpl *type_register_internal(const TypeInfo *info)
+static TypeImpl *type_new(const TypeInfo *info)
 {
     TypeImpl *ti = g_malloc0(sizeof(*ti));
     int i;
@@ -122,8 +122,15 @@ static TypeImpl *type_register_internal(const TypeInfo *info)
     }
     ti->num_interfaces = i;
 
+    return ti;
+}
+
+static TypeImpl *type_register_internal(const TypeInfo *info)
+{
+    TypeImpl *ti;
+    ti = type_new(info);
+
     type_table_add(ti);
-
     return ti;
 }
 
@@ -216,7 +223,7 @@ static void type_initialize_interface(TypeImpl *ti, const char *parent)
     info.name = g_strdup_printf("%s::%s", ti->name, info.parent);
     info.abstract = true;
 
-    iface_impl = type_register(&info);
+    iface_impl = type_new(&info);
     type_initialize(iface_impl);
     g_free((char *)info.name);
 
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 2/8] qom: detect bad reentrance during object_class_foreach
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 3/8] boot: extend get_boot_devices_list() to ignore suffixes Alexey Kardashevskiy
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: aik, qemu-ppc, Hervé Poussineau, Alexander Graf, Paolo Bonzini

From: Hervé Poussineau <hpoussin@reactos.org>

We should not modify the type hash table while it is being iterated on.
Assert that it does not happen.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v4:
* rename: @enumerating -> @enumerating_types
* @enumerating_types is static and does not require initialization to "false"
---
 qom/object.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qom/object.c b/qom/object.c
index 3a43186..937af00 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -78,8 +78,10 @@ static GHashTable *type_table_get(void)
     return type_table;
 }
 
+static bool enumerating_types;
 static void type_table_add(TypeImpl *ti)
 {
+    assert(!enumerating_types);
     g_hash_table_insert(type_table_get(), (void *)ti->name, ti);
 }
 
@@ -666,7 +668,9 @@ void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
 {
     OCFData data = { fn, implements_type, include_abstract, opaque };
 
+    enumerating_types = true;
     g_hash_table_foreach(type_table_get(), object_class_foreach_tramp, &data);
+    enumerating_types = false;
 }
 
 int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 3/8] boot: extend get_boot_devices_list() to ignore suffixes
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 2/8] qom: detect bad reentrance during object_class_foreach Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 4/8] spapr-llan: add to boot device list Alexey Kardashevskiy
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

As suffixes do not make sense for sPAPR's device tree and
there is no way to filter them out on the BusState::get_fw_dev_path
level, let's add an ability for the external caller to specify
whether to apply suffixes or not.

We could handle suffixes in SLOF (ignore for now) but this would require
serious rework in the node opening code in SLOF which has no obvious
benefit for the currently emulated sPAPR machine.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v4:
* changed commit message about not having plans in SLOF rework as it is scary :)
---
 hw/nvram/fw_cfg.c       | 2 +-
 include/sysemu/sysemu.h | 2 +-
 vl.c                    | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index f5dc3ea..4d0c76f 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -504,7 +504,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
 {
     size_t len;
     FWCfgState *s = container_of(n, FWCfgState, machine_ready);
-    char *bootindex = get_boot_devices_list(&len);
+    char *bootindex = get_boot_devices_list(&len, false);
 
     fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
 }
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 495dae8..2b71a4a 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -185,7 +185,7 @@ void rtc_change_mon_event(struct tm *tm);
 
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix);
-char *get_boot_devices_list(size_t *size);
+char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
 
 DeviceState *get_boot_device(uint32_t position);
 
diff --git a/vl.c b/vl.c
index b0399de..2cde6a1 100644
--- a/vl.c
+++ b/vl.c
@@ -1213,7 +1213,7 @@ DeviceState *get_boot_device(uint32_t position)
  * memory pointed by "size" is assigned total length of the array in bytes
  *
  */
-char *get_boot_devices_list(size_t *size)
+char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
 {
     FWBootEntry *i;
     size_t total = 0;
@@ -1228,7 +1228,7 @@ char *get_boot_devices_list(size_t *size)
             assert(devpath);
         }
 
-        if (i->suffix && devpath) {
+        if (i->suffix && !ignore_suffixes && devpath) {
             size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1;
 
             bootpath = g_malloc(bootpathlen);
@@ -1236,7 +1236,7 @@ char *get_boot_devices_list(size_t *size)
             g_free(devpath);
         } else if (devpath) {
             bootpath = devpath;
-        } else {
+        } else if (!ignore_suffixes) {
             assert(i->suffix);
             bootpath = g_strdup(i->suffix);
         }
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 4/8] spapr-llan: add to boot device list
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (2 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 3/8] boot: extend get_boot_devices_list() to ignore suffixes Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 5/8] spapr-vio: fix firmware names Alexey Kardashevskiy
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/net/spapr_llan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index 1bd6f50..229de00 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -29,6 +29,7 @@
 #include "hw/qdev.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
+#include "sysemu/sysemu.h"
 
 #include <libfdt.h>
 
@@ -213,6 +214,8 @@ static int spapr_vlan_init(VIOsPAPRDevice *sdev)
                             object_get_typename(OBJECT(sdev)), sdev->qdev.id, dev);
     qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
 
+    add_boot_device_path(dev->nicconf.bootindex, DEVICE(dev), "");
+
     return 0;
 }
 
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 5/8] spapr-vio: fix firmware names
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (3 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 4/8] spapr-llan: add to boot device list Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface Alexey Kardashevskiy
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

This changes VIO bridge fw name from spapr-vio-bridge to vdevice and
vscsi/veth node names from QEMU object names to VIO specific device tree
names.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_vio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index fee6195..42b8416 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -68,6 +68,7 @@ static void spapr_vio_bus_class_init(ObjectClass *klass, void *data)
     BusClass *k = BUS_CLASS(klass);
 
     k->get_dev_path = spapr_vio_get_dev_name;
+    k->get_fw_dev_path = spapr_vio_get_dev_name;
 }
 
 static const TypeInfo spapr_vio_bus_info = {
@@ -531,6 +532,7 @@ static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
+    dc->fw_name = "vdevice";
     k->init = spapr_vio_bridge_init;
     dc->no_user = 1;
 }
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (4 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 5/8] spapr-vio: fix firmware names Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2014-02-20 12:01   ` Andreas Färber
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 7/8] vl: allow customizing the class of /machine Alexey Kardashevskiy
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

QEMU supports firmware names for all devices in the QEMU tree but
some architectures expect some parts of firmware path names in different
format.

This introduces a firmware-pathname-change interface definition.
If some machines needs to redefine the firmware path format, it has
to add the TYPE_FW_PATH_PROVIDER interface to an object that is above
the device on the QOM tree (typically /machine).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Changes:
v4:
* added fw-path-provider.o into tests/Makefile
* fixed 80chars warning from checkpatch.pl
---
 hw/core/Makefile.objs         |  1 +
 hw/core/fw-path-provider.c    | 36 ++++++++++++++++++++++++++++++++++++
 hw/core/qdev.c                | 18 +++++++++++++++++-
 include/hw/fw-path-provider.h | 32 ++++++++++++++++++++++++++++++++
 tests/Makefile                |  1 +
 5 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 hw/core/fw-path-provider.c
 create mode 100644 include/hw/fw-path-provider.h

diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index 950146c..d829479 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -1,5 +1,6 @@
 # core qdev-related obj files, also used by *-user:
 common-obj-y += qdev.o qdev-properties.o
+common-obj-y += fw-path-provider.o
 # irq.o needed for qdev GPIO handling:
 common-obj-y += irq.o
 
diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
new file mode 100644
index 0000000..0187568
--- /dev/null
+++ b/hw/core/fw-path-provider.c
@@ -0,0 +1,36 @@
+#include "hw/fw-path-provider.h"
+
+char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
+                                    DeviceState *dev)
+{
+    FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
+
+    return k->get_dev_path(p, bus, dev);
+}
+
+char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
+                                        DeviceState *dev)
+{
+    FWPathProvider *p = (FWPathProvider *)
+        object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
+
+    if (p) {
+        return fw_path_provider_get_dev_path(p, bus, dev);
+    }
+
+    return NULL;
+}
+
+static const TypeInfo fw_path_provider_info = {
+    .name          = TYPE_FW_PATH_PROVIDER,
+    .parent        = TYPE_INTERFACE,
+    .class_size = sizeof(FWPathProviderClass),
+};
+
+
+static void fw_path_provider_register_types(void)
+{
+    type_register_static(&fw_path_provider_info);
+}
+
+type_init(fw_path_provider_register_types)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 959130c..81a0e75 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -26,6 +26,7 @@
    this API directly.  */
 
 #include "hw/qdev.h"
+#include "hw/fw-path-provider.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
@@ -503,6 +504,18 @@ static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
     return NULL;
 }
 
+static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev)
+{
+    Object *obj = OBJECT(dev);
+    char *d = NULL;
+
+    while (!d && obj->parent) {
+        obj = obj->parent;
+        d = fw_path_provider_try_get_dev_path(obj, bus, dev);
+    }
+    return d;
+}
+
 static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
 {
     int l = 0;
@@ -510,7 +523,10 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
     if (dev && dev->parent_bus) {
         char *d;
         l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
-        d = bus_get_fw_dev_path(dev->parent_bus, dev);
+        d = qdev_get_fw_dev_path_from_handler(dev->parent_bus, dev);
+        if (!d) {
+            d = bus_get_fw_dev_path(dev->parent_bus, dev);
+        }
         if (d) {
             l += snprintf(p + l, size - l, "%s", d);
             g_free(d);
diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h
new file mode 100644
index 0000000..765170b
--- /dev/null
+++ b/include/hw/fw-path-provider.h
@@ -0,0 +1,32 @@
+#ifndef FW_PATH_PROVIDER_H
+#define FW_PATH_PROVIDER_H 1
+
+#include "qemu-common.h"
+#include "qom/object.h"
+
+#define TYPE_FW_PATH_PROVIDER "fw-path-provider"
+
+#define FW_PATH_PROVIDER_CLASS(klass) \
+     OBJECT_CLASS_CHECK(FWPathProviderClass, (klass), TYPE_FW_PATH_PROVIDER)
+#define FW_PATH_PROVIDER_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(FWPathProviderClass, (obj), TYPE_FW_PATH_PROVIDER)
+#define FW_PATH_PROVIDER(obj) \
+     INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
+
+typedef struct FWPathProvider {
+    Object Parent;
+} FWPathProvider;
+
+typedef void (*StreamCanPushNotifyFn)(void *opaque);
+
+typedef struct FWPathProviderClass {
+    InterfaceClass parent;
+    char *(*get_dev_path)(FWPathProvider *p, BusState *bus, DeviceState *dev);
+} FWPathProviderClass;
+
+char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
+                                    DeviceState *dev);
+char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
+                                        DeviceState *dev);
+
+#endif /* FW_PATH_PROVIDER_H */
diff --git a/tests/Makefile b/tests/Makefile
index 379cdd9..09c42d0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -160,6 +160,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
 	hw/core/qdev.o hw/core/qdev-properties.o \
 	hw/core/irq.o \
 	qom/object.o qom/container.o qom/qom-qobject.o \
+	hw/core/fw-path-provider.o \
 	$(test-qapi-obj-y) \
 	libqemuutil.a libqemustub.a
 
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 7/8] vl: allow customizing the class of /machine
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (5 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 8/8] spapr: define interface to fix device pathname Alexey Kardashevskiy
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: aik, Paolo Bonzini, qemu-ppc, Alexander Graf

From: Paolo Bonzini <pbonzini@redhat.com>

This is a first step towards QOMifying /machine.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/boards.h | 1 +
 vl.c                | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 5a7ae9f..431d016 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -25,6 +25,7 @@ typedef struct QEMUMachine {
     const char *name;
     const char *alias;
     const char *desc;
+    const char *class_name;
     QEMUMachineInitFunc *init;
     QEMUMachineResetFunc *reset;
     QEMUMachineHotAddCPUFunc *hot_add_cpu;
diff --git a/vl.c b/vl.c
index 2cde6a1..442b190 100644
--- a/vl.c
+++ b/vl.c
@@ -4047,6 +4047,11 @@ int main(int argc, char **argv, char **envp)
         qtest_init();
     }
 
+    if (machine->class_name) {
+        Object *m = object_new(machine->class_name);
+        object_property_add_child(object_get_root(), "machine", m, NULL);
+    }
+
     machine_opts = qemu_get_machine_opts();
     kernel_filename = qemu_opt_get(machine_opts, "kernel");
     initrd_filename = qemu_opt_get(machine_opts, "initrd");
-- 
1.8.4.rc4

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

* [Qemu-devel] [PATCH v4 8/8] spapr: define interface to fix device pathname
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (6 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 7/8] vl: allow customizing the class of /machine Alexey Kardashevskiy
@ 2013-12-11 10:22 ` Alexey Kardashevskiy
  2013-12-11 10:36 ` [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Paolo Bonzini
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-11 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf

This defines an object with the interface to fix firmware pathnames
for devices which have @bootindex property.

This fixes SCSI disks device node names (which are wildcard nodes in
the device-tree).

This fixes PHB name from "pci" to "pci@XXXX" where XXXX is a BUID as
there is no bus on top of sPAPRPHBState where PHB firmware name could
be fixed using the BusClass::get_fw_dev_path mechanism.

This stores the boot list in the /chosen/qemu,boot-list property of
the device tree. "\n" are replaced by spaces to support OF1275.
SLOF needs an update in order to support the boot list.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/ppc/spapr.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 79 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 38b43c9..2cac1ef 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -26,6 +26,7 @@
  */
 #include "sysemu/sysemu.h"
 #include "hw/hw.h"
+#include "hw/fw-path-provider.h"
 #include "elf.h"
 #include "net/net.h"
 #include "sysemu/blockdev.h"
@@ -45,6 +46,7 @@
 #include "hw/pci/msi.h"
 
 #include "hw/pci/pci.h"
+#include "hw/scsi/scsi.h"
 
 #include "exec/address-spaces.h"
 #include "hw/usb.h"
@@ -80,6 +82,8 @@
 
 #define HTAB_SIZE(spapr)        (1ULL << ((spapr)->htab_shift))
 
+#define TYPE_SPAPR_MACHINE      "machine-spapr"
+
 sPAPREnvironment *spapr;
 
 int spapr_allocate_irq(int hint, bool lsi)
@@ -587,7 +591,9 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
                                hwaddr rtas_addr,
                                hwaddr rtas_size)
 {
-    int ret;
+    int ret, i;
+    size_t cb = 0;
+    char *bootlist;
     void *fdt;
     sPAPRPHBState *phb;
 
@@ -629,6 +635,21 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
         fprintf(stderr, "Couldn't finalize CPU device tree properties\n");
     }
 
+    bootlist = get_boot_devices_list(&cb, true);
+    if (cb && bootlist) {
+        int offset = fdt_path_offset(fdt, "/chosen");
+        if (offset < 0) {
+            exit(1);
+        }
+        for (i = 0; i < cb; i++) {
+            if (bootlist[i] == '\n') {
+                bootlist[i] = ' ';
+            }
+
+        }
+        ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist);
+    }
+
     if (!spapr->has_graphics) {
         spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
     }
@@ -1352,6 +1373,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 static QEMUMachine spapr_machine = {
     .name = "pseries",
     .desc = "pSeries Logical Partition (PAPR compliant)",
+    .class_name = TYPE_SPAPR_MACHINE,
     .is_default = 1,
     .init = ppc_spapr_init,
     .reset = ppc_spapr_reset,
@@ -1367,3 +1389,59 @@ static void spapr_machine_init(void)
 }
 
 machine_init(spapr_machine_init);
+
+/*
+ * Implementation of an interface to adjust firmware patch
+ * for the bootindex property handling.
+ */
+static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,
+                                   DeviceState *dev)
+{
+#define CAST(type, obj, name) \
+    ((type *)object_dynamic_cast(OBJECT(obj), (name)))
+    SCSIDevice *d = CAST(SCSIDevice,  dev, TYPE_SCSI_DEVICE);
+    sPAPRPHBState *phb = CAST(sPAPRPHBState, dev, TYPE_SPAPR_PCI_HOST_BRIDGE);
+
+    if (d) {
+        /*
+         * Replace "channel@0/disk@0,0" with "disk@8000000000000000":
+         * We use SRP luns of the form 8000 | (bus << 8) | (id << 5) | lun
+         * in the top 16 bits of the 64-bit LUN
+         */
+        unsigned id = 0x8000 | (d->channel << 8) | (d->id << 5) | d->lun;
+
+        return g_strdup_printf("%s@%"PRIX64, qdev_fw_name(dev),
+                               (uint64_t)id << 48);
+    }
+
+    if (phb) {
+        /* Replace "pci" with "pci@800000020000000" */
+        return g_strdup_printf("pci@%"PRIX64, phb->buid);
+    }
+
+    return NULL;
+}
+
+static void spapr_machine_class_init(ObjectClass *oc, void *data)
+{
+    FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
+
+    fwc->get_dev_path = spapr_get_fw_dev_path;
+}
+
+static const TypeInfo spapr_machine_info = {
+    .name          = TYPE_SPAPR_MACHINE,
+    .parent        = TYPE_OBJECT,
+    .class_init    = spapr_machine_class_init,
+    .interfaces = (InterfaceInfo[]) {
+            { TYPE_FW_PATH_PROVIDER },
+            { }
+    }
+};
+
+static void spapr_machine_register_types(void)
+{
+    type_register_static(&spapr_machine_info);
+}
+
+type_init(spapr_machine_register_types)
-- 
1.8.4.rc4

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (7 preceding siblings ...)
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 8/8] spapr: define interface to fix device pathname Alexey Kardashevskiy
@ 2013-12-11 10:36 ` Paolo Bonzini
  2013-12-12 14:05 ` Michael S. Tsirkin
  2014-01-22  4:19 ` Alexey Kardashevskiy
  10 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2013-12-11 10:36 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel, Alexander Graf

Il 11/12/2013 11:22, Alexey Kardashevskiy ha scritto:
> With the great help from Paolo, I am presenting yet another try of bootindex
> support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
> Please, comment. Thanks.
> 
> Alexey Kardashevskiy (5):
>   boot: extend get_boot_devices_list() to ignore suffixes
>   spapr-llan: add to boot device list
>   spapr-vio: fix firmware names
>   qdev: introduce FWPathProvider interface
>   spapr: define interface to fix device pathname
> 
> Hervé Poussineau (1):
>   qom: detect bad reentrance during object_class_foreach
> 
> Paolo Bonzini (2):
>   qom: do not register interface "types" in the type table
>   vl: allow customizing the class of /machine
> 
>  hw/core/Makefile.objs         |  1 +
>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>  hw/core/qdev.c                | 18 +++++++++-
>  hw/net/spapr_llan.c           |  3 ++
>  hw/nvram/fw_cfg.c             |  2 +-
>  hw/ppc/spapr.c                | 80 ++++++++++++++++++++++++++++++++++++++++++-
>  hw/ppc/spapr_vio.c            |  2 ++
>  include/hw/boards.h           |  1 +
>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>  include/sysemu/sysemu.h       |  2 +-
>  qom/object.c                  | 17 +++++++--
>  tests/Makefile                |  1 +
>  vl.c                          | 11 ++++--
>  13 files changed, 193 insertions(+), 10 deletions(-)
>  create mode 100644 hw/core/fw-path-provider.c
>  create mode 100644 include/hw/fw-path-provider.h
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (8 preceding siblings ...)
  2013-12-11 10:36 ` [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Paolo Bonzini
@ 2013-12-12 14:05 ` Michael S. Tsirkin
  2013-12-13  3:19   ` Alexey Kardashevskiy
  2014-01-22  4:19 ` Alexey Kardashevskiy
  10 siblings, 1 reply; 21+ messages in thread
From: Michael S. Tsirkin @ 2013-12-12 14:05 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: Paolo Bonzini, qemu-ppc, qemu-devel, Alexander Graf

On Wed, Dec 11, 2013 at 09:22:13PM +1100, Alexey Kardashevskiy wrote:
> With the great help from Paolo, I am presenting yet another try of bootindex
> support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
> Please, comment. Thanks.
> 
> Alexey Kardashevskiy (5):
>   boot: extend get_boot_devices_list() to ignore suffixes
>   spapr-llan: add to boot device list
>   spapr-vio: fix firmware names
>   qdev: introduce FWPathProvider interface
>   spapr: define interface to fix device pathname
> 
> Hervé Poussineau (1):
>   qom: detect bad reentrance during object_class_foreach
> 
> Paolo Bonzini (2):
>   qom: do not register interface "types" in the type table
>   vl: allow customizing the class of /machine

Looks good overall.
But this seems to suffer from the same problem as existing
bootindex code on x86: you can't add a bootable device
by hotplug.

And we really want to fix it on x86 too.

This might be fixable using FW CFG read callback, and updating
the bootindex blob dynamically.
See how e.g. acpi_build_update works.



>  hw/core/Makefile.objs         |  1 +
>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>  hw/core/qdev.c                | 18 +++++++++-
>  hw/net/spapr_llan.c           |  3 ++
>  hw/nvram/fw_cfg.c             |  2 +-
>  hw/ppc/spapr.c                | 80 ++++++++++++++++++++++++++++++++++++++++++-
>  hw/ppc/spapr_vio.c            |  2 ++
>  include/hw/boards.h           |  1 +
>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>  include/sysemu/sysemu.h       |  2 +-
>  qom/object.c                  | 17 +++++++--
>  tests/Makefile                |  1 +
>  vl.c                          | 11 ++++--
>  13 files changed, 193 insertions(+), 10 deletions(-)
>  create mode 100644 hw/core/fw-path-provider.c
>  create mode 100644 include/hw/fw-path-provider.h
> 
> -- 
> 1.8.4.rc4
> 

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2013-12-12 14:05 ` Michael S. Tsirkin
@ 2013-12-13  3:19   ` Alexey Kardashevskiy
  0 siblings, 0 replies; 21+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-13  3:19 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Paolo Bonzini, qemu-ppc, qemu-devel, Alexander Graf

On 12/13/2013 01:05 AM, Michael S. Tsirkin wrote:
> On Wed, Dec 11, 2013 at 09:22:13PM +1100, Alexey Kardashevskiy wrote:
>> With the great help from Paolo, I am presenting yet another try of bootindex
>> support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
>> Please, comment. Thanks.
>>
>> Alexey Kardashevskiy (5):
>>   boot: extend get_boot_devices_list() to ignore suffixes
>>   spapr-llan: add to boot device list
>>   spapr-vio: fix firmware names
>>   qdev: introduce FWPathProvider interface
>>   spapr: define interface to fix device pathname
>>
>> Hervé Poussineau (1):
>>   qom: detect bad reentrance during object_class_foreach
>>
>> Paolo Bonzini (2):
>>   qom: do not register interface "types" in the type table
>>   vl: allow customizing the class of /machine
> 
> Looks good overall.
> But this seems to suffer from the same problem as existing
> bootindex code on x86: you can't add a bootable device
> by hotplug.


Why? The boot list is delivered to SLOF via the device tree which is
composed on a machine reset (spapr_finalize_fdt() calls
get_boot_devices_list() and that's it) so if a bootable device was
hotplugged, then after reset it will be in the list.


> And we really want to fix it on x86 too.

> This might be fixable using FW CFG read callback, and updating
> the bootindex blob dynamically.
> See how e.g. acpi_build_update works.

Sorry, since I do not have good understanding what is happening in x86, I
need more details.

Because I would implement qemu_add_machine_reset_notifier (copied from
qemu_add_machine_init_done_notifier thing) and make fw_cfg_init() register
a reset notifier.

Or just call qemu_add_machine_init_done_notifier() on a machine reset - I
do not really see a code in any of those notifiers which could not be
executed on a machine reset (but again, I am even more ignorant in x86
field than usual :) ).


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
                   ` (9 preceding siblings ...)
  2013-12-12 14:05 ` Michael S. Tsirkin
@ 2014-01-22  4:19 ` Alexey Kardashevskiy
  2014-01-22 10:16   ` Paolo Bonzini
  10 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-22  4:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf,
	Andreas Färber

On 12/11/2013 09:22 PM, Alexey Kardashevskiy wrote:
> With the great help from Paolo, I am presenting yet another try of bootindex
> support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
> Please, comment. Thanks.
> 
> Alexey Kardashevskiy (5):
>   boot: extend get_boot_devices_list() to ignore suffixes
>   spapr-llan: add to boot device list
>   spapr-vio: fix firmware names
>   qdev: introduce FWPathProvider interface
>   spapr: define interface to fix device pathname
> 
> Hervé Poussineau (1):
>   qom: detect bad reentrance during object_class_foreach
> 
> Paolo Bonzini (2):
>   qom: do not register interface "types" in the type table
>   vl: allow customizing the class of /machine
> 
>  hw/core/Makefile.objs         |  1 +
>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>  hw/core/qdev.c                | 18 +++++++++-
>  hw/net/spapr_llan.c           |  3 ++
>  hw/nvram/fw_cfg.c             |  2 +-
>  hw/ppc/spapr.c                | 80 ++++++++++++++++++++++++++++++++++++++++++-
>  hw/ppc/spapr_vio.c            |  2 ++
>  include/hw/boards.h           |  1 +
>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>  include/sysemu/sysemu.h       |  2 +-
>  qom/object.c                  | 17 +++++++--
>  tests/Makefile                |  1 +
>  vl.c                          | 11 ++++--
>  13 files changed, 193 insertions(+), 10 deletions(-)
>  create mode 100644 hw/core/fw-path-provider.c
>  create mode 100644 include/hw/fw-path-provider.h


Some bits from this went upstream but none of them is mine. What am I
missing here? Thanks.


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-01-22  4:19 ` Alexey Kardashevskiy
@ 2014-01-22 10:16   ` Paolo Bonzini
  2014-01-22 12:17     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2014-01-22 10:16 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel
  Cc: qemu-ppc, Alexander Graf, Andreas Färber

Il 22/01/2014 05:19, Alexey Kardashevskiy ha scritto:
> On 12/11/2013 09:22 PM, Alexey Kardashevskiy wrote:
>> With the great help from Paolo, I am presenting yet another try of bootindex
>> support on sPAPR, this time with some QOM fixes. Details are in the commit messages.
>> Please, comment. Thanks.
>>
>> Alexey Kardashevskiy (5):
>>   boot: extend get_boot_devices_list() to ignore suffixes
>>   spapr-llan: add to boot device list
>>   spapr-vio: fix firmware names
>>   qdev: introduce FWPathProvider interface
>>   spapr: define interface to fix device pathname
>>
>> Hervé Poussineau (1):
>>   qom: detect bad reentrance during object_class_foreach
>>
>> Paolo Bonzini (2):
>>   qom: do not register interface "types" in the type table
>>   vl: allow customizing the class of /machine
>>
>>  hw/core/Makefile.objs         |  1 +
>>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>>  hw/core/qdev.c                | 18 +++++++++-
>>  hw/net/spapr_llan.c           |  3 ++
>>  hw/nvram/fw_cfg.c             |  2 +-
>>  hw/ppc/spapr.c                | 80 ++++++++++++++++++++++++++++++++++++++++++-
>>  hw/ppc/spapr_vio.c            |  2 ++
>>  include/hw/boards.h           |  1 +
>>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>>  include/sysemu/sysemu.h       |  2 +-
>>  qom/object.c                  | 17 +++++++--
>>  tests/Makefile                |  1 +
>>  vl.c                          | 11 ++++--
>>  13 files changed, 193 insertions(+), 10 deletions(-)
>>  create mode 100644 hw/core/fw-path-provider.c
>>  create mode 100644 include/hw/fw-path-provider.h
>
>
> Some bits from this went upstream but none of them is mine. What am I
> missing here? Thanks.

No idea, perhaps it's because the same patches were present in multiple 
series?  Alex, are you picking up what's left?

Paolo

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-01-22 10:16   ` Paolo Bonzini
@ 2014-01-22 12:17     ` Alexey Kardashevskiy
  2014-02-14  3:25       ` Alexey Kardashevskiy
  0 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-22 12:17 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-ppc, Alexander Graf, Andreas Färber

On 01/22/2014 09:16 PM, Paolo Bonzini wrote:
> Il 22/01/2014 05:19, Alexey Kardashevskiy ha scritto:
>> On 12/11/2013 09:22 PM, Alexey Kardashevskiy wrote:
>>> With the great help from Paolo, I am presenting yet another try of
>>> bootindex
>>> support on sPAPR, this time with some QOM fixes. Details are in the
>>> commit messages.
>>> Please, comment. Thanks.
>>>
>>> Alexey Kardashevskiy (5):
>>>   boot: extend get_boot_devices_list() to ignore suffixes
>>>   spapr-llan: add to boot device list
>>>   spapr-vio: fix firmware names
>>>   qdev: introduce FWPathProvider interface
>>>   spapr: define interface to fix device pathname
>>>
>>> Hervé Poussineau (1):
>>>   qom: detect bad reentrance during object_class_foreach
>>>
>>> Paolo Bonzini (2):
>>>   qom: do not register interface "types" in the type table
>>>   vl: allow customizing the class of /machine
>>>
>>>  hw/core/Makefile.objs         |  1 +
>>>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>>>  hw/core/qdev.c                | 18 +++++++++-
>>>  hw/net/spapr_llan.c           |  3 ++
>>>  hw/nvram/fw_cfg.c             |  2 +-
>>>  hw/ppc/spapr.c                | 80
>>> ++++++++++++++++++++++++++++++++++++++++++-
>>>  hw/ppc/spapr_vio.c            |  2 ++
>>>  include/hw/boards.h           |  1 +
>>>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>>>  include/sysemu/sysemu.h       |  2 +-
>>>  qom/object.c                  | 17 +++++++--
>>>  tests/Makefile                |  1 +
>>>  vl.c                          | 11 ++++--
>>>  13 files changed, 193 insertions(+), 10 deletions(-)
>>>  create mode 100644 hw/core/fw-path-provider.c
>>>  create mode 100644 include/hw/fw-path-provider.h
>>
>>
>> Some bits from this went upstream but none of them is mine. What am I
>> missing here? Thanks.
> 
> No idea, perhaps it's because the same patches were present in multiple
> series?  Alex, are you picking up what's left?
> 
> Paolo


In the "Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during
object_class_foreach" thread Andreas told me:

===
Be patient.

1) I am on holidays and thus not available full-time.
2) Alex has already sent out his ppc PULL, so no urgency.
3) As mentioned, I plan to post QOM and CPU PULLs later today.

And no, you don't need to repost after parts of your series get applied
pretty much unmodified.
===

So I wonder if I am not just patient enough :)



-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-01-22 12:17     ` Alexey Kardashevskiy
@ 2014-02-14  3:25       ` Alexey Kardashevskiy
  2014-02-14  7:29         ` Paolo Bonzini
  0 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2014-02-14  3:25 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-ppc, Alexander Graf, Andreas Färber

On 01/22/2014 11:17 PM, Alexey Kardashevskiy wrote:
> On 01/22/2014 09:16 PM, Paolo Bonzini wrote:
>> Il 22/01/2014 05:19, Alexey Kardashevskiy ha scritto:
>>> On 12/11/2013 09:22 PM, Alexey Kardashevskiy wrote:
>>>> With the great help from Paolo, I am presenting yet another try of
>>>> bootindex
>>>> support on sPAPR, this time with some QOM fixes. Details are in the
>>>> commit messages.
>>>> Please, comment. Thanks.
>>>>
>>>> Alexey Kardashevskiy (5):
>>>>   boot: extend get_boot_devices_list() to ignore suffixes
>>>>   spapr-llan: add to boot device list
>>>>   spapr-vio: fix firmware names
>>>>   qdev: introduce FWPathProvider interface
>>>>   spapr: define interface to fix device pathname
>>>>
>>>> Hervé Poussineau (1):
>>>>   qom: detect bad reentrance during object_class_foreach
>>>>
>>>> Paolo Bonzini (2):
>>>>   qom: do not register interface "types" in the type table
>>>>   vl: allow customizing the class of /machine
>>>>
>>>>  hw/core/Makefile.objs         |  1 +
>>>>  hw/core/fw-path-provider.c    | 34 ++++++++++++++++++
>>>>  hw/core/qdev.c                | 18 +++++++++-
>>>>  hw/net/spapr_llan.c           |  3 ++
>>>>  hw/nvram/fw_cfg.c             |  2 +-
>>>>  hw/ppc/spapr.c                | 80
>>>> ++++++++++++++++++++++++++++++++++++++++++-
>>>>  hw/ppc/spapr_vio.c            |  2 ++
>>>>  include/hw/boards.h           |  1 +
>>>>  include/hw/fw-path-provider.h | 31 +++++++++++++++++
>>>>  include/sysemu/sysemu.h       |  2 +-
>>>>  qom/object.c                  | 17 +++++++--
>>>>  tests/Makefile                |  1 +
>>>>  vl.c                          | 11 ++++--
>>>>  13 files changed, 193 insertions(+), 10 deletions(-)
>>>>  create mode 100644 hw/core/fw-path-provider.c
>>>>  create mode 100644 include/hw/fw-path-provider.h
>>>
>>>
>>> Some bits from this went upstream but none of them is mine. What am I
>>> missing here? Thanks.
>>
>> No idea, perhaps it's because the same patches were present in multiple
>> series?  Alex, are you picking up what's left?
>>
>> Paolo
> 
> 
> In the "Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during
> object_class_foreach" thread Andreas told me:
> 
> ===
> Be patient.
> 
> 1) I am on holidays and thus not available full-time.
> 2) Alex has already sent out his ppc PULL, so no urgency.
> 3) As mentioned, I plan to post QOM and CPU PULLs later today.
> 
> And no, you don't need to repost after parts of your series get applied
> pretty much unmodified.
> ===
> 
> So I wonder if I am not just patient enough :)


Nobody seems picking up the bits I am interested in from this :-/
What can I possibly do to get this in upstream?... I feel I am doing
something systematically wrong but nobody is telling me what exactly. Thanks.


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-02-14  3:25       ` Alexey Kardashevskiy
@ 2014-02-14  7:29         ` Paolo Bonzini
  2014-02-14  8:26           ` Alexey Kardashevskiy
  0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2014-02-14  7:29 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel
  Cc: qemu-ppc, Alexander Graf, Andreas Färber

Il 14/02/2014 04:25, Alexey Kardashevskiy ha scritto:
> Nobody seems picking up the bits I am interested in from this :-/
> What can I possibly do to get this in upstream?... I feel I am doing
> something systematically wrong but nobody is telling me what exactly. Thanks.

No, you're not.  Ping agraf on IRC if he doesn't answer.

Paolo

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-02-14  7:29         ` Paolo Bonzini
@ 2014-02-14  8:26           ` Alexey Kardashevskiy
  2014-02-20  8:37             ` Alexey Kardashevskiy
  0 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2014-02-14  8:26 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-ppc, Alexander Graf, Andreas Färber

On 02/14/2014 06:29 PM, Paolo Bonzini wrote:
> Il 14/02/2014 04:25, Alexey Kardashevskiy ha scritto:
>> Nobody seems picking up the bits I am interested in from this :-/
>> What can I possibly do to get this in upstream?... I feel I am doing
>> something systematically wrong but nobody is telling me what exactly.
>> Thanks.
> 
> No, you're not.  Ping agraf on IRC if he doesn't answer.

This almost never helps...


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-02-14  8:26           ` Alexey Kardashevskiy
@ 2014-02-20  8:37             ` Alexey Kardashevskiy
  2014-02-20 11:09               ` Paolo Bonzini
  0 siblings, 1 reply; 21+ messages in thread
From: Alexey Kardashevskiy @ 2014-02-20  8:37 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-ppc, Alexander Graf, Andreas Färber

On 02/14/2014 07:26 PM, Alexey Kardashevskiy wrote:
> On 02/14/2014 06:29 PM, Paolo Bonzini wrote:
>> Il 14/02/2014 04:25, Alexey Kardashevskiy ha scritto:
>>> Nobody seems picking up the bits I am interested in from this :-/
>>> What can I possibly do to get this in upstream?... I feel I am doing
>>> something systematically wrong but nobody is telling me what exactly.
>>> Thanks.
>>
>> No, you're not.  Ping agraf on IRC if he doesn't answer.
> 
> This almost never helps...

Tried. Did not help. Oh.

I also would like to post a patchset adding NMI for ppc64 and since I am
not allowed to post yet another #ifdef PPC64 thing, I tried making it an
NMI interface for a machine (same as FWPathProvider) but found out that
even "qdev: introduce FWPathProvider interface" it is not upstream yet -
where is it now and what are the plans about it?


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support
  2014-02-20  8:37             ` Alexey Kardashevskiy
@ 2014-02-20 11:09               ` Paolo Bonzini
  0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-02-20 11:09 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel
  Cc: qemu-ppc, Alexander Graf, Andreas Färber

Il 20/02/2014 09:37, Alexey Kardashevskiy ha scritto:
> On 02/14/2014 07:26 PM, Alexey Kardashevskiy wrote:
>> > On 02/14/2014 06:29 PM, Paolo Bonzini wrote:
>>> >> Il 14/02/2014 04:25, Alexey Kardashevskiy ha scritto:
>>>> >>> Nobody seems picking up the bits I am interested in from this :-/
>>>> >>> What can I possibly do to get this in upstream?... I feel I am doing
>>>> >>> something systematically wrong but nobody is telling me what exactly.
>>>> >>> Thanks.
>>> >>
>>> >> No, you're not.  Ping agraf on IRC if he doesn't answer.
>> >
>> > This almost never helps...
> Tried. Did not help. Oh.
>
> I also would like to post a patchset adding NMI for ppc64 and since I am
> not allowed to post yet another #ifdef PPC64 thing, I tried making it an
> NMI interface for a machine (same as FWPathProvider) but found out that
> even "qdev: introduce FWPathProvider interface" it is not upstream yet -
> where is it now and what are the plans about it?

Well, that would also be for Alex since the sole user is pseries.

I suggest you just repost the whole series, either Alex or Andreas can 
pick it up.

Paolo

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

* Re: [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface
  2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface Alexey Kardashevskiy
@ 2014-02-20 12:01   ` Andreas Färber
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Färber @ 2014-02-20 12:01 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel, Paolo Bonzini; +Cc: qemu-ppc, Alexander Graf

Am 11.12.2013 11:22, schrieb Alexey Kardashevskiy:
> QEMU supports firmware names for all devices in the QEMU tree but
> some architectures expect some parts of firmware path names in different
> format.
> 
> This introduces a firmware-pathname-change interface definition.
> If some machines needs to redefine the firmware path format, it has
> to add the TYPE_FW_PATH_PROVIDER interface to an object that is above
> the device on the QOM tree (typically /machine).
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> Changes:
> v4:
> * added fw-path-provider.o into tests/Makefile
> * fixed 80chars warning from checkpatch.pl

I am puzzled that the patch ends in Paolo's Sob but was sent by Alexey.
Was this picked up from another series or is it even in multiple
concurrent series? Were changes performed since Paolo signed it off? If
not, please provide a Patchwork link to the original for convenience. :)

> ---
>  hw/core/Makefile.objs         |  1 +
>  hw/core/fw-path-provider.c    | 36 ++++++++++++++++++++++++++++++++++++
>  hw/core/qdev.c                | 18 +++++++++++++++++-
>  include/hw/fw-path-provider.h | 32 ++++++++++++++++++++++++++++++++
>  tests/Makefile                |  1 +
>  5 files changed, 87 insertions(+), 1 deletion(-)
>  create mode 100644 hw/core/fw-path-provider.c
>  create mode 100644 include/hw/fw-path-provider.h
> 
> diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
> index 950146c..d829479 100644
> --- a/hw/core/Makefile.objs
> +++ b/hw/core/Makefile.objs
> @@ -1,5 +1,6 @@
>  # core qdev-related obj files, also used by *-user:
>  common-obj-y += qdev.o qdev-properties.o
> +common-obj-y += fw-path-provider.o
>  # irq.o needed for qdev GPIO handling:
>  common-obj-y += irq.o
>  
> diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
> new file mode 100644
> index 0000000..0187568
> --- /dev/null
> +++ b/hw/core/fw-path-provider.c
> @@ -0,0 +1,36 @@
> +#include "hw/fw-path-provider.h"

This new file is lacking a license header. Same for the header file below.

> +
> +char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
> +                                    DeviceState *dev)
> +{
> +    FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
> +
> +    return k->get_dev_path(p, bus, dev);
> +}
> +
> +char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
> +                                        DeviceState *dev)
> +{
> +    FWPathProvider *p = (FWPathProvider *)
> +        object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
> +
> +    if (p) {
> +        return fw_path_provider_get_dev_path(p, bus, dev);
> +    }
> +
> +    return NULL;
> +}
> +
> +static const TypeInfo fw_path_provider_info = {
> +    .name          = TYPE_FW_PATH_PROVIDER,
> +    .parent        = TYPE_INTERFACE,
> +    .class_size = sizeof(FWPathProviderClass),

Indentation looks inconsistent.

> +};
> +

Double white line seems unintentional.

> +
> +static void fw_path_provider_register_types(void)
> +{
> +    type_register_static(&fw_path_provider_info);
> +}
> +
> +type_init(fw_path_provider_register_types)
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 959130c..81a0e75 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -26,6 +26,7 @@
>     this API directly.  */
>  
>  #include "hw/qdev.h"
> +#include "hw/fw-path-provider.h"
>  #include "sysemu/sysemu.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qerror.h"
> @@ -503,6 +504,18 @@ static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
>      return NULL;
>  }
>  
> +static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev)
> +{
> +    Object *obj = OBJECT(dev);
> +    char *d = NULL;
> +
> +    while (!d && obj->parent) {
> +        obj = obj->parent;
> +        d = fw_path_provider_try_get_dev_path(obj, bus, dev);
> +    }
> +    return d;
> +}
> +
>  static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
>  {
>      int l = 0;
> @@ -510,7 +523,10 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
>      if (dev && dev->parent_bus) {
>          char *d;
>          l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
> -        d = bus_get_fw_dev_path(dev->parent_bus, dev);
> +        d = qdev_get_fw_dev_path_from_handler(dev->parent_bus, dev);
> +        if (!d) {
> +            d = bus_get_fw_dev_path(dev->parent_bus, dev);
> +        }
>          if (d) {
>              l += snprintf(p + l, size - l, "%s", d);
>              g_free(d);
> diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h
> new file mode 100644
> index 0000000..765170b
> --- /dev/null
> +++ b/include/hw/fw-path-provider.h
> @@ -0,0 +1,32 @@
> +#ifndef FW_PATH_PROVIDER_H
> +#define FW_PATH_PROVIDER_H 1
> +
> +#include "qemu-common.h"
> +#include "qom/object.h"
> +
> +#define TYPE_FW_PATH_PROVIDER "fw-path-provider"
> +
> +#define FW_PATH_PROVIDER_CLASS(klass) \
> +     OBJECT_CLASS_CHECK(FWPathProviderClass, (klass), TYPE_FW_PATH_PROVIDER)
> +#define FW_PATH_PROVIDER_GET_CLASS(obj) \
> +    OBJECT_GET_CLASS(FWPathProviderClass, (obj), TYPE_FW_PATH_PROVIDER)
> +#define FW_PATH_PROVIDER(obj) \
> +     INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
> +
> +typedef struct FWPathProvider {
> +    Object Parent;

parent_obj

> +} FWPathProvider;
> +
> +typedef void (*StreamCanPushNotifyFn)(void *opaque);
> +
> +typedef struct FWPathProviderClass {
> +    InterfaceClass parent;

parent_class and white line after, please.

Patch looks independent of the other pieces, so we could extract some
non-ppc pieces if this is not just waiting for an ack.
The QOM patches should already be upstream by now.

Thanks,
Andreas

> +    char *(*get_dev_path)(FWPathProvider *p, BusState *bus, DeviceState *dev);
> +} FWPathProviderClass;
> +
> +char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
> +                                    DeviceState *dev);
> +char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
> +                                        DeviceState *dev);
> +
> +#endif /* FW_PATH_PROVIDER_H */
> diff --git a/tests/Makefile b/tests/Makefile
> index 379cdd9..09c42d0 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -160,6 +160,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
>  	hw/core/qdev.o hw/core/qdev-properties.o \
>  	hw/core/irq.o \
>  	qom/object.o qom/container.o qom/qom-qobject.o \
> +	hw/core/fw-path-provider.o \
>  	$(test-qapi-obj-y) \
>  	libqemuutil.a libqemustub.a
>  
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

end of thread, other threads:[~2014-02-20 12:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 10:22 [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 2/8] qom: detect bad reentrance during object_class_foreach Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 3/8] boot: extend get_boot_devices_list() to ignore suffixes Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 4/8] spapr-llan: add to boot device list Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 5/8] spapr-vio: fix firmware names Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 6/8] qdev: introduce FWPathProvider interface Alexey Kardashevskiy
2014-02-20 12:01   ` Andreas Färber
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 7/8] vl: allow customizing the class of /machine Alexey Kardashevskiy
2013-12-11 10:22 ` [Qemu-devel] [PATCH v4 8/8] spapr: define interface to fix device pathname Alexey Kardashevskiy
2013-12-11 10:36 ` [Qemu-devel] [PATCH v4 0/8] spapr: bootindex support Paolo Bonzini
2013-12-12 14:05 ` Michael S. Tsirkin
2013-12-13  3:19   ` Alexey Kardashevskiy
2014-01-22  4:19 ` Alexey Kardashevskiy
2014-01-22 10:16   ` Paolo Bonzini
2014-01-22 12:17     ` Alexey Kardashevskiy
2014-02-14  3:25       ` Alexey Kardashevskiy
2014-02-14  7:29         ` Paolo Bonzini
2014-02-14  8:26           ` Alexey Kardashevskiy
2014-02-20  8:37             ` Alexey Kardashevskiy
2014-02-20 11:09               ` Paolo Bonzini

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.