Received: by 10.223.148.5 with SMTP id 5csp6884775wrq; Wed, 17 Jan 2018 21:01:48 -0800 (PST) X-Google-Smtp-Source: ACJfBosbzAhFz+6TU6teO0hQrHwzUAE7zVvjbD/2rYqn5aPTyJ93AArKTGarR+1KJOZ8S9SIu/Oh X-Received: by 10.99.189.81 with SMTP id d17mr35872448pgp.370.1516251707970; Wed, 17 Jan 2018 21:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516251707; cv=none; d=google.com; s=arc-20160816; b=n+RGYlLrL8626EjslAMthEuavfUmoW1w7jMzL4VJCXlmdAl0hzprK8xF94lz9dGg4q vwOYchqKIHnT7M2Ybz8HwzZiqGEbnzwRN9i9xTsCvVdWR7BHsKA8VsvYxdrUYdMjh5u3 EM4XeJWyhr4PCsdnWvMogngCaX5TU7mRfha1JFuMNU107/ZBISeCajpp+daXYcBejG4a qq2AG5Xws8UwVV/RsYCgF5C1kmroVDb9wTBLKOaM29W22yCjD1QcyVz572DZhUR5IxnJ HXdtI0ARiLp7hTAUwUcwHVEo/7b3H0JV5IiKgfDtztjjaWq9IEZL/asxoqO2jRTFpCtl cPow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=gfsPM/BMMsAq2gOVW2Ag/uK+TtBH41zgzIXKZxmFC7Y=; b=LlLIhKMDSsDyCDMfSEtEw5rkRCsMVW5GanUzNyJziCjDhQ8moVsO3NflzJJJ8jH5ZP wDkzZzacrjkQn67+i0LxAHN4KTcPYAXHI2oyUW5TzgIotUIOsZB1TM398zQZcREwLXqB UryBG6QDraUJ1ONXzTHwqnl/1zpQaBxWXyPnDuJZj+NNTKw0XAotHq3ilgxuzCYHO+Op Jl2DVh2uzgiR85cVNnTRpIvo+NOVnO96Jw/O3SNpUiEudNdNICIYou8Rld3Cn15Bb18D 36zwIYTvIc1k9zuhkpY3t4OrZfvL/b4Ap0iZCRuGg+1VWFJz/ckNv+GPOw3WYHgOAc/L VNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ep3JFrxQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=fwB9BhrY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si5834827plh.640.2018.01.17.21.01.34; Wed, 17 Jan 2018 21:01:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ep3JFrxQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=fwB9BhrY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754263AbeARFAl (ORCPT + 99 others); Thu, 18 Jan 2018 00:00:41 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60518 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754104AbeARFAj (ORCPT ); Thu, 18 Jan 2018 00:00:39 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2064960A00; Thu, 18 Jan 2018 05:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516251639; bh=3tW6QcWBVTya9qknw8l8yrmYCCbvkgqYJeQ76Jd6a1A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ep3JFrxQ902G0te35prjkx7p1o0IhrVl6xazZbMLutRvut4EJuAfTUr23Qu03jQxJ RXyp+J/G4BvemMhEK0tzQuQGcfVCHZAhlcTScYRnH+AGkvSfankupc7XE9q8OM1Dtp rAU0cfqMEQP3Mn9Ac7RGPGj2+TLmhxc1bj4Yqwsw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 249E760452; Thu, 18 Jan 2018 05:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516251638; bh=3tW6QcWBVTya9qknw8l8yrmYCCbvkgqYJeQ76Jd6a1A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fwB9BhrYpTzzMXnR4aovI5j77ow1AHr3qWYBDK6eGYmQFRQDht+s8aNhqb4Os9RTL 6K09a/S9RGNRKCzQhz+L0NZ8Jz4GIhd4GMQ9z7sjLEyXc4YAH5h18KekteKp5ViJ+o pWgkpaX9kly66dZnjd9YUUrmZrmQ+CI9tY1vo6uQ= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 17 Jan 2018 21:00:38 -0800 From: Channa To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, will.deacon@arm.com, marc.zyngier@arm.com, linux-kernel-owner@vger.kernel.org Subject: Re: [PATCH 3/3] arm64: Add work around for Arm Cortex-A55 Erratum 1024718 In-Reply-To: <4b06ad53-e8a6-abd2-2ecf-177abb71bdfe@arm.com> References: <20180116102323.3470-1-suzuki.poulose@arm.com> <20180116102323.3470-4-suzuki.poulose@arm.com> <5bff2bc7fc3d5d04d8fccc099599dd58@codeaurora.org> <4b06ad53-e8a6-abd2-2ecf-177abb71bdfe@arm.com> Message-ID: X-Sender: ckadabi@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-01-17 02:28, Suzuki K Poulose wrote: > On 17/01/18 03:34, ckadabi@codeaurora.org wrote: >> On 2018-01-16 02:23, Suzuki K Poulose wrote: >>> Some variants of the Arm Cortex-55 cores (r0p0, r0p1, r1p0) suffer >>> from an erratum 1024718, which causes incorrect updates when DBM/AP >>> bits in a page table entry is modified without a break-before-make >>> sequence. The work around is to disable the hardware DBM feature >>> on the affected cores. The hardware Access Flag management features >>> is not affected. >>> >>> The hardware DBM feature is a non-conflicting capability, i.e, the >>> kernel could handle cores using the feature and those without having >>> the features running at the same time. So this work around is >>> detected >>> at early boot time, rather than delaying it until the CPUs are >>> brought >>> up into the kernel with MMU turned on. This also avoids other >>> complexities >>> with late CPUs turning online, with or without the hardware DBM >>> features. >>> >>> Cc: Catalin Marinas >>> Cc: Mark Rutland >>> Cc: Will Deacon >>> Signed-off-by: Suzuki K Poulose >>> --- >>>  Documentation/arm64/silicon-errata.txt |  1 + >>>  arch/arm64/Kconfig                     | 14 ++++++++++++++ >>>  arch/arm64/mm/proc.S                   |  5 +++++ >>>  3 files changed, 20 insertions(+) >>> >>> diff --git a/Documentation/arm64/silicon-errata.txt >>> b/Documentation/arm64/silicon-errata.txt >>> index b9d93e981a05..5203e71c113d 100644 >>> --- a/Documentation/arm64/silicon-errata.txt >>> +++ b/Documentation/arm64/silicon-errata.txt >>> @@ -55,6 +55,7 @@ stable kernels. >>>  | ARM            | Cortex-A57      | #834220         | >>> ARM64_ERRATUM_834220        | >>>  | ARM            | Cortex-A72      | #853709         | N/A >>>              | >>>  | ARM            | Cortex-A73      | #858921         | >>> ARM64_ERRATUM_858921        | >>> +| ARM            | Cortex-A55      | #1024718        | >>> ARM64_ERRATUM_1024718       | >>>  | ARM            | MMU-500         | #841119,#826419 | N/A >>>              | >>>  |                |                 |                 | >>>              | >>>  | Cavium         | ThunderX ITS    | #22375, #24313  | >>> CAVIUM_ERRATUM_22375        | >>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >>> index 664fadc2aa2e..19b8407a0325 100644 >>> --- a/arch/arm64/Kconfig >>> +++ b/arch/arm64/Kconfig >>> @@ -461,6 +461,20 @@ config ARM64_ERRATUM_843419 >>> >>>        If unsure, say Y. >>> >>> +config ARM64_ERRATUM_1024718 >>> +    bool "Cortex-A55: 1024718: Update of DBM/AP bits without break >>> before make might result in incorrect update" >>> +    default y >>> +    help >>> +      This option adds work around for Arm Cortex-A55 Erratum >>> 1024718. >>> + >>> +      Affected Cortex-A55 cores (r0p0, r0p1, r1p0) could cause >>> incorrect >>> +      update of the hardware dirty bit when the DBM/AP bits are >>> updated >>> +      without a break-before-make. The work around is to disable the >>> usage >>> +      of hardware DBM locally on the affected cores. CPUs not >>> affected by >>> +      erratum will continue to use the feature. >>> + >>> +      If unsure, say Y. >>> + >>>  config CAVIUM_ERRATUM_22375 >>>      bool "Cavium erratum 22375, 24313" >>>      default y >>> diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S >>> index 5a59eea49395..ba2c22180f4e 100644 >>> --- a/arch/arm64/mm/proc.S >>> +++ b/arch/arm64/mm/proc.S >>> @@ -252,6 +252,11 @@ ENTRY(__cpu_setup) >>>      cbz    x9, 2f >>>      cmp    x9, #2 >>>      b.lt    1f >>> +#ifdef CONFIG_ARM64_ERRATUM_1024718 >>> +    /* Disable hardware DBM on Cortex-A55 r0p0, r0p1 & r1p0 */ >>> +    cpu_midr_match MIDR_CORTEX_A55, MIDR_CPU_VAR_REV(0, 0), >> >> What is there is a custom core with different MIDRs, can we specify >> multiple MIDR values? > > At the moment no. May be we could pass a table of such values to the > macro ? > >> Would it be good to clear the bit as part of >> arch/arm64/kernel/cpu_errata.c so we can specify multiple MIDR values >> if required. > > The problem is, we already have some part of the kernel mappings with > PTE_DBM set > (PTE_WRITE = PTE_DBM with CONFIG_HW_AFDBM) and could potentially hit > the errata, > before we disable it on the CPU. Also, if the CPU is brought up late > by userspace, > that adds more entities. I had another approach, where we delay > enabling the > TCR_HD until all cores are up. But then it has other complexities with > the CPU > feature framework. > e.g, we can't use the feature unless we turn the HADBS feature bit to > HIGHER_SAFE > so that we can turn it on if at least one CPU has it. But then, we > don't know > what the future values of the feature could imply, leaving that choice > unsafe. > Also, a late CPU will be prevented from booting if it doesn't have DBM > unless > we hack the framework. I was thinking if we can enable the DBM feature based on a cpu feature register. Not sure if all future CPUs would have a bit for identifying whether DBM is supported or not. > > So an early check seemed the easier solution at the moment. I will take > a look > at changing the framework a little bit and see where it takes us. > Otherwise, > we could switch back to a table of affected MIDRs. Agree, its better to change the implementation to take a table of MIDRs. > > Suzuki -- -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project