From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCfQF-0005Eq-K7 for qemu-devel@nongnu.org; Mon, 04 Mar 2013 19:08:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCfQE-0005OB-GI for qemu-devel@nongnu.org; Mon, 04 Mar 2013 19:07:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCfQE-0005O3-1B for qemu-devel@nongnu.org; Mon, 04 Mar 2013 19:07:58 -0500 Date: Mon, 4 Mar 2013 21:07:41 -0300 From: Marcelo Tosatti Message-ID: <20130305000741.GA17903@amt.cnet> References: <1362051201-56541-1-git-send-email-cornelia.huck@de.ibm.com> <1362051201-56541-7-git-send-email-cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1362051201-56541-7-git-send-email-cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH v5 6/6] KVM: s390: Wire up ioeventfd. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: Carsten Otte , KVM , Gleb Natapov , "Michael S. Tsirkin" , linux-s390 , Heiko Carstens , Alexander Graf , qemu-devel , Christian Borntraeger , Martin Schwidefsky On Thu, Feb 28, 2013 at 12:33:21PM +0100, Cornelia Huck wrote: > Enable ioeventfd support on s390 and hook up diagnose 500 virtio-ccw > notifications. > > Signed-off-by: Cornelia Huck > --- > arch/s390/kvm/Kconfig | 1 + > arch/s390/kvm/Makefile | 2 +- > arch/s390/kvm/diag.c | 26 ++++++++++++++++++++++++++ > arch/s390/kvm/kvm-s390.c | 1 + > 4 files changed, 29 insertions(+), 1 deletion(-) > > diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig > index b58dd86..3c43e30 100644 > --- a/arch/s390/kvm/Kconfig > +++ b/arch/s390/kvm/Kconfig > @@ -22,6 +22,7 @@ config KVM > select PREEMPT_NOTIFIERS > select ANON_INODES > select HAVE_KVM_CPU_RELAX_INTERCEPT > + select HAVE_KVM_EVENTFD > ---help--- > Support hosting paravirtualized guest machines using the SIE > virtualization capability on the mainframe. This should work > diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile > index 3975722..8fe9d65 100644 > --- a/arch/s390/kvm/Makefile > +++ b/arch/s390/kvm/Makefile > @@ -6,7 +6,7 @@ > # it under the terms of the GNU General Public License (version 2 only) > # as published by the Free Software Foundation. > > -common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o) > +common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o eventfd.o) > > ccflags-y := -Ivirt/kvm -Iarch/s390/kvm > > diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c > index a390687..1c01a99 100644 > --- a/arch/s390/kvm/diag.c > +++ b/arch/s390/kvm/diag.c > @@ -13,6 +13,7 @@ > > #include > #include > +#include > #include "kvm-s390.h" > #include "trace.h" > #include "trace-s390.h" > @@ -104,6 +105,29 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu) > return -EREMOTE; > } > > +static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) > +{ > + int ret, idx; > + > + /* No virtio-ccw notification? Get out quickly. */ > + if (!vcpu->kvm->arch.css_support || > + (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY)) > + return -EOPNOTSUPP; > + > + idx = srcu_read_lock(&vcpu->kvm->srcu); > + /* > + * The layout is as follows: > + * - gpr 2 contains the subchannel id (passed as addr) > + * - gpr 3 contains the virtqueue index (passed as datamatch) > + */ > + ret = kvm_io_bus_write(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS, > + vcpu->run->s.regs.gprs[2], > + 8, &vcpu->run->s.regs.gprs[3]); > + srcu_read_unlock(&vcpu->kvm->srcu, idx); > + /* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */ > + return ret < 0 ? ret : 0; > +} > + What about the cookie?