Deleted Added
full compact
pmap.c (270439) pmap.c (270920)
1/*-
2 * Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com>
3 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 35 unchanged lines hidden (view full) ---

44 * 0xc100_0000 - 0xc100_3fff : reserved for page zero/copy
45 * 0xc100_4000 - 0xc200_3fff : reserved for ptbl bufs
46 * 0xc200_4000 - 0xc200_8fff : guard page + kstack0
47 * 0xc200_9000 - 0xfeef_ffff : actual free KVA space
48 * 0xfef0_0000 - 0xffff_ffff : I/O devices region
49 */
50
51#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com>
3 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 35 unchanged lines hidden (view full) ---

44 * 0xc100_0000 - 0xc100_3fff : reserved for page zero/copy
45 * 0xc100_4000 - 0xc200_3fff : reserved for ptbl bufs
46 * 0xc200_4000 - 0xc200_8fff : guard page + kstack0
47 * 0xc200_9000 - 0xfeef_ffff : actual free KVA space
48 * 0xfef0_0000 - 0xffff_ffff : I/O devices region
49 */
50
51#include <sys/cdefs.h>
52__FBSDID("$FreeBSD: stable/10/sys/powerpc/booke/pmap.c 270439 2014-08-24 07:53:15Z kib $");
52__FBSDID("$FreeBSD: stable/10/sys/powerpc/booke/pmap.c 270920 2014-09-01 07:58:15Z kib $");
53
54#include <sys/param.h>
55#include <sys/malloc.h>
56#include <sys/ktr.h>
57#include <sys/proc.h>
58#include <sys/user.h>
59#include <sys/queue.h>
60#include <sys/systm.h>

--- 200 unchanged lines hidden (view full) ---

261/* Pointer to ptbl_buf structures. */
262static struct ptbl_buf *ptbl_bufs;
263
264void pmap_bootstrap_ap(volatile uint32_t *);
265
266/*
267 * Kernel MMU interface
268 */
53
54#include <sys/param.h>
55#include <sys/malloc.h>
56#include <sys/ktr.h>
57#include <sys/proc.h>
58#include <sys/user.h>
59#include <sys/queue.h>
60#include <sys/systm.h>

--- 200 unchanged lines hidden (view full) ---

261/* Pointer to ptbl_buf structures. */
262static struct ptbl_buf *ptbl_bufs;
263
264void pmap_bootstrap_ap(volatile uint32_t *);
265
266/*
267 * Kernel MMU interface
268 */
269static void mmu_booke_change_wiring(mmu_t, pmap_t, vm_offset_t, boolean_t);
270static void mmu_booke_clear_modify(mmu_t, vm_page_t);
271static void mmu_booke_copy(mmu_t, pmap_t, pmap_t, vm_offset_t,
272 vm_size_t, vm_offset_t);
273static void mmu_booke_copy_page(mmu_t, vm_page_t, vm_page_t);
274static void mmu_booke_copy_pages(mmu_t, vm_page_t *,
275 vm_offset_t, vm_page_t *, vm_offset_t, int);
276static int mmu_booke_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t,
277 vm_prot_t, u_int flags, int8_t psind);

--- 23 unchanged lines hidden (view full) ---

301static void mmu_booke_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t,
302 vm_prot_t);
303static void mmu_booke_qenter(mmu_t, vm_offset_t, vm_page_t *, int);
304static void mmu_booke_qremove(mmu_t, vm_offset_t, int);
305static void mmu_booke_release(mmu_t, pmap_t);
306static void mmu_booke_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t);
307static void mmu_booke_remove_all(mmu_t, vm_page_t);
308static void mmu_booke_remove_write(mmu_t, vm_page_t);
269static void mmu_booke_clear_modify(mmu_t, vm_page_t);
270static void mmu_booke_copy(mmu_t, pmap_t, pmap_t, vm_offset_t,
271 vm_size_t, vm_offset_t);
272static void mmu_booke_copy_page(mmu_t, vm_page_t, vm_page_t);
273static void mmu_booke_copy_pages(mmu_t, vm_page_t *,
274 vm_offset_t, vm_page_t *, vm_offset_t, int);
275static int mmu_booke_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t,
276 vm_prot_t, u_int flags, int8_t psind);

--- 23 unchanged lines hidden (view full) ---

300static void mmu_booke_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t,
301 vm_prot_t);
302static void mmu_booke_qenter(mmu_t, vm_offset_t, vm_page_t *, int);
303static void mmu_booke_qremove(mmu_t, vm_offset_t, int);
304static void mmu_booke_release(mmu_t, pmap_t);
305static void mmu_booke_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t);
306static void mmu_booke_remove_all(mmu_t, vm_page_t);
307static void mmu_booke_remove_write(mmu_t, vm_page_t);
308static void mmu_booke_unwire(mmu_t, pmap_t, vm_offset_t, vm_offset_t);
309static void mmu_booke_zero_page(mmu_t, vm_page_t);
310static void mmu_booke_zero_page_area(mmu_t, vm_page_t, int, int);
311static void mmu_booke_zero_page_idle(mmu_t, vm_page_t);
312static void mmu_booke_activate(mmu_t, struct thread *);
313static void mmu_booke_deactivate(mmu_t, struct thread *);
314static void mmu_booke_bootstrap(mmu_t, vm_offset_t, vm_offset_t);
315static void *mmu_booke_mapdev(mmu_t, vm_paddr_t, vm_size_t);
316static void *mmu_booke_mapdev_attr(mmu_t, vm_paddr_t, vm_size_t, vm_memattr_t);

--- 8 unchanged lines hidden (view full) ---

325static vm_offset_t mmu_booke_dumpsys_map(mmu_t, struct pmap_md *,
326 vm_size_t, vm_size_t *);
327static void mmu_booke_dumpsys_unmap(mmu_t, struct pmap_md *,
328 vm_size_t, vm_offset_t);
329static struct pmap_md *mmu_booke_scan_md(mmu_t, struct pmap_md *);
330
331static mmu_method_t mmu_booke_methods[] = {
332 /* pmap dispatcher interface */
309static void mmu_booke_zero_page(mmu_t, vm_page_t);
310static void mmu_booke_zero_page_area(mmu_t, vm_page_t, int, int);
311static void mmu_booke_zero_page_idle(mmu_t, vm_page_t);
312static void mmu_booke_activate(mmu_t, struct thread *);
313static void mmu_booke_deactivate(mmu_t, struct thread *);
314static void mmu_booke_bootstrap(mmu_t, vm_offset_t, vm_offset_t);
315static void *mmu_booke_mapdev(mmu_t, vm_paddr_t, vm_size_t);
316static void *mmu_booke_mapdev_attr(mmu_t, vm_paddr_t, vm_size_t, vm_memattr_t);

--- 8 unchanged lines hidden (view full) ---

325static vm_offset_t mmu_booke_dumpsys_map(mmu_t, struct pmap_md *,
326 vm_size_t, vm_size_t *);
327static void mmu_booke_dumpsys_unmap(mmu_t, struct pmap_md *,
328 vm_size_t, vm_offset_t);
329static struct pmap_md *mmu_booke_scan_md(mmu_t, struct pmap_md *);
330
331static mmu_method_t mmu_booke_methods[] = {
332 /* pmap dispatcher interface */
333 MMUMETHOD(mmu_change_wiring, mmu_booke_change_wiring),
334 MMUMETHOD(mmu_clear_modify, mmu_booke_clear_modify),
335 MMUMETHOD(mmu_copy, mmu_booke_copy),
336 MMUMETHOD(mmu_copy_page, mmu_booke_copy_page),
337 MMUMETHOD(mmu_copy_pages, mmu_booke_copy_pages),
338 MMUMETHOD(mmu_enter, mmu_booke_enter),
339 MMUMETHOD(mmu_enter_object, mmu_booke_enter_object),
340 MMUMETHOD(mmu_enter_quick, mmu_booke_enter_quick),
341 MMUMETHOD(mmu_extract, mmu_booke_extract),

--- 14 unchanged lines hidden (view full) ---

356 MMUMETHOD(mmu_protect, mmu_booke_protect),
357 MMUMETHOD(mmu_qenter, mmu_booke_qenter),
358 MMUMETHOD(mmu_qremove, mmu_booke_qremove),
359 MMUMETHOD(mmu_release, mmu_booke_release),
360 MMUMETHOD(mmu_remove, mmu_booke_remove),
361 MMUMETHOD(mmu_remove_all, mmu_booke_remove_all),
362 MMUMETHOD(mmu_remove_write, mmu_booke_remove_write),
363 MMUMETHOD(mmu_sync_icache, mmu_booke_sync_icache),
333 MMUMETHOD(mmu_clear_modify, mmu_booke_clear_modify),
334 MMUMETHOD(mmu_copy, mmu_booke_copy),
335 MMUMETHOD(mmu_copy_page, mmu_booke_copy_page),
336 MMUMETHOD(mmu_copy_pages, mmu_booke_copy_pages),
337 MMUMETHOD(mmu_enter, mmu_booke_enter),
338 MMUMETHOD(mmu_enter_object, mmu_booke_enter_object),
339 MMUMETHOD(mmu_enter_quick, mmu_booke_enter_quick),
340 MMUMETHOD(mmu_extract, mmu_booke_extract),

--- 14 unchanged lines hidden (view full) ---

355 MMUMETHOD(mmu_protect, mmu_booke_protect),
356 MMUMETHOD(mmu_qenter, mmu_booke_qenter),
357 MMUMETHOD(mmu_qremove, mmu_booke_qremove),
358 MMUMETHOD(mmu_release, mmu_booke_release),
359 MMUMETHOD(mmu_remove, mmu_booke_remove),
360 MMUMETHOD(mmu_remove_all, mmu_booke_remove_all),
361 MMUMETHOD(mmu_remove_write, mmu_booke_remove_write),
362 MMUMETHOD(mmu_sync_icache, mmu_booke_sync_icache),
363 MMUMETHOD(mmu_unwire, mmu_booke_unwire),
364 MMUMETHOD(mmu_zero_page, mmu_booke_zero_page),
365 MMUMETHOD(mmu_zero_page_area, mmu_booke_zero_page_area),
366 MMUMETHOD(mmu_zero_page_idle, mmu_booke_zero_page_idle),
367 MMUMETHOD(mmu_activate, mmu_booke_activate),
368 MMUMETHOD(mmu_deactivate, mmu_booke_deactivate),
369
370 /* Internal interfaces */
371 MMUMETHOD(mmu_bootstrap, mmu_booke_bootstrap),

--- 2055 unchanged lines hidden (view full) ---

2427 }
2428 PMAP_UNLOCK(pv->pv_pmap);
2429 }
2430 rw_wunlock(&pvh_global_lock);
2431 return (count);
2432}
2433
2434/*
364 MMUMETHOD(mmu_zero_page, mmu_booke_zero_page),
365 MMUMETHOD(mmu_zero_page_area, mmu_booke_zero_page_area),
366 MMUMETHOD(mmu_zero_page_idle, mmu_booke_zero_page_idle),
367 MMUMETHOD(mmu_activate, mmu_booke_activate),
368 MMUMETHOD(mmu_deactivate, mmu_booke_deactivate),
369
370 /* Internal interfaces */
371 MMUMETHOD(mmu_bootstrap, mmu_booke_bootstrap),

--- 2055 unchanged lines hidden (view full) ---

2427 }
2428 PMAP_UNLOCK(pv->pv_pmap);
2429 }
2430 rw_wunlock(&pvh_global_lock);
2431 return (count);
2432}
2433
2434/*
2435 * Change wiring attribute for a map/virtual-address pair.
2435 * Clear the wired attribute from the mappings for the specified range of
2436 * addresses in the given pmap. Every valid mapping within that range must
2437 * have the wired attribute set. In contrast, invalid mappings cannot have
2438 * the wired attribute set, so they are ignored.
2439 *
2440 * The wired attribute of the page table entry is not a hardware feature, so
2441 * there is no need to invalidate any TLB entries.
2436 */
2437static void
2442 */
2443static void
2438mmu_booke_change_wiring(mmu_t mmu, pmap_t pmap, vm_offset_t va, boolean_t wired)
2444mmu_booke_unwire(mmu_t mmu, pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
2439{
2445{
2446 vm_offset_t va;
2440 pte_t *pte;
2441
2442 PMAP_LOCK(pmap);
2447 pte_t *pte;
2448
2449 PMAP_LOCK(pmap);
2443 if ((pte = pte_find(mmu, pmap, va)) != NULL) {
2444 if (wired) {
2445 if (!PTE_ISWIRED(pte)) {
2446 pte->flags |= PTE_WIRED;
2447 pmap->pm_stats.wired_count++;
2448 }
2449 } else {
2450 if (PTE_ISWIRED(pte)) {
2451 pte->flags &= ~PTE_WIRED;
2452 pmap->pm_stats.wired_count--;
2453 }
2450 for (va = sva; va < eva; va += PAGE_SIZE) {
2451 if ((pte = pte_find(mmu, pmap, va)) != NULL &&
2452 PTE_ISVALID(pte)) {
2453 if (!PTE_ISWIRED(pte))
2454 panic("mmu_booke_unwire: pte %p isn't wired",
2455 pte);
2456 pte->flags &= ~PTE_WIRED;
2457 pmap->pm_stats.wired_count--;
2454 }
2455 }
2456 PMAP_UNLOCK(pmap);
2458 }
2459 }
2460 PMAP_UNLOCK(pmap);
2461
2457}
2458
2459/*
2460 * Return true if the pmap's pv is one of the first 16 pvs linked to from this
2461 * page. This count may be changed upwards or downwards in the future; it is
2462 * only necessary that true be returned for a small subset of pmaps for proper
2463 * page aging.
2464 */

--- 857 unchanged lines hidden ---
2462}
2463
2464/*
2465 * Return true if the pmap's pv is one of the first 16 pvs linked to from this
2466 * page. This count may be changed upwards or downwards in the future; it is
2467 * only necessary that true be returned for a small subset of pmaps for proper
2468 * page aging.
2469 */

--- 857 unchanged lines hidden ---