Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/machdep.c
| Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Lines | parse_metadata(void) | ||||
| vm_offset_t lastaddr; | vm_offset_t lastaddr; | ||||
| #ifdef DDB | #ifdef DDB | ||||
| vm_offset_t ksym_start, ksym_end; | vm_offset_t ksym_start, ksym_end; | ||||
| #endif | #endif | ||||
| char *kern_envp; | char *kern_envp; | ||||
| /* Initialize preload_kmdp */ | /* Initialize preload_kmdp */ | ||||
| preload_initkmdp(true); | preload_initkmdp(true); | ||||
| sched_instance_select(); | |||||
| /* link_elf_ireloc(); */ | |||||
| /* Read the boot metadata */ | /* Read the boot metadata */ | ||||
| boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); | boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); | ||||
| lastaddr = MD_FETCH(preload_kmdp, MODINFOMD_KERNEND, vm_offset_t); | lastaddr = MD_FETCH(preload_kmdp, MODINFOMD_KERNEND, vm_offset_t); | ||||
| kern_envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); | kern_envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); | ||||
| if (kern_envp != NULL) | if (kern_envp != NULL) | ||||
| init_static_kenv(kern_envp, 0); | init_static_kenv(kern_envp, 0); | ||||
| else | else | ||||
| ▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | #ifdef FDT | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* | /* | ||||
| * Identify CPU/ISA features. | * Identify CPU/ISA features. | ||||
| */ | */ | ||||
| identify_cpu(0); | identify_cpu(0); | ||||
| sched_instance_select(); | |||||
imp: why'd you move this? | |||||
olceUnsubmitted Done Inline ActionsIMHO, sched_instance_select(), and even more the now uncommented link_elf_ireloc(), were misplaced for RISC V and have no real business in parse_metadata(). Elf relocs presumably must happen after the CPU has been identified, as selection functions need that info to choose the most performant variant given what the CPU reports. This is actually what we are doing in amd64. I'd also bet that sched_instance_select() needs to be after init_static_kenv() to work as intended, so basically after parse_metadata(). olce: IMHO, `sched_instance_select()`, and even more the now uncommented `link_elf_ireloc()`, were… | |||||
mhorneAuthorUnsubmitted Done Inline ActionsYes, as @olce says it can be run a little later, and after identify_cpu(0) makes much more information available to the resolvers. I'll note the move in the commit message. mhorne: Yes, as @olce says it can be run a little later, and after `identify_cpu(0)` makes much more… | |||||
| link_elf_ireloc(); | |||||
| /* Do basic tuning, hz etc */ | /* Do basic tuning, hz etc */ | ||||
| init_param1(); | init_param1(); | ||||
| /* Bootstrap enough of pmap to enter the kernel proper */ | /* Bootstrap enough of pmap to enter the kernel proper */ | ||||
| kernlen = (lastaddr - KERNBASE); | kernlen = (lastaddr - KERNBASE); | ||||
| pmap_bootstrap(rvbp->kern_phys, kernlen); | pmap_bootstrap(rvbp->kern_phys, kernlen); | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||
why'd you move this?