Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1453236rdb; Sat, 10 Feb 2024 02:51:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOpM2K8t593m8ly7K13Ot+Y0TxVcDyhAAF8vp2oKe3ugzfq0xHfJK0PiJnSl3O7/wQwyEj X-Received: by 2002:a05:6a21:918b:b0:19a:508a:7f70 with SMTP id tp11-20020a056a21918b00b0019a508a7f70mr1550227pzb.30.1707562261299; Sat, 10 Feb 2024 02:51:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707562261; cv=pass; d=google.com; s=arc-20160816; b=JHiEBEK9cxTw/+1n/6+r0C5Vxdy/KV7sV79l1eKzYtyH4U25nv5gcE3xRfWa7E/eLb e/nvtSp0xtUdcwaMHmvOq6LzKcP1Sg9WDm7iCn02Q4EkeSHL5ZuKQ5GLd64VMRGJUD3L ntbxTYLaAa4BbOLQoPxpYA9KqEL+QWGTdCfWPy2Ncu3Fnenz/LEWWjJ4FGK6oH0E/cN/ N5xskdUeYnTvXPQQKmKW4JaRJV1gJhyVVR2ic1IY80vn2oX2U5ZwWJf1aF/M1AC+FEyG YmN10TWwCcVU4q3ZhZL8vFEJRZvHmTDlWPI4bGGN7cNE5rLqCXmIdjjV5pZoB0GeHjXI 9Pfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dSjCyKghVnE+pRQUrxWXdE0XNE6p+IPHoxYYpdgP9us=; fh=d9CBDWZDdS4Efj6ahfKy1La759IkBJFv56Zoq1SOH7A=; b=Hz6hTlAN8MZMXBe6ZoQHTz2+Kkif1Dfr4jBX+g/pbgvxiK1z3u2ELP93mDzkIlp5yE iii4SaGq68bijVvSgh//GKWVB8TjP8q6yzHlRqIa1MhiOhq1sIPsdv2e3oErS0HlChms nRN/68LX2XwskeyXzSiMrqldTGBg+Nkv+AUu6KMGKzcslKDsblTqHVhmvfe5aUh7oMeZ pyGOrBEE8oxsK9tKj+9CU56izD+6XHQt5o9lq89sL5YQ3aqShTRjLE/KBM/Dtw/YqGxy UM+iTFe1aU2IcJzL9qufbPP+XVmVYABBIpC3q6umBIp7rtVa5gLYtYMh6LBuDfBFLtb/ /Njw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b="fiAme/xL"; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-60364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de X-Forwarded-Encrypted: i=2; AJvYcCVM+IN5JkxJZ0++bua53X0RlNF18LF6lLfUMS0see8UWcDYk+frSRKA6Cb3IabAoV+iCoh6cNL7Lxjp2baAILlp9lTJKLMc8cDumXFetg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i17-20020a170902eb5100b001d757bf025fsi3175366pli.231.2024.02.10.02.51.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 02:51:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b="fiAme/xL"; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-60364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 10BED286482 for ; Sat, 10 Feb 2024 10:41:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F0CF364B7; Sat, 10 Feb 2024 10:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="fiAme/xL" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 D5D402E3FE; Sat, 10 Feb 2024 10:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707561674; cv=none; b=qbs4PwRY6Y6/dpwBEWhDNDQ+YSPzfKDIRFcxi/Ejmwcdx5aIl6frNU2pMcwCPvoDJuxa422hg+7ESWAu/MgV29HHTT5Orh6kWdtSUjqRCm5zdHEBIMhAMK1srTmQ0m6jqd7t9o2g9otCtvUBsxmazc3Mp9Mr116q7a2OhTbXLi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707561674; c=relaxed/simple; bh=x+rMoLaemDU7O0UiEISg9iBNvLvyhD2E78cUrJEqRBQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u1PeMY+WJrx+xLYGBTCZi0TxSwrfUnn0F26ugm/IKVgdn884fXpuULDdCoPcMb8BVc59JjRXV/Kpv7BBpXBpLHU3A94FCgKL7QSFrp2Mt2N99IIYkoyM5ucvwRACfNdYvs8m3dOwAv7wNMIbkPO/6xilVIMYl8nrV9J12wBurIQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=fiAme/xL; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 4C03140E023B; Sat, 10 Feb 2024 10:41:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m99D3Vit8Jsc; Sat, 10 Feb 2024 10:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1707561663; bh=dSjCyKghVnE+pRQUrxWXdE0XNE6p+IPHoxYYpdgP9us=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fiAme/xLbxI9xs3wkAhG1kZG5wyVoM4V1XKCVCC0swGLdmtiwa7MaO03/y4OHEjNs VaB3vxeu4id6Kq/X3yNPcD5f5H/NYek5IrpW5gjDvSo7KZJ8r7i46phk+mNGdmIHl3 3fJ/+riwV4dPYtLefa9scDtwq+7ImGpJuJBcQ2POuVrgufM4PatyrqhUBuR6r76AvS CBfq9BO8MC9J0ItBR9jHj0WjYaV+Fiscoe75TZI1h+bBM5mpo2buAfzDkV3Q5saYhb RGdVnfvTTJzDN6G2d9QAfhJmOO6G1Nmu4Yk24+t8OqHVoVoq1DsEU2kRzOq0BeF1Yq godtyWo/kG9rZ7GBvqawDR8utdWnKcBb85Adej0ZoXeIpTm6PJ9gyZO/3zFFZyHlCe PRBTcGwwo+lewUlDtol/IGPfY0Hb9lw5efXRXrIHcHLeou+Uaka93qqvFjUtVDYKJe lyiE/dWBk5LHnmJawWmL6J61WY+c51s4HkceOHpviRgQG5g1Bo/IU0IFGWoaM22+xj Z1GhrW365Yh7OxZaGQ/llEAaPNQULy7aiaOmn+wa7OOH32rElcV5XnxMjA+qh7tCiR ksU2V4la9EECtnshreDatfablejJLgN0BBsdz1khmWYmC8j4NpQijZw9yT2GljUtXb /OfWu6tyQrxRaT1hEIqhwm1Q= Received: from zn.tnic (pd953021b.dip0.t-ipconnect.de [217.83.2.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A027140E016D; Sat, 10 Feb 2024 10:40:45 +0000 (UTC) Date: Sat, 10 Feb 2024 11:40:39 +0100 From: Borislav Petkov To: Ard Biesheuvel Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , 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 Subject: Re: [PATCH v3 06/19] x86/startup_64: Drop global variables keeping track of LA57 state Message-ID: <20240210104039.GAZcdSp7dRbgqBy3fg@fat_crate.local> References: <20240129180502.4069817-21-ardb+git@google.com> <20240129180502.4069817-27-ardb+git@google.com> <20240207132922.GSZcOFspSGaVluJo92@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Feb 09, 2024 at 01:55:02PM +0000, Ard Biesheuvel wrote: > I was trying to get rid of global variable assignments and accesses > from the 1:1 mapping, but since we cannot get rid of those entirely, > we might just keep __pgtable_l5_enabled but use RIP_REL_REF() in the > accessors, and move the assignment to the asm startup code. Yeah. > asm(ALTERNATIVE_TERNARY( > "movq %%cr4, %[reg] \n\t btl %[la57], %k[reg]" CC_SET(c), > %P[feat], "stc", "clc") > : [reg] "=r" (r), CC_OUT(c) (ret) > : [feat] "i" (X86_FEATURE_LA57), > [la57] "i" (X86_CR4_LA57_BIT) > : "cc"); Creative :) > but we'd still have two versions in that case. Yap. RIP_REL_REF() ain't too bad ... Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette