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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 18C83C433DB for ; Thu, 18 Mar 2021 13:34:06 +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 9CF3364E27 for ; Thu, 18 Mar 2021 13:34:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CF3364E27 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-Transfer-Encoding :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-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lB5vlx/UIb8wC8d3m5VBN71ga68Sggr8haL0cTRJsVo=; b=MY6uDZok1lhswjXg8DjhJi13D PnB/yGXsJAPDGyT17bCh32gVjiIM7MCTMpfLFvVE5F9ygUqo77T6kLDFFlmbcZ+2UPsb5to1eMq/D XGAeGTgaprzGOFTO+enRKS8XWZpjHtwyhzeZ+6hoIMhErYeePGVXeRy8o52o9/C20i5JEBfi4UTP9 0PpR1KywVcBj7b0zdTT0d48RTqZFlDT5mMckjqAstWiKlUE1PUeMjQM//Pw8cJIp9csXWyUz7svze zu2P2JsBqLVMZQUvF0GlbsW6Cf6ACOldrAEDKTWxHd3cGI/d3lD/GVVad1vTQwFyUWllizau3SqPN ub8Yz09Kw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMslM-005NS5-Km; Thu, 18 Mar 2021 13:32:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMslI-005NQY-Eo for linux-arm-kernel@lists.infradead.org; Thu, 18 Mar 2021 13:32:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 366D064F10; Thu, 18 Mar 2021 13:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616074345; bh=k/oQ8zP5s60bX2Q7fVafPs3TLGk3bNIqQryqUT2a1LM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fWBNJXdZdvEZpAGhCuiqIokjkwW7pCbd5R0/BOmSfXIIjt221+LzmJBc32/Fz3/NE R5Y3R24wGtMdb2duE8a8UqFBzZyWRDOtXmbeG0VflSDjWKZpF6MJguDMb7eEyA2G+F fBNTraqlKk37t/cUTiJH2ObT1pbm4tXusmorZM0YtcsMpqTJr34gZ4JhD8MH9DLmEP UGYO8UOs3figMLsbVLgmtBa2rci20YgwZA3ILsZtWm5okif+axoM6g1far9GkbCmj8 wCMy2jYfaVp5JSxPtEloWaHZlh/2KUo1R4lFwvJt5VaQAudsz+iaVI33II/mRgodmS 3XPYoH9sJtK4w== Date: Thu, 18 Mar 2021 13:32:19 +0000 From: Will Deacon To: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, dave.martin@arm.com, daniel.kiss@arm.com, Catalin Marinas , James Morse , Julien Thierry , Suzuki K Poulose , broonie@kernel.org, ascull@google.com, qperret@google.com, kernel-team@android.com Subject: Re: [PATCH v2 05/11] arm64: sve: Provide a conditional update accessor for ZCR_ELx Message-ID: <20210318133219.GB7055@willie-the-truck> References: <20210318122532.505263-1-maz@kernel.org> <20210318122532.505263-6-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210318122532.505263-6-maz@kernel.org> 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-20210318_133228_698378_8BBE43D4 X-CRM114-Status: GOOD ( 14.11 ) 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 Thu, Mar 18, 2021 at 12:25:26PM +0000, Marc Zyngier wrote: > A common pattern is to conditionally update ZCR_ELx in order > to avoid the "self-synchronizing" effect that writing to this > register has. > > Let's provide an accessor that does exactly this. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/fpsimd.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h > index bec5f14b622a..05c9c55768b8 100644 > --- a/arch/arm64/include/asm/fpsimd.h > +++ b/arch/arm64/include/asm/fpsimd.h > @@ -130,6 +130,15 @@ static inline void sve_user_enable(void) > sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); > } > > +#define sve_cond_update_zcr_vq(val, reg) \ > + do { \ > + u64 __zcr = read_sysreg_s((reg)); \ > + u64 __new = __zcr & ~ZCR_ELx_LEN_MASK; \ > + __new |= (val) & ZCR_ELx_LEN_MASK; \ > + if (__zcr != __new) \ > + write_sysreg_s(__new, (reg)); \ > + } while (0) Acked-by: Will Deacon Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel