linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: virtualization@lists.linux-foundation.org
Cc: linux-s390@vger.kernel.org, KVM list <kvm@vger.kernel.org>,
	borntraeger@de.ibm.com, Carsten Otte <carsteno@de.ibm.com>,
	Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Subject: [PATCH 1/3] S390: take a full byte as ext_param indicator
Date: Tue, 24 Aug 2010 15:48:50 +0200	[thread overview]
Message-ID: <1282657732-20902-1-git-send-email-agraf@suse.de> (raw)

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>

---

v1 -> v2:

  - move defines to virtio_s390.h
---
 arch/s390/include/asm/kvm_virtio.h |    6 ++++++
 drivers/s390/kvm/kvm_virtio.c      |   19 +++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/asm/kvm_virtio.h
index acdfdff..3f5d100 100644
--- a/arch/s390/include/asm/kvm_virtio.h
+++ b/arch/s390/include/asm/kvm_virtio.h
@@ -54,4 +54,10 @@ struct kvm_vqconfig {
  * This is pagesize for historical reasons. */
 #define KVM_S390_VIRTIO_RING_ALIGN	4096
 
+
+/* These values are supposed to be in ext_params on an interrupt */
+#define VIRTIO_PARAM_MASK		0xff
+#define VIRTIO_PARAM_VRING_INTERRUPT	0x0
+#define VIRTIO_PARAM_CONFIG_CHANGED	0x1
+
 #endif
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 4e298bc..68cef4d 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -334,7 +334,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 +343,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

             reply	other threads:[~2010-08-24 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 13:48 Alexander Graf [this message]
2010-08-24 13:48 ` [PATCH 2/3] S390: Add virtio hotplug add support Alexander Graf
2010-08-25  8:16   ` Heiko Carstens
2010-08-25  8:20     ` Alexander Graf
2010-08-25  8:35       ` Heiko Carstens
2010-08-25  8:34         ` Alexander Graf
2010-08-25  8:48           ` Heiko Carstens
2010-08-25  8:52             ` Alexander Graf
2010-09-12  0:42   ` Alexander Graf
2010-09-12  9:00     ` Avi Kivity
2010-09-13  3:35       ` Rusty Russell
2010-09-13  7:41         ` Martin Schwidefsky
2010-09-13  9:41           ` Avi Kivity
2010-08-24 13:48 ` [PATCH 3/3] S390: Export kvm_virtio.h Alexander Graf
2010-08-25 21:20 ` [PATCH 1/3] S390: take a full byte as ext_param indicator Marcelo Tosatti

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=1282657732-20902-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=carsteno@de.ibm.com \
    --cc=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).