Skip to content

Commit 732e8e4

Browse files
andreas-schwabpalmer-dabbelt
authored andcommitted
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>
1 parent d26c4bb commit 732e8e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

arch/riscv/kernel/cpufeature.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool has_fpu __read_mostly;
2828

2929
void riscv_fill_hwcap(void)
3030
{
31-
struct device_node *node;
31+
struct device_node *node = NULL;
3232
const char *isa;
3333
size_t i;
3434
static unsigned long isa2hwcap[256] = {0};
@@ -44,9 +44,11 @@ void riscv_fill_hwcap(void)
4444

4545
/*
4646
* 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.
4848
*/
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;
5052
if (!node) {
5153
pr_warning("Unable to find \"cpu\" devicetree entry");
5254
return;

0 commit comments

Comments
 (0)