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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 92381C433DF for ; Wed, 29 Jul 2020 09:02:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 600912076E for ; Wed, 29 Jul 2020 09:02:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZrqAyWQj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="gZc0KDFR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 600912076E 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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OLAS1pzFB1nMs1pFN/q3X6dBZqtEbKwIrgtnEa4vtpc=; b=ZrqAyWQjrr5bsrKrG6MkZADpk rtf+SJt552hzaYl3w0Slrq2mZPrTdHDtIQ1EZpFGffZQ8cGfEh6wjF746LvhWga+0SDiOGAAauCLn h/Ha572nRn+bdhpQAPcsIvTAR8SodFBBup29dD9mP6BNgR9RCtdP1HAjEHsmt+z2KD14pPjjd3kh9 d8DrKPaFAWrzFZs+SwKNGaOB3uJ6XOlmgk4yAB465rGv2OBzALCIKzSzbBwPrAqOPn4V+3WhmQq4O bj6HWpzrKrfZ7Oe8DIos8iCrEVRdOcxBTye9NhAiiCMfYWwUx0Hc8FL2+PipiMOX43pH9Fsmc8zLl HTCZY6hvQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0hx9-0005Tt-M4; Wed, 29 Jul 2020 09:00:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0hx5-0005SL-NC for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2020 09:00:45 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 265612075D; Wed, 29 Jul 2020 09:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596013242; bh=B/FiTkfH24JYKh/ORX5V20l3CMrSk3sUhl32pcmo4J0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gZc0KDFRDJ7TIbXsdvhPuXbaejM384kTmXGSlewE8mhkLtWLtAZdTMOtIKLZtpNYQ owjXtgvKc9FosGzkP0CCimmOH0PcFkoa0zcrJ8NUH8N7JccWT3P+grjzao8eM8VLAH HiL+59EkJZzP1uq2SA5SwNpdFwsCTby1/T3oPVtk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k0hx2-00FtK4-K4; Wed, 29 Jul 2020 10:00:40 +0100 MIME-Version: 1.0 Date: Wed, 29 Jul 2020 10:00:40 +0100 From: Marc Zyngier To: Stephen Boyd Subject: Re: [PATCH 1/2] arm64: Move handling of erratum 1418040 into C code In-Reply-To: <159596664845.1360974.11744942680863058676@swboyd.mtv.corp.google.com> References: <20200728092112.3865765-1-maz@kernel.org> <20200728092112.3865765-2-maz@kernel.org> <159596664845.1360974.11744942680863058676@swboyd.mtv.corp.google.com> User-Agent: Roundcube Webmail/1.4.5 Message-ID: <7b9a28b9a2d1ac474a7487f7f56ee094@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: swboyd@chromium.org, linux-arm-kernel@lists.infradead.org, swboyd@google.com, saiprakash.ranjan@codeaurora.org, kernel-team@android.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, dianders@google.com, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200729_050043_956698_C4A04D50 X-CRM114-Status: GOOD ( 16.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: swboyd@google.com, Sai Prakash Ranjan , Will Deacon , Suzuki K Poulose , Catalin Marinas , dianders@google.com, kernel-team@android.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Stephen, On 2020-07-28 21:04, Stephen Boyd wrote: > Quoting Marc Zyngier (2020-07-28 02:21:11) >> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S >> index 35de8ba60e3d..44445d471442 100644 >> --- a/arch/arm64/kernel/entry.S >> +++ b/arch/arm64/kernel/entry.S >> @@ -169,19 +169,6 @@ alternative_cb_end >> stp x28, x29, [sp, #16 * 14] >> >> .if \el == 0 >> - .if \regsize == 32 >> - /* >> - * If we're returning from a 32-bit task on a system affected >> by >> - * 1418040 then re-enable userspace access to the virtual >> counter. >> - */ > > Can this comment go above the function in C? It will have to be a slightly different comment, as the logic changes. Something like: /* * ARM erratum 1418040 handling affecting the 32bit view of CNTVCT. * * Assuming the virtual counter is enabled at the beginning of times: * - disable access when switching from a 64bit task to a 32bit task * - enable access when switching from a 32bit task to a 64bit task */ > >> -#ifdef CONFIG_ARM64_ERRATUM_1418040 >> -alternative_if ARM64_WORKAROUND_1418040 >> - mrs x0, cntkctl_el1 >> - orr x0, x0, #2 // ARCH_TIMER_USR_VCT_ACCESS_EN >> - msr cntkctl_el1, x0 >> -alternative_else_nop_endif >> -#endif >> - .endif >> clear_gp_regs >> mrs x21, sp_el0 >> ldr_this_cpu tsk, __entry_task, x20 >> @@ -337,14 +324,6 @@ alternative_else_nop_endif >> tst x22, #PSR_MODE32_BIT // native task? >> b.eq 3f >> >> -#ifdef CONFIG_ARM64_ERRATUM_1418040 >> -alternative_if ARM64_WORKAROUND_1418040 >> - mrs x0, cntkctl_el1 >> - bic x0, x0, #2 // >> ARCH_TIMER_USR_VCT_ACCESS_EN >> - msr cntkctl_el1, x0 >> -alternative_else_nop_endif >> -#endif >> - >> #ifdef CONFIG_ARM64_ERRATUM_845719 >> alternative_if ARM64_WORKAROUND_845719 >> #ifdef CONFIG_PID_IN_CONTEXTIDR >> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c >> index 6089638c7d43..87c33f7c536b 100644 >> --- a/arch/arm64/kernel/process.c >> +++ b/arch/arm64/kernel/process.c >> @@ -515,6 +515,34 @@ static void entry_task_switch(struct task_struct >> *next) >> __this_cpu_write(__entry_task, next); >> } >> >> +static void erratum_1418040_thread_switch(struct task_struct *prev, > > Should it be marked __always_inline so that the cpus_have_const_cap() > check can avoid the branch to this function when there's nothing to do? I'd expect the compiler to directly inline this (in my experience it does, as with most of the other functions called from __switch_to()). It probably doesn't hurt though, so I'll do that. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel