Remove the ARM_USE_SMALL_ALLOC option and code related to it.

This was an optimization used only by a few xscale platforms.  Part of
the optimization was to create a direct map for all physical pages, and
that resulted in making multiple mappings of pages in a way that bypassed
the logic in pmap.c to handle VIVT cache aliasing.  It also just generally
made the code more complex and hard to maintain for all SoCs.

Reviewed by:	cognet
This commit is contained in:
ian 2014-02-08 22:21:38 +00:00
parent 2c14a9960a
commit 5da54698fa
21 changed files with 10 additions and 539 deletions

View File

@ -783,9 +783,6 @@ makectx(struct trapframe *tf, struct pcb *pcb)
* Make a standard dump_avail array. Can't make the phys_avail
* since we need to do that after we call pmap_bootstrap, but this
* is needed before pmap_boostrap.
*
* ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before
* calling pmap_bootstrap.
*/
void
arm_dump_avail_init(vm_paddr_t physaddr, vm_offset_t ramsize, size_t max)

View File

@ -135,10 +135,6 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
uio->uio_rw == UIO_READ ?
VM_PROT_READ : VM_PROT_WRITE))
#ifdef ARM_USE_SMALL_ALLOC
if (addr <= VM_MAXUSER_ADDRESS ||
addr >= KERNBASE)
#endif
return (EFAULT);
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
continue;

View File

@ -1069,9 +1069,7 @@ pmap_l2ptp_ctor(void *mem, int size, void *arg, int flags)
#ifndef PMAP_INCLUDE_PTE_SYNC
struct l2_bucket *l2b;
pt_entry_t *ptep, pte;
#ifdef ARM_USE_SMALL_ALLOC
pd_entry_t *pde;
#endif
vm_offset_t va = (vm_offset_t)mem & ~PAGE_MASK;
/*
@ -1082,10 +1080,6 @@ pmap_l2ptp_ctor(void *mem, int size, void *arg, int flags)
* page tables, we simply fix up the cache-mode here if it's not
* correct.
*/
#ifdef ARM_USE_SMALL_ALLOC
pde = &kernel_pmap->pm_l1->l1_kva[L1_IDX(va)];
if (!l1pte_section_p(*pde)) {
#endif
l2b = pmap_get_l2_bucket(pmap_kernel(), va);
ptep = &l2b->l2b_kva[l2pte_index(va)];
pte = *ptep;
@ -1100,9 +1094,6 @@ pmap_l2ptp_ctor(void *mem, int size, void *arg, int flags)
cpu_tlb_flushD_SE(va);
cpu_cpwait();
}
#ifdef ARM_USE_SMALL_ALLOC
}
#endif
#endif
memset(mem, 0, L2_TABLE_SIZE_REAL);
PTE_SYNC_RANGE(mem, L2_TABLE_SIZE_REAL / sizeof(pt_entry_t));
@ -2259,10 +2250,6 @@ pmap_alloc_specials(vm_offset_t *availp, int pages, vm_offset_t *vap,
* (physical) address starting relative to 0]
*/
#define PMAP_STATIC_L2_SIZE 16
#ifdef ARM_USE_SMALL_ALLOC
extern struct mtx smallalloc_mtx;
#endif
void
pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
{
@ -2422,10 +2409,6 @@ pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
kernel_vm_end = pmap_curmaxkvaddr;
mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF);
#ifdef ARM_USE_SMALL_ALLOC
mtx_init(&smallalloc_mtx, "Small alloc page list", NULL, MTX_DEF);
arm_init_smallalloc();
#endif
pmap_set_pcb_pagedir(kernel_pmap, thread0.td_pcb);
}
@ -2669,11 +2652,7 @@ pmap_remove_pages(pmap_t pmap)
KASSERT(l2b != NULL, ("No L2 bucket in pmap_remove_pages"));
pt = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
m = PHYS_TO_VM_PAGE(*pt & L2_ADDR_MASK);
#ifdef ARM_USE_SMALL_ALLOC
KASSERT((vm_offset_t)m >= alloc_firstaddr, ("Trying to access non-existent page va %x pte %x", pv->pv_va, *pt));
#else
KASSERT((vm_offset_t)m >= KERNBASE, ("Trying to access non-existent page va %x pte %x", pv->pv_va, *pt));
#endif
*pt = 0;
PTE_SYNC(pt);
npv = TAILQ_NEXT(pv, pv_plist);
@ -2932,9 +2911,6 @@ pmap_kremove(vm_offset_t va)
vm_offset_t
pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
{
#ifdef ARM_USE_SMALL_ALLOC
return (arm_ptovirt(start));
#else
vm_offset_t sva = *virt;
vm_offset_t va = sva;
@ -2949,7 +2925,6 @@ pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
}
*virt = va;
return (sva);
#endif
}
static void
@ -4007,27 +3982,11 @@ pmap_remove(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
void
pmap_zero_page_generic(vm_paddr_t phys, int off, int size)
{
#ifdef ARM_USE_SMALL_ALLOC
char *dstpg;
#endif
if (_arm_bzero && size >= _min_bzero_size &&
_arm_bzero((void *)(phys + off), size, IS_PHYSICAL) == 0)
return;
#ifdef ARM_USE_SMALL_ALLOC
dstpg = (char *)arm_ptovirt(phys);
if (off || size != PAGE_SIZE) {
bzero(dstpg + off, size);
cpu_dcache_wbinv_range((vm_offset_t)(dstpg + off), size);
cpu_l2cache_wbinv_range((vm_offset_t)(dstpg + off), size);
} else {
bzero_page((vm_offset_t)dstpg);
cpu_dcache_wbinv_range((vm_offset_t)dstpg, PAGE_SIZE);
cpu_l2cache_wbinv_range((vm_offset_t)dstpg, PAGE_SIZE);
}
#else
mtx_lock(&cmtx);
/*
* Hook in the page, zero it, invalidate the TLB as needed.
@ -4045,7 +4004,6 @@ pmap_zero_page_generic(vm_paddr_t phys, int off, int size)
bzero_page(cdstp);
mtx_unlock(&cmtx);
#endif
}
#endif /* (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 */
@ -4053,23 +4011,11 @@ pmap_zero_page_generic(vm_paddr_t phys, int off, int size)
void
pmap_zero_page_xscale(vm_paddr_t phys, int off, int size)
{
#ifdef ARM_USE_SMALL_ALLOC
char *dstpg;
#endif
if (_arm_bzero && size >= _min_bzero_size &&
_arm_bzero((void *)(phys + off), size, IS_PHYSICAL) == 0)
return;
#ifdef ARM_USE_SMALL_ALLOC
dstpg = (char *)arm_ptovirt(phys);
if (off || size != PAGE_SIZE) {
bzero(dstpg + off, size);
cpu_dcache_wbinv_range((vm_offset_t)(dstpg + off), size);
} else {
bzero_page((vm_offset_t)dstpg);
cpu_dcache_wbinv_range((vm_offset_t)dstpg, PAGE_SIZE);
}
#else
mtx_lock(&cmtx);
/*
* Hook in the page, zero it, and purge the cache for that
@ -4087,7 +4033,6 @@ pmap_zero_page_xscale(vm_paddr_t phys, int off, int size)
bzero_page(cdstp);
mtx_unlock(&cmtx);
xscale_cache_clean_minidata();
#endif
}
/*
@ -4412,9 +4357,6 @@ pmap_copy_page_offs_xscale(vm_paddr_t a_phys, vm_offset_t a_offs,
void
pmap_copy_page(vm_page_t src, vm_page_t dst)
{
#ifdef ARM_USE_SMALL_ALLOC
vm_offset_t srcpg, dstpg;
#endif
cpu_dcache_wbinv_all();
cpu_l2cache_wbinv_all();
@ -4422,15 +4364,7 @@ pmap_copy_page(vm_page_t src, vm_page_t dst)
_arm_memcpy((void *)VM_PAGE_TO_PHYS(dst),
(void *)VM_PAGE_TO_PHYS(src), PAGE_SIZE, IS_PHYSICAL) == 0)
return;
#ifdef ARM_USE_SMALL_ALLOC
srcpg = arm_ptovirt(VM_PAGE_TO_PHYS(src));
dstpg = arm_ptovirt(VM_PAGE_TO_PHYS(dst));
bcopy_page(srcpg, dstpg);
cpu_dcache_wbinv_range(dstpg, PAGE_SIZE);
cpu_l2cache_wbinv_range(dstpg, PAGE_SIZE);
#else
pmap_copy_page_func(VM_PAGE_TO_PHYS(src), VM_PAGE_TO_PHYS(dst));
#endif
}
int unmapped_buf_allowed = 1;
@ -4442,9 +4376,6 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[],
vm_page_t a_pg, b_pg;
vm_offset_t a_pg_offset, b_pg_offset;
int cnt;
#ifdef ARM_USE_SMALL_ALLOC
vm_offset_t a_va, b_va;
#endif
cpu_dcache_wbinv_all();
cpu_l2cache_wbinv_all();
@ -4455,16 +4386,8 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[],
b_pg = mb[b_offset >> PAGE_SHIFT];
b_pg_offset = b_offset & PAGE_MASK;
cnt = min(cnt, PAGE_SIZE - b_pg_offset);
#ifdef ARM_USE_SMALL_ALLOC
a_va = arm_ptovirt(VM_PAGE_TO_PHYS(a_pg)) + a_pg_offset;
b_va = arm_ptovirt(VM_PAGE_TO_PHYS(b_pg)) + b_pg_offset;
bcopy((char *)a_va, (char *)b_va, cnt);
cpu_dcache_wbinv_range(b_va, cnt);
cpu_l2cache_wbinv_range(b_va, cnt);
#else
pmap_copy_page_offs_func(VM_PAGE_TO_PHYS(a_pg), a_pg_offset,
VM_PAGE_TO_PHYS(b_pg), b_pg_offset, cnt);
#endif
xfersize -= cnt;
a_offset += cnt;
b_offset += cnt;

View File

@ -82,8 +82,6 @@ __FBSDID("$FreeBSD$");
CTASSERT(sizeof(struct switchframe) == 24);
CTASSERT(sizeof(struct trapframe) == 80);
#ifndef ARM_USE_SMALL_ALLOC
#ifndef NSFBUFS
#define NSFBUFS (512 + maxusers * 16)
#endif
@ -119,7 +117,6 @@ static u_int sf_buf_alloc_want;
* A lock used to synchronize access to the hash table and free list
*/
static struct mtx sf_buf_lock;
#endif /* !ARM_USE_SMALL_ALLOC */
/*
* Finish a fork operation, with process p2 nearly set up.
@ -191,7 +188,7 @@ cpu_thread_swapout(struct thread *td)
void
sf_buf_free(struct sf_buf *sf)
{
#ifndef ARM_USE_SMALL_ALLOC
mtx_lock(&sf_buf_lock);
sf->ref_count--;
if (sf->ref_count == 0) {
@ -204,10 +201,8 @@ sf_buf_free(struct sf_buf *sf)
wakeup(&sf_buf_freelist);
}
mtx_unlock(&sf_buf_lock);
#endif
}
#ifndef ARM_USE_SMALL_ALLOC
/*
* Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-))
*/
@ -233,7 +228,6 @@ sf_buf_init(void *arg)
sf_buf_alloc_want = 0;
mtx_init(&sf_buf_lock, "sf_buf", NULL, MTX_DEF);
}
#endif
/*
* Get an sf_buf from the freelist. Will block if none are available.
@ -241,9 +235,6 @@ sf_buf_init(void *arg)
struct sf_buf *
sf_buf_alloc(struct vm_page *m, int flags)
{
#ifdef ARM_USE_SMALL_ALLOC
return ((struct sf_buf *)m);
#else
struct sf_head *hash_list;
struct sf_buf *sf;
int error;
@ -289,7 +280,6 @@ sf_buf_alloc(struct vm_page *m, int flags)
done:
mtx_unlock(&sf_buf_lock);
return (sf);
#endif
}
void
@ -492,194 +482,3 @@ cpu_exit(struct thread *td)
{
}
#ifdef ARM_USE_SMALL_ALLOC
static TAILQ_HEAD(,arm_small_page) pages_normal =
TAILQ_HEAD_INITIALIZER(pages_normal);
static TAILQ_HEAD(,arm_small_page) pages_wt =
TAILQ_HEAD_INITIALIZER(pages_wt);
static TAILQ_HEAD(,arm_small_page) free_pgdesc =
TAILQ_HEAD_INITIALIZER(free_pgdesc);
extern uma_zone_t l2zone;
struct mtx smallalloc_mtx;
vm_offset_t alloc_firstaddr;
#ifdef ARM_HAVE_SUPERSECTIONS
#define S_FRAME L1_SUP_FRAME
#define S_SIZE L1_SUP_SIZE
#else
#define S_FRAME L1_S_FRAME
#define S_SIZE L1_S_SIZE
#endif
vm_offset_t
arm_ptovirt(vm_paddr_t pa)
{
int i;
vm_offset_t addr = alloc_firstaddr;
KASSERT(alloc_firstaddr != 0, ("arm_ptovirt called too early ?"));
for (i = 0; dump_avail[i + 1]; i += 2) {
if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
break;
addr += (dump_avail[i + 1] & S_FRAME) + S_SIZE -
(dump_avail[i] & S_FRAME);
}
KASSERT(dump_avail[i + 1] != 0, ("Trying to access invalid physical address"));
return (addr + (pa - (dump_avail[i] & S_FRAME)));
}
void
arm_init_smallalloc(void)
{
vm_offset_t to_map = 0, mapaddr;
int i;
/*
* We need to use dump_avail and not phys_avail, since we want to
* map the whole memory and not just the memory available to the VM
* to be able to do a pa => va association for any address.
*/
for (i = 0; dump_avail[i + 1]; i+= 2) {
to_map += (dump_avail[i + 1] & S_FRAME) + S_SIZE -
(dump_avail[i] & S_FRAME);
}
alloc_firstaddr = mapaddr = KERNBASE - to_map;
for (i = 0; dump_avail[i + 1]; i+= 2) {
vm_offset_t size = (dump_avail[i + 1] & S_FRAME) +
S_SIZE - (dump_avail[i] & S_FRAME);
vm_offset_t did = 0;
while (size > 0) {
#ifdef ARM_HAVE_SUPERSECTIONS
pmap_kenter_supersection(mapaddr,
(dump_avail[i] & L1_SUP_FRAME) + did,
SECTION_CACHE);
#else
pmap_kenter_section(mapaddr,
(dump_avail[i] & L1_S_FRAME) + did, SECTION_CACHE);
#endif
mapaddr += S_SIZE;
did += S_SIZE;
size -= S_SIZE;
}
}
}
void
arm_add_smallalloc_pages(void *list, void *mem, int bytes, int pagetable)
{
struct arm_small_page *pg;
bytes &= ~PAGE_MASK;
while (bytes > 0) {
pg = (struct arm_small_page *)list;
pg->addr = mem;
if (pagetable)
TAILQ_INSERT_HEAD(&pages_wt, pg, pg_list);
else
TAILQ_INSERT_HEAD(&pages_normal, pg, pg_list);
list = (char *)list + sizeof(*pg);
mem = (char *)mem + PAGE_SIZE;
bytes -= PAGE_SIZE;
}
}
void *
uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
{
void *ret;
struct arm_small_page *sp;
TAILQ_HEAD(,arm_small_page) *head;
vm_page_t m;
*flags = UMA_SLAB_PRIV;
/*
* For CPUs where we setup page tables as write back, there's no
* need to maintain two separate pools.
*/
if (zone == l2zone && pte_l1_s_cache_mode != pte_l1_s_cache_mode_pt)
head = (void *)&pages_wt;
else
head = (void *)&pages_normal;
mtx_lock(&smallalloc_mtx);
sp = TAILQ_FIRST(head);
if (!sp) {
int pflags;
mtx_unlock(&smallalloc_mtx);
if (zone == l2zone &&
pte_l1_s_cache_mode != pte_l1_s_cache_mode_pt) {
*flags = UMA_SLAB_KMEM;
ret = ((void *)kmem_malloc(kmem_arena, bytes,
M_NOWAIT));
return (ret);
}
pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
if (m == NULL) {
if (wait & M_NOWAIT)
return (NULL);
VM_WAIT;
} else
break;
}
ret = (void *)arm_ptovirt(VM_PAGE_TO_PHYS(m));
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
bzero(ret, PAGE_SIZE);
return (ret);
}
TAILQ_REMOVE(head, sp, pg_list);
TAILQ_INSERT_HEAD(&free_pgdesc, sp, pg_list);
ret = sp->addr;
mtx_unlock(&smallalloc_mtx);
if ((wait & M_ZERO))
bzero(ret, bytes);
return (ret);
}
void
uma_small_free(void *mem, int size, u_int8_t flags)
{
pd_entry_t *pd;
pt_entry_t *pt;
if (flags & UMA_SLAB_KMEM)
kmem_free(kmem_arena, (vm_offset_t)mem, size);
else {
struct arm_small_page *sp;
if ((vm_offset_t)mem >= KERNBASE) {
mtx_lock(&smallalloc_mtx);
sp = TAILQ_FIRST(&free_pgdesc);
KASSERT(sp != NULL, ("No more free page descriptor ?"));
TAILQ_REMOVE(&free_pgdesc, sp, pg_list);
sp->addr = mem;
pmap_get_pde_pte(kernel_pmap, (vm_offset_t)mem, &pd,
&pt);
if ((*pd & pte_l1_s_cache_mask) ==
pte_l1_s_cache_mode_pt &&
pte_l1_s_cache_mode_pt != pte_l1_s_cache_mode)
TAILQ_INSERT_HEAD(&pages_wt, sp, pg_list);
else
TAILQ_INSERT_HEAD(&pages_normal, sp, pg_list);
mtx_unlock(&smallalloc_mtx);
} else {
vm_page_t m;
vm_paddr_t pa = vtophys((vm_offset_t)mem);
m = PHYS_TO_VM_PAGE(pa);
m->wire_count--;
vm_page_free(m);
atomic_subtract_int(&cnt.v_wire_count, 1);
}
}
}
#endif

View File

@ -24,7 +24,6 @@ include "../xscale/ixp425/std.ixp425"
# NB: memory mapping is defined in std.avila
include "../xscale/ixp425/std.avila"
options XSCALE_CACHE_READ_WRITE_ALLOCATE
#options ARM_USE_SMALL_ALLOC
#To statically compile in device wiring instead of /boot/device.hints
hints "AVILA.hints" #Default places to look for devices.
makeoptions MODULES_OVERRIDE=""

View File

@ -24,7 +24,6 @@ include "../xscale/ixp425/std.ixp435"
# NB: memory mapping is defined in std.avila
include "../xscale/ixp425/std.avila"
options XSCALE_CACHE_READ_WRITE_ALLOCATE
#options ARM_USE_SMALL_ALLOC
#To statically compile in device wiring instead of /boot/device.hints
hints "CAMBRIA.hints" # Default places to look for devices.

View File

@ -102,7 +102,6 @@ device loop
device md
device random # Entropy device
#options ARM_USE_SMALL_ALLOC
device usb
#options USB_DEBUG

View File

@ -106,6 +106,5 @@ device md
device random # Entropy device
device iopwdog
options ARM_USE_SMALL_ALLOC
# Floppy drives

View File

@ -101,7 +101,6 @@ options XSCALE_CACHE_READ_WRITE_ALLOCATE
device md
device random # Entropy device
options ARM_USE_SMALL_ALLOC
# Floppy drives
options INCLUDE_CONFIG_FILE # Include this file in kernel

View File

@ -106,6 +106,5 @@ options XSCALE_CACHE_READ_WRITE_ALLOCATE
device md
device random # Entropy device
options ARM_USE_SMALL_ALLOC
# Floppy drives

View File

@ -105,8 +105,6 @@ device loop
device md
device random # Entropy device
#options ARM_USE_SMALL_ALLOC
device usb
options USB_DEBUG
device ohci

View File

@ -708,17 +708,6 @@ extern char *_tmppt;
void pmap_postinit(void);
#ifdef ARM_USE_SMALL_ALLOC
void arm_add_smallalloc_pages(void *, void *, int, int);
vm_offset_t arm_ptovirt(vm_paddr_t);
void arm_init_smallalloc(void);
struct arm_small_page {
void *addr;
TAILQ_ENTRY(arm_small_page) pg_list;
};
#endif
extern vm_paddr_t dump_avail[];
#endif /* _KERNEL */

View File

@ -29,33 +29,10 @@
#ifndef _MACHINE_SF_BUF_H_
#define _MACHINE_SF_BUF_H_
#include <sys/queue.h>
struct vm_page;
#ifdef ARM_USE_SMALL_ALLOC
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
struct sf_buf;
static __inline vm_offset_t
sf_buf_kva(struct sf_buf *sf)
{
return arm_ptovirt(VM_PAGE_TO_PHYS((vm_page_t)sf));
}
static __inline vm_page_t
sf_buf_page(struct sf_buf *sf)
{
return ((vm_page_t)sf);
}
#else
#include <sys/queue.h>
struct sf_buf {
LIST_ENTRY(sf_buf) list_entry; /* list of buffers */
TAILQ_ENTRY(sf_buf) free_entry; /* list of buffers */
@ -78,8 +55,6 @@ sf_buf_page(struct sf_buf *sf)
return (sf->m);
}
#endif
struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags);
void sf_buf_free(struct sf_buf *sf);

View File

@ -82,21 +82,15 @@
#define VM_PHYSSEG_DENSE
/*
* Create two or three free page pools depending on the existence of a direct
* map: VM_FREEPOOL_DEFAULT is the default pool from which physical pages are
* allocated, and VM_FREEPOOL_DIRECT is the pool from which physical pages for
* small UMA objects are allocated.
* Create two free page pools. Since the ARM kernel virtual address
* space does not include a mapping onto the machine's entire physical
* memory, VM_FREEPOOL_DIRECT is defined as an alias for the default
* pool, VM_FREEPOOL_DEFAULT.
*/
#ifdef ARM_USE_SMALL_ALLOC
#define VM_NFREEPOOL 3
#define VM_FREEPOOL_CACHE 2
#define VM_FREEPOOL_DIRECT 1
#else
#define VM_NFREEPOOL 2
#define VM_FREEPOOL_CACHE 1
#define VM_FREEPOOL_DIRECT 0
#endif
#define VM_FREEPOOL_DEFAULT 0
#define VM_FREEPOOL_DIRECT 0
/*
* we support 2 free lists:
@ -132,23 +126,9 @@
#define UPT_MIN_ADDRESS VADDR(UPTPTDI, 0)
#define VM_MIN_ADDRESS (0x00001000)
#ifdef ARM_USE_SMALL_ALLOC
/*
* ARM_KERN_DIRECTMAP is used to make sure there's enough space between
* VM_MAXUSER_ADDRESS and KERNBASE to map the whole memory.
* It has to be a compile-time constant, even if arm_init_smallalloc(),
* which will do the mapping, gets the real amount of memory at runtime,
* because VM_MAXUSER_ADDRESS is a constant.
*/
#ifndef ARM_KERN_DIRECTMAP
#define ARM_KERN_DIRECTMAP 512 * 1024 * 1024 /* 512 MB */
#endif
#define VM_MAXUSER_ADDRESS KERNBASE - ARM_KERN_DIRECTMAP
#else /* ARM_USE_SMALL_ALLOC */
#ifndef VM_MAXUSER_ADDRESS
#define VM_MAXUSER_ADDRESS KERNBASE
#endif /* VM_MAXUSER_ADDRESS */
#endif /* ARM_USE_SMALL_ALLOC */
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
#define USRSTACK VM_MAXUSER_ADDRESS
@ -187,10 +167,6 @@
VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
#endif
#ifdef ARM_USE_SMALL_ALLOC
#define UMA_MD_SMALL_ALLOC
#endif /* ARM_USE_SMALL_ALLOC */
extern vm_offset_t vm_max_kernel_address;
#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */

View File

@ -231,21 +231,6 @@ initarm(struct arm_boot_params *abp)
valloc_pages(kernelstack, KSTACK_PAGES);
alloc_pages(minidataclean.pv_pa, 1);
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
#ifdef ARM_USE_SMALL_ALLOC
freemempos -= PAGE_SIZE;
freemem_pt = trunc_page(freemem_pt);
freemem_after = freemempos - ((freemem_pt - 0xa0100000) /
PAGE_SIZE) * sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000),
(void *)0xc0100000, freemem_pt - 0xa0100000, 1);
freemem_after -= ((freemem_after - 0xa0001000) / PAGE_SIZE) *
sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000),
(void *)0xc0001000, trunc_page(freemem_after) - 0xa0001000, 0);
freemempos = trunc_page(freemem_after);
freemempos -= PAGE_SIZE;
#endif
/*
* Allocate memory for the l1 and l2 page tables. The scheme to avoid
* wasting memory by allocating the l1pt on the first 16k memory was
@ -285,15 +270,6 @@ initarm(struct arm_boot_params *abp)
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
#ifdef ARM_USE_SMALL_ALLOC
if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) {
arm_add_smallalloc_pages((void *)(freemem_after),
(void*)(freemem_after + PAGE_SIZE),
afterkern - (freemem_after + PAGE_SIZE), 0);
}
#endif
/* Map the Mini-Data cache clean area. */
xscale_setup_minidata(l1pagetable, afterkern,
minidataclean.pv_pa);
@ -359,10 +335,6 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
/*
* ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before
* calling pmap_bootstrap.
*/
dump_avail[0] = 0xa0000000;
dump_avail[1] = 0xa0000000 + memsize;
dump_avail[2] = 0;
@ -375,13 +347,6 @@ initarm(struct arm_boot_params *abp)
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = 0xa0000000;
phys_avail[i++] = 0xa0001000; /*
*XXX: Gross hack to get our
* pages in the vm_page_array
. */
#endif
phys_avail[i++] = round_page(virtual_avail - KERNBASE + IQ80321_SDRAM_START);
phys_avail[i++] = trunc_page(0xa0000000 + memsize - 1);
phys_avail[i++] = 0;

View File

@ -232,21 +232,6 @@ initarm(struct arm_boot_params *abp)
valloc_pages(kernelstack, KSTACK_PAGES);
alloc_pages(minidataclean.pv_pa, 1);
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
#ifdef ARM_USE_SMALL_ALLOC
freemempos -= PAGE_SIZE;
freemem_pt = trunc_page(freemem_pt);
freemem_after = freemempos - ((freemem_pt - 0xa0100000) /
PAGE_SIZE) * sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000),
(void *)0xc0100000, freemem_pt - 0xa0100000, 1);
freemem_after -= ((freemem_after - 0xa0001000) / PAGE_SIZE) *
sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000),
(void *)0xc0001000, trunc_page(freemem_after) - 0xa0001000, 0);
freemempos = trunc_page(freemem_after);
freemempos -= PAGE_SIZE;
#endif
/*
* Allocate memory for the l1 and l2 page tables. The scheme to avoid
* wasting memory by allocating the l1pt on the first 16k memory was
@ -286,15 +271,6 @@ initarm(struct arm_boot_params *abp)
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
#ifdef ARM_USE_SMALL_ALLOC
if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) {
arm_add_smallalloc_pages((void *)(freemem_after),
(void*)(freemem_after + PAGE_SIZE),
afterkern - (freemem_after + PAGE_SIZE), 0);
}
#endif
/* Map the Mini-Data cache clean area. */
xscale_setup_minidata(l1pagetable, afterkern,
minidataclean.pv_pa);
@ -360,10 +336,6 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
/*
* ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before
* calling pmap_bootstrap.
*/
dump_avail[0] = 0xa0000000;
dump_avail[1] = 0xa0000000 + memsize;
dump_avail[2] = 0;
@ -376,13 +348,6 @@ initarm(struct arm_boot_params *abp)
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = 0xa0000000;
phys_avail[i++] = 0xa0001000; /*
*XXX: Gross hack to get our
* pages in the vm_page_array
. */
#endif
phys_avail[i++] = round_page(virtual_avail - KERNBASE + SDRAM_START);
phys_avail[i++] = trunc_page(0xa0000000 + memsize - 1);
phys_avail[i++] = 0;

View File

@ -230,22 +230,6 @@ initarm(struct arm_boot_params *abp)
valloc_pages(undstack, UND_STACK_SIZE);
valloc_pages(kernelstack, KSTACK_PAGES);
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
#ifdef ARM_USE_SMALL_ALLOC
freemempos -= PAGE_SIZE;
freemem_pt = trunc_page(freemem_pt);
freemem_after = freemempos - ((freemem_pt - 0x00100000) /
PAGE_SIZE) * sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0xc0000000)
, (void *)0xc0100000, freemem_pt - 0x00100000, 1);
freemem_after -= ((freemem_after - 0x00001000) / PAGE_SIZE) *
sizeof(struct arm_small_page);
#if 0
arm_add_smallalloc_pages((void *)(freemem_after + 0xc0000000)
, (void *)0xc0001000, trunc_page(freemem_after) - 0x00001000, 0);
#endif
freemempos = trunc_page(freemem_after);
freemempos -= PAGE_SIZE;
#endif
/*
* Now we start construction of the L1 page table
* We start by mapping the L2 page tables into the L1.
@ -274,15 +258,6 @@ initarm(struct arm_boot_params *abp)
}
#ifdef ARM_USE_SMALL_ALLOC
if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) {
arm_add_smallalloc_pages((void *)(freemem_after),
(void*)(freemem_after + PAGE_SIZE),
afterkern - (freemem_after + PAGE_SIZE), 0);
}
#endif
/* Map the vector page. */
pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
@ -338,10 +313,7 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
/*
* ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before
* calling pmap_bootstrap.
*/
dump_avail[0] = 0x00000000;
dump_avail[1] = 0x00000000 + memsize;
dump_avail[2] = 0;
@ -354,13 +326,6 @@ initarm(struct arm_boot_params *abp)
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = 0x00001000;
phys_avail[i++] = 0x00002000; /*
*XXX: Gross hack to get our
* pages in the vm_page_array
. */
#endif
phys_avail[i++] = round_page(virtual_avail - KERNBASE + SDRAM_START);
phys_avail[i++] = trunc_page(0x00000000 + memsize - 1);
phys_avail[i++] = 0;

View File

@ -299,24 +299,6 @@ initarm(struct arm_boot_params *abp)
valloc_pages(kernelstack, KSTACK_PAGES);
alloc_pages(minidataclean.pv_pa, 1);
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
#ifdef ARM_USE_SMALL_ALLOC
freemempos -= PAGE_SIZE;
freemem_pt = trunc_page(freemem_pt);
freemem_after = freemempos - ((freemem_pt - (PHYSADDR + 0x100000)) /
PAGE_SIZE) * sizeof(struct arm_small_page);
arm_add_smallalloc_pages(
(void *)(freemem_after + (KERNVIRTADDR - KERNPHYSADDR)),
(void *)0xc0100000,
freemem_pt - (PHYSADDR + 0x100000), 1);
freemem_after -= ((freemem_after - (PHYSADDR + 0x1000)) / PAGE_SIZE) *
sizeof(struct arm_small_page);
arm_add_smallalloc_pages(
(void *)(freemem_after + (KERNVIRTADDR - KERNPHYSADDR)),
(void *)0xc0001000,
trunc_page(freemem_after) - (PHYSADDR + 0x1000), 0);
freemempos = trunc_page(freemem_after);
freemempos -= PAGE_SIZE;
#endif
/*
* Now construct the L1 page table. First map the L2
@ -352,14 +334,6 @@ initarm(struct arm_boot_params *abp)
pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
#ifdef ARM_USE_SMALL_ALLOC
if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) {
arm_add_smallalloc_pages((void *)(freemem_after),
(void*)(freemem_after + PAGE_SIZE),
afterkern - (freemem_after + PAGE_SIZE), 0);
}
#endif
/* Map the Mini-Data cache clean area. */
xscale_setup_minidata(l1pagetable, afterkern,
@ -440,13 +414,6 @@ initarm(struct arm_boot_params *abp)
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = PHYSADDR;
phys_avail[i++] = PHYSADDR + PAGE_SIZE; /*
*XXX: Gross hack to get our
* pages in the vm_page_array.
*/
#endif
phys_avail[i++] = round_page(virtual_avail - KERNBASE + PHYSADDR);
phys_avail[i++] = trunc_page(PHYSADDR + memsize - 1);
phys_avail[i++] = 0;

View File

@ -213,20 +213,6 @@ initarm(struct arm_boot_params *abp)
valloc_pages(kernelstack, KSTACK_PAGES);
alloc_pages(minidataclean.pv_pa, 1);
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
#ifdef ARM_USE_SMALL_ALLOC
freemempos -= PAGE_SIZE;
freemem_pt = trunc_page(freemem_pt);
freemem_after = freemempos - ((freemem_pt - 0xa0100000) /
PAGE_SIZE) * sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000)
, (void *)0xc0100000, freemem_pt - 0xa0100000, 1);
freemem_after -= ((freemem_after - 0xa0001000) / PAGE_SIZE) *
sizeof(struct arm_small_page);
arm_add_smallalloc_pages((void *)(freemem_after + 0x20000000)
, (void *)0xc0001000, trunc_page(freemem_after) - 0xa0001000, 0);
freemempos = trunc_page(freemem_after);
freemempos -= PAGE_SIZE;
#endif
/*
* Allocate memory for the l1 and l2 page tables. The scheme to avoid
* wasting memory by allocating the l1pt on the first 16k memory was
@ -267,13 +253,6 @@ initarm(struct arm_boot_params *abp)
pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
#ifdef ARM_USE_SMALL_ALLOC
if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) {
arm_add_smallalloc_pages((void *)(freemem_after),
(void*)(freemem_after + PAGE_SIZE),
afterkern - (freemem_after + PAGE_SIZE), 0);
}
#endif
/* Map the Mini-Data cache clean area. */
xscale_setup_minidata(l1pagetable, afterkern,
@ -350,10 +329,6 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
/*
* ARM USE_SMALL_ALLOC uses dump_avail, so it must be filled before
* calling pmap_bootstrap.
*/
i = 0;
for (j = 0; j < PXA2X0_SDRAM_BANKS; j++) {
if (memsize[j] > 0) {
@ -371,13 +346,6 @@ initarm(struct arm_boot_params *abp)
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = 0xa0000000;
phys_avail[i++] = 0xa0001000; /*
*XXX: Gross hack to get our
* pages in the vm_page_array
. */
#endif
for (j = 0; j < PXA2X0_SDRAM_BANKS; j++) {
if (memsize[j] > 0) {
phys_avail[i] = round_page(memstart[j]);
@ -393,11 +361,7 @@ initarm(struct arm_boot_params *abp)
phys_avail[i++] = 0;
dump_avail[i] = 0;
phys_avail[i] = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[2] = round_page(virtual_avail - KERNBASE + phys_avail[2]);
#else
phys_avail[0] = round_page(virtual_avail - KERNBASE + phys_avail[0]);
#endif
init_param2(physmem);
kdb_init();

View File

@ -6,5 +6,4 @@ makeoptions KERNPHYSADDR=0xa0200000
makeoptions KERNVIRTADDR=0xc0200000
makeoptions CONF_CFLAGS=-mcpu=xscale
options XSCALE_CACHE_READ_WRITE_ALLOCATE
options ARM_USE_SMALL_ALLOC
machine arm

View File

@ -4,7 +4,6 @@ ARM_CACHE_LOCK_ENABLE opt_global.h
ARM_KERN_DIRECTMAP opt_vm.h
ARM_L2_PIPT opt_global.h
ARM_MANY_BOARD opt_global.h
ARM_USE_SMALL_ALLOC opt_global.h
ARM_WANT_TP_ADDRESS opt_global.h
COUNTS_PER_SEC opt_timer.h
CPU_ARM9 opt_global.h