All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: kvm@vger.kernel.org,
	virtualization <virtualization@lists.linux-foundation.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	lguest@ozlabs.org, Carsten Otte <cotte@de.ibm.com>
Subject: [PATCH 2/2] kvm-s390: implement config_changed for virtio on s390
Date: Tue, 18 Nov 2008 12:47:41 +0100	[thread overview]
Message-ID: <200811181247.41739.borntraeger@de.ibm.com> (raw)
In-Reply-To: <200811181245.03931.borntraeger@de.ibm.com>



From: Christian Borntraeger <borntraeger@de.ibm.com>

This patch implements config_changed for the s390 virtio transport.

We use the least significant bit of the interrupt parameter field
to decide, if this interrupt should call the virtio virtqueue callback
or the config_changed callback.

This method is compatible with old host and guest code. Old 64 bit guests
will not check the bit and trigger a harmless additional vring_interrupt
call. Old host code will never set this bit, this is also safe.

I dont know if we will implement 31bit guest support, but this interface 
is also 31-bit safe

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/s390/kvm/kvm_virtio.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Index: kvm/drivers/s390/kvm/kvm_virtio.c
===================================================================
--- kvm.orig/drivers/s390/kvm/kvm_virtio.c
+++ kvm/drivers/s390/kvm/kvm_virtio.c
@@ -295,13 +295,29 @@ static void scan_devices(void)
  */
 static void kvm_extint_handler(u16 code)
 {
-	void *data = (void *) *(long *) __LC_PFAULT_INTPARM;
-	u16 subcode = S390_lowcore.cpu_addr;
+	struct virtqueue *vq;
+	u16 subcode;
+	int config_changed;
 
+ 	subcode = S390_lowcore.cpu_addr;
 	if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)
 		return;
 
-	vring_interrupt(0, data);
+	/* The LSB is overloaded, we have to mask it */
+	vq = (struct virtqueue *) ((*(long *) __LC_PFAULT_INTPARM) & ~1UL);
+
+	/* We use the LSB of extparam, to decide, if this interrupt is a config
+	 * change or a "standard" interrupt */
+	config_changed =  (*(long *)  __LC_PFAULT_INTPARM & 1);
+
+	if (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
+		vring_interrupt(0, vq);
 }
 
 /*

  parent reply	other threads:[~2008-11-18 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 11:45 [RFC/PATCH 0/2] virtio console resize support Christian Borntraeger
2008-11-18 11:47 ` [PATCH 1/2] virtio_console: support console resizing Christian Borntraeger
2008-11-18 11:47 ` Christian Borntraeger
2008-11-18 11:47 ` Christian Borntraeger [this message]
     [not found]   ` <200811181247.41739.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2008-11-18 14:34     ` [PATCH 2/2] kvm-s390: implement config_changed for virtio on s390 Rusty Russell
2008-11-18 14:34   ` Rusty Russell
2008-11-18 21:44   ` Christian Borntraeger
2008-11-19  0:23     ` Rusty Russell
2008-11-19  0:23     ` Rusty Russell
2008-11-18 21:44   ` Christian Borntraeger
2008-11-18 11:47 ` Christian Borntraeger

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=200811181247.41739.borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=lguest@ozlabs.org \
    --cc=rusty@rustcorp.com.au \
    --cc=schwidefsky@de.ibm.com \
    --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 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.