implement pmap_mmap_flags() and teach PowerPC's bus_space_mmap() to actually
use BUS_SPACE_MAP_PREFETCHABLE which, now that /dev/pci* knows how to use it, helps improve X performance
This commit is contained in:
parent
8e6786bbdd
commit
852746b927
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.21 2011/02/12 18:23:10 matt Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.22 2011/02/15 19:39:12 macallan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -117,8 +117,6 @@ extern int pmap_use_altivec;
|
||||
#define pmap_is_modified(pg) (pmap_query_bit((pg), PTE_CHG))
|
||||
#define pmap_is_referenced(pg) (pmap_query_bit((pg), PTE_REF))
|
||||
|
||||
#define pmap_phys_address(x) (x)
|
||||
|
||||
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
|
||||
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
|
||||
|
||||
@ -142,6 +140,14 @@ void pmap_procwr(struct proc *, vaddr_t, size_t);
|
||||
int pmap_pte_spill(pmap_t, vaddr_t, bool);
|
||||
void pmap_pinit(pmap_t);
|
||||
|
||||
u_int powerpc_mmap_flags(paddr_t);
|
||||
#define POWERPC_MMAP_FLAG_MASK 0xf
|
||||
#define POWERPC_MMAP_FLAG_PREFETCHABLE 0x1
|
||||
#define POWERPC_MMAP_FLAG_CACHEABLE 0x2
|
||||
|
||||
#define pmap_phys_address(ppn) (ppn & ~POWERPC_MMAP_FLAG_MASK)
|
||||
#define pmap_mmap_flags(ppn) powerpc_mmap_flags(ppn)
|
||||
|
||||
static inline paddr_t vtophys (vaddr_t);
|
||||
|
||||
/*
|
||||
@ -208,6 +214,7 @@ int pmap_setup_segment0_map(int use_large_pages, ...);
|
||||
#endif
|
||||
|
||||
#define PMAP_MD_NOCACHE 0x1000000
|
||||
#define PMAP_MD_PREFETCHABLE 0x2000000
|
||||
#define PMAP_STEAL_MEMORY
|
||||
#define PMAP_NEED_PROCWR
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.76 2011/02/12 18:23:10 matt Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.77 2011/02/15 19:39:12 macallan Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -63,7 +63,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2011/02/12 18:23:10 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2011/02/15 19:39:12 macallan Exp $");
|
||||
|
||||
#define PMAP_NOOPNAMES
|
||||
|
||||
@ -1927,7 +1927,11 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
|
||||
* it's in our available memory array. If it is in the memory array,
|
||||
* asssume it's in memory coherent memory.
|
||||
*/
|
||||
pte_lo = PTE_IG;
|
||||
if (flags & PMAP_MD_PREFETCHABLE) {
|
||||
pte_lo = 0;
|
||||
} else
|
||||
pte_lo = PTE_G;
|
||||
|
||||
if ((flags & PMAP_MD_NOCACHE) == 0) {
|
||||
for (mp = mem; mp->size; mp++) {
|
||||
if (pa >= mp->start && pa < mp->start + mp->size) {
|
||||
@ -1935,6 +1939,8 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pte_lo |= PTE_I;
|
||||
}
|
||||
|
||||
if (prot & VM_PROT_WRITE)
|
||||
@ -3514,3 +3520,16 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
u_int
|
||||
powerpc_mmap_flags(paddr_t pa)
|
||||
{
|
||||
u_int flags = PMAP_MD_NOCACHE;
|
||||
|
||||
if (pa & POWERPC_MMAP_FLAG_PREFETCHABLE)
|
||||
flags |= PMAP_MD_PREFETCHABLE;
|
||||
if (pa & POWERPC_MMAP_FLAG_CACHEABLE)
|
||||
flags &= ~PMAP_MD_NOCACHE;
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus_space.c,v 1.24 2011/01/18 01:02:55 matt Exp $ */
|
||||
/* $NetBSD: bus_space.c,v 1.25 2011/02/15 19:39:12 macallan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.24 2011/01/18 01:02:55 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.25 2011/02/15 19:39:12 macallan Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -499,6 +499,7 @@ memio_mmap(bus_space_tag_t t, bus_addr_t bpa, off_t offset, int prot, int flags)
|
||||
paddr_t ret;
|
||||
/* XXX what about stride? */
|
||||
ret = trunc_page(t->pbs_offset + bpa + offset);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ret == 0) {
|
||||
printf("%s: [%08x, %08x %08x] mmaps to 0?!\n", __func__,
|
||||
@ -506,6 +507,14 @@ memio_mmap(bus_space_tag_t t, bus_addr_t bpa, off_t offset, int prot, int flags)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef POWERPC_MMAP_FLAG_MASK
|
||||
if (flags & BUS_SPACE_MAP_PREFETCHABLE)
|
||||
ret |= POWERPC_MMAP_FLAG_PREFETCHABLE;
|
||||
if (flags & BUS_SPACE_MAP_CACHEABLE)
|
||||
ret |= POWERPC_MMAP_FLAG_CACHEABLE;
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user