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 35036C4345F for ; Tue, 23 Apr 2024 11:33:37 +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=JCH9zwQgsPPRsDnTePhtsIIXq4rD37MuY8pE6Tmiuk4=; b=o92q01JDNkkOJY c5q2EOOWmS7L08e0yz6Q0n77gCFC8a+Pa2GMOn/WjgpZNWReg2HtudNxbXVz2qI+QWk425HUe+lPZ IP4B7J3BBfGReBjYxiXlWkYoNY7muJyOv8oAOnwESWgVGXZlhkDiBZ4CePgBHvuegv6pFWyyFYtpJ lkh7J/REZwAzCnNfbjZftl3gvy+dqIoA2KpsDHnYjJtN4aZEhGL/x6b1NzIUuUki4913mx4+0ylfL N2g1bgJtcJtil2D6mEqQbKNJWE9bJowVozXsQUwuaEtPHukyZCpqOzhAz6WxnovihqH4EQlgcOObv 43TJuOkGrCknEcpDgB9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzEOp-0000000H7b8-2vO5; Tue, 23 Apr 2024 11:33:23 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzEOb-0000000H7Tt-007t for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 11:33:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 33D4F6127D; Tue, 23 Apr 2024 11:33:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCD75C2BD11; Tue, 23 Apr 2024 11:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713871987; bh=HNEJTtA/TGesL0cCJJJtqsekLkegSRTWZeBV7fPwewc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sy0BC9afjceDT3KxOj+53ZvnXRwJvLv/h4F8ask8j+J1SMrLIr7vqdkN/aQk2fzYJ gy+2HB8XWQnRmwTMTLTHxR0TQqgOJbw1j0MKpDVAgsiE4pVLZHo/wt+5qF/M9AsDqA QKuOzxnnUQpokR7bGfjzoUWXwBkNK9y/W+8yUDVmnmYRl2vvO5oSrTB6RzZyUT3BSJ CSoSYyr4LP5bRv+E89r9+uR8KucJMDTP5dxxIZYoGVLAUkRH5Gsjqsfysi7zvytyP1 ZuOS44B44kQe6zE4XyaZp+AQZ7ydQRXnzRk1gWj4QKnzDMQacMVocbYu+vh9yUWGYr Z5+/xAktdj04g== Received: from [12.161.88.66] (helo=wait-a-minute.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 1rzEOW-0079k1-LD; Tue, 23 Apr 2024 12:33:05 +0100 Date: Tue, 23 Apr 2024 12:33:00 +0100 Message-ID: <87sezctitv.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Arnd Bergmann , 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> 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/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 12.161.88.66 X-SA-Exim-Rcpt-To: mark.rutland@arm.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, arnd@arndb.de, 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_043309_559922_81B1BEAC X-CRM114-Status: GOOD ( 31.46 ) 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 09:37:04 +0100, Mark Rutland wrote: > > On Mon, Apr 22, 2024 at 11:48:49PM +0100, 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... > > > > This results in the NV ERETAx code breaking the build, as it relies > > on this extention to make use of the PACGA instruction. > > > > Work around it by hand-assembling the instruction using a mind-bending > > trick lifted from an old patch by Will. Magic. > > > > Fixes: e09faab353a6 ("KVM: arm64: nv: Add emulation for ERETAx instructions") > > Reported-by: Linaro Kernel Functional Testing > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/kvm/pauth.c | 19 +++++++++++++++++-- > > 1 file changed, 17 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm64/kvm/pauth.c b/arch/arm64/kvm/pauth.c > > index a3a5c404375b..8baf2a2cbdd3 100644 > > --- a/arch/arm64/kvm/pauth.c > > +++ b/arch/arm64/kvm/pauth.c > > @@ -17,6 +17,22 @@ > > #include > > #include > > > > +/* > > + * "// This is some of my finest work" (Will Deacon, 2019-02-12) > > + * > > + * The jury is still out on that one. > > + */ > > +#define REG(r) "(0%x[" #r "] - ((0%x[" #r "] >> 4) * 6))" > > + > > +/* PACGA Xd, Xn, Xm */ > > +#define PACGA(d,n,m) \ > > + asm volatile(".inst 0x9AC03000 |" \ > > + "(" REG(Rd) "<< 0) |" \ > > + "(" REG(Rn) "<< 5) |" \ > > + "(" REG(Rm) "<< 16)\n" \ > > + : [Rd] "=r" ((d)) \ > > + : [Rn] "r" ((n)), [Rm] "r" ((m))) > > Can you please use rather than open-coding this new REG() > helper? That way this'll be consistent with the way we assemble MRS/MSR in > , and it avoids the few seconds of confusion trying to figure out > the maths in the REG() helper (neat trick though!). Ah, I had completely forgot about this guy. Good call. I'll fold that patchlet in and re-push the result. Thanks, M. -- 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