Skip to content

Commit b75a22e

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: cpufeature: Do not drop Linux-internal extensions
The Linux-internal Xlinuxenvcfg ISA extension is omitted from the riscv_isa_ext array because it has no DT binding and should not appear in /proc/cpuinfo. The logic added in commit 625034a ("riscv: add ISA extensions validation callback") assumes all extensions are included in riscv_isa_ext, and so riscv_resolve_isa() wrongly drops Xlinuxenvcfg from the final ISA string. Instead, accept such Linux-internal ISA extensions as if they have no validation callback. Fixes: 625034a ("riscv: add ISA extensions validation callback") Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 8400291 commit b75a22e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

arch/riscv/kernel/cpufeature.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,28 +432,26 @@ static void __init riscv_resolve_isa(unsigned long *source_isa,
432432
bitmap_copy(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX);
433433
for_each_set_bit(bit, source_isa, RISCV_ISA_EXT_MAX) {
434434
ext = riscv_get_isa_ext_data(bit);
435-
if (!ext)
436-
continue;
437435

438-
if (ext->validate) {
436+
if (ext && ext->validate) {
439437
ret = ext->validate(ext, resolved_isa);
440438
if (ret == -EPROBE_DEFER) {
441439
loop = true;
442440
continue;
443441
} else if (ret) {
444442
/* Disable the extension entirely */
445-
clear_bit(ext->id, source_isa);
443+
clear_bit(bit, source_isa);
446444
continue;
447445
}
448446
}
449447

450-
set_bit(ext->id, resolved_isa);
448+
set_bit(bit, resolved_isa);
451449
/* No need to keep it in source isa now that it is enabled */
452-
clear_bit(ext->id, source_isa);
450+
clear_bit(bit, source_isa);
453451

454452
/* Single letter extensions get set in hwcap */
455-
if (ext->id < RISCV_ISA_EXT_BASE)
456-
*this_hwcap |= isa2hwcap[ext->id];
453+
if (bit < RISCV_ISA_EXT_BASE)
454+
*this_hwcap |= isa2hwcap[bit];
457455
}
458456
} while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa)));
459457
}

0 commit comments

Comments
 (0)