From patchwork Mon Aug 3 17:20:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 51878 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 95F5F229FD for ; Mon, 3 Aug 2015 17:21:53 +0000 (UTC) Received: by labby2 with SMTP id by2sf30686935lab.3 for ; Mon, 03 Aug 2015 10:21:52 -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=FzOPM2r/zIrVP/5yPd/eQK21BlfWKmQ5cOz3lxIt2D8=; b=hyLdrwdjOFOheeeuE8iiaeXmY8i1pHLfblU8Z7WSlz2+lY4gzUCNaPRQQXe0780CsF 9WNkbneeSGWyruQHzMz5XMNwMsgPKgIahp1gJyb+Rc5/ef6IhgtL0TtVgdPRQzr160k3 hEO+6eOGAEq1je7PT8ktx6kIb78WB8Wplcd4n91l8yNbAZgNPIXN+r6UTrOawY/NK07i EryVELDzdBABW6G84JzlE8pWUTnE5UJXY2VGfuIhZcyAWumS2VKIfRivD6DWPuruv7fo ZVhkr81hnl+PT9ORpk9VEZV+g7cPH5t7axN17a9dbZVjy1qKzK47QZCa+XwZSm3QxGOo cGgg== X-Gm-Message-State: ALoCoQlDcpaovKoMEWprc1/brQ/A7nia1aMpT76X8iydE6jM3ppt10eYyrErax1iwJAxFzSG/xXT X-Received: by 10.180.75.49 with SMTP id z17mr6170213wiv.7.1438622512585; Mon, 03 Aug 2015 10:21:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls651152lac.50.gmail; Mon, 03 Aug 2015 10:21:52 -0700 (PDT) X-Received: by 10.153.7.137 with SMTP id dc9mr17904672lad.16.1438622512244; Mon, 03 Aug 2015 10:21:52 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id g5si8472455lbh.142.2015.08.03.10.21.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 10:21:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labow3 with SMTP id ow3so21526405lab.1 for ; Mon, 03 Aug 2015 10:21:52 -0700 (PDT) X-Received: by 10.112.145.169 with SMTP id sv9mr18160058lbb.73.1438622512157; Mon, 03 Aug 2015 10:21:52 -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.7.198 with SMTP id l6csp1982310lba; Mon, 3 Aug 2015 10:21:51 -0700 (PDT) X-Received: by 10.180.95.35 with SMTP id dh3mr36218054wib.30.1438622505947; Mon, 03 Aug 2015 10:21:45 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com. [209.85.212.181]) by mx.google.com with ESMTPS id r2si15355655wia.14.2015.08.03.10.21.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 10:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; Received: by wibud3 with SMTP id ud3so123179338wib.0 for ; Mon, 03 Aug 2015 10:21:45 -0700 (PDT) X-Received: by 10.180.108.203 with SMTP id hm11mr36326653wib.54.1438622505678; Mon, 03 Aug 2015 10:21:45 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id uo6sm23887512wjc.1.2015.08.03.10.21.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 10:21:44 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, feng.wu@intel.com, pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: avi.kivity@gmail.com, mtosatti@redhat.com, joro@8bytes.org, marc.zyngier@arm.com, christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 5/5] KVM: eventfd: add irq bypass consumer management Date: Mon, 3 Aug 2015 19:20:44 +0200 Message-Id: <1438622444-25444-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438622444-25444-1-git-send-email-eric.auger@linaro.org> References: <1438622444-25444-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.46 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 Signed-off-by: Feng Wu --- v2 -> v3 (Feng Wu): - Use kvm_arch_irq_bypass_start - Remove kvm_arch_irq_bypass_update - Add member 'struct irq_bypass_producer *producer' in 'struct kvm_kernel_irqfd', it is needed by posted interrupt. - Remove 'irq_bypass_unregister_consumer' in kvm_irqfd_deassign() v1 -> v2: - populate of kvm and gsi removed - unregister the consumer on irqfd_shutdown --- include/linux/kvm_irqfd.h | 2 ++ virt/kvm/eventfd.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/kvm_irqfd.h b/include/linux/kvm_irqfd.h index f926b39..0c1de05 100644 --- a/include/linux/kvm_irqfd.h +++ b/include/linux/kvm_irqfd.h @@ -64,6 +64,8 @@ struct kvm_kernel_irqfd { struct list_head list; poll_table pt; struct work_struct shutdown; + struct irq_bypass_consumer consumer; + struct irq_bypass_producer *producer; }; #endif /* __LINUX_KVM_IRQFD_H */ diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 647ffb8..08855de 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -140,6 +141,7 @@ irqfd_shutdown(struct work_struct *work) /* * It is now safe to release the object's resources */ + irq_bypass_unregister_consumer(&irqfd->consumer); eventfd_ctx_put(irqfd->eventfd); kfree(irqfd); } @@ -380,6 +382,14 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) */ fdput(f); + irqfd->consumer.token = (void *)irqfd->eventfd; + irqfd->consumer.add_producer = kvm_arch_irq_bypass_add_producer; + irqfd->consumer.del_producer = kvm_arch_irq_bypass_del_producer; + irqfd->consumer.stop = kvm_arch_irq_bypass_stop; + irqfd->consumer.start = kvm_arch_irq_bypass_start; + ret = irq_bypass_register_consumer(&irqfd->consumer); + WARN_ON(ret); + return 0; fail: