Skip to contentSkip to conversation

MIPS: Add support for the 1074K core.

PATCH Superseded Steven J. Hill 2 participants 3 messages May 10, 2012 – May 21, 2012 MIPS

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 MIPS: Add support for the 1074K core.

From: "Steven J. Hill" <[email protected]>

This patch adds support for detecting and using 1074K cores.

---
 arch/mips/include/asm/cpu.h          |    1 +
 arch/mips/kernel/cpu-probe.c         |    4 ++++
 arch/mips/mm/c-r4k.c                 |   24 +++++++++++++++++++++---
 arch/mips/oprofile/op_model_mipsxx.c |    6 ------
 4 files changed, 26 insertions(+), 9 deletions(-)
arch/mips/include/asm/cpu.h +1 -0
index f9fa2a4..9f8feeb 100644
@@ -94,6 +94,7 @@
 #define PRID_IMP_24KE		0x9600
 #define PRID_IMP_74K		0x9700
 #define PRID_IMP_1004K		0x9900
+#define PRID_IMP_1074K		0x9a00
 
 /*
  * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
arch/mips/kernel/cpu-probe.c +4 -0
index 5099201..4b5c7d6 100644
@@ -835,6 +835,10 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
 		c->cputype = CPU_1004K;
 		__cpu_name[cpu] = "MIPS 1004Kc";
 		break;
+	case PRID_IMP_1074K:
+		c->cputype = CPU_74K;
+		__cpu_name[cpu] = "MIPS 1074Kc";
+		break;
 	}
 
 	spram_config();
arch/mips/mm/c-r4k.c +21 -3
index bda8eb2..c646a79 100644
@@ -977,7 +977,7 @@ static void __cpuinit probe_pcache(void)
 			c->icache.linesz = 2 << lsize;
 		else
 			c->icache.linesz = lsize;
-		c->icache.sets = 64 << ((config1 >> 22) & 7);
+		c->icache.sets = 32 << (((config1 >> 22) + 1) & 7);
 		c->icache.ways = 1 + ((config1 >> 16) & 7);
 
 		icache_size = c->icache.sets *
@@ -997,7 +997,7 @@ static void __cpuinit probe_pcache(void)
 			c->dcache.linesz = 2 << lsize;
 		else
 			c->dcache.linesz= lsize;
-		c->dcache.sets = 64 << ((config1 >> 13) & 7);
+		c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7);
 		c->dcache.ways = 1 + ((config1 >> 7) & 7);
 
 		dcache_size = c->dcache.sets *
@@ -1051,9 +1051,26 @@ static void __cpuinit probe_pcache(void)
 	case CPU_R14000:
 		break;
 
+	case CPU_74K:
+		/*
+		 * Early versions of the 74k do not update
+		 * the cache tags on a vtag miss/ptag hit
+		 * which can occur in the case of KSEG0/KUSEG aliases
+		 * In this case it is better to treat the cache as always
+		 * having aliases
+		 */
+		if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0))
+			c->dcache.flags |= MIPS_CACHE_VTAG;
+		if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0))
+			write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
+		if (((c->processor_id & 0xff00) == PRID_IMP_1074K) &&
+		   ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) {
+			c->dcache.flags |= MIPS_CACHE_VTAG;
+			write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
+		}
+		/* fall through */
 	case CPU_24K:
 	case CPU_34K:
-	case CPU_74K:
 	case CPU_1004K:
 		if ((read_c0_config7() & (1 << 16))) {
 			/* effectively physically indexed dcache,
@@ -1061,6 +1078,7 @@ static void __cpuinit probe_pcache(void)
 			c->dcache.flags |= MIPS_CACHE_PINDEX;
 			break;
 		}
+		/* fall through */
 	default:
 		if (c->dcache.waysize > PAGE_SIZE)
 			c->dcache.flags |= MIPS_CACHE_ALIASES;
arch/mips/oprofile/op_model_mipsxx.c +0 -6
index 54759f1..53bbe55 100644
@@ -330,12 +330,6 @@ static int __init mipsxx_init(void)
 		break;
 
 	case CPU_1004K:
-#if 0
-		/* FIXME: report as 34K for now */
-		op_model_mipsxx_ops.cpu_type = "mips/1004K";
-		break;
-#endif
-
 	case CPU_34K:
 		op_model_mipsxx_ops.cpu_type = "mips/34K";
 		break;
Signature · 1 line
1.7.10
#1 lore raw

Hello.

Quoted 5 lines · Steven J. Hill

From: "Steven J. Hill"<[email protected]>

This patch adds support for detecting and using 1074K cores.

[...]

Quoted 14 lines
arch/mips/mm/c-r4k.c +1 -1
index bda8eb2..c646a79 100644
@@ -977,7 +977,7 @@ static void __cpuinit probe_pcache(void)
  			c->icache.linesz = 2<<  lsize;
  		else
  			c->icache.linesz = lsize;
-		c->icache.sets = 64<<  ((config1>>  22)&  7);
+		c->icache.sets = 32<<  (((config1>>  22) + 1)&  7);
  		c->icache.ways = 1 + ((config1>>  16)&  7);
 
  		icache_size = c->icache.sets *

arch/mips/mm/c-r4k.c static void __cpuinit probe_pcache(void) · line 1001

Quoted 6 lines
arch/mips/mm/c-r4k.c +1 -1
@@ -997,7 +997,7 @@ static void __cpuinit probe_pcache(void)
  			c->dcache.linesz = 2<<  lsize;
  		else
  			c->dcache.linesz= lsize;
-		c->dcache.sets = 64<<  ((config1>>  13)&  7);
+		c->dcache.sets = 32<<  (((config1>>  13) + 1)&  7);
  		c->dcache.ways = 1 + ((config1>>  7)&  7);

Are these related changes? They seem common, no 1074K specific...

arch/mips/mm/c-r4k.c static void __cpuinit probe_pcache(void) · line 1056

Quoted 7 lines
arch/mips/mm/c-r4k.c +3 -0
@@ -1051,9 +1051,26 @@ static void __cpuinit probe_pcache(void)
  	case CPU_R14000:
  		break;
 
+	case CPU_74K:
+		/*
+		 * Early versions of the 74k do not update

Early versions of 74K and 1074K? Shouldn't this be a sperate patch?

Quoted 26 lines
arch/mips/mm/c-r4k.c +15 -1
+		 * the cache tags on a vtag miss/ptag hit
+		 * which can occur in the case of KSEG0/KUSEG aliases
+		 * In this case it is better to treat the cache as always
+		 * having aliases
+		 */
+		if ((c->processor_id&  0xff)<= PRID_REV_ENCODE_332(2, 4, 0))
+			c->dcache.flags |= MIPS_CACHE_VTAG;
+		if ((c->processor_id&  0xff) == PRID_REV_ENCODE_332(2, 4, 0))
+			write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
+		if (((c->processor_id&  0xff00) == PRID_IMP_1074K)&&
+		   ((c->processor_id&  0xff)<= PRID_REV_ENCODE_332(1, 1, 0))) {
+			c->dcache.flags |= MIPS_CACHE_VTAG;
+			write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
+		}
+		/* fall through */
  	case CPU_24K:
  	case CPU_34K:
-	case CPU_74K:
  	case CPU_1004K:
  		if ((read_c0_config7()&  (1<<  16))) {
  			/* effectively physically indexed dcache,
arch/mips/oprofile/op_model_mipsxx.c +0 -0
index 54759f1..53bbe55 100644

arch/mips/oprofile/op_model_mipsxx.c static int __init mipsxx_init(void) · line 338

Quoted 9 lines
arch/mips/oprofile/op_model_mipsxx.c +0 -6
@@ -330,12 +330,6 @@ static int __init mipsxx_init(void)
  		break;
 
  	case CPU_1004K:
-#if 0
-		/* FIXME: report as 34K for now */
-		op_model_mipsxx_ops.cpu_type = "mips/1004K";
-		break;
-#endif
-

Unrelated change.

WBR, Sergei

#2 lore raw

I have cleaned up this patch for 1074K change only. The code that is refactored for 74K is part of the 1074K support. 1074K is a multi-cored 74K and thus the changes are necessary.

-Steve