Subject: Re: CVS [email-masked]: linux

From: "Maciej W. Rozycki" <[email-masked]>
Date: Fri, 6 May 2005 15:51:25 +0100 (BST)

On Fri, 6 May 2005 [email-masked] wrote:

> CVSROOT:	/home/cvs
> Module name:	linux
> Changes by:	[email-masked]	05/05/06 15:31:13
> 
> Modified files:
> 	arch/mips/kernel: cpu-probe.c 
> 
> Log message:
> 	No point in checking cpu_has_tlb before we've computed the CPU options.

 ???  decode_config0() sets up the CPU option in question, so doing a 
check after decode_configs() is fine.

> 	So for now we just unconditionally set the option - Linux wouldn't
> 	work without a TLB anyway.

 I don't like the idea -- bits shouldn't be scattered all over the place, 
so that all the places need to be chased and fixed once conditions change.  

 Instead of polluting all the cpu_probe_*() functions, it should actually 
be moved to decode_config0().  I can apply a suitable fix.

  Maciej

---

From: "Maciej W. Rozycki" <[email-masked]>
Date: Fri, 6 May 2005 19:41:53 +0100 (BST)

> be moved to decode_config0().  I can apply a suitable fix.

 How about this?

  Maciej

patch-mips-2.6.12-rc3-20050506-4ktlb-0
Index: arch/mips/kernel/cpu-probe.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/cpu-probe.c,v
retrieving revision 1.46
diff -u -p -r1.46 cpu-probe.c
--- arch/mips/kernel/cpu-probe.c	6 May 2005 14:31:13 -0000	1.46
+++ arch/mips/kernel/cpu-probe.c	6 May 2005 18:10:01 -0000
@@ -429,7 +429,7 @@ static inline unsigned int decode_config
 	config0 = read_c0_config();
 
 	if (((config0 & MIPS_CONF_MT) >> 7) == 1)
-		c->options |= MIPS_CPU_TLB;
+		c->options |= MIPS_CPU_TLB | MIPS_CPU_4KTLB;
 	isa = (config0 & MIPS_CONF_AT) >> 13;
 	switch (isa) {
 	case 0:
@@ -515,7 +515,6 @@ static inline void decode_configs(struct
 static inline void cpu_probe_mips(struct cpuinfo_mips *c)
 {
 	decode_configs(c);
-	c->options |= MIPS_CPU_4KTLB;
 	switch (c->processor_id & 0xff00) {
 	case PRID_IMP_4KC:
 		c->cputype = CPU_4KC;
@@ -549,7 +548,6 @@ static inline void cpu_probe_mips(struct
 static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
 {
 	decode_configs(c);
-	c->options |= MIPS_CPU_4KTLB;
 	switch (c->processor_id & 0xff00) {
 	case PRID_IMP_AU1_REV1:
 	case PRID_IMP_AU1_REV2:
@@ -580,7 +578,6 @@ static inline void cpu_probe_alchemy(str
 static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
 {
 	decode_configs(c);
-	c->options |= MIPS_CPU_4KTLB;
 	switch (c->processor_id & 0xff00) {
 	case PRID_IMP_SB1:
 		c->cputype = CPU_SB1;
@@ -595,7 +592,6 @@ static inline void cpu_probe_sibyte(stru
 static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
 {
 	decode_configs(c);
-	c->options |= MIPS_CPU_4KTLB;
 	switch (c->processor_id & 0xff00) {
 	case PRID_IMP_SR71000:
 		c->cputype = CPU_SR71000;