From patchwork Thu Jan 3 14:52:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fred.konrad@greensocs.com X-Patchwork-Id: 209265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5D49F2C0089 for ; Fri, 4 Jan 2013 01:53:14 +1100 (EST) Received: from localhost ([::1]:60364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmAS-0008HJ-FO for incoming@patchwork.ozlabs.org; Thu, 03 Jan 2013 09:53:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmAA-00086q-Hc for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:52:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqmA9-0005Ti-AQ for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:52:54 -0500 Received: from greensocs.com ([87.106.252.221]:53349 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmA8-0005TH-VT for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:52:53 -0500 Received: from localhost (unknown [127.0.0.1]) by s15328186.onlinehome-server.info (Postfix) with ESMTP id 82BD3439E39; Thu, 3 Jan 2013 14:52:52 +0000 (UTC) Received: from s15328186.onlinehome-server.info ([127.0.0.1]) by localhost (s15328186.onlinehome-server.info [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iA4v6ZGQZQwq; Thu, 3 Jan 2013 15:52:52 +0100 (CET) Received: by s15328186.onlinehome-server.info (Postfix, from userid 491) id 24871439E38; Thu, 3 Jan 2013 15:52:51 +0100 (CET) Received: from compaq.katmai.xl.cx.katmai.xl.cx (lan31-11-83-155-143-136.fbx.proxad.net [83.155.143.136]) by s15328186.onlinehome-server.info (Postfix) with ESMTPSA id DEAD1439E3C; Thu, 3 Jan 2013 15:52:50 +0100 (CET) From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 3 Jan 2013 15:52:18 +0100 Message-Id: <1357224744-14443-7-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357224744-14443-1-git-send-email-fred.konrad@greensocs.com> References: <1357224744-14443-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 87.106.252.221 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, e.voevodin@samsung.com, mark.burton@greensocs.com, agraf@suse.de, stefanha@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC V9 06/12] virtio-s390-bus : add virtio-s390-bus. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: KONRAD Frederic This add the virtio-s390-bus which extends virtio-bus. So one VirtIODevice can be connected on this bus. Signed-off-by: KONRAD Frederic --- 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);