39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From 184b2f4dd43dfbec64654ba9dce6aa6645717ca1 Mon Sep 17 00:00:00 2001
|
|
From: Renat Sabitov <r.sabitov@gmail.com>
|
|
Date: Thu, 2 Nov 2023 22:03:05 +1000
|
|
Subject: [PATCH] Fixed RISCV T-Head 1520 CPU identification
|
|
|
|
---
|
|
src/cpu/cpu.cpp | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
|
|
index eb1578d9..ca1e3a74 100644
|
|
--- a/src/cpu/cpu.cpp
|
|
+++ b/src/cpu/cpu.cpp
|
|
@@ -174,6 +174,8 @@ static void handle_one_cpu(unsigned int number, char *vendor, int family, int mo
|
|
file.open(filename, ios::in);
|
|
if (file) {
|
|
file >> core_number;
|
|
+ if (core_number == (unsigned int) -1)
|
|
+ core_number = number;
|
|
file.close();
|
|
}
|
|
|
|
@@ -300,11 +302,13 @@ void enumerate_cpus(void)
|
|
}
|
|
/* on x86 and others 'bogomips' is last
|
|
* on ARM it *can* be bogomips, or 'CPU revision'
|
|
- * on POWER, it's revision
|
|
+ * on POWER, it's 'revision'
|
|
+ * on RISCV64 it's 'isa'
|
|
*/
|
|
if (strncasecmp(line, "bogomips\t", 9) == 0
|
|
|| strncasecmp(line, "CPU revision\t", 13) == 0
|
|
- || strncmp(line, "revision", 8) == 0) {
|
|
+ || strncmp(line, "revision", 8) == 0
|
|
+ || strncmp(line, "isa\t", 4) == 0) {
|
|
if (number == -1) {
|
|
/* Not all /proc/cpuinfo include "processor\t". */
|
|
number = 0;
|