From patchwork Fri Feb 22 12:09:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 222524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0AD232C02A9 for ; Sat, 23 Feb 2013 00:03:24 +1100 (EST) Received: from localhost ([::1]:54393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rSk-0001pD-4q for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2013 07:10:50 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rS7-0001km-Fu for qemu-devel@nongnu.org; Fri, 22 Feb 2013 07:10:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8rRt-0005NV-1H for qemu-devel@nongnu.org; Fri, 22 Feb 2013 07:10:03 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:53866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rRs-0005Mv-PG for qemu-devel@nongnu.org; Fri, 22 Feb 2013 07:09:56 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Feb 2013 12:08:20 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Feb 2013 12:08:17 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CE6C117D805D for ; Fri, 22 Feb 2013 12:10:21 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1MC9gZ229229230 for ; Fri, 22 Feb 2013 12:09:42 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1MC9ph7015297 for ; Fri, 22 Feb 2013 05:09:51 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r1MC9oP2015241; Fri, 22 Feb 2013 05:09:50 -0700 From: Cornelia Huck To: KVM Date: Fri, 22 Feb 2013 13:09:48 +0100 Message-Id: <1361534989-38884-4-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1361534989-38884-1-git-send-email-cornelia.huck@de.ibm.com> References: <1361534989-38884-1-git-send-email-cornelia.huck@de.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13022212-0542-0000-0000-0000047B2BF5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.113 Cc: linux-s390 , qemu-devel , "Michael S. Tsirkin" Subject: [Qemu-devel] [RFC PATCH v2 3/4] KVM: ioeventfd for s390 css devices. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Enhance KVM_IOEVENTFD with a new flag that allows to attach to s390 css devices. Signed-off-by: Cornelia Huck --- Documentation/virtual/kvm/api.txt | 7 +++++++ include/uapi/linux/kvm.h | 2 ++ virt/kvm/eventfd.c | 8 ++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index c2534c3..40e799c 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -1468,15 +1468,22 @@ struct kvm_ioeventfd { __u8 pad[36]; }; +For the special case of s390 css devices, 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_CSS (1 << kvm_ioeventfd_flag_nr_css) 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 css 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..1df0766 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -448,12 +448,14 @@ enum { kvm_ioeventfd_flag_nr_datamatch, kvm_ioeventfd_flag_nr_pio, kvm_ioeventfd_flag_nr_deassign, + kvm_ioeventfd_flag_nr_css, 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_CSS (1 << kvm_ioeventfd_flag_nr_css) #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..7347652 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -679,11 +679,13 @@ 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 css = args->flags & KVM_IOEVENTFD_FLAG_CSS; + enum kvm_bus bus_idx; struct _ioeventfd *p; struct eventfd_ctx *eventfd; int ret; + bus_idx = pio ? KVM_PIO_BUS : css ? KVM_CSS_BUS: KVM_MMIO_BUS; /* must be natural-word sized */ switch (args->len) { case 1: @@ -759,11 +761,13 @@ 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 css = args->flags & KVM_IOEVENTFD_FLAG_CSS; + enum kvm_bus bus_idx; struct _ioeventfd *p, *tmp; struct eventfd_ctx *eventfd; int ret = -ENOENT; + bus_idx = pio ? KVM_PIO_BUS : css ? KVM_CSS_BUS: KVM_MMIO_BUS; eventfd = eventfd_ctx_fdget(args->fd); if (IS_ERR(eventfd)) return PTR_ERR(eventfd);