From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sxdcQwez" 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-Google-Smtp-Source: AGHT+IHVeZnWZzX9x8MwziS5Z9VLveTfJkLYZmbBNObwr2EDXGgzT2Yz8dfelIQ/4Pz45SqzPUgDy83l9kcP8lU4+j0= 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