Skip to content

Commit 0b144c8

Browse files
vlsunilpalmer-dabbelt
authored andcommitted
RISC-V: cpu: Enable cpuinfo for ACPI systems
On ACPI based platforms, few details like ISA need to be read from the ACPI table. Enable cpuinfo on ACPI based systems. ACPI has nothing similar to DT compatible property for each CPU. Hence, cpuinfo will not print "uarch". Signed-off-by: Sunil V L <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 396c018 commit 0b144c8

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

arch/riscv/kernel/cpu.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
* Copyright (C) 2012 Regents of the University of California
44
*/
55

6+
#include <linux/acpi.h>
67
#include <linux/cpu.h>
78
#include <linux/init.h>
89
#include <linux/seq_file.h>
910
#include <linux/of.h>
11+
#include <asm/acpi.h>
1012
#include <asm/cpufeature.h>
1113
#include <asm/csr.h>
1214
#include <asm/hwcap.h>
@@ -283,23 +285,35 @@ static void c_stop(struct seq_file *m, void *v)
283285
static int c_show(struct seq_file *m, void *v)
284286
{
285287
unsigned long cpu_id = (unsigned long)v - 1;
286-
struct device_node *node = of_get_cpu_node(cpu_id, NULL);
287288
struct riscv_cpuinfo *ci = per_cpu_ptr(&riscv_cpuinfo, cpu_id);
289+
struct device_node *node;
288290
const char *compat, *isa;
289291

290292
seq_printf(m, "processor\t: %lu\n", cpu_id);
291293
seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hartid_map(cpu_id));
292-
if (!of_property_read_string(node, "riscv,isa", &isa))
293-
print_isa(m, isa);
294-
print_mmu(m);
295-
if (!of_property_read_string(node, "compatible", &compat)
296-
&& strcmp(compat, "riscv"))
297-
seq_printf(m, "uarch\t\t: %s\n", compat);
294+
295+
if (acpi_disabled) {
296+
node = of_get_cpu_node(cpu_id, NULL);
297+
if (!of_property_read_string(node, "riscv,isa", &isa))
298+
print_isa(m, isa);
299+
300+
print_mmu(m);
301+
if (!of_property_read_string(node, "compatible", &compat) &&
302+
strcmp(compat, "riscv"))
303+
seq_printf(m, "uarch\t\t: %s\n", compat);
304+
305+
of_node_put(node);
306+
} else {
307+
if (!acpi_get_riscv_isa(NULL, cpu_id, &isa))
308+
print_isa(m, isa);
309+
310+
print_mmu(m);
311+
}
312+
298313
seq_printf(m, "mvendorid\t: 0x%lx\n", ci->mvendorid);
299314
seq_printf(m, "marchid\t\t: 0x%lx\n", ci->marchid);
300315
seq_printf(m, "mimpid\t\t: 0x%lx\n", ci->mimpid);
301316
seq_puts(m, "\n");
302-
of_node_put(node);
303317

304318
return 0;
305319
}

0 commit comments

Comments
 (0)