public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Gleb Natapov <gleb@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Carsten Otte <cotte@de.ibm.com>, Alexander Graf <agraf@suse.de>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH v3 4/5] KVM: ioeventfd for virtio-ccw devices.
Date: Tue, 26 Feb 2013 12:55:28 +0100	[thread overview]
Message-ID: <20130226125528.28052cfe@gondolin> (raw)
In-Reply-To: <20130226105536.GA10915@redhat.com>

On Tue, 26 Feb 2013 12:55:36 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Feb 25, 2013 at 04:27:49PM +0100, Cornelia Huck wrote:
> > Enhance KVM_IOEVENTFD with a new flag that allows to attach to virtio-ccw
> > devices on s390 via the KVM_VIRTIO_CCW_NOTIFY_BUS.
> > 
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > ---
> >  Documentation/virtual/kvm/api.txt |  8 ++++++++
> >  include/uapi/linux/kvm.h          |  3 +++
> >  virt/kvm/eventfd.c                | 14 ++++++++++++--
> >  3 files changed, 23 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
> > index c2534c3..86232d6 100644
> > --- a/Documentation/virtual/kvm/api.txt
> > +++ b/Documentation/virtual/kvm/api.txt
> > @@ -1468,15 +1468,23 @@ struct kvm_ioeventfd {
> >  	__u8  pad[36];
> >  };
> >  
> > +For the special case of virtio-ccw devices on s390, the ioevent is matched
> > +to a subchannel/virtqueue tuple instead.
> > +
> >  The following flags are defined:
> >  
> >  #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
> >  #define KVM_IOEVENTFD_FLAG_PIO       (1 << kvm_ioeventfd_flag_nr_pio)
> >  #define KVM_IOEVENTFD_FLAG_DEASSIGN  (1 << kvm_ioeventfd_flag_nr_deassign)
> > +#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \
> > +	(1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
> >  
> >  If datamatch flag is set, the event will be signaled only if the written value
> >  to the registered address is equal to datamatch in struct kvm_ioeventfd.
> >  
> > +For virtio-ccw devices, addr contains the subchannel id and datamatch the
> > +virtqueue index.
> > +
> >  
> >  4.60 KVM_DIRTY_TLB
> >  
> > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> > index 9a2db57..8f3e5ae 100644
> > --- a/include/uapi/linux/kvm.h
> > +++ b/include/uapi/linux/kvm.h
> > @@ -448,12 +448,15 @@ enum {
> >  	kvm_ioeventfd_flag_nr_datamatch,
> >  	kvm_ioeventfd_flag_nr_pio,
> >  	kvm_ioeventfd_flag_nr_deassign,
> > +	kvm_ioeventfd_flag_nr_virtio_ccw_notify,
> >  	kvm_ioeventfd_flag_nr_max,
> >  };
> >  
> >  #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
> >  #define KVM_IOEVENTFD_FLAG_PIO       (1 << kvm_ioeventfd_flag_nr_pio)
> >  #define KVM_IOEVENTFD_FLAG_DEASSIGN  (1 << kvm_ioeventfd_flag_nr_deassign)
> > +#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \
> > +	(1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
> >  
> >  #define KVM_IOEVENTFD_VALID_FLAG_MASK  ((1 << kvm_ioeventfd_flag_nr_max) - 1)
> >  
> > diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> > index f0ced1a..8de3cd7 100644
> > --- a/virt/kvm/eventfd.c
> > +++ b/virt/kvm/eventfd.c
> > @@ -679,11 +679,16 @@ static int
> >  kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
> >  {
> >  	int                       pio = args->flags & KVM_IOEVENTFD_FLAG_PIO;
> > -	enum kvm_bus              bus_idx = pio ? KVM_PIO_BUS : KVM_MMIO_BUS;
> > +	int                       ccw;
> > +	enum kvm_bus              bus_idx;
> >  	struct _ioeventfd        *p;
> >  	struct eventfd_ctx       *eventfd;
> >  	int                       ret;
> >  
> > +	ccw = args->flags & KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY;
> > +	bus_idx = pio ? KVM_PIO_BUS :
> > +		ccw ? KVM_VIRTIO_CCW_NOTIFY_BUS :
> > +		KVM_MMIO_BUS;
> 
> May be better to rewrite using if/else.

Matter of taste, I guess. But I can do that.

> 
> >  	/* must be natural-word sized */
> >  	switch (args->len) {
> >  	case 1:
> > @@ -759,11 +764,16 @@ static int
> >  kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
> >  {
> >  	int                       pio = args->flags & KVM_IOEVENTFD_FLAG_PIO;
> > -	enum kvm_bus              bus_idx = pio ? KVM_PIO_BUS : KVM_MMIO_BUS;
> > +	int                       ccw;
> > +	enum kvm_bus              bus_idx;
> >  	struct _ioeventfd        *p, *tmp;
> >  	struct eventfd_ctx       *eventfd;
> >  	int                       ret = -ENOENT;
> >  
> > +	ccw = args->flags & KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY;
> > +	bus_idx = pio ? KVM_PIO_BUS :
> > +		ccw ? KVM_VIRTIO_CCW_NOTIFY_BUS :
> > +		KVM_MMIO_BUS;
> >  	eventfd = eventfd_ctx_fdget(args->fd);
> >  	if (IS_ERR(eventfd))
> >  		return PTR_ERR(eventfd);
> > -- 
> > 1.7.12.4
> 


  reply	other threads:[~2013-02-26 11:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 15:27 [PATCH v3 0/5] kvm: Make ioeventfd usable on s390 Cornelia Huck
2013-02-25 15:27 ` [PATCH v3 1/5] KVM: Initialize irqfd from kvm_init() Cornelia Huck
2013-02-25 15:27 ` [PATCH v3 2/5] KVM: s390: Export virtio-ccw api Cornelia Huck
2013-02-25 15:27 ` [PATCH v3 3/5] KVM: Introduce KVM_VIRTIO_CCW_NOTIFY_BUS Cornelia Huck
2013-02-25 15:27 ` [PATCH v3 4/5] KVM: ioeventfd for virtio-ccw devices Cornelia Huck
2013-02-26 10:55   ` Michael S. Tsirkin
2013-02-26 11:55     ` Cornelia Huck [this message]
2013-02-26 14:20     ` [Qemu-devel] " Stefan Hajnoczi
2013-02-26 14:47       ` Cornelia Huck
2013-02-26 14:19   ` Stefan Hajnoczi
2013-02-25 15:27 ` [PATCH v3 5/5] KVM: s390: Wire up ioeventfd Cornelia Huck
2013-02-26 11:04 ` [PATCH v3 0/5] kvm: Make ioeventfd usable on s390 Michael S. Tsirkin
2013-02-26 11:18   ` Michael S. Tsirkin
2013-02-26 11:54     ` Christian Borntraeger
2013-02-26 12:13     ` Christian Borntraeger
2013-02-26 13:29       ` Cornelia Huck
2013-02-26 13:56         ` Michael S. Tsirkin
2013-02-26 14:05           ` Cornelia Huck
2013-02-26 13:41       ` Michael S. Tsirkin
2013-02-26 13:48         ` Christian Borntraeger
2013-02-26 13:57           ` Michael S. Tsirkin
2013-02-27 19:49     ` Christian Borntraeger
2013-03-07 18:02     ` virtio-s390: document GPR4/GPR2 cookie values Michael S. Tsirkin
2013-03-08  7:55       ` Cornelia Huck
2013-03-12  3:47         ` Rusty Russell
2013-02-26 11:29   ` [PATCH v3 0/5] kvm: Make ioeventfd usable on s390 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=20130226125528.28052cfe@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=gleb@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=schwidefsky@de.ibm.com \
    /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