From patchwork Thu Jul 2 13:17:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50590 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3852F214B3 for ; Thu, 2 Jul 2015 13:18:49 +0000 (UTC) Received: by lbbui3 with SMTP id ui3sf13319183lbb.2 for ; Thu, 02 Jul 2015 06:18:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gbz2Ct7cC4vwpHSn22dYFdUaFe1xgX5YSoZmdLOHWH8=; b=QXXI0x4yNdrkOz2ruAHMuyOWKcG7ddsLQDh7wnZ+uxLu6MvFmnxFySdCaXHqydH2P0 x+I2f2AoMec8ytZjpfmdwSFylET87KxC8BBio2k8i5DobEDhWRQxuJck6K4S4kcZLjAU xL9WSgh+BRytQmljrHoHAVbDpi5mTERYKepwFoSzSl1u8s5e6Lo6p2m5YtEsl7my6FgZ cV0VwQqWQW52uHrIIXBLVPdBc/dn0h8M5GmIBDrOl3tZv4mdEP2lP7bI9oOFHzpsKiw5 +V78mVj6BYO6HuzphE7ZH/fH2OhYFV2Z3MTkSlnybDJbYDpG+ny2SSSpNeLohhQbNfQe zA1g== X-Gm-Message-State: ALoCoQk0KJ3uUfWxlTH1QogqodDouYn5ujEzAtjx8REBbfesf+wzeUahOi0v3X35QsdivSOuSaZb X-Received: by 10.112.148.101 with SMTP id tr5mr19979088lbb.13.1435843128226; Thu, 02 Jul 2015 06:18:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.133 with SMTP id y5ls343502laj.19.gmail; Thu, 02 Jul 2015 06:18:48 -0700 (PDT) X-Received: by 10.152.224.162 with SMTP id rd2mr30356012lac.43.1435843128082; Thu, 02 Jul 2015 06:18:48 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id ya4si1101300lbb.113.2015.07.02.06.18.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagc2 with SMTP id c2so60993397lag.3 for ; Thu, 02 Jul 2015 06:18:48 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr31173759lbc.32.1435843127364; Thu, 02 Jul 2015 06:18:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp476545lbb; Thu, 2 Jul 2015 06:18:46 -0700 (PDT) X-Received: by 10.181.12.111 with SMTP id ep15mr16016414wid.15.1435843107651; Thu, 02 Jul 2015 06:18:27 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id da6si9408653wib.118.2015.07.02.06.18.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:27 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by widjy10 with SMTP id jy10so84737537wid.1 for ; Thu, 02 Jul 2015 06:18:27 -0700 (PDT) X-Received: by 10.180.90.241 with SMTP id bz17mr50343298wib.95.1435843107281; Thu, 02 Jul 2015 06:18:27 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id tl3sm8157099wjc.20.2015.07.02.06.18.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:26 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, alex.williamson@redhat.com, pbonzini@redhat.com, avi.kivity@gmail.com, mtosatti@redhat.com, feng.wu@intel.com, joro@8bytes.org, b.reynal@virtualopensystems.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org Subject: [RFC 16/17] KVM: eventfd: add irq bypass consumer management Date: Thu, 2 Jul 2015 15:17:26 +0200 Message-Id: <1435843047-6327-17-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435843047-6327-1-git-send-email-eric.auger@linaro.org> References: <1435843047-6327-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds the registration/unregistration of an irq_bypass_consumer on irqfd assignment/deassignment. Signed-off-by: Eric Auger --- virt/kvm/eventfd.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index f3da161..425a47b 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -93,6 +94,7 @@ struct _irqfd { struct list_head list; poll_table pt; struct work_struct shutdown; + struct irq_bypass_consumer *cons; }; static struct workqueue_struct *irqfd_cleanup_wq; @@ -429,7 +431,21 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) */ fdput(f); - /* irq_bypass_register_consumer(); */ + irqfd->cons = kzalloc(sizeof(struct irq_bypass_consumer), + GFP_KERNEL); + if (!irqfd->cons) { + ret = -ENOMEM; + goto fail; + } + irqfd->cons->token = (void *)irqfd->eventfd; + irqfd->cons->gsi = irqfd->gsi; + irqfd->cons->kvm = kvm; + irqfd->cons->add_producer = kvm_arch_add_producer; + irqfd->cons->del_producer = kvm_arch_del_producer; + irqfd->cons->stop_consumer = kvm_arch_stop_consumer; + irqfd->cons->resume_consumer = kvm_arch_resume_consumer; + ret = irq_bypass_register_consumer(irqfd->cons); + WARN_ON(ret); return 0; @@ -530,8 +546,6 @@ kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args) struct _irqfd *irqfd, *tmp; struct eventfd_ctx *eventfd; - /* irq_bypass_unregister_consumer() */ - eventfd = eventfd_ctx_fdget(args->fd); if (IS_ERR(eventfd)) return PTR_ERR(eventfd); @@ -550,6 +564,8 @@ kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args) irqfd->irq_entry.type = 0; write_seqcount_end(&irqfd->irq_entry_sc); irqfd_deactivate(irqfd); + irq_bypass_unregister_consumer(irqfd->cons); + kfree(irqfd->cons); } }