All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM PJ4B: Add support for errata 4611
Date: Wed, 29 May 2013 12:16:58 +0200	[thread overview]
Message-ID: <1369822618-26797-4-git-send-email-gregory.clement@free-electrons.com> (raw)
In-Reply-To: <1369822618-26797-1-git-send-email-gregory.clement@free-electrons.com>

From: Lior Amsalem <alior@marvell.com>

A CP15 clean operation can result in a dead lock state if it is hit by
an incoming snoop event. the fiw to this issue is the following:
before any CP15 clean type operation in Cache Coherency mode, issue a
Data Memory Barrier (DMB) or a Data Synchronization Barrier (DSB)
instruction.

[gregory.clement at free-electrons.com:add errata description in changelog]
[gregory.clement at free-electrons.com:make this errata depend on Aramda
370]
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 arch/arm/Kconfig                | 11 +++++++++++
 arch/arm/include/asm/tlbflush.h | 22 ++++++++++++++++++++++
 arch/arm/mm/copypage-v6.c       | 11 +++++++++++
 arch/arm/mm/proc-macros.S       | 13 +++++++++++++
 4 files changed, 57 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 48cdbea..05c13f9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1087,6 +1087,17 @@ if !MMU
 source "arch/arm/Kconfig-nommu"
 endif
 
+config PJ4B_ERRATA_4611
+        bool "PJ4B Errata 4611: A Deadlock can Occur if a CP15 Clean/Clean and Invalidate Operation is Hit By a Snoop Event"
+        depends on CPU_PJ4B && MACH_ARMADA_370
+        help
+          A CP15 clean operation can result in a dead lock state if it is hit by
+          an incoming snoop event.
+          Workaround:
+	  Before any CP15 clean type operation in Cache Coherency mode, issue
+          a Data Memory Barrier (DMB) or a Data Synchronization Barrier (DSB)
+          instruction.
+
 config PJ4B_ERRATA_4742
         bool "PJ4B Errata 4742: IDLE Wake Up Commands can Cause the CPU Core to Cease Operation"
         depends on CPU_PJ4B && MACH_ARMADA_370
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index e3a8064..112f778 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -475,11 +475,22 @@ static inline void flush_pmd_entry(void *pmd)
 {
 	const unsigned int __tlb_flag = __cpu_tlb_flags;
 
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	unsigned long flags;
+	raw_local_irq_save(flags);
+	dmb();
+#endif
+
 #ifdef CONFIG_PJ4B_ERRATA_6124
 	tlb_op(TLB_DCLEAN, "c7, c14, 1	@ flush_pmd", pmd);
 #else
 	tlb_op(TLB_DCLEAN, "c7, c10, 1	@ flush_pmd", pmd);
 #endif
+
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	raw_local_irq_restore(flags);
+#endif
+
 	tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1  @ L2 flush_pmd", pmd);
 
 	if (tlb_flag(TLB_WB))
@@ -490,11 +501,22 @@ static inline void clean_pmd_entry(void *pmd)
 {
 	const unsigned int __tlb_flag = __cpu_tlb_flags;
 
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	unsigned long flags;
+	raw_local_irq_save(flags);
+	dmb();
+#endif
+
 #ifdef CONFIG_PJ4B_ERRATA_6124
 	tlb_op(TLB_DCLEAN, "c7, c14, 1	@ flush_pmd", pmd);
 #else
 	tlb_op(TLB_DCLEAN, "c7, c10, 1	@ flush_pmd", pmd);
 #endif
+
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	raw_local_irq_restore(flags);
+#endif
+
 	tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1  @ L2 flush_pmd", pmd);
 }
 
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index b9bcc9d..20b69ad 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -59,11 +59,22 @@ static void v6_clear_user_highpage_nonaliasing(struct page *page, unsigned long
  */
 static void discard_old_kernel_data(void *kto)
 {
+#ifdef CONFIG_PJ4B_ERRATA_4611
+        unsigned long flags;
+
+        raw_local_irq_save(flags);
+        dmb();
+#endif
+
 	__asm__("mcrr	p15, 0, %1, %0, c6	@ 0xec401f06"
 	   :
 	   : "r" (kto),
 	     "r" ((unsigned long)kto + PAGE_SIZE - L1_CACHE_BYTES)
 	   : "cc");
+
+#ifdef CONFIG_PJ4B_ERRATA_4611
+        raw_local_irq_restore(flags);
+#endif
 }
 
 /*
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index f9a0aa7..ca81291 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -178,7 +178,20 @@
 #endif
 
 	str	r3, [r0]
+
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	mrs     r2, cpsr
+	orr     r3, r2, #PSR_F_BIT | PSR_I_BIT
+	msr     cpsr_c, r3                      @ Disable interrupts
+	dmb                                     @ ensure ordering with previous memory accesses
+#endif
+
 	mcr	p15, 0, r0, c7, c10, 1		@ flush_pte
+
+#ifdef CONFIG_PJ4B_ERRATA_4611
+	msr     cpsr_c, r2                      @ Restore interrupts
+	mcr     p15, 0, r0, c7, c10, 4          @ drain write buffer
+#endif
 	.endm
 
 
-- 
1.8.1.2

  parent reply	other threads:[~2013-05-29 10:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 10:16 [PATCH 0/3] ARM: PJ4B: fixes for 3.10-rc Gregory CLEMENT
2013-05-29 10:16 ` [PATCH 1/3] ARM PJ4B: Add support for errata 4742 Gregory CLEMENT
2013-05-29 11:03   ` Will Deacon
2013-06-02  8:27     ` Lior Amsalem
2013-05-29 10:16 ` [PATCH 2/3] ARM PJ4B: Add support for errata 6124 Gregory CLEMENT
2013-05-29 11:16   ` Will Deacon
2013-06-03  7:15     ` Lior Amsalem
2013-05-29 10:16 ` Gregory CLEMENT [this message]
2013-05-29 11:22   ` [PATCH 3/3] ARM PJ4B: Add support for errata 4611 Will Deacon
2013-05-29 12:57     ` Gregory CLEMENT
2013-05-29 13:11       ` Arnd Bergmann
2013-05-29 13:27         ` Gregory CLEMENT
2013-05-29 13:33           ` Arnd Bergmann
2013-06-04 11:34             ` Lior Amsalem
2013-06-04 11:39               ` Arnd Bergmann
2013-06-06  7:46                 ` Lior Amsalem
2013-06-03  7:16     ` Lior Amsalem
2013-05-29 11:03 ` [PATCH 0/3] ARM: PJ4B: fixes for 3.10-rc Jason Cooper

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=1369822618-26797-4-git-send-email-gregory.clement@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.