[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 11/13] qdev: introduce automatic creation of
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [RFC PATCH v2 11/13] qdev: introduce automatic creation of buses |
Date: |
Mon, 6 Jun 2011 18:04:20 +0200 |
When a logical unit is hung directly below an HBA, we want to introduce
the "missing levels" to avoid duplicating generic target code across
all devices. To do this, I introduce a callback in qdev that is given
the bus specified by the user, and returns the actual bus to use.
Signed-off-by: Paolo Bonzini <address@hidden>
Cc: Markus Armbruster <address@hidden>
---
hw/qdev.c | 13 +++++++++++++
hw/qdev.h | 3 +++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 9519f5d..847bcda 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -204,6 +204,17 @@ int qdev_device_help(QemuOpts *opts)
return 1;
}
+static BusState *qbus_realize_topology(BusState *bus, DeviceInfo *info,
+ QemuOpts *opts)
+{
+ BusState *old = NULL;
+ while (old != bus && bus->info->realize_topology) {
+ old = bus;
+ bus = bus->info->realize_topology(bus, info, opts);
+ }
+ return bus;
+}
+
DeviceState *qdev_device_add(QemuOpts *opts)
{
const char *driver, *path, *id;
@@ -245,6 +256,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
return NULL;
}
}
+
+ bus = qbus_realize_topology(bus, info, opts);
if (qdev_hotplug && !bus->allow_hotplug) {
qerror_report(QERR_BUS_NO_HOTPLUG, bus->name);
return NULL;
diff --git a/hw/qdev.h b/hw/qdev.h
index 8a13ec9..ae18406 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -56,6 +56,8 @@ typedef char *(*bus_get_dev_path)(DeviceState *dev);
*/
typedef char *(*bus_get_fw_dev_path)(DeviceState *dev);
typedef int (qbus_resetfn)(BusState *bus);
+typedef BusState *(*bus_realize_topology)(BusState *bus, DeviceInfo *dev,
+ QemuOpts *opts);
struct BusInfo {
const char *name;
@@ -63,6 +65,7 @@ struct BusInfo {
bus_dev_printfn print_dev;
bus_get_dev_path get_dev_path;
bus_get_fw_dev_path get_fw_dev_path;
+ bus_realize_topology realize_topology;
qbus_resetfn *reset;
Property *props;
};
--
1.7.4.4
- [Qemu-devel] [RFC PATCH v2 01/13] scsi: cleanup reset and destroy callbacks, (continued)
- [Qemu-devel] [RFC PATCH v2 01/13] scsi: cleanup reset and destroy callbacks, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 03/13] scsi: add initiator field to SCSIRequest, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 04/13] scsi: let a SCSIDevice have children devices, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 05/13] scsi: let the bus pick a LUN for the child device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 06/13] scsi-generic: fix passthrough of devices with LUN != 0, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 07/13] scsi: add walking of hierarchical LUNs, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 09/13] scsi: introduce the scsi-target device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 10/13] scsi: include bus and device levels, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 11/13] qdev: introduce automatic creation of buses,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH v2 12/13] scsi: create scsi-path and scsi-target devices automatically, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 13/13] scsi: delete handling of REPORT LUNS and unknown LUNs outside scsi-target, Paolo Bonzini, 2011/06/06