diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -89,6 +89,7 @@ void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cpu(void); +void identify_cpu_report(void); static __inline uint64_t get_cyclecount(void) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -372,6 +372,15 @@ void identify_cpu(void) +{ + struct cpu_desc *desc = &cpu_desc[PCPU_GET(cpuid)]; + + identify_cpu_vendor(desc); + identify_cpu_microarch(desc); +} + +void +identify_cpu_report(void) { struct cpu_desc *desc; u_int cpu, hart; @@ -380,9 +389,6 @@ hart = PCPU_GET(hart); desc = &cpu_desc[cpu]; - identify_cpu_vendor(desc); - identify_cpu_microarch(desc); - /* Print details for boot CPU or if we want verbose output */ if (cpu == 0 || bootverbose) { printf("CPU %d: Hart %d\n" diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -131,7 +131,7 @@ { sbi_print_version(); - identify_cpu(); + identify_cpu_report(); printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem), ptoa((uintmax_t)realmem) / (1024 * 1024)); @@ -539,6 +539,11 @@ physmem_hardware_regions(mem_regions, mem_regions_sz); #endif + /* + * Identify CPU/ISA features. + */ + identify_cpu(); + /* Do basic tuning, hz etc */ init_param1(); diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -282,6 +282,13 @@ atomic_store_rel_int(&smp_started, 1); } + /* + * Announce the CPU. This is done inside the spinlock so that APs don't + * trample on each others' output. In the !bootverbose case this + * function returns immediately. + */ + identify_cpu_report(); + mtx_unlock_spin(&ap_boot_mtx); /* Enter the scheduler */