Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2379694rdb; Mon, 20 Nov 2023 09:16:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjF0eZdadstaajtC9h8KE7nWjww+y6FaW6zsTIl5WyKiNuOCrfKGkOuPv354bD05Zp26dS X-Received: by 2002:a17:90a:a82:b0:281:3fb:6df2 with SMTP id 2-20020a17090a0a8200b0028103fb6df2mr6043816pjw.22.1700500609049; Mon, 20 Nov 2023 09:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700500609; cv=none; d=google.com; s=arc-20160816; b=sEbtbuRFeViEK+AwQh/lYmwWkWoitAw35gjaoNHEdrPAzGngDNd6veW0UdDqg3iyZ/ pC28dqS3NcD2+BPd95yhmIaKC5ZmjpsOKgqSBOoiFvbGzQ8hRi4i+6Plqs9ckmc353FY 4aNaJLXzgpp0N36Vzw6Ixmf16KEtPDxu9JzuJRVA3fe7st4EBRKH8PnuKQ8gKUgEz5fM ef6Tv9ApPDGQJ+hfCKwccqoIQ5dFqPD4X7nN27zuPKVNTd3dj712lbcT6Oa1NPRU9js2 bj0xYF07A6mXRC0OIrTzVwzbY8KdP5ume2d4j7yrPyHFJOKLH0pTL1ZXntLoVT1/UTRG 5lnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fdWOmTLSf43i6ShLExgvRSvrIeZq2RHpM/h9jmmkNZA=; fh=ZZz4hp0c5nhSsSBsTrdWchEkg94dMBlKMUkxaao6DR0=; b=fb/8UyAofAR9kgd/fSDWcq29wQrw/bygOfkHz5Zts5jLWqmASCb/dfe/yPSA4LH80X 5NqyzcbqNbY6/nUpjrapDf40ishzd3SjzopuShLiXpRXBZT5COtV5WSo/r0E6Q2kGsBA Q/bG4X1a5ydF6roBCExhv6mul5EPB7axBJrG9sFtpscJR72w8LhkAZhOUg+Zm/gipHUJ DaWRRhSZgjYCrC9UmXOnZ9YV/Wcuhlt9onGb12FnGkYAC19HtEbRejyuEHnOatVc4G14 5UsVOexLa16NMV6L6ushyEoVggekDIRvhq1BX9qFdaEu2KcMoRNX9U4Zyz/5CI8kijqx 9wvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=daxxyimA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ob14-20020a17090b390e00b00283a0cb5b9bsi7005604pjb.58.2023.11.20.09.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=daxxyimA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 63147805CF3C; Mon, 20 Nov 2023 09:15:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231996AbjKTRPh (ORCPT + 99 others); Mon, 20 Nov 2023 12:15:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjKTRPe (ORCPT ); Mon, 20 Nov 2023 12:15:34 -0500 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40211CF for ; Mon, 20 Nov 2023 09:15:29 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 47EF040E01E3; Mon, 20 Nov 2023 17:15:25 +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 xaSCVYJ0f5QL; Mon, 20 Nov 2023 17:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1700500522; bh=fdWOmTLSf43i6ShLExgvRSvrIeZq2RHpM/h9jmmkNZA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=daxxyimAXN57KctBefPhYIwyK4snLXUgmDClLS+QVbmGWRaAzUfsvIsJv1wE0Dkpw mw64wujRNjuqM997QZBwY9CswEzpzif3IYD+OOVqamQVHv8bDpXpFY+twI7IbdjNJr jZfzoioSKsa8VwcOZ28X5Ro8jS9itjs+A7Kk4YwM8P0243lB0dZ5Xz0Acvc3o2HeYv pz5QiCLBjgCgfxcDnvLnnkldWB7sIHbtan+7PsuSzNsm1PgbrVWot5Zo1sD7EaqWcq D5+JNiTsvh3sfP/qjniAhsQTaI6rxSZU5L2W2VZNSFllsdsb3O0CPwoqFVOhb+fdtO 9B+xaXtX3/9ObIPrnFgiIDitUGonYXujWom4mEYGu7jO0pJVEGOaVSj9kKXLzWOZDR hIaPN3/74iTqOUljBHGyWfQinRpOERXZFp7C+vwMYkCpNNNHw4BYCddap7XdeZvpXN yhOKwmSUqzGpytN96CNox0E1VTJRGSyKFDASTmNtBDO5p6dtnVkO2RmihtxxmRQFni IUxmp2/3FjmWcV9i8eCeH544YdZ54SJjBQ3VyhnLQRzXIvC5X1tSj7nNtwuhGBol4Y Z0AyMOR1uRIXY4X/1/tMA/7/kFpk8S0JZXocpA1Hq/R9wEiBfktPHt7GK2OFNn1lb0 mA2nfZHTxlYV/d3g1pHpiJ0U= Received: from zn.tnic (pd95304da.dip0.t-ipconnect.de [217.83.4.218]) (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 3B2C340E0197; Mon, 20 Nov 2023 17:15:12 +0000 (UTC) Date: Mon, 20 Nov 2023 18:15:07 +0100 From: Borislav Petkov To: Uros Bizjak Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Subject: Re: [PATCH] x86/mm/encrypt: Use %a asm operand modifier to obtain %rip-relative address Message-ID: <20231120171507.GGZVuUG9aSLyF52jHd@fat_crate.local> References: <20231120153419.3045-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231120153419.3045-1-ubizjak@gmail.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:15:55 -0800 (PST) On Mon, Nov 20, 2023 at 04:33:50PM +0100, Uros Bizjak wrote: > The "a" asm operand modifier substitutes a memory reference, with the > actual operand treated as address. For x86_64, when a symbol is > provided, the "a" modifier emits "sym(%rip)" instead of "sym". > > Clang allows only "i" and "r" operand constraints with an "a" modifier, > so the patch normalizes the modifier/constraint pair to "a"/"i" s/the patch normalizes/normalize/ > which is consistent between both compilers. > > No functional change intended. > > Suggested-by: Linus Torvalds > Cc: Dave Hansen > Cc: Andy Lutomirski > Cc: Peter Zijlstra > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Signed-off-by: Uros Bizjak > --- > arch/x86/mm/mem_encrypt_identity.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c > index d73aeb16417f..6a351fdd1b39 100644 > --- a/arch/x86/mm/mem_encrypt_identity.c > +++ b/arch/x86/mm/mem_encrypt_identity.c > @@ -346,9 +346,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp) > * We're running identity mapped, so we must obtain the address to the > * SME encryption workarea using rip-relative addressing. > */ > - asm ("lea sme_workarea(%%rip), %0" > - : "=r" (workarea_start) > - : "p" (sme_workarea)); > + asm ("lea %a1, %0" : "=r" (workarea_start) : "i" (sme_workarea)); Yeah, I saw that particular subthread today. Are you sure this "a" modifier DTRT with all gcc version we support? I.e., from 5.1 onwards... Just making sure. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette