Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14480C433B4 for ; Wed, 19 May 2021 13:17:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BA6F610CC for ; Wed, 19 May 2021 13:17:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BA6F610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KvTIeBMyqCIDKTYxkDmE/3Q9awOeTpNXLJ5SXjb1VfQ=; b=je2GYlW42yel5liISu3NLqQf8 vTv6Au+EmyBMk8sDZycwfLOLm+DgCzTP15qtXxDSaW4wfVaSR5WswJnaHQ2Csj78VM58JOfQuN5yz vVx4SxCyiSr5IdM7VDEIDkrGvvlJ/lrPLekp446NnDjM+yiVZnUqZiymWtVZsOItPH1H0lDmIODlS 34BsuTskWR0NXaLy0jjN7k3MSNyioTXaIzU2oiC+8wKtJb1BZxuy1PEjFncuSlMPVy4nsi35axqSI GDwipgRA40d+GAOkxNs2+4ESks/WGxJlTDX6ftcOYXYiRBCjS5F1D3AuObbAQcOokOzfsIrLVaUzd 3nDRC9cnw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljM2P-0044yO-V2; Wed, 19 May 2021 13:15:03 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljLwQ-0042a1-1P for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 13:08:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9egJxI4H6zPEdhW8M+dRE+FUYLvnZrNURlcYCrkkOLY=; b=dr9V0uwZGuOV23TnLdENxDaZtX MXFM1hxd1ymounp1SAanhzc6JzgTDIJoVuY47Xp9/pWXngsxbB+iGGlFJ/z/nvZ26kj6vthNO/Yn3 6ISCioaiGR8xRD5aKB5GG+3yWS5/uvX8kUZqLi157nrJhqPUWwb127OL4h0YKJBi4+cFJUQA+1mYp rSxsh43M3qDpCVggWb/M4QkEaAUGXd6szJd2mMnCqSLifu73ACyz7rx02pvZqxJqrFDPOpSFaELYZ D3MLymdxdBoBzHtgpNGcsWD4oNgeLTBHalMGnknCHREgkCgeNcPx+UQ+TrAVWP+WsIcZwCKMdf7Wz /9M4V88Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljLwM-00FU6j-Rq for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 13:08:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 602E460FF1; Wed, 19 May 2021 13:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621429724; bh=UjEj/Tl+krSExMLrmpJQv6jqC2YgLuY1NQMR1GCkdWc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rn1lMpJ3WljJ1+N6/rNIk6nVI1o1iU46ySr3DElrvWVneLDWgIeqPynLd/N4C55Fn COoOfH3zl1rCLtZE4OBUlCFwk0hFYGDJy5KpzKH9AteA3L5tTqmARxkeGtoqGJi18j 72TOLPH4erEo6UjCPjnLlAR9j80NNpVzPgDtWNbM/T6c7ADxyMOzbgwPov/cvbwDo/ XvJb++xzumbo4THTH6WAn5SPW1jU2OoNVD+0UX+idtvqh6Jh/J2ed9qy2bhWIjKmuq mtt8Ih1hpl5zBk9y49I0//RLEIXnQKTarfhti6SqR3E+0q1a9IULo2t9ajFK2UkWKm FgaLrp4c+3udg== Date: Wed, 19 May 2021 14:07:59 +0100 From: Mark Brown To: Ard Biesheuvel Cc: Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Linux ARM Subject: Re: [PATCH v2 2/2] arm64: smccc: Support SMCCC v1.3 SVE register saving hint Message-ID: <20210519130759.GC4224@sirena.org.uk> References: <20210518182549.38635-1-broonie@kernel.org> <20210518182549.38635-3-broonie@kernel.org> MIME-Version: 1.0 In-Reply-To: X-Cookie: There's no time like the pleasant. User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_060846_966962_B6B389B8 X-CRM114-Status: GOOD ( 21.10 ) 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: multipart/mixed; boundary="===============1532121200594199946==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1532121200594199946== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NKoe5XOeduwbEQHU" Content-Disposition: inline --NKoe5XOeduwbEQHU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 19, 2021 at 09:05:41AM +0200, Ard Biesheuvel wrote: > On Tue, 18 May 2021 at 20:35, Mark Brown wrote: > > + * Since we need scratch registers but wish to avoid having to handle > > + * the stack we expect the caller to preserve x15 and x16 if needed, > You should use x16 and x17 here. The calling convention dictates that > the linker may use x16 and x17 in a veneer (or PLT lookup sequence) if > the branch to __smccc_sve_check() goes out of range, and even if our > PLT code only uses x16 at this time, it is better to follow the AAPCS > here. Oh, of course - not sure why I didn't use x17 TBH. > > + * the only callers are expected to be the call below and the inline > > + * asm in linux/arm-smccc.h for SMCCC 1.1 and later calls. > > + */ > > +SYM_CODE_START(__smccc_sve_check) > > + BTI_C > Any reason not to use SYM_FUNC_START() here? Not with the changes you've suggested,=20 > > +alternative_if ARM64_SVE > > + > > + ldr_l x15, smccc_has_sve_hint > > + cbz x15, 2f > > + > > + get_current_task x15 > > + ldr x15, [x15, #TSK_TI_FLAGS] > > + and x16, x15, #_TIF_FOREIGN_FPSTATE // Any live FP state? > > + cbnz x16, 1f > You could use tbnz here, with the actual shift in TIF_FOREIGN_FPSTATE Ah, yes - I'd misremembered what tbnz uses and thought it didn't apply. That does help a lot. > > .macro SMCCC instr > > +alternative_if ARM64_SVE > > + bl __smccc_sve_check > > +alternative_else_nop_endif > Do we need the redundant alternatives here? Could we use an > ALTERNATIVE() below instead, and drop the one in __smccc_sve_check? We do need the one right there, but with the use of ALTERNATIVE() in the inline asm we'd be able to drop the one in __smccc_sve_check. Or for that matter we could not bother with alternatives at all if we're happy that the overhead were OK. --NKoe5XOeduwbEQHU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmClDa8ACgkQJNaLcl1U h9Bxwgf/fJCzBb+VUeiA3600/UPOtlam+bQIQ/aAEoQP7LAZfmXb/ZaKoog98lWp Rkd7dnv9a4fxJudWCCWe7mLBrYEDwYe8nAmDXpDvIgB4LPnHtHaqbMOxUYlPVdqg xhP1f3zGa952McVCBARmUqN0SgK+Q7iOdnZiiEl1fnYLV+/RrZhMnImCNVTuszaP fM/1PY3zZ6cI0eQO6tYeUlQzKmsLt+n5Vit9PaxbyxFSQwlUv6Nff/mRlpNREZtZ HVBoBHkXYBcaz1ly5/gubupLjbzuzjBWFFMJ2LqGjeOeeE3OUv6RVD5u3s+UVHzf UdwjZ80+8y29xAqC9VFLLDDkByVZ+A== =bnrz -----END PGP SIGNATURE----- --NKoe5XOeduwbEQHU-- --===============1532121200594199946== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1532121200594199946==--