From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 584E738C2B8; Tue, 23 Jun 2026 17:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782236083; cv=none; b=B/8WiAspwGlN8D7jo5yHxa337iUBK1gx3fh8tAQjC+SU7J2zJx3BiIERfwwvbkLgzPPzvyq5QHPIjdtjfq/TWdW+2SaEKIo/KxFtJtZuIBbeb8KE1OHFluV6w4+C08CFebhUphHVnNuTBtCizPPl0Z+y7EoVyJ7r3uHl5yfi3Fw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782236083; c=relaxed/simple; bh=z/sNUYaIrPTPe86EjpLm5BGVrpojz7obnEIgESIDYQQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o6Ic+swF2KefUI/EwrX3/gbwcMWuRu3lb4rmzGdcxtlu99PjmYHfAMkj1mbT+plJO1B1LIkfbHmWkTBn5uPcMN/OLNgl8YqW6UhF73KcwbFwMH97i+VYhZjvgoSpWp06rBD02Az5VJbQoLsnSoOAzAGyGctqb8OyL0QPFji6x1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hXFrhRGn; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hXFrhRGn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782236082; x=1813772082; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=z/sNUYaIrPTPe86EjpLm5BGVrpojz7obnEIgESIDYQQ=; b=hXFrhRGnl2UniOGQWDEsqhAuNiMntTi2dEmg7qJdMnyT2dTnXudVhuof 9ApnSR+9Ic4SVP+VXgRjzG92TgxudSzHxNdlO+5soa6214EZkLfkFYKxa EU00U6zsqpyilTirN2dGyBhcwkMmkbUjZ6azxJ/FccM9FwoI3R50pGDrn OGwtZnYkUudHPBte73FugnGrPMsoAR1D6d6oASZpe7aSmrZoa7H8cavBI Z8cK8yzlGlX9k7enIxJrj/JzjXDI5QFyuBYOEiAHzftaEOa8dIl2CixjO EmxmZJPyzubmC12noAvmMailIf6mFP8Y/9GpiYuJZYlzh5WYuqK5fMvHy w==; X-CSE-ConnectionGUID: yXtpioI1TDyv33wTqISp0Q== X-CSE-MsgGUID: yb4yGPZmSsSuOb950KFPrQ== X-IronPort-AV: E=McAfee;i="6800,10657,11826"; a="100414986" X-IronPort-AV: E=Sophos;i="6.24,221,1774335600"; d="scan'208";a="100414986" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2026 10:34:41 -0700 X-CSE-ConnectionGUID: 65kKS9OBRXKCxe0IHEOtwA== X-CSE-MsgGUID: dZylsM7yQC25fVOamVuTGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,221,1774335600"; d="scan'208";a="249687621" Received: from guptapa-desk.jf.intel.com (HELO desk) ([10.165.239.46]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2026 10:34:42 -0700 Date: Tue, 23 Jun 2026 10:34:41 -0700 From: Pawan Gupta To: x86@kernel.org, Jon Kohler , Nikolay Borisov , "H. Peter Anvin" , Josh Poimboeuf , David Kaplan , Sean Christopherson , Borislav Petkov , Dave Hansen , Peter Zijlstra , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , KP Singh , Jiri Olsa , "David S. Miller" , David Laight , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , David Ahern , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , Stanislav Fomichev , Hao Luo , Paolo Bonzini , Jonathan Corbet , Jason Baron , Alice Ryhl , Steven Rostedt , Ard Biesheuvel , Shuah Khan Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Asit Mallick , Tao Zhang , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v12 08/12] KVM: Define EXPORT_STATIC_CALL_FOR_KVM() Message-ID: <20260622-vmscape-bhb-v12-8-76cbda0ae3e5@linux.intel.com> X-Mailer: b4 0.16-dev References: <20260622-vmscape-bhb-v12-0-76cbda0ae3e5@linux.intel.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260622-vmscape-bhb-v12-0-76cbda0ae3e5@linux.intel.com> EXPORT_SYMBOL_FOR_KVM() exists to export symbols to KVM modules. Static calls need the same treatment when the core kernel defines a static_call that KVM needs access to (e.g. from a VM-exit path). Define EXPORT_STATIC_CALL_FOR_KVM() as the static_call analogue of EXPORT_SYMBOL_FOR_KVM(). The same three-way logic applies: - KVM_SUB_MODULES defined: export to "kvm," plus all sub-modules - KVM=m, no sub-modules: export to "kvm" only - KVM built-in: no export needed (noop) As with EXPORT_SYMBOL_FOR_KVM(), allow architectures to override both macros (e.g. to suppress the export when kvm.ko itself will not be built despite CONFIG_KVM=m). Add the x86 no-op overrides in arch/x86/include/asm/kvm_types.h for that case. To keep the pair in sync, EXPORT_STATIC_CALL_FOR_KVM() is defined inside the EXPORT_SYMBOL_FOR_KVM #ifndef block; an arch that defines EXPORT_SYMBOL_FOR_KVM must also define EXPORT_STATIC_CALL_FOR_KVM or the build will fail with a compile-time error. As with EXPORT_SYMBOL_FOR_KVM(), allow architectures to override EXPORT_STATIC_CALL_FOR_KVM definition (e.g. to suppress the export when kvm.ko itself will not be built despite CONFIG_KVM=m). Add the x86 no-op override in arch/x86/include/asm/kvm_types.h for that case. Architectures must also define EXPORT_STATIC_CALL_FOR_KVM when they define EXPORT_SYMBOL_FOR_KVM. Suggested-by: Sean Christopherson Acked-by: Sean Christopherson Signed-off-by: Pawan Gupta --- arch/x86/include/asm/kvm_types.h | 1 + include/linux/kvm_types.h | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_types.h b/arch/x86/include/asm/kvm_types.h index d7c704ed1be9..bceeaed2940e 100644 --- a/arch/x86/include/asm/kvm_types.h +++ b/arch/x86/include/asm/kvm_types.h @@ -15,6 +15,7 @@ * at least one vendor module is enabled. */ #define EXPORT_SYMBOL_FOR_KVM(symbol) +#define EXPORT_STATIC_CALL_FOR_KVM(symbol) #endif #define KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE 40 diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index a568d8e6f4e8..be602d3f287e 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -13,6 +13,8 @@ EXPORT_SYMBOL_FOR_MODULES(symbol, __stringify(KVM_SUB_MODULES)) #define EXPORT_SYMBOL_FOR_KVM(symbol) \ EXPORT_SYMBOL_FOR_MODULES(symbol, "kvm," __stringify(KVM_SUB_MODULES)) +#define EXPORT_STATIC_CALL_FOR_KVM(symbol) \ + EXPORT_STATIC_CALL_FOR_MODULES(symbol, "kvm," __stringify(KVM_SUB_MODULES)) #else #define EXPORT_SYMBOL_FOR_KVM_INTERNAL(symbol) /* @@ -23,11 +25,17 @@ #ifndef EXPORT_SYMBOL_FOR_KVM #if IS_MODULE(CONFIG_KVM) #define EXPORT_SYMBOL_FOR_KVM(symbol) EXPORT_SYMBOL_FOR_MODULES(symbol, "kvm") +#define EXPORT_STATIC_CALL_FOR_KVM(symbol) EXPORT_STATIC_CALL_FOR_MODULES(symbol, "kvm") #else #define EXPORT_SYMBOL_FOR_KVM(symbol) +#define EXPORT_STATIC_CALL_FOR_KVM(symbol) #endif /* IS_MODULE(CONFIG_KVM) */ -#endif /* EXPORT_SYMBOL_FOR_KVM */ +#else +#ifndef EXPORT_STATIC_CALL_FOR_KVM +#error Must #define EXPORT_STATIC_CALL_FOR_KVM if #defining EXPORT_SYMBOL_FOR_KVM #endif +#endif /* EXPORT_SYMBOL_FOR_KVM */ +#endif /* KVM_SUB_MODULES */ #ifndef __ASSEMBLER__ -- 2.34.1