Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/aim/mmu_oea64.c
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/rwlock.h> | #include <sys/rwlock.h> | ||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/vmmeter.h> | #include <sys/vmmeter.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/reboot.h> | |||||
#include <sys/kdb.h> | #include <sys/kdb.h> | ||||
#include <dev/ofw/openfirm.h> | #include <dev/ofw/openfirm.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <vm/vm_kern.h> | #include <vm/vm_kern.h> | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* PVO data. | * PVO data. | ||||
*/ | */ | ||||
uma_zone_t moea64_pvo_zone; /* zone for pvo entries */ | uma_zone_t moea64_pvo_zone; /* zone for pvo entries */ | ||||
static struct pvo_entry *moea64_bpvo_pool; | static struct pvo_entry *moea64_bpvo_pool; | ||||
static int moea64_bpvo_pool_index = 0; | static int moea64_bpvo_pool_index = 0; | ||||
static int moea64_bpvo_pool_size = 327680; | static int moea64_bpvo_pool_size = 0; | ||||
SYSCTL_INT(_machdep, OID_AUTO, moea64_allocated_bpvo_entries, CTLFLAG_RD, | SYSCTL_INT(_machdep, OID_AUTO, moea64_allocated_bpvo_entries, CTLFLAG_RD, | ||||
&moea64_bpvo_pool_index, 0, ""); | &moea64_bpvo_pool_index, 0, ""); | ||||
#define BPVO_POOL_SIZE 327680 /* Sensible historical default value */ | |||||
#define BPVO_POOL_EXPANSION_FACTOR 3 | |||||
#define VSID_NBPW (sizeof(u_int32_t) * 8) | #define VSID_NBPW (sizeof(u_int32_t) * 8) | ||||
#ifdef __powerpc64__ | #ifdef __powerpc64__ | ||||
#define NVSIDS (NPMAPS * 16) | #define NVSIDS (NPMAPS * 16) | ||||
#define VSID_HASHMASK 0xffffffffUL | #define VSID_HASHMASK 0xffffffffUL | ||||
#else | #else | ||||
#define NVSIDS NPMAPS | #define NVSIDS NPMAPS | ||||
#define VSID_HASHMASK 0xfffffUL | #define VSID_HASHMASK 0xfffffUL | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 712 Lines • ▼ Show 20 Lines | moea64_mid_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) | ||||
mtx_init(&moea64_slb_mutex, "SLB table", NULL, MTX_DEF); | mtx_init(&moea64_slb_mutex, "SLB table", NULL, MTX_DEF); | ||||
for (i = 0; i < PV_LOCK_COUNT; i++) | for (i = 0; i < PV_LOCK_COUNT; i++) | ||||
mtx_init(&pv_lock[i], "page pv", NULL, MTX_DEF); | mtx_init(&pv_lock[i], "page pv", NULL, MTX_DEF); | ||||
/* | /* | ||||
* Initialise the bootstrap pvo pool. | * Initialise the bootstrap pvo pool. | ||||
*/ | */ | ||||
TUNABLE_INT_FETCH("machdep.moea64_bpvo_pool_size", &moea64_bpvo_pool_size); | TUNABLE_INT_FETCH("machdep.moea64_bpvo_pool_size", &moea64_bpvo_pool_size); | ||||
if (moea64_bpvo_pool_size == 0) { | |||||
jhibbits: This needs to be a '== 0', since moea64_bpvo_pool_size is an integer used as an integer, not a… | |||||
if (!hw_direct_map) | |||||
moea64_bpvo_pool_size = ((ptoa((uintmax_t)physmem) * sizeof(struct vm_page)) / | |||||
Done Inline ActionsIt seems you are indenting with 2 spaces, but tabs should be used instead, except when you wrap long statements (as in the line below), then you should add 4 spaces. luporl: It seems you are indenting with 2 spaces, but tabs should be used instead, except when you wrap… | |||||
(PAGE_SIZE * PAGE_SIZE)) * BPVO_POOL_EXPANSION_FACTOR; | |||||
else | |||||
moea64_bpvo_pool_size = BPVO_POOL_SIZE; | |||||
Done Inline ActionsI'd make the 327680 a #define, commented that it's a sane historical default. jhibbits: I'd make the 327680 a #define, commented that it's a sane historical default. | |||||
} | |||||
Done Inline ActionsI think would be good print a message containing pool size and memory used by this pool when kernel boots is in verbose mode (boot -v). if (bootverbose) printf(".....\n"); alfredo: I think would be good print a message containing pool size and memory used by this pool when… | |||||
Done Inline ActionsGood idea, thanks. afscoelho_gmail.com: Good idea, thanks. | |||||
Done Inline ActionsIt looks like it's not possible to use 'bootverbose' at this stage of the boot. This variable is set later by init_main.c:129. afscoelho_gmail.com: It looks like it's not possible to use 'bootverbose' at this stage of the boot. This variable… | |||||
Done Inline Actions(boothowto & RB_VERBOSE) does the same thing, and should be available almost immediately. jhibbits: (boothowto & RB_VERBOSE) does the same thing, and should be available almost immediately. | |||||
if (boothowto & RB_VERBOSE) { | |||||
printf("mmu_oea64: bpvo pool entries = %d, bpvo pool size = %ju MB\n", | |||||
moea64_bpvo_pool_size, | |||||
moea64_bpvo_pool_size*sizeof(struct pvo_entry) / 1048576); | |||||
} | |||||
moea64_bpvo_pool = (struct pvo_entry *)moea64_bootstrap_alloc( | moea64_bpvo_pool = (struct pvo_entry *)moea64_bootstrap_alloc( | ||||
moea64_bpvo_pool_size*sizeof(struct pvo_entry), PAGE_SIZE); | moea64_bpvo_pool_size*sizeof(struct pvo_entry), PAGE_SIZE); | ||||
moea64_bpvo_pool_index = 0; | moea64_bpvo_pool_index = 0; | ||||
/* Place at address usable through the direct map */ | /* Place at address usable through the direct map */ | ||||
if (hw_direct_map) | if (hw_direct_map) | ||||
moea64_bpvo_pool = (struct pvo_entry *) | moea64_bpvo_pool = (struct pvo_entry *) | ||||
PHYS_TO_DMAP((uintptr_t)moea64_bpvo_pool); | PHYS_TO_DMAP((uintptr_t)moea64_bpvo_pool); | ||||
▲ Show 20 Lines • Show All 2,203 Lines • Show Last 20 Lines |
This needs to be a '== 0', since moea64_bpvo_pool_size is an integer used as an integer, not a boolean.