aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2018-10-23 03:33:47 -0400
committerPalmer Dabbelt <palmer@sifive.com>2018-10-31 15:13:43 -0400
commit732e8e4130ffccb618390e0f80a884543e61fd61 (patch)
tree49654d9e8c7afcb00c220a99262f6f3faf7df857
parentd26c4bbf992463c043fdee4b3e5efa3f08990862 (diff)
RISC-V: properly determine hardware caps
On the Hifive-U platform, cpu 0 is a masked cpu with less capabilities than the other cpus. Ignore it for the purpose of determining the hardware capabilities of the system. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r--arch/riscv/kernel/cpufeature.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index 5493f3228704..0339087aa652 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -28,7 +28,7 @@ bool has_fpu __read_mostly;
28 28
29void riscv_fill_hwcap(void) 29void riscv_fill_hwcap(void)
30{ 30{
31 struct device_node *node; 31 struct device_node *node = NULL;
32 const char *isa; 32 const char *isa;
33 size_t i; 33 size_t i;
34 static unsigned long isa2hwcap[256] = {0}; 34 static unsigned long isa2hwcap[256] = {0};
@@ -44,9 +44,11 @@ void riscv_fill_hwcap(void)
44 44
45 /* 45 /*
46 * We don't support running Linux on hertergenous ISA systems. For 46 * We don't support running Linux on hertergenous ISA systems. For
47 * now, we just check the ISA of the first processor. 47 * now, we just check the ISA of the first "okay" processor.
48 */ 48 */
49 node = of_find_node_by_type(NULL, "cpu"); 49 while ((node = of_find_node_by_type(node, "cpu")))
50 if (riscv_of_processor_hartid(node) >= 0)
51 break;
50 if (!node) { 52 if (!node) {
51 pr_warning("Unable to find \"cpu\" devicetree entry"); 53 pr_warning("Unable to find \"cpu\" devicetree entry");
52 return; 54 return;