From patchwork Mon Aug 23 22:02:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 62518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C2B88B70A4 for ; Tue, 24 Aug 2010 08:05:59 +1000 (EST) Received: from localhost ([127.0.0.1]:37784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Onf9R-0003MZ-3m for incoming@patchwork.ozlabs.org; Mon, 23 Aug 2010 18:05:57 -0400 Received: from [140.186.70.92] (port=37741 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Onf6E-00029N-6d for qemu-devel@nongnu.org; Mon, 23 Aug 2010 18:02:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Onf6A-0000bv-O1 for qemu-devel@nongnu.org; Mon, 23 Aug 2010 18:02:37 -0400 Received: from cantor.suse.de ([195.135.220.2]:56237 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onf6A-0000bB-CG for qemu-devel@nongnu.org; Mon, 23 Aug 2010 18:02:34 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id ED93A93F46; Tue, 24 Aug 2010 00:02:32 +0200 (CEST) From: Alexander Graf To: qemu-devel List Date: Tue, 24 Aug 2010 00:02:27 +0200 Message-Id: <1282600951-30803-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1282600951-30803-1-git-send-email-agraf@suse.de> References: <1282600951-30803-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Gerd Hoffmann , Markus Armbruster , Aurelien Jarno , Luiz Capitulino Subject: [Qemu-devel] [PATCH 1/5] [S390] Add hotplug support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org I just submitted a few patches that enable the s390 virtio bus to receive a hotplug add event. This patch implements the qemu side of it, so that new hotplug events can be submitted to the guest. Signed-off-by: Alexander Graf --- hw/s390-virtio-bus.c | 9 +++++++++ hw/s390-virtio-bus.h | 5 +++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index fe6884d..3ded3f9 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -76,6 +76,9 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size) bus->dev_offs = bus->dev_page; bus->next_ring = bus->dev_page + TARGET_PAGE_SIZE; + /* Enable hotplugging */ + _bus->allow_hotplug = 1; + /* Allocate RAM for VirtIO device pages (descriptors, queues, rings) */ *ram_size += S390_DEVICE_PAGES * TARGET_PAGE_SIZE; @@ -103,6 +106,11 @@ static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev) dev->host_features = vdev->get_features(vdev, dev->host_features); s390_virtio_device_sync(dev); + if (dev->qdev.hotplugged) { + kvm_s390_virtio_irq(s390_cpu_addr2state(0), VIRTIO_PARAM_DEV_ADD, + dev->dev_offs); + } + return 0; } @@ -365,6 +373,7 @@ static void s390_virtio_bus_register_withprop(VirtIOS390DeviceInfo *info) { info->qdev.init = s390_virtio_busdev_init; info->qdev.bus_info = &s390_virtio_bus_info; + info->qdev.unplug = qdev_simple_unplug_cb; assert(info->qdev.size >= sizeof(VirtIOS390Device)); qdev_register(&info->qdev); diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h index 333fea8..7a2f8dc 100644 --- a/hw/s390-virtio-bus.h +++ b/hw/s390-virtio-bus.h @@ -32,6 +32,11 @@ #define VIRTIO_RING_LEN (TARGET_PAGE_SIZE * 3) #define S390_DEVICE_PAGES 256 +#define VIRTIO_PARAM_MASK 0xff +#define VIRTIO_PARAM_VRING_INTERRUPT 0x0 +#define VIRTIO_PARAM_CONFIG_CHANGED 0x1 +#define VIRTIO_PARAM_DEV_ADD 0x2 + typedef struct VirtIOS390Device { DeviceState qdev; ram_addr_t dev_offs;