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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3976BC433F5 for ; Mon, 11 Oct 2021 10:36:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EB3F260E90 for ; Mon, 11 Oct 2021 10:36:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB3F260E90 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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=0oHJgvoOJb7ibumDbzgQQB7ToRjlkCWOaFQXwriQD8w=; b=VuQhW03gVigjG8 hKCI7VXSHeX740mPIuOIi2bW7mNmtTPgbgNozvKAIbitpdI6orlgORcrfalVJYFS2JT6hvY0sE+qx 09ESmRhXhLCt62XpOk5BdhfLRiEYS1Y8cziF/vMECdiUqYZOyHbMr2UEDskA9cTF7Y0WEcCGMh+b4 1V8B/Ya3K0SXk3kd4HNbLntm0HrGxgesTFYwv7mEGDI1AFqbhg4xxbRJsdBsxsPWRncjyRMQ1EPHc rRmvC/b0TefcINTO8guz7Qy2pAQ/hCiLtxqhwZZ6PeUGExrjAga25mOvTqI1WWbH2RZaQIN6Bt/FR R6wMSW1zZdCo18MbRW0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZscT-008rhQ-Ei; Mon, 11 Oct 2021 10:33:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZscP-008rgl-Ab for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 10:33:18 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id F36A460E0C; Mon, 11 Oct 2021 10:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633948396; bh=T6/qFqZUSY5CllfD3YHlAaFEA/wh2WZXwj3EP40ZDDc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ToTs/yyNFcBw+mTBM6VNtNB41jxEyY+acsOBWqp1kLI5eEIYIHBYBgmkG3W5xADLM 3oSgkHwjcgI7KZ7WFjP9qy32UoyjwfKCkEDNw/38X3/Wdd8BTkEbThrSthO7JoTxAl NEsh1CK7719bFMP+UXqjM2xKREjt38k54NT5V6b++ZB9wxQMhr5zs3whKom9JoXq7N cECYIaxWXBEUjATp/tv3HdG9YTkvxtZXaAvKOj3z+ZFK1I2IqORz9Qmpk1EkRtYDhG BDIxS5X2btBdUGT2Omh8i6yeYGnoZC/n71t5YOerkCrSTTs370zyrZEFtSCCD9JQ/W DVJHU3/Js/drA== Date: Mon, 11 Oct 2021 11:33:09 +0100 From: Will Deacon To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , Daniel Lezcano , Thomas Gleixner , Peter Shier , Raghavendra Rao Ananta , Ricardo Koller , Oliver Upton , Catalin Marinas , Linus Walleij , kernel-team@android.com Subject: Re: [PATCH v3 15/17] arm64: Add CNT{P,V}CTSS_EL0 alternatives to cnt{p,v}ct_el0 Message-ID: <20211011103308.GE3681@willie-the-truck> References: <20211010114306.2910453-1-maz@kernel.org> <20211010114306.2910453-16-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211010114306.2910453-16-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-20211011_033317_403534_F59DBA04 X-CRM114-Status: GOOD ( 18.87 ) 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 Sun, Oct 10, 2021 at 12:43:04PM +0100, Marc Zyngier wrote: > CNTPCTSS_EL0 and CNTVCTSS_EL0 are alternatives to the usual > CNTPCT_EL0 and CNTVCT_EL0 that do not require a previous ISB > to be synchronised (SS stands for Self-Synchronising). > > Use the ARM64_HAS_ECV capability to control alternative sequences > that switch to these low(er)-cost primitives. Note that the > counter access in the VDSO is for now left alone until we decide > whether we want to allow this. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/arch_timer.h | 32 +++++++++++++++++++++-------- > arch/arm64/include/asm/sysreg.h | 3 +++ > 2 files changed, 27 insertions(+), 8 deletions(-) > > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h > index 519ac1f7f859..33a08fff0f06 100644 > --- a/arch/arm64/include/asm/arch_timer.h > +++ b/arch/arm64/include/asm/arch_timer.h > @@ -64,14 +64,26 @@ DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *, > > static inline notrace u64 arch_timer_read_cntpct_el0(void) > { > - isb(); > - return read_sysreg(cntpct_el0); > + u64 cnt; > + > + asm volatile(ALTERNATIVE("isb\n mrs %x0, cntpct_el0", > + "nop\n" __mrs_s("%x0", SYS_CNTPCTSS_EL0), > + ARM64_HAS_ECV) > + : "=r" (cnt)); > + > + return cnt; Why do you need to use %x0 instead of just %0 here? Similarly for the other functions you're changing in this file. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel