From patchwork Wed Jul 29 08:47:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 51621 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 1D62F22DB5 for ; Wed, 29 Jul 2015 09:00:24 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf1447646lbv.3 for ; Wed, 29 Jul 2015 02:00:23 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=MqGM3C+hq/QkYehXEeE7dFoy5I3E4Rbhr6XzIcPtDc4=; b=HoUlePHraOjrTljnZQi2zTjKxHuo1j0mMGWB5sPmBiKlti5DTJ0P+N7mvPwDGbNm70 WClayUV72IDWTIOLLnmicyHw2pStSBuekLTr0h59/rTsSoRkz8Ir2/NrOK2q+qby6vn7 SHXse44TxmsQ8/1xO8FpeXEpLbJkU5twse91aHGdPgmilhxOKeUXfuItlAYIYYiuRWXx NzmbaWyt5nXdhPFsOxrg0YZYR1OfppFxhZ1wUI4D3RBzR85vToioXo8nIFdiVk4ADoym pTMary7TMPGboz+mZujdX0BQo6jnbM7FDnteeEq3Fum83bw+joh13Q/VH3mzmixbfiER bcTA== X-Gm-Message-State: ALoCoQkTcLRbjIy76VnEwNeUEko/Qt2XWAABsS4h7c5yY8FRNfOiszdWp81nEFY9VgF8bGLivSyq X-Received: by 10.180.96.137 with SMTP id ds9mr702389wib.2.1438160423044; Wed, 29 Jul 2015 02:00:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.102 with SMTP id lb6ls17122lab.49.gmail; Wed, 29 Jul 2015 02:00:22 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr38493445lak.56.1438160422842; Wed, 29 Jul 2015 02:00:22 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id y9si20953033lad.98.2015.07.29.02.00.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 02:00:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lblf12 with SMTP id f12so2464478lbl.2 for ; Wed, 29 Jul 2015 02:00:22 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr37163289lay.72.1438160422754; Wed, 29 Jul 2015 02:00:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp2616713lba; Wed, 29 Jul 2015 02:00:21 -0700 (PDT) X-Received: by 10.66.141.135 with SMTP id ro7mr63398403pab.68.1438160420838; Wed, 29 Jul 2015 02:00:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lh16si8138385pab.220.2015.07.29.02.00.19; Wed, 29 Jul 2015 02:00:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271AbbG2JAQ (ORCPT + 26 others); Wed, 29 Jul 2015 05:00:16 -0400 Received: from mga14.intel.com ([192.55.52.115]:63677 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbbG2I7V (ORCPT ); Wed, 29 Jul 2015 04:59:21 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 29 Jul 2015 01:59:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,569,1432623600"; d="scan'208";a="615065340" Received: from feng-bdw-de-pi.bj.intel.com ([10.238.154.67]) by orsmga003.jf.intel.com with ESMTP; 29 Jul 2015 01:59:18 -0700 From: Feng Wu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: pbonzini@redhat.com, alex.williamson@redhat.com, joro@8bytes.org, eric.auger@linaro.org, feng.wu@intel.com Subject: [v3 4/5] KVM: introduce kvm_arch functions for IRQ bypass Date: Wed, 29 Jul 2015 16:47:02 +0800 Message-Id: <1438159623-4227-5-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1438159623-4227-1-git-send-email-feng.wu@intel.com> References: <1438159623-4227-1-git-send-email-feng.wu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: feng.wu@intel.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Eric Auger 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. v2 -> v3: - 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 Signed-off-by: Eric Auger Signed-off-by: Feng Wu --- 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