[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V9 06/12] virtio-s390-bus : add virtio-s390-bus.
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC V9 06/12] virtio-s390-bus : add virtio-s390-bus. |
Date: |
Thu, 3 Jan 2013 15:52:18 +0100 |
From: KONRAD Frederic <address@hidden>
This add the virtio-s390-bus which extends virtio-bus. So one VirtIODevice can
be connected on this bus.
Signed-off-by: KONRAD Frederic <address@hidden>
---
hw/s390-virtio-bus.c | 28 ++++++++++++++++++++++++++++
hw/s390-virtio-bus.h | 13 +++++++++++++
2 files changed, 41 insertions(+)
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index b78d626..67ecb3a 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -32,6 +32,7 @@
#include "sysemu/kvm.h"
#include "hw/s390-virtio-bus.h"
+#include "hw/virtio-bus.h"
/* #define DEBUG_S390 */
@@ -555,8 +556,35 @@ static TypeInfo s390_virtio_bridge_info = {
.class_init = s390_virtio_bridge_class_init,
};
+/* virtio-s390-bus */
+
+VirtioBusState *virtio_s390_bus_new(VirtIOS390Device *dev)
+{
+ DeviceState *qdev = DEVICE(dev);
+ BusState *qbus = qbus_create(TYPE_VIRTIO_S390_BUS, qdev, NULL);
+ VirtioBusState *bus = VIRTIO_BUS(qbus);
+ qbus->allow_hotplug = 0;
+ qbus->max_dev = 1;
+ return bus;
+}
+
+static void virtio_s390_bus_class_init(ObjectClass *klass, void *data)
+{
+ VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
+ k->notify = virtio_s390_notify;
+ k->get_features = virtio_s390_get_features;
+}
+
+static const TypeInfo virtio_s390_bus_info = {
+ .name = TYPE_VIRTIO_S390_BUS,
+ .parent = TYPE_VIRTIO_BUS,
+ .instance_size = sizeof(VirtioBusState),
+ .class_init = virtio_s390_bus_class_init,
+};
+
static void s390_virtio_register_types(void)
{
+ type_register_static(&virtio_s390_bus_info);
type_register_static(&s390_virtio_bus_info);
type_register_static(&virtio_s390_device_info);
type_register_static(&s390_virtio_serial);
diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h
index 23fedd5..d5a6f9b 100644
--- a/hw/s390-virtio-bus.h
+++ b/hw/s390-virtio-bus.h
@@ -24,6 +24,7 @@
#include "virtio-rng.h"
#include "virtio-serial.h"
#include "virtio-scsi.h"
+#include "virtio-bus.h"
#define VIRTIO_DEV_OFFS_TYPE 0 /* 8 bits */
#define VIRTIO_DEV_OFFS_NUM_VQ 1 /* 8 bits */
@@ -59,8 +60,20 @@
#define S390_VIRTIO_BUS(obj) \
OBJECT_CHECK(VirtIOS390Bus, (obj), TYPE_S390_VIRTIO_BUS)
+/* virtio-s390-bus */
+
+#define TYPE_VIRTIO_S390_BUS "virtio-s390-bus"
+#define VIRTIO_S390_BUS_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VirtioBusClass, obj, TYPE_VIRTIO_S390_BUS)
+#define VIRTIO_PCI_BUS_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VirtioBusClass, klass, TYPE_VIRTIO_S390_BUS)
+#define VIRTIO_PCI_BUS(obj) \
+ OBJECT_CHECK(VirtioBusState, (obj), TYPE_VIRTIO_S390_BUS)
+
typedef struct VirtIOS390Device VirtIOS390Device;
+VirtioBusState *virtio_s390_bus_new(VirtIOS390Device *dev);
+
typedef struct VirtIOS390DeviceClass {
DeviceClass qdev;
int (*init)(VirtIOS390Device *dev);
--
1.7.11.7
- [Qemu-devel] [RFC V9 00/12] Virtio refactoring., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 01/12] qdev : add a maximum device allowed field for the bus., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 06/12] virtio-s390-bus : add virtio-s390-bus.,
fred . konrad <=
- [Qemu-devel] [RFC V9 03/12] virtio-pci-bus : introduce virtio-pci-bus., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 07/12] virtio-s390-device : create a virtio-s390-bus during init., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 05/12] virtio-device : refactor virtio-device., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 02/12] virtio-bus : introduce virtio-bus, fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 04/12] virtio-pci : refactor virtio-pci device., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 08/12] virtio-blk : add the virtio-blk device., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 10/12] virtio-blk-s390 : switch to the new API., fred . konrad, 2013/01/03
- [Qemu-devel] [RFC V9 09/12] virtio-blk-pci : switch to new API., fred . konrad, 2013/01/03