mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Caesar Wang <wxt@rock-chips.com>
To: linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org
Cc: heiko@sntech.de, hl@rock-chips.com, sjg@chromium.org,
	j.stone@samsung.com, dianders@chromium.org,
	linux-rockchip@lists.infradead.org, cwz@rock-chips.com,
	huangtao@rock-chips.com, kever.yang@rock-chips.com,
	wxt@rock-chips.com, ard.biesheuvel@linaro.org,
	gregory.clement@free-electrons.com, sboyd@codeaurora.org,
	linux-kernel@vger.kernel.org,
	thomas.petazzoni@free-electrons.com, nadavh@marvell.com
Subject: [PATCH v1] ARM: errata: Workaround for Cortex-A12 erratum 818325
Date: Tue,  3 Nov 2015 18:41:15 +0800	[thread overview]
Message-ID: <1446547275-23481-1-git-send-email-wxt@rock-chips.com> (raw)
In-Reply-To: <1446538209-13490-1-git-send-email-wxt@rock-chips.com>

From: Huang Tao <huangtao@rock-chips.com>

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 <huangtao@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>

---

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
-- 
1.9.1


  parent reply	other threads:[~2015-11-03 10:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03  8:10 [RESEND PATCH 0/1] Fix the "hard LOCKUP" when running a heavy loading Caesar Wang
2015-11-03  8:10 ` [RESEND PATCH] ARM: errata: Workaround for Cortex-A12 erratum 818325 Caesar Wang
2015-11-03  8:45   ` Arnd Bergmann
2015-11-03  9:04     ` Caesar Wang
2015-11-03 10:21   ` kbuild test robot
2015-11-03 10:41 ` Caesar Wang [this message]
2015-11-03 11:14 ` [RESEND PATCH 0/1] Fix the "hard LOCKUP" when running a heavy loading Russell King - ARM Linux
2015-11-03 12:00   ` Huang, Tao
2015-11-03 11:30 ` Will Deacon
2015-11-03 19:00   ` Doug Anderson
2015-11-06 12:17     ` Will Deacon
2015-11-09  4:39       ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446547275-23481-1-git-send-email-wxt@rock-chips.com \
    --to=wxt@rock-chips.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=cwz@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=heiko@sntech.de \
    --cc=hl@rock-chips.com \
    --cc=huangtao@rock-chips.com \
    --cc=j.stone@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nadavh@marvell.com \
    --cc=sboyd@codeaurora.org \
    --cc=sjg@chromium.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome