From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE05CC4345F for ; Tue, 23 Apr 2024 16:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vaM6+9mONjhIE7z33vEjM57xk+wSU8K9hamVEfRkRFU=; b=Cjw20ENlhLuQrv Yv41aguJ5b6egZAKti7PvxiznVML5Ajh8muy7qqlisCd+hzmNFdwWi2dStZwiyUWC5CP2zNo5IhJy mr+WOuLWRVRXM79asFecU8uDn2zq7sbl7IBHRRBMnkjsJ93Bew1IK71idsFrEKUCVnsdNR1Bi4YAh yNE2KMjpeNmCh3aL252pdUjbrP8ZiAmnadDwIYrRhq2VPsln0v1tXyqJdzEYHJzL5rGPSSurw0ZYF 40RCLy+N+bxkBjj9ZEoU6LXB0d3KgWQ/HYug01m9n0kvsT+NnQugYhrb7HXErZ4kAVjn1LhZTAj02 Z4CX8z4Uo6xLZwe4jcZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzIoB-00000000h7Q-3b9T; Tue, 23 Apr 2024 16:15:51 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzIo7-00000000h43-24Wv for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 16:15:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 1E1CBCE117E; Tue, 23 Apr 2024 16:15:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E10BC116B1; Tue, 23 Apr 2024 16:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713888944; bh=VFsxRs6aRTGo6VLD+2rO7+0u3Yj+FJKKgggb7kHRJUM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BZk4XoMNL+NkqhEJqoe7zs9sBYwRPpFwwPF8WYxGJrNgPO53zXjAQDOMrcB8ueCBN Q1D3mMfjDxuw4fbix4vNiBhF5h7AY+jHnCq4d1zaAF8rNs/1Oz6mZcNFm0QKiNcwQ0 85rMr1dlTpqAtGq7/X9/ivPO1myE7h5bsdAseIA+DtCYYT7sX0PIKabXuwyI6bqR2J 9h6yDEJ81ktcVfsGeP6/fEv6cQH24SdoIX+Sb3Maz4I8r5pPEOgjMpOLwKgU4HoCBP i3/UVx4U0DeLLceu55EBaYPmpaOOHFzWIl6+7FMPeRtPxS00ERLeYZ4hnDMk8Ej4gv ggPuxKvzt49mg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rzIo2-007FwL-1S; Tue, 23 Apr 2024 17:15:42 +0100 Date: Tue, 23 Apr 2024 17:15:41 +0100 Message-ID: <86le54qclu.wl-maz@kernel.org> From: Marc Zyngier To: "Arnd Bergmann" Cc: "Maria Yu" , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, "James Morse" , "Suzuki K Poulose" , "Oliver Upton" , "Zenghui Yu" , "Mark Rutland" , "Joey Gouly" , "Will Deacon" , "Naresh Kamboju" , "Linaro Kernel Functional Testing" Subject: Re: [PATCH] KVM: arm64: nv: Work around lack of pauth support in old toolchains In-Reply-To: References: <20240422224849.2238222-1-maz@kernel.org> <0b970cf5-a880-469c-93ab-9a268ee4ea2b@quicinc.com> <87o7a0tha6.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: arnd@arndb.de, quic_aiquny@quicinc.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, mark.rutland@arm.com, joey.gouly@arm.com, will@kernel.org, naresh.kamboju@linaro.org, lkft@linaro.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_091547_962679_EBA86E3A X-CRM114-Status: GOOD ( 32.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 23 Apr 2024 13:37:09 +0100, "Arnd Bergmann" wrote: > > On Tue, Apr 23, 2024, at 14:06, Marc Zyngier wrote: > > On Tue, 23 Apr 2024 13:00:55 +0100, > > "Aiqun Yu (Maria)" wrote: > >> On 4/23/2024 4:24 PM, Arnd Bergmann wrote: > >> > On Tue, Apr 23, 2024, at 00:48, Marc Zyngier wrote: > >> >> We still support GCC 8.x, and it appears that this toolchain > >> >> does not understand "pauth" as a valid architectural extension. > >> >> After all, it's only been 8 years since ARMv8.3 was released... > >> > > >> > Just to clarify: I'm fairly sure that all supported toolchains > >> > support ARMv8.3 and PACGA, the problem with ".arch_extension pauth\n" > >> > seems to be that it was retroactively made an optional > >> > feature for earlier architecture versions a few years after > >> > ARMv8.3, so most binutils versions we support understand > >> > pacga as an armv8.3 feature but reject the pauth name for the > >> > extension. > >> Kind of agree with Arnd here. > >> Shall the fix just remove the ".arch_extension pauth"? > >> > >> I've tried gcc 7 failed with the pauth name for the extension. > >> After I remove the ".arch_extension pauth" and use "pacga" instruction > >> directly pass the gcc 7 compilation. > > It really depends on the binutils version, not gcc of course. Right. I'll amend the commit message to reflect that. > > > And breaks with LLVM: > > > > CC arch/arm64/kvm/pauth.o > > arch/arm64/kvm/pauth.c:40:9: error: instruction requires: pauth > > "pacga %0, %1, %2" : "=r" (pac) : "r" (ptr), "r" (mod)); > > ^ > > :2:1: note: instantiated into assembly here > > pacga x19, x1, x9 > > ^ > > It works when building with LLVM_IAS=0, which we obviously don't > want to mandate here. The variant below works for both clang+ias > (including all still supported versions) and gcc+binutils, but at > that point it gets obscure enough that your .inst version is easier > to understand. Exactly. Either we have a good way to abstract this behind the scenes (which I don't see right now), or we just assume control of the instruction generation, which is what my patch does. In general, I question the value of the ".arch_extension" requirement for something like Linux, where we already have a pretty fine grained control of what we want to see being output by the compiler. but that ship has sailed long ago. Thanks, M. > > arnd > > --- a/arch/arm64/kvm/pauth.c > +++ b/arch/arm64/kvm/pauth.c > @@ -36,7 +36,12 @@ static u64 compute_pac(struct kvm_vcpu *vcpu, u64 ptr, > __ptrauth_key_install_nosync(APGA, ikey); > isb(); > > - asm volatile(ARM64_ASM_PREAMBLE ".arch_extension pauth\n" > + asm volatile(ARM64_ASM_PREAMBLE > +#ifdef CONFIG_AS_IS_LLVM > + ".arch_extension pauth\n" > +#else > + ".arch armv8.3-a\n" > +#endif > "pacga %0, %1, %2" : "=r" (pac) : "r" (ptr), "r" (mod)); > isb(); > > -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel