Changeset View
Standalone View
sys/powerpc/aim/aim_machdep.c
Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | if (cacheline_warn == 1) { | ||||
printf("WARNING: cacheline size undetermined, setting to 32\n"); | printf("WARNING: cacheline size undetermined, setting to 32\n"); | ||||
} | } | ||||
/* | /* | ||||
* Initialise virtual memory. Use BUS_PROBE_GENERIC priority | * Initialise virtual memory. Use BUS_PROBE_GENERIC priority | ||||
* in case the platform module had a better idea of what we | * in case the platform module had a better idea of what we | ||||
* should do. | * should do. | ||||
*/ | */ | ||||
if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { | |||||
radix_mmu = 0; | |||||
TUNABLE_INT_FETCH("radix_mmu", &radix_mmu); | |||||
if (radix_mmu) | if (radix_mmu) | ||||
pmap_mmu_install(MMU_TYPE_RADIX, BUS_PROBE_GENERIC); | pmap_mmu_install(MMU_TYPE_RADIX, BUS_PROBE_GENERIC); | ||||
else | else if (cpu_features & PPC_FEATURE_64) | ||||
pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); | pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); | ||||
} else if (cpu_features & PPC_FEATURE_64) | |||||
pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); | |||||
else | else | ||||
pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); | pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); | ||||
} | } | ||||
/* | /* | ||||
* Shutdown the CPU as much as possible. | * Shutdown the CPU as much as possible. | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
uint64_t | uint64_t | ||||
va_to_vsid(pmap_t pm, vm_offset_t va) | va_to_vsid(pmap_t pm, vm_offset_t va) | ||||
{ | { | ||||
return ((pm->pm_sr[(uintptr_t)va >> ADDR_SR_SHFT]) & SR_VSID_MASK); | return ((pm->pm_sr[(uintptr_t)va >> ADDR_SR_SHFT]) & SR_VSID_MASK); | ||||
} | } | ||||
#endif | #endif | ||||
void | |||||
pmap_early_io_map_init(void) | |||||
{ | |||||
if ((cpu_features2 & PPC_FEATURE2_ARCH_3_00) == 0) | |||||
jhibbits: Since you're doing this work here, can you simplify aim_cpu_init() above? The end of… | |||||
radix_mmu = 0; | |||||
else | |||||
TUNABLE_INT_FETCH("radix_mmu", &radix_mmu); | |||||
Done Inline ActionsI'd prefer to have "radix_mmu" available for user tunning independent of ISA version. alfredo: I'd prefer to have "radix_mmu" available for user tunning independent of ISA version.
And use… | |||||
Done Inline ActionsThe problem is we can't allow radix_mmu=1 if ARCH is lower than 3.0 (before POWER9). Also, this is basically what previous code was doing, just on an earlier spot. luporl: The problem is we can't allow radix_mmu=1 if ARCH is lower than 3.0 (before POWER9).
Radix is… | |||||
Done Inline ActionsYes, what I meant to say was to leave "radix_mmu" available for user hacking, that could be useful to workaround some problem with CPU feature detection or mismatch in future, custom or virtualized CPUs. Anyway this doesn't make sense of there are other parts that could conflict with with. alfredo: Yes, what I meant to say was to leave "radix_mmu" available for user hacking, that could be… | |||||
/* | /* | ||||
* When using Radix, set the start and end of kva early, to be able to | |||||
* use KVAs on pmap_early_io_map and avoid issues when remapping them | |||||
* later. | |||||
*/ | |||||
if (radix_mmu) { | |||||
virtual_avail = VM_MIN_KERNEL_ADDRESS; | |||||
virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; | |||||
} | |||||
} | |||||
/* | |||||
* These functions need to provide addresses that both (a) work in real mode | * These functions need to provide addresses that both (a) work in real mode | ||||
* (or whatever mode/circumstances the kernel is in in early boot (now)) and | * (or whatever mode/circumstances the kernel is in in early boot (now)) and | ||||
* (b) can still, in principle, work once the kernel is going. Because these | * (b) can still, in principle, work once the kernel is going. Because these | ||||
* rely on existing mappings/real mode, unmap is a no-op. | * rely on existing mappings/real mode, unmap is a no-op. | ||||
*/ | */ | ||||
vm_offset_t | vm_offset_t | ||||
pmap_early_io_map(vm_paddr_t pa, vm_size_t size) | pmap_early_io_map(vm_paddr_t pa, vm_size_t size) | ||||
{ | { | ||||
KASSERT(!pmap_bootstrapped, ("Not available after PMAP started!")); | KASSERT(!pmap_bootstrapped, ("Not available after PMAP started!")); | ||||
/* | /* | ||||
* If we have the MMU up in early boot, assume it is 1:1. Otherwise, | * If we have the MMU up in early boot, assume it is 1:1. Otherwise, | ||||
* try to get the address in a memory region compatible with the | * try to get the address in a memory region compatible with the | ||||
* direct map for efficiency later. | * direct map for efficiency later. | ||||
* Except for Radix MMU, for which current implementation doesn't | |||||
* support mapping arbitrary virtual addresses, such as the ones | |||||
* generated by "direct mapping" I/O addresses. In this case, use | |||||
* addresses from KVA area. | |||||
*/ | */ | ||||
if (mfmsr() & PSL_DR) | if (mfmsr() & PSL_DR) | ||||
return (pa); | return (pa); | ||||
else | else if (radix_mmu) { | ||||
vm_offset_t va; | |||||
va = virtual_avail; | |||||
virtual_avail += round_page(size + pa - trunc_page(pa)); | |||||
return (va); | |||||
} else | |||||
return (DMAP_BASE_ADDRESS + pa); | return (DMAP_BASE_ADDRESS + pa); | ||||
} | } | ||||
void | void | ||||
pmap_early_io_unmap(vm_offset_t va, vm_size_t size) | pmap_early_io_unmap(vm_offset_t va, vm_size_t size) | ||||
{ | { | ||||
KASSERT(!pmap_bootstrapped, ("Not available after PMAP started!")); | KASSERT(!pmap_bootstrapped, ("Not available after PMAP started!")); | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |
Since you're doing this work here, can you simplify aim_cpu_init() above? The end of aim_cpu_init() could change to something like: