Skip to contentSkip to conversation

mips: small improvements

PATCH Applied Denis Orlov 2 participants 5 messages Mar 28, 2024 – Apr 2, 2024 MIPS

lore
Share & tools
lore
#0 lore raw

cover mips: small improvements

Denis Orlov (3):
mips: cpuinfo: fix cpu name output for unknown processors
mips: cpu-probe: identify more MIPS CPUs
mips: mipsregs: remove duplicate definitions for Config 1 bits

 arch/mips/include/asm/cpu.h      | 30 +++++++++++++---
 arch/mips/include/asm/mipsregs.h | 12 +++----
 arch/mips/lib/cpu-probe.c        | 61 ++++++++++++++++++++++++++++++--
 3 files changed, 88 insertions(+), 15 deletions(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH 1/3 mips: cpuinfo: fix cpu name output for unknown processors

Otherwise it would output <NULL> as __cpu_name global variable ends up being a null pointer.

---
 arch/mips/lib/cpu-probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/lib/cpu-probe.c +1 -1
index cbde43a595..47c9c671eb 100644
@@ -17,7 +17,7 @@
 #include <asm-generic/memory_layout.h>
 #include <init.h>
 
-const char *__cpu_name;
+const char *__cpu_name = "unknown";
 struct cpuinfo_mips cpu_data[1];
 
 static char unknown_isa[] = KERN_ERR \
Signature · 1 line
2.44.0
#2 lore raw

PATCH 2/3 mips: cpu-probe: identify more MIPS CPUs

In reply to Denis Orlov

This adds support for identifying more CPUs emulatable by QEMU, so that their names are shown when using 'cpuinfo' command.

---
 arch/mips/include/asm/cpu.h | 30 +++++++++++++++----
 arch/mips/lib/cpu-probe.c   | 59 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 6 deletions(-)
arch/mips/include/asm/cpu.h +25 -5
index 155e254a81..7fba0b77df 100644
@@ -51,9 +51,25 @@
  * These are the PRID's for when 23:16 == PRID_COMP_MIPS
  */
 
+#define PRID_IMP_QEMU_GENERIC	0x0000
+#define PRID_IMP_4KC		0x8000
+#define PRID_IMP_5KC		0x8100
+#define PRID_IMP_20KC		0x8200
+#define PRID_IMP_4KEC		0x8400
+#define PRID_IMP_4KSC		0x8600
+#define PRID_IMP_25KF		0x8800
+#define PRID_IMP_5KE		0x8900
+#define PRID_IMP_4KECR2		0x9000
+#define PRID_IMP_4KEMPR2	0x9100
+#define PRID_IMP_4KSD		0x9200
 #define PRID_IMP_24K		0x9300
+#define PRID_IMP_34K		0x9500
 #define PRID_IMP_24KE		0x9600
 #define PRID_IMP_74K		0x9700
+#define PRID_IMP_1004K		0x9900
+#define PRID_IMP_1074K		0x9a00
+#define PRID_IMP_M14KC		0x9c00
+#define PRID_IMP_M14KEC		0x9e00
 
 /*
  * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
@@ -107,11 +123,15 @@ enum cpu_type_enum {
 	/*
 	 * MIPS32 class processors
 	 */
-	CPU_24K,
-	CPU_74K,
-	CPU_BMIPS3300,
-	CPU_JZRISC,
-	CPU_GS232,
+	CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
+	CPU_M14KC, CPU_M14KEC, CPU_1074K, CPU_BMIPS3300, CPU_JZRISC, CPU_GS232,
+
+	/*
+	 * MIPS64 class processors
+	 */
+	CPU_5KC, CPU_5KE, CPU_20KC, CPU_25KF,
+
+	CPU_QEMU_GENERIC,
 
 	CPU_LAST
 };
arch/mips/lib/cpu-probe.c +58 -1

73 lines not on this page · raw message

Signature · 1 line
2.44.0
#3 lore raw

PATCH 3/3 mips: mipsregs: remove duplicate definitions for Config 1 bits

In reply to Denis Orlov

Also reorder some of them to be more uniform.

---
 arch/mips/include/asm/mipsregs.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/mips/include/asm/mipsregs.h +4 -8
index 9e7d656542..0b618320ff 100644
@@ -406,18 +406,14 @@
 #define MIPS_CONF1_PC		(_ULCAST_(1) <<  4)
 #define MIPS_CONF1_MD		(_ULCAST_(1) <<  5)
 #define MIPS_CONF1_C2		(_ULCAST_(1) <<  6)
-#define MIPS_CONF1_DA_SHF	7
-#define MIPS_CONF1_DA		(_ULCAST_(7) <<  7)
-#define MIPS_CONF1_DL_SHF	10
-#define MIPS_CONF1_DL		(_ULCAST_(7) << 10)
-#define MIPS_CONF1_DS_SHF	13
-#define MIPS_CONF1_DS		(_ULCAST_(7) << 13)
-#define MIPS_CONF1_IA_SHF	16
-
 #define MIPS_CONF1_DA		(_ULCAST_(7) <<  7)
+#define MIPS_CONF1_DA_SHF	7
 #define MIPS_CONF1_DL		(_ULCAST_(7) << 10)
+#define MIPS_CONF1_DL_SHF	10
 #define MIPS_CONF1_DS		(_ULCAST_(7) << 13)
+#define MIPS_CONF1_DS_SHF	13
 #define MIPS_CONF1_IA		(_ULCAST_(7) << 16)
+#define MIPS_CONF1_IA_SHF	16
 #define MIPS_CONF1_IL		(_ULCAST_(7) << 19)
 #define MIPS_CONF1_IS		(_ULCAST_(7) << 22)
 #define MIPS_CONF1_TLBS		(_ULCAST_(63)<< 25)
Signature · 1 line
2.44.0
Applied
#4 lore raw
In reply to Denis Orlov
Quoted 11 lines · Denis Orlov

Denis Orlov (3):
mips: cpuinfo: fix cpu name output for unknown processors
mips: cpu-probe: identify more MIPS CPUs
mips: mipsregs: remove duplicate definitions for Config 1 bits

arch/mips/include/asm/cpu.h | 30 +++++++++++++---

 arch/mips/include/asm/mipsregs.h | 12 +++----
 arch/mips/lib/cpu-probe.c        | 61 ++++++++++++++++++++++++++++++--
 3 files changed, 88 insertions(+), 15 deletions(-)

[...]

Applied, thanks!

[1/3] mips: cpuinfo: fix cpu name output for unknown processors
https://git.pengutronix.de/cgit/barebox/commit/?id=4fe0614f65c2 (link may not be stable)
[2/3] mips: cpu-probe: identify more MIPS CPUs
https://git.pengutronix.de/cgit/barebox/commit/?id=e8f9bc9ea42a (link may not be stable)
[3/3] mips: mipsregs: remove duplicate definitions for Config 1 bits
https://git.pengutronix.de/cgit/barebox/commit/?id=63d38f891a9c (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>