From patchwork Mon Aug 3 17:20:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6932081 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C36D4C05AC for ; Mon, 3 Aug 2015 17:22:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D177C20395 for ; Mon, 3 Aug 2015 17:22:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D23E3202C8 for ; Mon, 3 Aug 2015 17:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932275AbbHCRWl (ORCPT ); Mon, 3 Aug 2015 13:22:41 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:32883 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176AbbHCRVp (ORCPT ); Mon, 3 Aug 2015 13:21:45 -0400 Received: by wicmv11 with SMTP id mv11so144301603wic.0 for ; Mon, 03 Aug 2015 10:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rhE+pNws+9i2wVHkZ9CO+AUK3bA1GYPxCe74ukY1Hg0=; b=icJXaOE0C4xqLmjxXXEOAg3Kwi7pYgohBNvvAXKmJtFBZ4iP/PDspZv7/NST0V6W9J smHKFGBNeem5Pa9/g+SgX0DZe+vg+8qMYMPqFagnzSEZWBmocVYOjiTGMUJ3A6Ndnhj/ GbraRYK1m71ioAvgY4ATfxHLbVuywDDsITJM32peuENUR6/ksS+blzL8pqz0E9M5c3cK JYBNeLcAHObXE3efg219eiRB0o/9HG/4QD7IW9z6APQfxdORd5UPWOu7+7QrWcYEBKhO K+YqYmuiYfM1qvXjW3hWfM2m+a1h9/UjNlLACFoAy9Wk0S7J5/UkqfBSdTdlmvg21NXm a6aA== X-Gm-Message-State: ALoCoQl7Y7GJQddSovIR67hFW3v7fQZbXAxJPBPlPlggqMYlE17ofFqQUfUBM3F+NV8L50BheYWY X-Received: by 10.194.84.211 with SMTP id b19mr619370wjz.120.1438622503828; Mon, 03 Aug 2015 10:21:43 -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.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 10:21:42 -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 4/5] KVM: introduce kvm_arch functions for IRQ bypass Date: Mon, 3 Aug 2015 19:20:43 +0200 Message-Id: <1438622444-25444-5-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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces - kvm_arch_irq_bypass_add_producer - kvm_arch_irq_bypass_del_producer - kvm_arch_irq_bypass_stop - kvm_arch_irq_bypass_start They make possible to specialize the KVM IRQ bypass consumer in case CONFIG_KVM_HAVE_IRQ_BYPASS is set. Signed-off-by: Eric Auger Signed-off-by: Feng Wu --- v2 -> v3 (Feng Wu): - use 'kvm_arch_irq_bypass_start' instead of 'kvm_arch_irq_bypass_resume' - Remove 'kvm_arch_irq_bypass_update', which is not needed to be a irqbypass callback per Alex's comments. - Make kvm_arch_irq_bypass_add_producer return 'int' v1 -> v2: - use CONFIG_KVM_HAVE_IRQ_BYPASS instead CONFIG_IRQ_BYPASS_MANAGER - rename all functions according to Paolo's proposal - add kvm_arch_irq_bypass_update according to Feng's need --- include/linux/kvm_host.h | 33 +++++++++++++++++++++++++++++++++ virt/kvm/Kconfig | 3 +++ 2 files changed, 36 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 05e99b8..84b5feb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1151,5 +1152,37 @@ static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val) { } #endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ + +#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS + +int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *, + struct irq_bypass_producer *); +void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *, + struct irq_bypass_producer *); +void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *); +void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *); + +#else + +static inline int kvm_arch_irq_bypass_add_producer( + struct irq_bypass_consumer *cons, + struct irq_bypass_producer *prod) +{ + return -1; +} +static inline void kvm_arch_irq_bypass_del_producer( + struct irq_bypass_consumer *cons, + struct irq_bypass_producer *prod) +{ +} +static inline void kvm_arch_irq_bypass_stop( + struct irq_bypass_consumer *cons) +{ +} +static inline void kvm_arch_irq_bypass_start( + struct irq_bypass_consumer *cons) +{ +} +#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */ #endif diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index e2c876d..9f8014d 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT config KVM_COMPAT def_bool y depends on COMPAT && !S390 + +config HAVE_KVM_IRQ_BYPASS + bool