From patchwork Tue Nov 3 10:41:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 7541481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C700BBEEA4 for ; Tue, 3 Nov 2015 10:46:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDF6C205D6 for ; Tue, 3 Nov 2015 10:46:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D7EE20592 for ; Tue, 3 Nov 2015 10:46:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtZ2Z-0003Af-6p; Tue, 03 Nov 2015 10:42:11 +0000 Received: from mail-pa0-f65.google.com ([209.85.220.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtZ2U-00039S-9d; Tue, 03 Nov 2015 10:42:08 +0000 Received: by padfb7 with SMTP id fb7so1784537pad.0; Tue, 03 Nov 2015 02:41:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=EJ7bG8OgS9pSblggEweOLc09HAf8DNlIqTTF0AUYQ2c=; b=Iy6cSzWsWg3KcL3B/Hqq8qnTm0UUG6XIrneOa6e62KpTxfcC4tr2IJZIiWxbGTv+Bg ox/q1tvs5onFU1AIZCHAiw0kf2Y0WJyOQlO9eWi0ViSBJh6WGAzigtmgPO6R0oY4P6UR 81dTYPri7500gA4wmBn4LGdKKpkip/fW+3CnZGyAe6OPU5jhMNeQrsxS9goDBe7WCk97 CtNi97lygpbVHe34Ncs1xXLIsrqm+NLR6P2HuMLo2J9oa08J8YMRgfIK3bsKaPf/e95b QJg0feHPjo4IcyWHXeJ+Bt+J/m+VctlfZH3bVVC6/wOSfuR7sYIruSUpM4rMEyUDvcPu +5yQ== X-Received: by 10.66.102.34 with SMTP id fl2mr33012224pab.82.1446547305313; Tue, 03 Nov 2015 02:41:45 -0800 (PST) Received: from localhost.localdomain ([103.46.142.62]) by smtp.gmail.com with ESMTPSA id c3sm28773133pbu.24.2015.11.03.02.41.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 02:41:44 -0800 (PST) From: Caesar Wang To: linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1] ARM: errata: Workaround for Cortex-A12 erratum 818325 Date: Tue, 3 Nov 2015 18:41:15 +0800 Message-Id: <1446547275-23481-1-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446538209-13490-1-git-send-email-wxt@rock-chips.com> References: <1446538209-13490-1-git-send-email-wxt@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151103_024206_382264_DC85C193 X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, thomas.petazzoni@free-electrons.com, heiko@sntech.de, ard.biesheuvel@linaro.org, linux-kernel@vger.kernel.org, sjg@chromium.org, sboyd@codeaurora.org, dianders@chromium.org, kever.yang@rock-chips.com, nadavh@marvell.com, linux-rockchip@lists.infradead.org, cwz@rock-chips.com, j.stone@samsung.com, gregory.clement@free-electrons.com, wxt@rock-chips.com, hl@rock-chips.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Huang Tao On Cortex-A12 (r0p0..r0p1-00lac0-rc11), when a CPU executes a sequence of two conditional store instructions with opposite condition code and updating the same register, the system might enter a deadlock if the second conditional instruction is an UNPREDICTABLE STR or STM instruction. This workaround setting bit[12] of the Feature Register prevents the erratum. This bit disables an optimisation applied to a sequence of 2 instructions that use opposing condition codes. Signed-off-by: Huang Tao Signed-off-by: Kever Yang Signed-off-by: Caesar Wang --- Changes in v1: - fix the build error. arch/arm/Kconfig | 13 +++++++++++++ arch/arm/mm/proc-v7.S | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 639411f..554b57a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1263,6 +1263,19 @@ config ARM_ERRATA_773022 loop buffer may deliver incorrect instructions. This workaround disables the loop buffer to avoid the erratum. +config ARM_ERRATA_818325 + bool "ARM errata: Execution of an UNPREDICTABLE STR or STM instruction might deadlock" + depends on CPU_V7 + help + This option enables the workaround for the 818325 Cortex-A12 + (r0p0..r0p1-00lac0-rc11) erratum. When a CPU executes a sequence of + two conditional store instructions with opposite condition code and + updating the same register, the system might enter a deadlock if the + second conditional instruction is an UNPREDICTABLE STR or STM + instruction. This workaround setting bit[12] of the Feature Register + prevents the erratum. This bit disables an optimisation applied to a + sequence of 2 instructions that use opposing condition codes. + endmenu source "arch/arm/common/Kconfig" diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index de2b246..e95c83c 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -351,6 +351,17 @@ __ca9_errata: #endif b __errata_finish +__ca12_errata: +#ifdef CONFIG_ARM_ERRATA_818325 + teq r6, #0x00 @ present in r0p0 + teqne r6, #0x01 @ present in r0p1-00lac0-rc11 + mrceq p15, 0, r10, c15, c0, 1 @ read diagnostic register + orreq r10, r10, #1 << 12 @ set bit #12 + mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register + isb +#endif + b __errata_finish + __ca15_errata: #ifdef CONFIG_ARM_ERRATA_773022 cmp r6, #0x4 @ only present up to r0p4 @@ -439,6 +450,11 @@ __v7_setup_cont: teq r0, r10 beq __ca9_errata + /* Cortex-A12 Errata */ + ldr r10, =0x00000c0d @ Cortex-A12 primary part number + teq r0, r10 + beq __ca12_errata + /* Cortex-A15 Errata */ ldr r10, =0x00000c0f @ Cortex-A15 primary part number teq r0, r10