Message ID | 20240125112818.2016733-31-ardb+git@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1574440dyi; Thu, 25 Jan 2024 03:36:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUJM9Aw022NZtS8BwqlehRB8kaliu7Hfjhx+ecXGu0hXKTE1IgCRyeTd/EDzCgi8A/UvLp X-Received: by 2002:a17:907:76c7:b0:a27:a977:9131 with SMTP id kf7-20020a17090776c700b00a27a9779131mr434093ejc.93.1706182609939; Thu, 25 Jan 2024 03:36:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182609; cv=pass; d=google.com; s=arc-20160816; b=KoiFE3Y1FwwsTbkvzYW3tq2U3FGlm62nTG9Itts4twd0UefdcN8iD0IzrKbqJRv+sC 3PBTCTL11gLKFZgNPpYH4PprB5SwriW1k95W1mjjS3VgkjlXPYIBNe6YfHL1ArLMKbwq J8ISbiTK43Oyv4U8dhYtQmj/grNPO/olLvxWQkCwcwv0oHe225lTTMB4c8FPN4Q94qOZ IrLo53SMr6IyX9IkOQe2SIkCHQUBOUhOwilZ//aPoA3rWcGSPwm7f3ymBKboLOW/7wd8 2GMRc+6M7ps78sQou1z0fe/0mfaMonFYGpPvQZ7JC0bOsVF0DgYKOrOd6Esq/vBjqRHz al3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=6DdM1fA2/BUC7ScxyUb41JZesEtpKP4YlIE0jOqBF4A=; fh=Mjd69IxHltS/Jba8SYEPy4aDMrScq2KBDxG2XjETtWk=; b=KJvKkV0qaKthdxuPQgVATkNsY1k2FA34YaPupoIvFs3C0C0E+0DOwXcYgiZuo1E0Ix w8PB4cH+vwxhwlTtpejJu/hILBh1ny9Bign02VttSlVvQWJSVQu5TiUXVsEvv7UOqV6D Bnb152FeYMYJDkxOoKV1TUaDo86zrnJUZilXYAupW+o5ZmH1F3jhaksWSajJ7FOI8GqP gg39isTcwwNyd+tt9jidXlpbXiRGUb4sQKm0EVYxkxTP3mohSNucwYokBshWKSNaiVeh g3pFQo9aj009J/pLD6ykmUGbSpigcmW8igASxpYTeUr6Ak/fobcTbjW9L+3VWXNiwsMk Kuyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EUVR1Obo; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t22-20020a17090616d600b00a3163680dcasi707483ejd.726.2024.01.25.03.36.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:36:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EUVR1Obo; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38516-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 649831F22A53 for <ouuuleilei@gmail.com>; Thu, 25 Jan 2024 11:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E09045786F; Thu, 25 Jan 2024 11:33:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EUVR1Obo" Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DF1B54BE3 for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 11:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182390; cv=none; b=reLkhAoNVEZXpiOR0/VcdHHKjC9x3jTEXebpXVw6GwaLO2sHv6vOx3KFCufcFlvGEBbrBB1pV/FXMEPcHjDQcLUaFN/tzCiF+Hmg8SJ646VFpYb2Fmwj8+Iu4VCnQ8tMBiZ82sxuLiQpU/BlE/+CMLnMI/SvHfDEbml93hs7qWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182390; c=relaxed/simple; bh=2tkXbI4kkP7Bg5PktzWdMGd8q8tWspLGt7tFV60fDKM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=S8YtOBVWoC/jIEAHW8UTU8HxkH3qTf1DPA2vGbCJDQdR4fA1EgOfm4xxEW1Ql3wlunBavQ+7S7Uw5iPI95i8ZrqmXlrI920gwuhPGYv3YF/5dAsIWGOahZF71VQgs/RQwODaKfSTdlm6DnI2CvI6ZnAModdC0ekQFRmT9h1spIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EUVR1Obo; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-40e61491b81so2748295e9.0 for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 03:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706182385; x=1706787185; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=6DdM1fA2/BUC7ScxyUb41JZesEtpKP4YlIE0jOqBF4A=; b=EUVR1Obo8J5S4JUDK9Vu9muWNHvllPSi0sc9wX03vWhO4w3P2v3AJwxPr7E+J6mnby g8Ptd3X7l7POxEFaU7IAni4pJDqEEej63FRH0bXqUIwkx59lpKl2tykLvvIn9k4uSrsZ s7x+y/FSY9gMc1FeH3iJw/CUHTeBWbSXUoSYyeT3jhWB8qN8XLw9QqyrV7Nq/xNOUhe/ zuPhHi+6lfw6Q4D7l/CNDqH/50WeYu5+e72NuaLiU/9IQHkbpRmb/7r/DNAWU3Dia48w lXxNvIMGJfolyNivyguTFvdo8EAez9mnE19BYzisMpeo12AxT4PmETzIrepyPsbt3qfl ttrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706182385; x=1706787185; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6DdM1fA2/BUC7ScxyUb41JZesEtpKP4YlIE0jOqBF4A=; b=wFwtu6f2znhDTRIN9QHd5gbz6Bu2/icE7YxNR1LStn9BN0Bwtz8SjUzAE33KyNz45b Xhl8TsjgOfGqxCIsn+YwcE7LIJM4o+uhug6KhFDCUSpkycCe6Adw3jvZcHH5TnfEKkIx JVPSSqhupk3o63WPKJra5WuVAqc66jTYX+oqlUjN1jMb9lMN4/RbA5/64ZCq/z+RuoLh gMJgHZQqoFs/r+bNd/GH4gOvqioTnzTGAE4lK4qnSZHF1NNjHE7d5Ec6zqFQDg+uhxQx ScjUA8mF/VBJw1mcBEkB0oRzu1MDfOYjKlVFhSmA91KEkVNygRgGVMjQKPa4q/3UbS/h PUhg== X-Gm-Message-State: AOJu0YywP3Z9ltZwW06GOa58ew3WHehYaRPk7HISy1nkIScP87BPWui+ j6G2sEvP7FRKm57Q6OX2pea/EflC+pORh5UO5IErF9vpfssO44DDXuxmrNEa3cxZ4SELxTwsocq boHKyJ44ho+LTqgz4In8kE2ZXr2V7OzuGmJY8SzxvcT7M+/KuXlVQ6ZjtMp5PdPv9/EfK0/v/Ir i94WteqLXQQu9L4PhAAilL82pbGQpfGw== X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:3c8f:b0:40e:541d:dd64 with SMTP id bg15-20020a05600c3c8f00b0040e541ddd64mr40221wmb.4.1706182385129; Thu, 25 Jan 2024 03:33:05 -0800 (PST) Date: Thu, 25 Jan 2024 12:28:31 +0100 In-Reply-To: <20240125112818.2016733-19-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240125112818.2016733-19-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1516; i=ardb@kernel.org; h=from:subject; bh=XIt7BesiIe5Ouf8eLT5Jk6gT3ML8ZNdNuPHWU+248+Y=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXWT65eLE7uWmk2dq6Kz8dWG4PnqX5YX5X3TUYr0tLFyE m78IB/TUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACZiEczI8LglN+rBwh+LaxmN ne73hRUuFn7LcdbD44WH1g6pXXLRfowMa/fpH3z+e/YjJ4esjoxCpfbczZOmiv4Of7fe3k3Zd6Y dDwA= X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240125112818.2016733-31-ardb+git@google.com> Subject: [PATCH v2 12/17] x86/coco: Make cc_set_mask() static inline From: Ard Biesheuvel <ardb+git@google.com> To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel <ardb@kernel.org>, Kevin Loughlin <kevinloughlin@google.com>, Tom Lendacky <thomas.lendacky@amd.com>, Dionna Glaze <dionnaglaze@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Justin Stitt <justinstitt@google.com>, Brian Gerst <brgerst@gmail.com>, linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789062136600153413 X-GMAIL-MSGID: 1789062136600153413 |
Series |
x86: Confine early 1:1 mapped startup code
|
|
Commit Message
Ard Biesheuvel
Jan. 25, 2024, 11:28 a.m. UTC
From: Ard Biesheuvel <ardb@kernel.org> Setting the cc_mask global variable may be done early in the boot while running fromm a 1:1 translation. This code is built with -fPIC in order to support this. Make cc_set_mask() static inline so it can execute safely in this context as well. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> --- arch/x86/coco/core.c | 7 +------ arch/x86/include/asm/coco.h | 8 +++++++- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c index eeec9986570e..d07be9d05cd0 100644 --- a/arch/x86/coco/core.c +++ b/arch/x86/coco/core.c @@ -14,7 +14,7 @@ #include <asm/processor.h> enum cc_vendor cc_vendor __ro_after_init = CC_VENDOR_NONE; -static u64 cc_mask __ro_after_init; +u64 cc_mask __ro_after_init; static bool noinstr intel_cc_platform_has(enum cc_attr attr) { @@ -148,8 +148,3 @@ u64 cc_mkdec(u64 val) } } EXPORT_SYMBOL_GPL(cc_mkdec); - -__init void cc_set_mask(u64 mask) -{ - cc_mask = mask; -} diff --git a/arch/x86/include/asm/coco.h b/arch/x86/include/asm/coco.h index 6ae2d16a7613..ecc29d6136ad 100644 --- a/arch/x86/include/asm/coco.h +++ b/arch/x86/include/asm/coco.h @@ -13,7 +13,13 @@ enum cc_vendor { extern enum cc_vendor cc_vendor; #ifdef CONFIG_ARCH_HAS_CC_PLATFORM -void cc_set_mask(u64 mask); +static inline void cc_set_mask(u64 mask) +{ + extern u64 cc_mask; + + cc_mask = mask; +} + u64 cc_mkenc(u64 val); u64 cc_mkdec(u64 val); #else