Skip to contentSkip to conversation

ARM: ARM926EJS - Add cache operations

PATCH New Hong Xu 6 participants 16 messages Aug 11, 2011 – Sep 7, 2011 Arm (32-bit)

lore
Share & tools
lore

Hong Xu

author
#0 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---
V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined
V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

 arch/arm/cpu/arm926ejs/Makefile |    2 +-
 arch/arm/cpu/arm926ejs/cache.c  |  142 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/cache.c
arch/arm/cpu/arm926ejs/Makefile +1 -1
index 930e0d1..5b5f330 100644
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).o
 
 START	= start.o
-COBJS	= cpu.o
+COBJS	= cpu.o cache.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/arm926ejs/cache.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
1.7.6
#1 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 36 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---
V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined
V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

 arch/arm/cpu/arm926ejs/Makefile |    2 +-
 arch/arm/cpu/arm926ejs/cache.c  |  142
+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143
insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/cache.c
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..5b5f330 100644

arch/arm/cpu/arm926ejs/Makefile +1 -1
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).o
 
 START	= start.o
-COBJS	= cpu.o
+COBJS	= cpu.o cache.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/cache.c new file mode 100644 index 0000000..fc321f6

arch/arm/cpu/arm926ejs/cache.c line 3

Quoted 3 lines
arch/arm/cpu/arm926ejs/cache.c new file +3 -0
@@ -0,0 +1,142 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.

Again ... really ?

Quoted 33 lines
arch/arm/cpu/arm926ejs/cache.c new file +30 -0
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#define FLUSH_CACHE_OP		0
+#define INVALIDATE_CACHE_OP	1
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+/*
+ * Flush or Invalidate DCache respectively
+ */
+static void cache_range_op(unsigned long start, unsigned long stop, int

op) +{

arch/arm/cpu/arm926ejs/cache.c new file +2 -0
+	int cache_line_len;
+	unsigned long mva;

arch/arm/cpu/arm926ejs/cache.c line 46

Quoted 10 lines
arch/arm/cpu/arm926ejs/cache.c new file +10 -0
+	char *func_name;
+
+	if (op == FLUSH_CACHE_OP)
+		func_name = "flush_dcache_range";
+	else if (op == INVALIDATE_CACHE_OP)
+		func_name = "invalidate_dcache_range";
+	else {
+		printf("WARNING: %s - Invalid cache operation!\n", __func__);
+		return;
+	}

hm...
if (op > 2)
printf(warning);

otherwise, just declare an array of strings ...
char *name[] = { "flush", "invalidate" };

and access it where needed ... printf("%s", name[OP]); ... maybe ?

arch/arm/cpu/arm926ejs/cache.c line 56

Quoted 10 lines
arch/arm/cpu/arm926ejs/cache.c new file +10 -0
+
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+	cache_line_len = CONFIG_SYS_CACHELINE_SIZE;
+#else
+	/*
+	 * ARM926EJ-S Technical Reference Manual, Chap 2.3.1 Table 2-9
+	 * only b'10, aka. 32 bytes cache line len is valid
+	 */
+	cache_line_len = 32;
+#endif

Move this at the begining of the file

#ifndef CONFIG_SYS...
#define
#endif

include the comment, just modify it a bit accordingly, explaining what it does here. Then use CONFIG_SYS... as it'll always be defined.

Otherwise looks good.

I need sleep badly :-) Good night !

Quoted 86 lines
arch/arm/cpu/arm926ejs/cache.c new file +86 -0
+	mva = start;
+	if ((mva & (cache_line_len - 1)) != 0) {
+		printf("WARNING: %s - start address 0x%08x not aligned to"
+			"cache line size(%d bytes)\n", func_name, start,
+			cache_line_len);
+		/* Round up starting address */
+		mva = (mva | (cache_line_len - 1)) + 1;
+	}
+	if ((stop & (cache_line_len - 1)) != 0) {
+		printf("WARNING: %s - stop address 0x%08x not aligned to"
+			"cache line size(%d bytes)\n", func_name, stop,
+			cache_line_len);
+		/* Round down ending address */
+		stop &= ~(cache_line_len - 1);
+	}
+
+	while (mva < stop) {
+		if (op == FLUSH_CACHE_OP)
+			asm("mcr p15, 0, %0, c7, c14, 1\n" : : "r"(mva));
+		else
+			asm("mcr p15, 0, %0, c7, c6, 1\n" : : "r"(mva));
+
+		mva += cache_line_len;
+	}
+
+	/* Drain WB if necessary */
+	if (op == FLUSH_CACHE_OP)
+		asm("mcr p15, 0, %0, c7, c10, 4\n" : : "r" (0));
+}
+
+/*
+ * The buffer range to be flushed is [start, stop)
+ */
+void flush_dcache_range(unsigned long start, unsigned long stop)
+{
+	cache_range_op(start, stop, FLUSH_CACHE_OP);
+}
+
+void flush_dcache_all(void)
+{
+	/*
+	 * ARM926EJ-S Technical Reference Manual, Chap 2.3.8
+	 * Clean & Invalidate the entire DCache
+	 */
+	asm("0: mrc p15, 0, r15, c7, c14, 3\n\t" "bne 0b\n" : : : "memory");
+	/* Drain WB */
+	asm("mcr p15, 0, %0, c7, c10, 4\n" : : "r" (0));
+}
+
+void flush_cache(unsigned long start, unsigned long size)
+{
+	flush_dcache_range(start, start + size);
+}
+
+/*
+ * The buffer range to be invalidated is [start, stop)
+ */
+void invalidate_dcache_range(unsigned long start, unsigned long stop)
+{
+	cache_range_op(start, stop, INVALIDATE_CACHE_OP);
+}
+
+void invalidate_dcache_all(void)
+{
+	asm("mcr p15, 0, %0, c7, c6, 0\n" : : "r" (0));
+}
+
+#else /* #ifndef CONFIG_SYS_DCACHE_OFF */
+
+void flush_cache(unsigned long start, unsigned long size) {}
+void flush_dcache_all(void) {}
+void flush_dcache_range(unsigned long start, unsigned long stop) {}
+void invalidate_dcache_range(unsigned long start, unsigned long stop) {}
+void invalidate_dcache_all(void) {}
+#endif
+
+#ifndef CONFIG_SYS_ICACHE_OFF
+void invalidate_icache_all(void)
+{
+	asm("mcr p15, 0, %0, c7, c5, 0\n" : : "r" (0));
+}
+
+#else /* #ifndef CONFIG_SYS_ICACHE_OFF */
+
+void invalidate_icache_all(void) {}
+#endif
author
#2 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Hi Marek,

Quoted 29 lines · Marek Vasut
Quoted 28 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---
V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined
V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

  arch/arm/cpu/arm926ejs/Makefile |    2 +-
  arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/cpu/arm926ejs/cache.c

(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..5b5f330 100644

arch/arm/cpu/arm926ejs/Makefile +1 -1
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
  LIB	= $(obj)lib$(CPU).o
 
  START	= start.o
-COBJS	= cpu.o
+COBJS	= cpu.o cache.o
 
Quoted 14 lines

arch/arm/cpu/arm926ejs/cache.c line 3

Quoted 11 lines
arch/arm/cpu/arm926ejs/Makefile +0 -0
  SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
  OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/cache.c new file mode 100644 index 0000000..fc321f6

arch/arm/cpu/arm926ejs/cache.c new file +3 -0
@@ -0,0 +1,142 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.

Again ... really ?

not sure...
add a new copyright line on top of it?

Quoted 35 lines
Quoted 35 lines
arch/arm/cpu/arm926ejs/cache.c new file +30 -0
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include<common.h>
+
+#define FLUSH_CACHE_OP		0
+#define INVALIDATE_CACHE_OP	1
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+/*
+ * Flush or Invalidate DCache respectively
+ */
+static void cache_range_op(unsigned long start, unsigned long stop, int

op) +{

arch/arm/cpu/arm926ejs/cache.c new file +4 -0
+	int cache_line_len;
+	unsigned long mva;
+	char *func_name;
+
Quoted 8 lines

arch/arm/cpu/arm926ejs/cache.c line 46

Quoted 8 lines
arch/arm/cpu/arm926ejs/cache.c new file +8 -0
+	if (op == FLUSH_CACHE_OP)
+		func_name = "flush_dcache_range";
+	else if (op == INVALIDATE_CACHE_OP)
+		func_name = "invalidate_dcache_range";
+	else {
+		printf("WARNING: %s - Invalid cache operation!\n", __func__);
+		return;
+	}

well, looks removing it and printing the `op' code is enough.

Quoted 22 lines

hm...
if (op> 2)
printf(warning);

otherwise, just declare an array of strings ...
char *name[] = { "flush", "invalidate" };

and access it where needed ... printf("%s", name[OP]); ... maybe ?

arch/arm/cpu/arm926ejs/cache.c line 56

Quoted 10 lines
arch/arm/cpu/arm926ejs/cache.c new file +10 -0
+
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+	cache_line_len = CONFIG_SYS_CACHELINE_SIZE;
+#else
+	/*
+	 * ARM926EJ-S Technical Reference Manual, Chap 2.3.1 Table 2-9
+	 * only b'10, aka. 32 bytes cache line len is valid
+	 */
+	cache_line_len = 32;
+#endif

Move this at the begining of the file

Quoted 7 lines

#ifndef CONFIG_SYS...
#define
#endif

include the comment, just modify it a bit accordingly, explaining what it does here. Then use CONFIG_SYS... as it'll always be defined.

OK, looks better.

BR,
Eric

Quoted 8 lines

Otherwise looks good.

I need sleep badly :-) Good night !

Quoted 4 lines
arch/arm/cpu/arm926ejs/cache.c new file +4 -0
+	mva = start;
+	if ((mva&  (cache_line_len - 1)) != 0) {
+		printf("WARNING: %s - start address 0x%08x not aligned to"
+			"cache line size(%d bytes)\n", func_name, start,

[...]

#3 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Hi Hong,

Quoted 20 lines · Hong Xu

Hi Marek,

Quoted 17 lines · Marek Vasut
Quoted 16 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---
V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined
V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

  arch/arm/cpu/arm926ejs/Makefile |    2 +-
  arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

Regards,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110902/8ed8ea42/attachment.pgp

#4 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 26 lines · Simon Guinot

Hi Hong,

Quoted 23 lines · Hong Xu

Hi Marek,

Quoted 20 lines · Marek Vasut
Quoted 19 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

  arch/arm/cpu/arm926ejs/Makefile |    2 +-
  arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Cheers

Quoted 4 lines

Regards,

Simon

#5 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 29 lines · Marek Vasut
Quoted 28 lines · Simon Guinot

Hi Hong,

Quoted 24 lines · Hong Xu

Hi Marek,

Quoted 21 lines · Marek Vasut
Quoted 20 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

  arch/arm/cpu/arm926ejs/Makefile |    2 +-
  arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

Quoted 8 lines
Quoted 4 lines

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110902/a6505024/attachment.pgp

#6 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 35 lines · Simon Guinot
Quoted 34 lines · Marek Vasut
Quoted 32 lines · Simon Guinot

Hi Hong,

Quoted 24 lines · Hong Xu

Hi Marek,

Quoted 21 lines · Marek Vasut
Quoted 20 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

  arch/arm/cpu/arm926ejs/Makefile |    2 +-
  arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

Quoted 7 lines
Quoted 4 lines

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

I have some fixes already queued, yes.

Quoted 2 lines

Simon

#7 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Le 02/09/2011 13:57, Marek Vasut a ?crit :

Quoted 41 lines · Simon Guinot
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Simon Guinot
Quoted 26 lines

Hi Hong,

Quoted 23 lines · Hong Xu

Hi Marek,

Quoted 20 lines · Marek Vasut
Quoted 19 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

   arch/arm/cpu/arm926ejs/Makefile |    2 +-
   arch/arm/cpu/arm926ejs/cache.c  |  142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
   create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Quoted 7 lines
Quoted 2 lines

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

I have some fixes already queued, yes.

Quoted 2 lines

Simon

Hi folks,

I'm trying to locate the latest version of this set's patches in patchwork and I can't find them at all in any state. What am I missing?

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 48 lines

Le 02/09/2011 13:57, Marek Vasut a ?crit :

Quoted 47 lines · Simon Guinot
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Simon Guinot
Quoted 32 lines

Hi Hong,

Quoted 24 lines · Hong Xu

Hi Marek,

Quoted 21 lines · Marek Vasut
Quoted 20 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
??? Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
??? Undo changes in include/configs/at91sam9260ek.h ??? It's for testing purpose
???
arch/arm/cpu/arm926ejs/Makefile |? ? ? 2 +- arch/arm/cpu/arm926ejs/cache.c? |? 142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

Quoted 7 lines
Quoted 4 lines

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

I have some fixes already queued, yes.

Quoted 1 line
Quoted 6 lines
Quoted 1 line
Quoted 1 line

Simon

Hi folks,

I'm trying to locate the latest version of this set's patches in patchwork and I can't find them at all in any state. What am I missing?

Hi Albert,

you're missing the move from cpu/arm926ejs to cpu/armv5/ . Though I'd prefer to have it in arm926 for now as we still didn't verify the other cores are ok with it (I changed my opinion just recently). For example, xscale isn't. So maybe we can pick the patches as they are.

Cheers!

Quoted 4 lines

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Le 05/09/2011 21:50, Marek Vasut a ?crit :

Quoted 50 lines
Quoted 50 lines

Le 02/09/2011 13:57, Marek Vasut a ?crit :

Quoted 48 lines · Simon Guinot
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Simon Guinot
Quoted 32 lines

Hi Hong,

Quoted 24 lines · Hong Xu

Hi Marek,

Quoted 21 lines · Marek Vasut
Quoted 20 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

arch/arm/cpu/arm926ejs/Makefile | 2 +-
arch/arm/cpu/arm926ejs/cache.c | 142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

I have failed to find any trace for this patch in patchwork or in the arm git repository...

Quoted 7 lines
Quoted 4 lines

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

I have some fixes already queued, yes.

Quoted 2 lines

Simon

Quoted 8 lines
Quoted 4 lines

Hi folks,

I'm trying to locate the latest version of this set's patches in patchwork and I can't find them at all in any state. What am I missing?

Hi Albert,

you're missing the move from cpu/arm926ejs to cpu/armv5/ . Though I'd prefer to have it in arm926 for now as we still didn't verify the other cores are ok with it (I changed my opinion just recently). For example, xscale isn't. So maybe we can pick the patches as they are.

Seems like we're having two problems there:

1) at least some cpus or cores (xscale) do not implement all of what was thought to be armv5 cache operations, which suggests we should indeed keep this patch in arm926ejs;

2) that many cpus and cores implement a good subset of armv5 cache operations, which warrants having an armv5 directory where we would define them once only for all to use.

I think the Right Way is to create an armv5 subtree with armv5-common operations, but with the capability of overruling these with cpu-level variants, themselves being possibly overridden by core-level variants.

Now as to where to put this:

As ARMv5 is an ISA, not a cpu or core, I'm uncomfortable with creating arch/arm/cpu/armv5 anyway. I'd prefer an ISA subtree, either in parallel with the cpu subtree: arch/arm/isa [/armv5], or, and I would slightly prefer that even though some paths would become rather long, a hierarchy withe cpus stand below their isa: arch/arm/isa [/armv5/cpu/arm926ejs]. To reduce path length, we could remove the 'cpu' part and consider that anything below the 'isa' is a cpu, just like currently anything below the cpu is a core.

To sum it up, we would have

arch/arm/isa/armv5 (where ARMv5t ISA common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs (where ARM926EJ-S cpu common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs/orion5x (a personal favorite :) where Orion5x core code would reside, including cache ops)

Maybe we could even make do without the .../isa/... level and put ISAs directly under ARM -- I don't think any ARM ISA will ever be named 'include' or 'lib' or 'Makefile'. :)

Comments?

Quoted 1 line

Cheers!

Amicalement,

Signature · 1 line
Albert.
#10 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 68 lines · Albert ARIBAUD

Le 05/09/2011 21:50, Marek Vasut a ?crit :

Quoted 54 lines
Quoted 45 lines

Le 02/09/2011 13:57, Marek Vasut a ?crit :

Quoted 44 lines · Simon Guinot
Quoted 42 lines · Marek Vasut
Quoted 31 lines · Simon Guinot
Quoted 30 lines

Hi Hong,

Quoted 24 lines · Hong Xu

Hi Marek,

Quoted 21 lines · Marek Vasut
Quoted 20 lines · Hong Xu

Add a new file arch/arm/cpu/arm926ejs/cache.c and put cache operations into this file.

---

V2:
Fixed a typo when CONFIG_SYS_DCACHE_OFF is defined

V3:
Undo changes in include/configs/at91sam9260ek.h It's for testing purpose

arch/arm/cpu/arm926ejs/Makefile | 2 +-
arch/arm/cpu/arm926ejs/cache.c | 142

+++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletions(-)

create mode 100644 arch/arm/cpu/arm926ejs/cache.c

What is the status for this patch ?

Quoted 7 lines
Quoted 2 lines

I have failed to find any trace for this patch in patchwork or in the arm git repository...

We discussed this should be moved to arch/arm/cpu/armv5 (Aneesh V's idea ... I dunno what's this guys' full name ;-D). I tested this patch on certain type of CPU and it works really good. I'd be really glad if we got this mainline!

Yes. Moreover some drivers (as mvgbe) really needs such functions to fix the DMA operations when D-cache is enabled.

Quoted 8 lines
Quoted 3 lines

I have some fixes already queued, yes.

Quoted 1 line

Simon

Hi folks,

I'm trying to locate the latest version of this set's patches in patchwork and I can't find them at all in any state. What am I missing?

Quoted 6 lines

Hi Albert,

you're missing the move from cpu/arm926ejs to cpu/armv5/ . Though I'd prefer to have it in arm926 for now as we still didn't verify the other cores are ok with it (I changed my opinion just recently). For example, xscale isn't. So maybe we can pick the patches as they are.

Seems like we're having two problems there:

1) at least some cpus or cores (xscale) do not implement all of what was thought to be armv5 cache operations, which suggests we should indeed keep this patch in arm926ejs;

Quoted 7 lines

2) that many cpus and cores implement a good subset of armv5 cache operations, which warrants having an armv5 directory where we would define them once only for all to use.

I think the Right Way is to create an armv5 subtree with armv5-common operations, but with the capability of overruling these with cpu-level variants, themselves being possibly overridden by core-level variants.

All right, but what about the CPUs that don't adapt so fast? There will be CPUs with broken cache-ops. How do you intend to solve that ?

Quoted 12 lines

Now as to where to put this:

As ARMv5 is an ISA, not a cpu or core, I'm uncomfortable with creating arch/arm/cpu/armv5 anyway. I'd prefer an ISA subtree, either in parallel with the cpu subtree: arch/arm/isa [/armv5], or, and I would slightly prefer that even though some paths would become rather long, a hierarchy withe cpus stand below their isa: arch/arm/isa [/armv5/cpu/arm926ejs]. To reduce path length, we could remove the 'cpu' part and consider that anything below the 'isa' is a cpu, just like currently anything below the cpu is a core.

This is completely out of scope for this patch. My proposal would be to merge this, then start mucking with this moving files around.

Quoted 8 lines

To sum it up, we would have

arch/arm/isa/armv5 (where ARMv5t ISA common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs (where ARM926EJ-S cpu common code would reside, including cache ops)

Quoted 8 lines

arch/arm/isa/armv5/arm926ejs/orion5x (a personal favorite :) where Orion5x core code would reside, including cache ops)

Maybe we could even make do without the .../isa/... level and put ISAs directly under ARM -- I don't think any ARM ISA will ever be named 'include' or 'lib' or 'Makefile'. :)

Comments?

I'll have to think about it, but there is my proposal above. Please consider it, it'll help while dodging the trouble for a while until this is settled.

Quoted 4 lines
Quoted 2 lines

Cheers!

Amicalement,

Cheers

#11 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

(splitting this discussion between the patch and my longer term RFC, here I follow the patch, keeping the subject line unchanged)

Le 06/09/2011 08:40, Marek Vasut a ?crit :

Quoted 2 lines

This is completely out of scope for this patch. My proposal would be to merge this, then start mucking with this moving files around.

Agreed. My proposal was more of a longer term RFC)

Quoted 2 lines

I'll have to think about it, but there is my proposal above. Please consider it, it'll help while dodging the trouble for a while until this is settled.

If you mean 'have arm-generic weak defaults in arch/arm and arm926ejs implementation in arch/arm/cpu/arm926ejs', I'm ok with that.

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH v3 3/3 ARM: ARM926EJS - Add cache operations

Quoted 7 lines · Albert ARIBAUD

(splitting this discussion between the patch and my longer term RFC, here I follow the patch, keeping the subject line unchanged)

Le 06/09/2011 08:40, Marek Vasut a ?crit :

Quoted 2 lines

This is completely out of scope for this patch. My proposal would be to merge this, then start mucking with this moving files around.

Quoted 8 lines

Agreed. My proposal was more of a longer term RFC)

Quoted 3 lines

I'll have to think about it, but there is my proposal above. Please consider it, it'll help while dodging the trouble for a while until this is settled.

If you mean 'have arm-generic weak defaults in arch/arm and arm926ejs implementation in arch/arm/cpu/arm926ejs', I'm ok with that.

Yes please.

Quoted 2 lines

Amicalement,

Cheers

#13 lore raw

[U-Boot] [RFC] Long term ARM ISA/cpu/core code organization (was: [PATCH 3/3 v3] ARM: ARM926EJS - Add cache operations)

In reply to Marek Vasut

(splitting this discussion between the patch question and longer term RFC, here I follow the RFC and update the subject line accordingly)

Quoted 10 lines
Quoted 10 lines

Seems like we're having two problems there:

1) at least some cpus or cores (xscale) do not implement all of what was thought to be armv5 cache operations, which suggests we should indeed keep this patch in arm926ejs;

2) that many cpus and cores implement a good subset of armv5 cache operations, which warrants having an armv5 directory where we would define them once only for all to use.

Quoted 5 lines
Quoted 3 lines

I think the Right Way is to create an armv5 subtree with armv5-common operations, but with the capability of overruling these with cpu-level variants, themselves being possibly overridden by core-level variants.

All right, but what about the CPUs that don't adapt so fast?

Adapt to what?

Quoted 2 lines

There will be CPUs
with broken cache-ops. How do you intend to solve that ?

If a cpu has partly broken cache ops, but its cache is still useable by not using the armv5-stock cache ops implementation, then the cpu should override the broken armv5 ops with its own version.

For instance, say some armv5 based cpu badly implements full flush but correctly implements cache line flush. The cpu code should then provide its own version of the full cache flush op, based on looping through the cache lines instead of the armv5 single coprocessor instruction.

If, OTOH, a cpu has broken cache ops, to the point that cache is unuseable, then it should have its cache disabled, which can be done through configuration options or by providing cpu-specific cache ops implementations that will emit appropriate messages.

Quoted 11 lines
Quoted 10 lines

Now as to where to put this:

As ARMv5 is an ISA, not a cpu or core, I'm uncomfortable with creating arch/arm/cpu/armv5 anyway. I'd prefer an ISA subtree, either in parallel with the cpu subtree: arch/arm/isa [/armv5], or, and I would slightly prefer that even though some paths would become rather long, a hierarchy withe cpus stand below their isa: arch/arm/isa [/armv5/cpu/arm926ejs]. To reduce path length, we could remove the 'cpu' part and consider that anything below the 'isa' is a cpu, just like currently anything below the cpu is a core.

Quoted 2 lines

This is completely out of scope for this patch. My proposal would be to merge this, then start mucking with this moving files around.

Indeed -- I was not suggestion a rework of the patch, only sending out an RFC of sorts.

Quoted 11 lines
Quoted 11 lines

To sum it up, we would have

arch/arm/isa/armv5 (where ARMv5t ISA common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs (where ARM926EJ-S cpu common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs/orion5x (a personal favorite :) where Orion5x core code would reside, including cache ops)

Quoted 7 lines
Quoted 5 lines

Maybe we could even make do without the .../isa/... level and put ISAs directly under ARM -- I don't think any ARM ISA will ever be named 'include' or 'lib' or 'Makefile'. :)

Comments?

I'll have to think about it,

By all means do. :)

Amicalement,

Signature · 1 line
Albert.
#14 lore raw

[U-Boot] [RFC] Long term ARM ISA/cpu/core code organization (was: [PATCH 3/3 v3] ARM: ARM926EJS - Add cache operations)

Quoted 13 lines · Albert ARIBAUD

(splitting this discussion between the patch question and longer term RFC, here I follow the RFC and update the subject line accordingly)

Quoted 10 lines
Quoted 10 lines

Seems like we're having two problems there:

1) at least some cpus or cores (xscale) do not implement all of what was thought to be armv5 cache operations, which suggests we should indeed keep this patch in arm926ejs;

2) that many cpus and cores implement a good subset of armv5 cache operations, which warrants having an armv5 directory where we would define them once only for all to use.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I think the Right Way is to create an armv5 subtree with armv5-common operations, but with the capability of overruling these with cpu-level variants, themselves being possibly overridden by core-level variants.

All right, but what about the CPUs that don't adapt so fast?

Adapt to what?

Adapt to this new cache stuff. Some CPUs have no cache functions implemented at all and therefore with the new stuff, they will use the generic ones -- which might be not good.

Quoted 13 lines
Quoted 3 lines

There will be CPUs
with broken cache-ops. How do you intend to solve that ?

If a cpu has partly broken cache ops, but its cache is still useable by not using the armv5-stock cache ops implementation, then the cpu should override the broken armv5 ops with its own version.

For instance, say some armv5 based cpu badly implements full flush but correctly implements cache line flush. The cpu code should then provide its own version of the full cache flush op, based on looping through the cache lines instead of the armv5 single coprocessor instruction.

Quoted 4 lines

If, OTOH, a cpu has broken cache ops, to the point that cache is unuseable, then it should have its cache disabled, which can be done through configuration options or by providing cpu-specific cache ops implementations that will emit appropriate messages.

Ack, agree.

Quoted 33 lines
Quoted 12 lines
Quoted 11 lines

Now as to where to put this:

As ARMv5 is an ISA, not a cpu or core, I'm uncomfortable with creating arch/arm/cpu/armv5 anyway. I'd prefer an ISA subtree, either in parallel with the cpu subtree: arch/arm/isa [/armv5], or, and I would slightly prefer that even though some paths would become rather long, a hierarchy withe cpus stand below their isa: arch/arm/isa [/armv5/cpu/arm926ejs]. To reduce path length, we could remove the 'cpu' part and consider that anything below the 'isa' is a cpu, just like currently anything below the cpu is a core.

Quoted 2 lines

This is completely out of scope for this patch. My proposal would be to merge this, then start mucking with this moving files around.

Indeed -- I was not suggestion a rework of the patch, only sending out an RFC of sorts.

Quoted 15 lines
Quoted 15 lines

To sum it up, we would have

arch/arm/isa/armv5 (where ARMv5t ISA common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs (where ARM926EJ-S cpu common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs/orion5x (a personal favorite :) where Orion5x core code would reside, including cache ops)

Maybe we could even make do without the .../isa/... level and put ISAs directly under ARM -- I don't think any ARM ISA will ever be named 'include' or 'lib' or 'Makefile'. :)

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Comments?

I'll have to think about it,

By all means do. :)

Amicalement,

Cheers

#15 lore raw

[U-Boot] [RFC] Long term ARM ISA/cpu/core code organization

In reply to Albert ARIBAUD

Hi Albert,

Quoted 1 line · Albert ARIBAUD

(splitting this discussion between the patch question and longer term

[snip ...]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

To sum it up, we would have

arch/arm/isa/armv5 (where ARMv5t ISA common code would reside, including cache ops)

arch/arm/isa/armv5/arm926ejs (where ARM926EJ-S cpu common code would reside, including cache ops)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

arch/arm/isa/armv5/arm926ejs/orion5x (a personal favorite :) where Orion5x core code would reside, including cache ops)

Maybe we could even make do without the .../isa/... level and put ISAs directly under ARM -- I don't think any ARM ISA will ever be named 'include' or 'lib' or 'Makefile'. :)

Comments?

Here is a rather wild thought. I am not sure whether we can do such a thing for ARM alone. Just ideating:-)

arch/arm/cpu/<isa>/<cpu>
arch/arm/soc/<soc-family>/<soc>

Reasoning:
1. SoCs in same SoC family typically share/can-share a lot of code.
2. SoCs in same SoC family need not necessarily have the same cpu. Usually a new SoC brings in a new CPU while maintaining a lot of peripheral IPs from the previous generation.

best regards,
Aneesh