All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] S390: take a full byte as ext_param indicator
@ 2010-08-23 21:31 Alexander Graf
  2010-08-23 21:31 ` [PATCH 2/2] S390: Add virtio hotplug add support Alexander Graf
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Alexander Graf @ 2010-08-23 21:31 UTC (permalink / raw)
  To: virtualization; +Cc: Rusty Russell, Christian Ehrhardt, Carsten Otte, KVM list

Currenty the ext_param field only distinguishes between "config change" and
"vring interrupt". We can do a lot more with it though, so let's enable a
full byte of possible values and constants to #defines while at it.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 drivers/s390/kvm/kvm_virtio.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 4e298bc..ada7e2c 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -27,6 +27,9 @@
 #include <asm/s390_ext.h>
 
 #define VIRTIO_SUBCODE_64 0x0D00
+#define VIRTIO_PARAM_MASK		0xff
+#define VIRTIO_PARAM_VRING_INTERRUPT	0x0
+#define VIRTIO_PARAM_CONFIG_CHANGED	0x1
 
 /*
  * The pointer to our (page) of device descriptions.
@@ -334,7 +337,7 @@ static void kvm_extint_handler(u16 code)
 {
 	struct virtqueue *vq;
 	u16 subcode;
-	int config_changed;
+	u32 param;
 
 	subcode = S390_lowcore.cpu_addr;
 	if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)
@@ -343,18 +346,25 @@ static void kvm_extint_handler(u16 code)
 	/* The LSB might be overloaded, we have to mask it */
 	vq = (struct virtqueue *)(S390_lowcore.ext_params2 & ~1UL);
 
-	/* We use the LSB of extparam, to decide, if this interrupt is a config
-	 * change or a "standard" interrupt */
-	config_changed = S390_lowcore.ext_params & 1;
+	/* We use ext_params to decide what this interrupt means */
+	param = S390_lowcore.ext_params & VIRTIO_PARAM_MASK;
 
-	if (config_changed) {
+	switch (param) {
+	case VIRTIO_PARAM_CONFIG_CHANGED:
+	{
 		struct virtio_driver *drv;
 		drv = container_of(vq->vdev->dev.driver,
 				   struct virtio_driver, driver);
 		if (drv->config_changed)
 			drv->config_changed(vq->vdev);
-	} else
+
+		break;
+	}
+	case VIRTIO_PARAM_VRING_INTERRUPT:
+	default:
 		vring_interrupt(0, vq);
+		break;
+	}
 }
 
 /*
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread
* [PATCH 1/2] S390: take a full byte as ext_param indicator
@ 2010-08-23 21:31 Alexander Graf
  0 siblings, 0 replies; 24+ messages in thread
From: Alexander Graf @ 2010-08-23 21:31 UTC (permalink / raw)
  To: virtualization; +Cc: Carsten Otte, Christian Ehrhardt, KVM list

Currenty the ext_param field only distinguishes between "config change" and
"vring interrupt". We can do a lot more with it though, so let's enable a
full byte of possible values and constants to #defines while at it.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 drivers/s390/kvm/kvm_virtio.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 4e298bc..ada7e2c 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -27,6 +27,9 @@
 #include <asm/s390_ext.h>
 
 #define VIRTIO_SUBCODE_64 0x0D00
+#define VIRTIO_PARAM_MASK		0xff
+#define VIRTIO_PARAM_VRING_INTERRUPT	0x0
+#define VIRTIO_PARAM_CONFIG_CHANGED	0x1
 
 /*
  * The pointer to our (page) of device descriptions.
@@ -334,7 +337,7 @@ static void kvm_extint_handler(u16 code)
 {
 	struct virtqueue *vq;
 	u16 subcode;
-	int config_changed;
+	u32 param;
 
 	subcode = S390_lowcore.cpu_addr;
 	if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)
@@ -343,18 +346,25 @@ static void kvm_extint_handler(u16 code)
 	/* The LSB might be overloaded, we have to mask it */
 	vq = (struct virtqueue *)(S390_lowcore.ext_params2 & ~1UL);
 
-	/* We use the LSB of extparam, to decide, if this interrupt is a config
-	 * change or a "standard" interrupt */
-	config_changed = S390_lowcore.ext_params & 1;
+	/* We use ext_params to decide what this interrupt means */
+	param = S390_lowcore.ext_params & VIRTIO_PARAM_MASK;
 
-	if (config_changed) {
+	switch (param) {
+	case VIRTIO_PARAM_CONFIG_CHANGED:
+	{
 		struct virtio_driver *drv;
 		drv = container_of(vq->vdev->dev.driver,
 				   struct virtio_driver, driver);
 		if (drv->config_changed)
 			drv->config_changed(vq->vdev);
-	} else
+
+		break;
+	}
+	case VIRTIO_PARAM_VRING_INTERRUPT:
+	default:
 		vring_interrupt(0, vq);
+		break;
+	}
 }
 
 /*
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-08-24 13:24 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 21:31 [PATCH 1/2] S390: take a full byte as ext_param indicator Alexander Graf
2010-08-23 21:31 ` [PATCH 2/2] S390: Add virtio hotplug add support Alexander Graf
2010-08-24  7:13   ` Christian Borntraeger
2010-08-24  7:13   ` Christian Borntraeger
2010-08-23 21:31 ` Alexander Graf
2010-08-24  7:03 ` [PATCH 1/2] S390: take a full byte as ext_param indicator Christian Borntraeger
2010-08-24  7:03 ` Christian Borntraeger
2010-08-24 12:06   ` Alexander Graf
2010-08-24 12:06   ` Alexander Graf
2010-08-24 12:14     ` Christian Borntraeger
2010-08-24 12:14     ` Christian Borntraeger
2010-08-24 12:22       ` Avi Kivity
2010-08-24 12:22       ` Avi Kivity
2010-08-24 12:25         ` Alexander Graf
2010-08-24 12:25         ` Alexander Graf
2010-08-24 12:30           ` Avi Kivity
2010-08-24 12:30           ` Avi Kivity
2010-08-24 12:32             ` Alexander Graf
2010-08-24 12:32             ` Alexander Graf
2010-08-24 12:35               ` Avi Kivity
2010-08-24 12:35               ` Avi Kivity
2010-08-24 13:24         ` Christian Borntraeger
2010-08-24 13:24         ` Christian Borntraeger
  -- strict thread matches above, loose matches on Subject: below --
2010-08-23 21:31 Alexander Graf

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.