Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/pseries/mmu_phyp.c
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
#define dprintf0(fmt, ...) dprintf(MMU_PHYP_ID fmt, ## __VA_ARGS__) | #define dprintf0(fmt, ...) dprintf(MMU_PHYP_ID fmt, ## __VA_ARGS__) | ||||
#else | #else | ||||
#define dprintf(fmt, args...) do { ; } while(0) | #define dprintf(fmt, args...) do { ; } while(0) | ||||
#define dprintf0(fmt, args...) do { ; } while(0) | #define dprintf0(fmt, args...) do { ; } while(0) | ||||
#endif | #endif | ||||
static struct rmlock mphyp_eviction_lock; | static struct rmlock mphyp_eviction_lock; | ||||
static struct dump_context { | |||||
u_long ptex; | |||||
u_long ptex_end; | |||||
size_t blksz; | |||||
} dump_ctx; | |||||
/* | /* | ||||
* Kernel MMU interface | * Kernel MMU interface | ||||
*/ | */ | ||||
static void mphyp_bootstrap(mmu_t mmup, vm_offset_t kernelstart, | static void mphyp_bootstrap(mmu_t mmup, vm_offset_t kernelstart, | ||||
vm_offset_t kernelend); | vm_offset_t kernelend); | ||||
static void mphyp_cpu_bootstrap(mmu_t mmup, int ap); | static void mphyp_cpu_bootstrap(mmu_t mmup, int ap); | ||||
static void *mphyp_dump_pmap_init(mmu_t mmup, unsigned blkpgs); | |||||
static u_long mphyp_dump_pmap(mmu_t mmup, void *ctx, void *buf); | |||||
static int64_t mphyp_pte_synch(mmu_t, struct pvo_entry *pvo); | static int64_t mphyp_pte_synch(mmu_t, struct pvo_entry *pvo); | ||||
static int64_t mphyp_pte_clear(mmu_t, struct pvo_entry *pvo, uint64_t ptebit); | static int64_t mphyp_pte_clear(mmu_t, struct pvo_entry *pvo, uint64_t ptebit); | ||||
static int64_t mphyp_pte_unset(mmu_t, struct pvo_entry *pvo); | static int64_t mphyp_pte_unset(mmu_t, struct pvo_entry *pvo); | ||||
static int mphyp_pte_insert(mmu_t, struct pvo_entry *pvo); | static int mphyp_pte_insert(mmu_t, struct pvo_entry *pvo); | ||||
static mmu_method_t mphyp_methods[] = { | static mmu_method_t mphyp_methods[] = { | ||||
MMUMETHOD(mmu_bootstrap, mphyp_bootstrap), | MMUMETHOD(mmu_bootstrap, mphyp_bootstrap), | ||||
MMUMETHOD(mmu_cpu_bootstrap, mphyp_cpu_bootstrap), | MMUMETHOD(mmu_cpu_bootstrap, mphyp_cpu_bootstrap), | ||||
MMUMETHOD(mmu_dump_pmap_init, mphyp_dump_pmap_init), | |||||
MMUMETHOD(mmu_dump_pmap, mphyp_dump_pmap), | |||||
MMUMETHOD(moea64_pte_synch, mphyp_pte_synch), | MMUMETHOD(moea64_pte_synch, mphyp_pte_synch), | ||||
MMUMETHOD(moea64_pte_clear, mphyp_pte_clear), | MMUMETHOD(moea64_pte_clear, mphyp_pte_clear), | ||||
MMUMETHOD(moea64_pte_unset, mphyp_pte_unset), | MMUMETHOD(moea64_pte_unset, mphyp_pte_unset), | ||||
MMUMETHOD(moea64_pte_insert, mphyp_pte_insert), | MMUMETHOD(moea64_pte_insert, mphyp_pte_insert), | ||||
/* XXX: pmap_copy_page, pmap_init_page with H_PAGE_INIT */ | /* XXX: pmap_copy_page, pmap_init_page with H_PAGE_INIT */ | ||||
▲ Show 20 Lines • Show All 403 Lines • ▼ Show 20 Lines | mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo) | ||||
pvo->pvo_pte.slot = index; | pvo->pvo_pte.slot = index; | ||||
if (result == H_SUCCESS) | if (result == H_SUCCESS) | ||||
return (0); | return (0); | ||||
panic("Page replacement error: %ld", result); | panic("Page replacement error: %ld", result); | ||||
return (result); | return (result); | ||||
} | } | ||||
static void * | |||||
mphyp_dump_pmap_init(mmu_t mmu, unsigned blkpgs) | |||||
{ | |||||
dump_ctx.ptex = 0; | |||||
dump_ctx.ptex_end = moea64_pteg_count * 8; | |||||
dump_ctx.blksz = blkpgs * PAGE_SIZE; | |||||
return (&dump_ctx); | |||||
} | |||||
static u_long | |||||
mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf) | |||||
{ | |||||
struct dump_context *dctx; | |||||
struct lpte p, *pbuf; | |||||
int bufidx; | |||||
uint64_t junk; | |||||
u_long count, ptex, ptex_end; | |||||
dctx = (struct dump_context *)ctx; | |||||
pbuf = (struct lpte *)buf; | |||||
bufidx = 0; | |||||
ptex = dctx->ptex; | |||||
ptex_end = ptex + dctx->blksz / sizeof(struct lpte); | |||||
ptex_end = MIN(ptex_end, dctx->ptex_end); | |||||
count = ptex_end - ptex; | |||||
for (; ptex < ptex_end; ptex++) { | |||||
phyp_pft_hcall(H_READ, 0, ptex, 0, 0, | |||||
&p.pte_hi, &p.pte_lo, &junk); | |||||
pbuf[bufidx++] = p; | |||||
} | |||||
dctx->ptex = ptex; | |||||
return (count * sizeof(struct lpte)); | |||||
} |