All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel List <qemu-devel@nongnu.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH 1/5] [S390] Add hotplug support
Date: Tue, 24 Aug 2010 00:02:27 +0200	[thread overview]
Message-ID: <1282600951-30803-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1282600951-30803-1-git-send-email-agraf@suse.de>

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 <agraf@suse.de>
---
 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;
-- 
1.6.0.2

  reply	other threads:[~2010-08-23 22:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 22:02 [Qemu-devel] [PATCH 0/5] Add S390 hotplug add support Alexander Graf
2010-08-23 22:02 ` Alexander Graf [this message]
2010-08-23 22:02 ` [Qemu-devel] [PATCH 2/5] [S390] Increase amount of virtio pages Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 3/5] Compile device-hotplug on all targets Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 4/5] Add generic drive hotplugging Alexander Graf
2010-08-23 22:21   ` Anthony Liguori
2010-08-23 22:23     ` Alexander Graf
2010-08-23 22:45       ` Alexander Graf
2010-08-23 22:50         ` Anthony Liguori
2010-08-23 22:54           ` Alexander Graf
2010-08-24  9:31   ` Daniel P. Berrange
2010-08-24 10:45     ` Alexander Graf
2010-08-24 10:51       ` Daniel P. Berrange
2010-08-24 13:40         ` Alexander Graf
2010-08-24 13:44           ` Daniel P. Berrange
2010-08-24 13:46             ` Alexander Graf
2010-08-24 13:51               ` Daniel P. Berrange
2010-08-27  9:27                 ` Markus Armbruster
2010-08-24 18:35             ` Anthony Liguori
2010-08-24 21:53               ` Alexander Graf
2010-08-27  9:53   ` Markus Armbruster
2010-08-27  9:56     ` Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 5/5] Expose drive_add on all architectures Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282600951-30803-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.