Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1224251rwb; Thu, 22 Sep 2022 11:50:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IBkaaDLfyfcTT6QyFMbIyAmL++KzY0lwaCqAaVzQvI7DMsWWW5Azqg4IBYpAyQJvkjvXC X-Received: by 2002:a17:907:2705:b0:77b:521e:8b5e with SMTP id w5-20020a170907270500b0077b521e8b5emr4098765ejk.260.1663872638779; Thu, 22 Sep 2022 11:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663872638; cv=none; d=google.com; s=arc-20160816; b=gmEGBMEe8zbH93+STFMX2cYK4WPoNAMSAK9n+20Rn9YExmCvVQNldwmpSDEtiPN9Vq g/JMtmI+uH62CmOdaYIT+LWxeJ1YnCx4oyJaojiqpk0ZQ9FUuMaMOj4fg0VX0qRDJO0J Ab+kSA8otWkwj+IRGHcb9aH+qfkdNtU2i2kzABUF/aBV3VVDzUmpxcoWkooWnXjjObdn A/uPnEhlk0fWjAMB/eKO/SoNSYxoNAQ0IqIsYokPbb//sct5/bA+mwHvFlhrBBadToZg lPq7hJLom8HdbnVYjp/TT0kLLs+yliX+qOEjTam6bLgr1cU/EbOkkAMrvuUfseNIWsQF sErA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i3VriOovp+Rfz1cl0tSJPtG9+wnnXOWcFOCyAYDatAo=; b=BLCLIQNA4a9OKqO15ekw943UuygdCbA0JQ1GqvsFYqPCzsTGO9rI0YPiZk3qRbHNk1 3cXqywPSBW2SP7xkADIg1pcPrAfxo5rdMCRJuM+FDopP4+l6zmTRhNeoCc9vgJWV+z+X B0o/ekKi4eCpLceZGyUhHjd6JSkMwc9quqhrkNLnFy0IrKzG7LtuCN0pKvQwN58kKrLN 2vc9nQmx6cUwgjgPe4onjdnj3BZaTtxWQCnDBEYixy+E1bDXEaBquHzsFku2AD/LSxMl 2jLqYekXc1nPh4sukjwVwBRxxrbS3K/xhLreNXB5HrIgSVr9dgYHN4VPBWGvK2YAs3B0 F+kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kUq0gvFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a50eb8f000000b00454561e3b98si5471834edr.139.2022.09.22.11.50.13; Thu, 22 Sep 2022 11:50:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kUq0gvFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232614AbiIVSYH (ORCPT + 99 others); Thu, 22 Sep 2022 14:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbiIVSX2 (ORCPT ); Thu, 22 Sep 2022 14:23:28 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DCF210961A; Thu, 22 Sep 2022 11:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663870940; x=1695406940; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AxxjbbyyR0194wjXyMbCislo3hv78tU3zlzwW8OtOcw=; b=kUq0gvFlRAo9I/sbIpcCYcdTr1HkGGRiwfNFt7TIIzGVrcFqKoNsVkrH hWhVq79O39cd+EjMUbVhrNZ1cfQUk0tHDk7KbUj1+eP8ep9MfuBaOP3Tp dcyJIXjjxwS4QbixtkEQ6CRmYT69ky3Q0/uC5exsW4Lr10CUcpL2+qOGz A5f10yItXNAjSv0h7y1T9/40i4USMzj6nliaX8vkIOTpDCKXYwbihnVB5 OZx02cQHbUcaGFRejncsD+fLBJAapyNu5F+RqbBQixwetqtBwOCoxss48 B/S5MX8WPGGuww4JtXMwNDFncn5nR85fs/zSRBBpjEH+gTQsfupaN6M// Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="326712929" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="326712929" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:26 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="653086860" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:26 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v5 24/30] KVM: Add config to not compile kvm_arch.c Date: Thu, 22 Sep 2022 11:20:53 -0700 Message-Id: <66e9475874595880b0951edf6ad17b6317992bed.1663869838.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata So that kvm_arch_hardware_enable/disable() aren't required. Once the conversion of all KVM archs is done, this config and kvm_arch.c should be removed. Suggested-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/Kconfig | 1 + arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 3 +++ virt/kvm/Kconfig | 3 +++ virt/kvm/Makefile.kvm | 5 ++++- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index e3cbd7706136..e2e16205425d 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig @@ -25,6 +25,7 @@ config KVM depends on X86_LOCAL_APIC select PREEMPT_NOTIFIERS select MMU_NOTIFIER + select HAVE_KVM_OVERRIDE_HARDWARE_ENABLE select HAVE_KVM_IRQCHIP select HAVE_KVM_PFNCACHE select HAVE_KVM_IRQFD diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bf8d3b901725..01687b553915 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11864,7 +11864,7 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector) } EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector); -int kvm_arch_hardware_enable(void) +static int kvm_arch_hardware_enable(void) { return static_call(kvm_x86_hardware_enable)(); } @@ -11961,7 +11961,7 @@ void kvm_arch_resume(int usage_count) } } -void kvm_arch_hardware_disable(void) +static void kvm_arch_hardware_disable(void) { static_call(kvm_x86_hardware_disable)(); drop_user_return_notifiers(); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 8dfa212b4543..7efc4792ff5f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1440,8 +1440,11 @@ int kvm_arch_reboot(int val); int kvm_arch_suspend(int usage_count); void kvm_arch_resume(int usage_count); +#ifndef CONFIG_HAVE_KVM_OVERRIDE_HARDWARE_ENABLE int kvm_arch_hardware_enable(void); void kvm_arch_hardware_disable(void); +#endif + int kvm_arch_hardware_setup(void *opaque); void kvm_arch_hardware_unsetup(void); int kvm_arch_check_processor_compat(void); diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index a8c5c9f06b3c..917314a87696 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -72,3 +72,6 @@ config KVM_XFER_TO_GUEST_WORK config HAVE_KVM_PM_NOTIFIER bool + +config HAVE_KVM_OVERRIDE_HARDWARE_ENABLE + def_bool n diff --git a/virt/kvm/Makefile.kvm b/virt/kvm/Makefile.kvm index 428b09b3f80a..c0187ec4f83c 100644 --- a/virt/kvm/Makefile.kvm +++ b/virt/kvm/Makefile.kvm @@ -5,7 +5,10 @@ KVM ?= ../../../virt/kvm -kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o $(KVM)/kvm_arch.o +kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o +ifneq ($(CONFIG_HAVE_KVM_OVERRIDE_HARDWARE_ENABLE), y) +kvm-y += $(KVM)/kvm_arch.o +endif kvm-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o kvm-$(CONFIG_KVM_MMIO) += $(KVM)/coalesced_mmio.o kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o -- 2.25.1