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 29542C4345F for ; Tue, 23 Apr 2024 12:37:56 +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:Subject:Cc:To:From:Date:References: In-Reply-To:Message-Id:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yz2zUTBIX+KG+EnnyhyXHcQyzQKkIXZGBIK4KEsHJ2w=; b=ZWz0CTalBhuCTa ctdzcacTrsu/jpdJG2kcauO4pjQW4rnXOLTIq2RRXCTsnchuqcmYIf0qnz0yryD7guXg3H1PLTv8+ 4c1FjZRpbI/aHhRM+sqhkqCSFK5uOvbbBnDp7AMKNj3KeqtdmUZK3GgLJWO3HCfKVb2leDxqnimV7 mk3mRIe+yuY4RMUVfhDudh4YMRYc3q56e7Kg+cjQM3tKgG5ReUbOD7TqF8xab24mca1V2UzryMP4j PbsKgor6Jizgxo8KPl/qU2w5Pi18CbIoCHBNA9Sw8kKF0J1vEyvmjCGPjA5zwYrAD9oiSkjXqtmsm 3oeWX3blfA1WsRSsm+bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFP5-0000000HQR3-33WQ; Tue, 23 Apr 2024 12:37:43 +0000 Received: from fout2-smtp.messagingengine.com ([103.168.172.145]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFOt-0000000HQLq-3su5 for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 12:37:35 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 3647913800F3; Tue, 23 Apr 2024 08:37:30 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 23 Apr 2024 08:37:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1713875850; x=1713962250; bh=dYBIiyebXU zVTqIXzZSOLioEANbfpV6DnHCY6//IT2M=; b=hyc3yZHLHh4eb43VLtUEQa5WaX gD4p8o8tlQklQXhzMsL++yHQSG2fQ8sLndSX9tfKIUTCE09SuEzUWew7LS6A98ax 2MOTNZ4EWjXqgub4PJjPZCYFdomzNhPq722R8Xqf0Aq55KujJAZ9wTqVmQm7rQb0 omit4LgdA92iyfn2UPuidl6V3lPbu0Q1fGza7zpUONP6O03rsGrh//SmcMD5aZBx +xF0nb3mS7JPIXWGhi4++o9UJhmNesigchraDx1ORd4gtP8JMvsxEhi8ecdNJTNB PlDytdW2cr7WH15t6KRpQH6hFdI4Di52TUKJqq3+icMeknx+swnXdZi2OWog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713875850; x=1713962250; bh=dYBIiyebXUzVTqIXzZSOLioEANbf pV6DnHCY6//IT2M=; b=GbO437nKuXNwVDu2wMM+L7dEkU/CXPEMsw0jKv21D2vK UzS2FXuOFKLFoW4RqXANxPZK74uL8qp0xzXHwYr9NLoZ0Lpy4PeU+bvoik1lnFpj qCQwIFTyZ89rkrNe3sKoUSp9gnxa507/w/deVDnGS5VlEhQsFLpo8B9HFcpJu1cy ntR9R9Jmr85swylfRbs0Bd9s4qatckAMoeyIM8HeWCKMa6jwmCqwpC52IwmUToHl nzGiuY1oTSqDLbUgmBy2AIUn362+V+bSJSWo1oK8Oqn1rrbOUgH12FdsgP/shTi/ NyM93gV8Tfqw0RRQ7At2vCDmuCwXhA3/hY4FSDNgmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeluddgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A264BB6008D; Tue, 23 Apr 2024 08:37:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-386-g4cb8e397f9-fm-20240415.001-g4cb8e397 MIME-Version: 1.0 Message-Id: In-Reply-To: <87o7a0tha6.wl-maz@kernel.org> References: <20240422224849.2238222-1-maz@kernel.org> <0b970cf5-a880-469c-93ab-9a268ee4ea2b@quicinc.com> <87o7a0tha6.wl-maz@kernel.org> Date: Tue, 23 Apr 2024 14:37:09 +0200 From: "Arnd Bergmann" To: "Marc Zyngier" , "Maria Yu" Cc: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_053732_507634_9EB2ECA0 X-CRM114-Status: GOOD ( 18.69 ) 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, 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. > 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. 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(); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel