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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT 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 0E3BEC10F0E for ; Fri, 12 Apr 2019 13:17:58 +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 CC2D42054F for ; Fri, 12 Apr 2019 13:17:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JHmeYNb8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC2D42054F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=sZefHyCojkIy1wKyeXzVsXWcXUZmbPwt8p5jUy4GY1Y=; b=JHmeYNb8zEPp94 yAvic77nHi2wyrMwzultNrK1MfjDcQC//7+26/xY+wE25zZzltV0JOiV2RuQQ7KNy4Q3326P+BbIZ CUrdxZ+L/FZ9I84xu/14NOsWam+6CxcyBB58vVItQhWvfbyRijrCQhtQ/PNeV9JwVkp4pSmFkmnHk TvZXo1EV7KbjGnr1/5X4443dA8KuiNM0iw+QwIhmcqXRE0flAo4z6HRQGBb6nQLmNK7lTmdpnGrOt b7FJL+rOH0ESUItTAFZglGfBZ6l07RFmiR7yl+mFjhWUlZdp4FJW02lMYZUened6r1FlXnl9Rhx2Q YWCzNqNbQbozJ0ZihK0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEw44-0007Cr-OV; Fri, 12 Apr 2019 13:17:56 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEw42-0007CW-1M for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2019 13:17:55 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A33215AD; Fri, 12 Apr 2019 06:17:53 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 782233F68F; Fri, 12 Apr 2019 06:17:52 -0700 (PDT) Date: Fri, 12 Apr 2019 14:17:50 +0100 From: Will Deacon To: Marc Zyngier Subject: Re: [PATCH 1/4] arm64: Restrict ARM64_ERRATUM_1188873 mitigation to AArch32 Message-ID: <20190412131750.GC29218@fuggles.cambridge.arm.com> References: <20190408160216.223871-1-marc.zyngier@arm.com> <20190408160216.223871-2-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190408160216.223871-2-marc.zyngier@arm.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_061754_078337_510F9E12 X-CRM114-Status: GOOD ( 18.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Daniel Lezcano , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, On Mon, Apr 08, 2019 at 05:02:13PM +0100, Marc Zyngier wrote: > We currently deal with ARM64_ERRATUM_1188873 by always trapping EL0 > accesses for both instruction sets. Although nothing wrong comes out > of that, people trying to squeeze the last drop of performance from > buggy HW find this over the top. Oh well. > > Let's change the mitigation by flipping the counter enable bit > on return to userspace. Non-broken HW gets an extra branch on > the fast path, which is hopefully not the end of the world. > The arch timer workaround it also removed. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kernel/entry.S | 23 +++++++++++++++++++++++ > drivers/clocksource/arm_arch_timer.c | 15 --------------- > 2 files changed, 23 insertions(+), 15 deletions(-) > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index c50a7a75f2e0..e0aed21ab402 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -336,6 +336,29 @@ alternative_if ARM64_WORKAROUND_845719 > alternative_else_nop_endif > #endif > 3: > +#ifdef CONFIG_ARM64_ERRATUM_1188873 > +alternative_if_not ARM64_WORKAROUND_1188873 > + b 1f > +alternative_else_nop_endif > + > + ubfx x0, x22, #4, #1 // Extract PSR_MODE32 > + eor x0, x0, #1 // Negate it > +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN > + mrs x1, cntkctl_el1 > +alternative_else > + mrs x1, cnthctl_el2 > +alternative_endif > + ubfx x2, x1, #1, #1 // Extract EL0VCTEN > + cmp x2, x0 Aren't the flags live at this point (they indicate native vs compat)? Maybe you can use that instead of re-extracting PSR_MODE32. > + b.eq 1f // Matches, nothing to do > + bfi x1, x0, #1, #1 // Move EL0VCTEN in place ARCH_TIMER_USR_VCT_ACCESS_EN > +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN > + msr cntkctl_el1, x1 > +alternative_else > + msr cnthctl_el2, x1 > +alternative_endif > +1: Sorry to be a pain, but could you use label '4:' here and update the others in this macro, please? > +#endif > apply_ssbd 0, x0, x1 > .endif > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index 5fcccc467868..27acc9eb0f7c 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c I probably need an Ack from Thomas or Daniel on these parts, so I can take the series via arm64. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel