Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1324131rdb; Tue, 30 Jan 2024 15:20:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGY9je9zp/AakceOIm8vYzxYTo2kEtN/ofBVwQ/phIGSqfF/6wa30I08hMmVKGMtibCuuNG X-Received: by 2002:a05:6359:4c03:b0:176:5cea:da96 with SMTP id kj3-20020a0563594c0300b001765ceada96mr5551510rwc.41.1706656815695; Tue, 30 Jan 2024 15:20:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706656815; cv=pass; d=google.com; s=arc-20160816; b=gcjg2AKjD+u+DXZ7m9GCHRn/3WO/bDXFtPxwQq5uhEt2WbvfH4f54vC/CQEQk87GEM mc8ApP5PtOo2+s8RApJ/k7rVhTnZUBEPsUXbxx7W/Rh955UVBC/E87nFpK5f3qdAPi12 ONEPc4Cz3X6Mstt9UH1orXJEn2K/EoMY3AHchuVpRuAWZ2+j0bTCo6YoJJX0o37c5C5C pD0/PJsp5v8uoJJ+EI4RL5iUtRdr4p5rPiYNoti5/HKkLPNyS8v6bDIhoPFpJJVn4rYm JMvxuy9ARcfrwq48TlO7UVBSc/fWuV+8lX6DObBwAFUwj02xSOYKCMsZ/MMp0UoLceA+ EzDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=X5dtCbU1Q3SdQupNf6FgVTBSHBjEi2YVyb9X02Fgq+c=; fh=ZZMlXE0dQq+2wf541x16b5Cpu6lj+5B3aRX8oFe9ek8=; b=uoWxD90iRVEe3ASzrdh0kYz5QsZzCephs7eYwE8uSTBo9U3N2fAxKkTBH9J4LRfHtl 8lQAwwhuNu9arxfDaM9WYafg/soXaipHmpFhlRoO7k3zncL7Q80zGIUlPUpTCYVbjqkt JKWjyxjiMEbHTtBqVqGQKe2JPtbcZyAFUZH/9OXErUoi0M8fDqfqgJL+IZpTetM4ztY6 trj4dcdh0gRrFwcroQBPKQQgjbFr1m6Bq238L95QCnFVQpoM36upQosVV5Ky9hvntUAB IDECIQP2t9/wyPn/28+8TdqsGLUgsdlyB1XmNAgvIqn3n4VavywPvb6OSDqFZOhPvxP8 ierw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=sxdcQwez; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z5-20020a6552c5000000b005d8e36d9e11si1972892pgp.149.2024.01.30.15.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:20:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=sxdcQwez; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45462-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B59BEB25371 for ; Tue, 30 Jan 2024 23:18:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC8387EF1C; Tue, 30 Jan 2024 23:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sxdcQwez" Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) (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 381B678B71 for ; Tue, 30 Jan 2024 23:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656583; cv=none; b=itfBkbCrG3OG3TjAWx7dYSozJckjJgaALuMcifVdlRp/J+m5kWD3mGuyMFcR2FhyuI1CAF3lHgX6MZZAJUxR2uWJYLCyR6+WxJQP0A9ecu2r40Z3M3o9yajuc23NWfr5Lk+uLa9qfQ4BwY5up6QST+lLrBqaiQVONSnWw7HUNSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706656583; c=relaxed/simple; bh=8HUiHdc+ibKN+Ur+tXnhLRORbN73eAOd7u4PFL/scZQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=B+1MyTrasYDWbAiHWL3cStriIwK0KjV5m3lMe5BYU3oY0wQgrTi8n6olTyNp232NfFcB0iFy5VXf3t988ZsN97lQ1oKpGoRDA2LHP+Jgvgrwuu/W75mqss1068m6kxXXeXO67AUIIKmUOOieJaKKMK5eDJnbCOAXObSWNJuFKkk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sxdcQwez; arc=none smtp.client-ip=209.85.222.43 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=google.com Received: by mail-ua1-f43.google.com with SMTP id a1e0cc1a2514c-7d2df857929so1974199241.3 for ; Tue, 30 Jan 2024 15:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706656581; x=1707261381; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=X5dtCbU1Q3SdQupNf6FgVTBSHBjEi2YVyb9X02Fgq+c=; b=sxdcQwezfSLgVaSQ8rr0d/EC3e2v63lGwwlaTIUZDKEm/kTdyK+fwuf14qitt8tLqS 1zqGaXdbpqTgrRoT8FkIe+QYGpmMj829KUSTBni2gpOsWynelRJ3n6XkAyxARG18ESKR rFgXMVrZ6PmG5SqprNS5+HxlSr/8ORWiV9VBrHoQfO7lQZDW0If+B8axCkvBv7ivYg2f hCKFKATKvW2nGDQlwCMGTfl5T+Qfhl6MVkJ0sM6h6o7LC/oWWOpfrNbzAVZTqbQZAJcy ObjYgOKqj9igk+zunjMi7bQv/sj//0R1WA/UqnVmn9EK2SeDmddAk0Ma91XzhmSpYUSq yYhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706656581; x=1707261381; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X5dtCbU1Q3SdQupNf6FgVTBSHBjEi2YVyb9X02Fgq+c=; b=TzFmmlEsl6A1ZaiOeqIQC6Kq4QqXbMQiJFdf4r1c7XOz3bYi+c1CfKLEs/Qsz/4Qm6 iyYr2svRQeeLQuL/xo7czo6cWDZN2kBS+ED4OyelPlwgYW9QwQYNS182ZQIame7BMxeM ihC+IJgr86fnNANPp2XDBMie/CSXPbz/VYnQ3pXtEN3JN5EEx4ckNfyIKs4ef3wSlQIu ddYGHQW87AH7TwPybjgIbf6SZn+tAd9tNAqFr7E4W1RKkXYvLy0DoG1J6WSlZ4Bv8Z75 5xmbWkMhA4YLoD9aBsFcryDEAKfKV02Qu8BtUCBCeA82ZDo6wFmbnwcSYUjVsPFqbKgW tvGg== X-Gm-Message-State: AOJu0YwvUtrFOeJWhF7b4ZA0LM3ACWacSHHliIazhPvoXq1WGaOB572l SBBwqXX1UFo+7qBOrhaA+1Z25zo10C8fjZo/tt2PEVfD/HZnrea/upIZ7w1EmQblUk3qJG64GM2 3cR1z2cuCMsO4Qf0HYxoG9Ed2wKmqlh2TIuQJ8BL4JmAsaXcX6uZaxa4= X-Received: by 2002:a05:6102:3bf0:b0:46b:3e99:7813 with SMTP id be16-20020a0561023bf000b0046b3e997813mr5251130vsb.9.1706656580881; Tue, 30 Jan 2024 15:16:20 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240129180502.4069817-21-ardb+git@google.com> <20240129180502.4069817-35-ardb+git@google.com> In-Reply-To: <20240129180502.4069817-35-ardb+git@google.com> From: Kevin Loughlin Date: Tue, 30 Jan 2024 15:16:09 -0800 Message-ID: Subject: Re: [PATCH v3 14/19] x86/coco: Make cc_set_mask() static inline To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Justin Stitt , Kees Cook , Brian Gerst , linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 29, 2024 at 10:06=E2=80=AFAM Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > 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 > --- > 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 > > enum cc_vendor cc_vendor __ro_after_init =3D 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 =3D 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) In the inline functions I changed/added to core.c in [0], I saw an objtool warning on clang builds when using inline instead of __always_inline; I did not see the same warning for gcc . Should we similarly use __always_inline to strictly-enforce here? [0] https://lore.kernel.org/lkml/20240130220845.1978329-2-kevinloughlin@goo= gle.com/#Z31arch:x86:coco:core.c