[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 16/26] qdev: fix get_fw_dev_path to support to add
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 16/26] qdev: fix get_fw_dev_path to support to add nothing to fw_dev_path |
Date: |
Wed, 12 Jun 2013 16:41:28 -0500 |
From: Amos Kong <address@hidden>
Recent virtio refactoring in QEMU made virtio-bus become the parent bus
of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation,
typename will be added to fw_dev_path by default, the new fw_dev_path
could not be identified by seabios. It causes that bootindex parameter
of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called
if bus doesn't implement the method, tyename will be added to
fw_dev_path. If the implemented method returns NULL, nothing will be
added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then
QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-id: address@hidden
--
v2: only add nothing to fw_dev_path when get_fw_dev_path() is
implemented and returns NULL. then it will not effect other devices
don't have get_fw_dev_path() implementation.
v3: implement default get_fw_dev_path() in BusClass
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit bbfa18fca4e44ff9c23d36b50d8a998af9c9e9fc)
Signed-off-by: Michael Roth <address@hidden>
---
hw/core/qdev.c | 10 +++++++++-
hw/virtio/virtio-bus.c | 6 ++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 6985ad8..9190a7e 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev,
char *p, int size)
l += snprintf(p + l, size - l, "%s", d);
g_free(d);
} else {
- l += snprintf(p + l, size - l, "%s",
object_get_typename(OBJECT(dev)));
+ return l;
}
}
l += snprintf(p + l , size - l, "/");
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj)
QTAILQ_INIT(&bus->children);
}
+static char *default_bus_get_fw_dev_path(DeviceState *dev)
+{
+ return g_strdup(object_get_typename(OBJECT(dev)));
+}
+
static void bus_class_init(ObjectClass *class, void *data)
{
+ BusClass *bc = BUS_CLASS(class);
+
class->unparent = bus_unparent;
+ bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj)
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index ea2e11a..6849a01 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev)
return qdev_get_dev_path(proxy);
}
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev)
+{
+ return NULL;
+}
+
static void virtio_bus_class_init(ObjectClass *klass, void *data)
{
BusClass *bus_class = BUS_CLASS(klass);
bus_class->get_dev_path = virtio_bus_get_dev_path;
+ bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
--
1.7.9.5
- [Qemu-stable] [PATCH 05/26] xen: simplify xen_enabled, (continued)
- [Qemu-stable] [PATCH 05/26] xen: simplify xen_enabled, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 06/26] main_loop: do not set nonblocking if xen_enabled(), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 07/26] xen_machine_pv: do not create a dummy CPU in machine->init, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 08/26] chardev: fix "info chardev" output, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 09/26] ide: Set BSY bit during FLUSH, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 10/26] Revert "roms: switch oldnoconfig to olddefconfig", Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 12/26] target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 13/26] Remove OSS support for OpenBSD, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 14/26] xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 15/26] do not check pointers after dereferencing them, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 16/26] qdev: fix get_fw_dev_path to support to add nothing to fw_dev_path,
Michael Roth <=
- [Qemu-stable] [PATCH 17/26] host-libusb: Correct test for USB packet state, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 18/26] Fix usage of USB_DEV_FLAG_IS_HOST flag., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 20/26] ui/gtk.c: Fix *BSD build of Gtk+ UI, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 19/26] vmxnet3: fix NICState cleanup, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 22/26] virtio-ccw: Fix unsetting of indicators., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 21/26] s390x/css: Fix concurrent sense., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 24/26] qemu-char: don't issue CHR_EVENT_OPEN in a BH, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 25/26] target-i386: Fix aflag logic for CODE64 and the 0x67 prefix, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 26/26] q35: set fw_name, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 23/26] xilinx_axidma: Do not set DMA .notify to NULL after notify, Michael Roth, 2013/06/12