Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1218681rwb; Thu, 6 Oct 2022 09:56:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65h57iHJyWO80YswMu1+hAn40p0M8XXPHbmfg3AB80uIsWXlMj770qL4A3iDZFS9Ue02tQ X-Received: by 2002:a05:6402:26cf:b0:459:d119:5728 with SMTP id x15-20020a05640226cf00b00459d1195728mr690118edd.424.1665075404725; Thu, 06 Oct 2022 09:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665075404; cv=none; d=google.com; s=arc-20160816; b=WVNU5Zm/TroaGZW6WlgDSoQTJ3Kf/vFvUkhlzhKYPJAYu8pLu/1zuvQkBOnpYhpjz8 UO3rYqLD3lJdae1aM7YF8stgTj0yljHzPY4ypkJ9t87TZYKY32ROoCPHh89s/YC0tuco YA/O/nLuDQ6nwHGFukbvrPNh7/nJKfH4xCwAZpUtkaggkEgwtfnQouGkbieQ3AjXehQC JrMNitxltWO5QNhntEbRCKvMIx4XK1GNrfPnB4k1mK6EoBlbvVyKzwQRGrG/Z5wvxsRX 0mQUp8vwnD3tlb1wLvsK8MJQ4Itoq87ap7g9NfTmnCgK23GSYgVuuw2FyRqwwthIsZtO sS6w== 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=pZm/kyqoGIWzVOoMvTkc5/EE4DN9bg8f556Rl51v5Cs=; b=oMaqr2+UoJ022uzHviwj3C3IHoA7ja0vcO3V2ktFP0YFjxBZ4gGb/mhgRtbROM6WAv dVe1LcFjLZLqxjoQnpEGTE9n8WQlreNmsU+Ey2FpFPLAO+ynuADAxNhIxT6OVUm3rd75 2b+FJygaGpelUnYFrLCNSZDJ7bgFHIC/VT3Cx+2aYsMpyu+1q9UW+fD96r2JMpbZxivA C6JyaiT+/28F9rGJofBPeXqpTJKU5oIZoza73D69bibcQ2DViMYzyZ8SUQZKAMXhqwrK E2H3unX3ikoBRGQGOhS38zwWj0wvqZ6LCBYiir95gbvJ4Q0UlBPjw12jlOdQBeU9PBRS BrUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Nn1+qBbR; 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 m21-20020a1709062b9500b007800b181a0csi14577088ejg.300.2022.10.06.09.56.19; Thu, 06 Oct 2022 09:56:44 -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=Nn1+qBbR; 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 S232049AbiJFQEH (ORCPT + 99 others); Thu, 6 Oct 2022 12:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbiJFQDs (ORCPT ); Thu, 6 Oct 2022 12:03:48 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EC5B14E9 for ; Thu, 6 Oct 2022 09:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665072227; x=1696608227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=juR16UITaT3MxswvlHsDaympRivW8hA0yaAGOHpwels=; b=Nn1+qBbR+WZ13vZdNujYMPhoypfyvc3cS4U7bTv5MP241b+PWmRbmyox pFna9wrayJwYYBNVNKQJBl2kgCk5BXEl2AhlP5LQwFvdyLrjIKhZf156X OwNUnDXvDlQybisM5o3q/iXv05X8nzc6AjXYfaJ2lkrGpp31FcuJkCFo1 j5oA89vONeXKQhutC/2PZ+lHCMVzG8feavQg9UnIOt7D1VO0dsPJjLv2q EKPfhbECNb0J1uKIzqjJumIrm06QIyxyR+AX9DTme6LbZ81ALYzu7IQro NvfYgdYq7+cya0QLuBxyWK4UEtSh8h4m4NLNzDLnLqk9NSMruoWMgxD0P Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10492"; a="304480716" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="304480716" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2022 09:02:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="687486234" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="687486234" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga008.fm.intel.com with ESMTP; 06 Oct 2022 09:02:36 -0700 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com Subject: [PATCH 5/6] x86/gsseg: move load_gs_index() to its own header file Date: Thu, 6 Oct 2022 08:40:40 -0700 Message-Id: <20221006154041.13001-6-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006154041.13001-1-xin3.li@intel.com> References: <20221006154041.13001-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: "H. Peter Anvin (Intel)" depends on , so in order to be able to use alternatives in native_load_gs_index(), factor it out into a separate header file. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li --- arch/x86/ia32/ia32_signal.c | 1 + arch/x86/include/asm/gsseg.h | 32 ++++++++++++++++++++++++++++ arch/x86/include/asm/mmu_context.h | 1 + arch/x86/include/asm/special_insns.h | 17 --------------- arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/tls.c | 1 + 6 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 arch/x86/include/asm/gsseg.h diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index c9c3859322fa..14c739303099 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c @@ -34,6 +34,7 @@ #include #include #include +#include static inline void reload_segments(struct sigcontext_32 *sc) { diff --git a/arch/x86/include/asm/gsseg.h b/arch/x86/include/asm/gsseg.h new file mode 100644 index 000000000000..5e3b56a17098 --- /dev/null +++ b/arch/x86/include/asm/gsseg.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_X86_GSSEG_H +#define _ASM_X86_GSSEG_H + +#include +#include + +#ifdef CONFIG_X86_64 + +extern asmlinkage void asm_load_gs_index(u16 selector); + +static inline void native_load_gs_index(unsigned int selector) +{ + asm_load_gs_index(selector); +} + +#endif /* CONFIG_X86_64 */ + +#ifndef CONFIG_PARAVIRT_XXL + +static inline void load_gs_index(unsigned int selector) +{ +#ifdef CONFIG_X86_64 + native_load_gs_index(selector); +#else + loadsegment(gs, selector); +#endif +} + +#endif /* CONFIG_PARAVIRT_XXL */ + +#endif /* _ASM_X86_GSSEG_H */ diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index b8d40ddeab00..e01aa74a6de7 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -12,6 +12,7 @@ #include #include #include +#include extern atomic64_t last_mm_ctx_id; diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 6de00dec6564..cfd9499b617c 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -120,13 +120,6 @@ static inline void native_wbinvd(void) asm volatile("wbinvd": : :"memory"); } -extern asmlinkage void asm_load_gs_index(u16 selector); - -static inline void native_load_gs_index(unsigned int selector) -{ - asm_load_gs_index(selector); -} - static inline unsigned long __read_cr4(void) { return native_read_cr4(); @@ -180,16 +173,6 @@ static inline void wbinvd(void) native_wbinvd(); } - -static inline void load_gs_index(unsigned int selector) -{ -#ifdef CONFIG_X86_64 - native_load_gs_index(selector); -#else - loadsegment(gs, selector); -#endif -} - #endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush(volatile void *__p) diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 7ca2d46c08cc..00f6a92551d2 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -32,6 +32,7 @@ #include #include #include +#include /* * nop stub, which must not clobber anything *including the stack* to diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c index 3c883e064242..3ffbab0081f4 100644 --- a/arch/x86/kernel/tls.c +++ b/arch/x86/kernel/tls.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "tls.h" -- 2.34.1