linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8] ARM: Use the Inner Shareable I-cache and BTB ops on ARMv7 SMP
Date: Tue, 04 May 2010 17:44:54 +0100	[thread overview]
Message-ID: <20100504164454.26355.7003.stgit@e102109-lin.cambridge.arm.com> (raw)
In-Reply-To: <20100504163823.26355.58568.stgit@e102109-lin.cambridge.arm.com>

The standard I-cache Invalidate All (ICIALLU) and Branch Predication
Invalidate All (BPIALL) operations are not automatically broadcast to
the other CPUs in an ARMv7 MP system. The patch adds the Inner Shareable
variants, ICIALLUIS and BPIALLIS, if ARMv7 and SMP.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/include/asm/cacheflush.h |    4 ++++
 arch/arm/include/asm/tlbflush.h   |   29 ++++++++++++++++++++++++++++-
 arch/arm/mm/cache-v7.S            |    4 ++++
 arch/arm/mm/tlb-v7.S              |    8 ++++++++
 4 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 0d08d41..4656a24 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -371,6 +371,10 @@ static inline void __flush_icache_all(void)
 #ifdef CONFIG_ARM_ERRATA_411920
 	extern void v6_icache_inval_all(void);
 	v6_icache_inval_all();
+#elif defined(CONFIG_SMP) && __LINUX_ARM_ARCH__ >= 7
+	asm("mcr	p15, 0, %0, c7, c1, 0	@ invalidate I-cache inner shareable\n"
+	    :
+	    : "r" (0));
 #else
 	asm("mcr	p15, 0, %0, c7, c5, 0	@ invalidate I-cache\n"
 	    :
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index e085e2c..bd863d8 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -46,6 +46,9 @@
 #define TLB_V7_UIS_FULL (1 << 20)
 #define TLB_V7_UIS_ASID (1 << 21)
 
+/* Inner Shareable BTB operation (ARMv7 MP extensions) */
+#define TLB_V7_IS_BTB	(1 << 22)
+
 #define TLB_L2CLEAN_FR	(1 << 29)		/* Feroceon */
 #define TLB_DCLEAN	(1 << 30)
 #define TLB_WB		(1 << 31)
@@ -183,7 +186,7 @@
 #endif
 
 #ifdef CONFIG_SMP
-#define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \
+#define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_V7_IS_BTB | \
 			 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID)
 #else
 #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \
@@ -339,6 +342,12 @@ static inline void local_flush_tlb_all(void)
 		dsb();
 		isb();
 	}
+	if (tlb_flag(TLB_V7_IS_BTB)) {
+		/* flush the branch target cache */
+		asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc");
+		dsb();
+		isb();
+	}
 }
 
 static inline void local_flush_tlb_mm(struct mm_struct *mm)
@@ -376,6 +385,12 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
 		asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
 		dsb();
 	}
+	if (tlb_flag(TLB_V7_IS_BTB)) {
+		/* flush the branch target cache */
+		asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc");
+		dsb();
+		isb();
+	}
 }
 
 static inline void
@@ -416,6 +431,12 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
 		asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
 		dsb();
 	}
+	if (tlb_flag(TLB_V7_IS_BTB)) {
+		/* flush the branch target cache */
+		asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc");
+		dsb();
+		isb();
+	}
 }
 
 static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
@@ -454,6 +475,12 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
 		dsb();
 		isb();
 	}
+	if (tlb_flag(TLB_V7_IS_BTB)) {
+		/* flush the branch target cache */
+		asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc");
+		dsb();
+		isb();
+	}
 }
 
 /*
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index bcd64f2..06a90dc 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -167,7 +167,11 @@ ENTRY(v7_coherent_user_range)
 	cmp	r0, r1
 	blo	1b
 	mov	r0, #0
+#ifdef CONFIG_SMP
+	mcr	p15, 0, r0, c7, c1, 6		@ invalidate BTB Inner Shareable
+#else
 	mcr	p15, 0, r0, c7, c5, 6		@ invalidate BTB
+#endif
 	dsb
 	isb
 	mov	pc, lr
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S
index 0cb1848..f3f288a 100644
--- a/arch/arm/mm/tlb-v7.S
+++ b/arch/arm/mm/tlb-v7.S
@@ -50,7 +50,11 @@ ENTRY(v7wbi_flush_user_tlb_range)
 	cmp	r0, r1
 	blo	1b
 	mov	ip, #0
+#ifdef CONFIG_SMP
+	mcr	p15, 0, ip, c7, c1, 6		@ flush BTAC/BTB Inner Shareable
+#else
 	mcr	p15, 0, ip, c7, c5, 6		@ flush BTAC/BTB
+#endif
 	dsb
 	mov	pc, lr
 ENDPROC(v7wbi_flush_user_tlb_range)
@@ -79,7 +83,11 @@ ENTRY(v7wbi_flush_kern_tlb_range)
 	cmp	r0, r1
 	blo	1b
 	mov	r2, #0
+#ifdef CONFIG_SMP
+	mcr	p15, 0, r2, c7, c1, 6		@ flush BTAC/BTB Inner Shareable
+#else
 	mcr	p15, 0, r2, c7, c5, 6		@ flush BTAC/BTB
+#endif
 	dsb
 	isb
 	mov	pc, lr

  parent reply	other threads:[~2010-05-04 16:44 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04 16:44 [PATCH 0/8] Various patches for comments and upstream Catalin Marinas
2010-05-04 16:44 ` [PATCH 1/8] ARM: Improve the L2 cache performance when PL310 is used Catalin Marinas
2010-05-04 17:02   ` Jason McMullan
2010-05-05 16:07     ` Catalin Marinas
2010-05-04 16:44 ` [PATCH 2/8] ARM: Implement read/write for ownership in the ARMv6 DMA cache ops Catalin Marinas
2010-05-04 17:04   ` Jason McMullan
2010-05-05 16:23     ` Catalin Marinas
2010-05-05 13:26   ` George G. Davis
2010-05-06 14:40     ` Catalin Marinas
2010-05-06 15:57       ` George G. Davis
2010-05-12 12:51   ` Ronen Shitrit
2010-05-12 13:55     ` Catalin Marinas
2010-05-12 15:03       ` Ronen Shitrit
2010-05-12 18:48       ` Russell King - ARM Linux
2010-05-12 18:59         ` Russell King - ARM Linux
2010-05-12 20:00           ` Ronen Shitrit
2010-05-12 20:04             ` Russell King - ARM Linux
2010-05-12 20:19               ` Ronen Shitrit
2010-05-12 21:21           ` [PATCH 2/8] ARM: Implement read/write for ownership in theARMv6 " Catalin Marinas
2010-05-13  5:27             ` Ronen Shitrit
2010-05-13  8:26               ` Catalin Marinas
2010-05-13 13:54                 ` George G. Davis
2010-05-13 14:15                   ` Catalin Marinas
2010-05-13 20:34                     ` George G. Davis
2010-05-14 16:29                       ` Catalin Marinas
2010-05-14 16:42                         ` Catalin Marinas
2010-05-15  1:26                           ` George G. Davis
2010-05-16  6:28                             ` Ronen Shitrit
2010-05-16  6:29                 ` Ronen Shitrit
2010-05-16 15:01                   ` Russell King - ARM Linux
2010-05-17  6:29                     ` Ronen Shitrit
2010-05-17  6:57                       ` Russell King - ARM Linux
2010-05-17  7:34                         ` Ronen Shitrit
2010-05-17  7:43                           ` Russell King - ARM Linux
2010-05-17  8:29                             ` Ronen Shitrit
2010-05-17  8:57                               ` Russell King - ARM Linux
2010-05-17  9:50                                 ` Ronen Shitrit
2010-05-17 10:03                                   ` Russell King - ARM Linux
2010-05-17 11:26                                     ` Ronen Shitrit
2010-05-17 11:31                                       ` Russell King - ARM Linux
2010-05-17 11:45                                         ` Catalin Marinas
2010-05-17 10:00                           ` Catalin Marinas
2010-05-17 11:29                             ` Ronen Shitrit
2010-05-17 11:42                               ` Catalin Marinas
2010-05-17 12:04                                 ` Ronen Shitrit
2010-05-17 13:45                                   ` Catalin Marinas
2010-05-17  9:51                   ` Catalin Marinas
2010-05-17  9:57                     ` Catalin Marinas
2010-05-17  9:59                       ` Ronen Shitrit
2010-05-17 11:08                         ` Catalin Marinas
2010-05-17 11:27                           ` Ronen Shitrit
2010-05-17 11:47                             ` Catalin Marinas
2010-05-17 13:46                               ` [PATCH 2/8] ARM: Implement read/write for ownership intheARMv6 " Catalin Marinas
2010-05-04 16:44 ` [PATCH 3/8] ARM: Align machine_desc.phys_io to a 1MB section Catalin Marinas
2010-05-04 16:44 ` [PATCH 4/8] ARM: Remove the domain switching on ARMv6k/v7 CPUs Catalin Marinas
2010-05-04 16:44 ` [PATCH 5/8] ARM: Fix the __arm_ioremap_caller() definition in nommu.c Catalin Marinas
2010-05-04 17:19   ` Russell King - ARM Linux
2010-05-04 16:44 ` [PATCH 6/8] ARM: Implement copy_to_user_page() for noMMU Catalin Marinas
2010-05-04 17:19   ` Russell King - ARM Linux
2010-05-04 16:44 ` Catalin Marinas [this message]
2010-05-28 18:50   ` [PATCH 7/8] ARM: Use the Inner Shareable I-cache and BTB ops on ARMv7 SMP Russell King - ARM Linux
2010-05-28 21:37     ` [PATCH 7/8] ARM: Use the Inner Shareable I-cache and BTB opson " Catalin Marinas
2010-05-04 16:44 ` [PATCH 8/8] ARM: Implement phys_mem_access_prot() to avoid attributes aliasing Catalin Marinas
2010-05-04 16:48 ` [PATCH 0/8] Various patches for comments and upstream Catalin Marinas

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=20100504164454.26355.7003.stgit@e102109-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).