powerpc: Link Book-E kernels at the same address as AIM kernels

Summary:
Reduce the diff between AIM and Book-E even more.  This also cleans up
vmparam.h significantly.

Reviewed by:	luporl
Differential Revision:	https://reviews.freebsd.org/D21301
This commit is contained in:
Justin Hibbits 2019-08-20 01:26:02 +00:00
parent df845c0f86
commit 6793e5b23d
3 changed files with 23 additions and 43 deletions

View File

@ -219,7 +219,7 @@ uint32_t tlb1_entries;
#define TLB1_ENTRIES (tlb1_entries)
static vm_offset_t tlb1_map_base = VM_MAXUSER_ADDRESS + PAGE_SIZE;
static vm_offset_t tlb1_map_base = (vm_offset_t)VM_MAXUSER_ADDRESS + PAGE_SIZE;
static tlbtid_t tid_alloc(struct pmap *);
static void tid_flush(tlbtid_t tid);
@ -1574,7 +1574,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
* Note that kernel end does not necessarily relate to kernsize.
* kernsize is the size of the kernel that is actually mapped.
*/
kernstart = trunc_page(start);
data_start = round_page(kernelend);
data_end = data_start;
@ -2146,7 +2145,7 @@ mmu_booke_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const void *uaddr,
void **kaddr, size_t ulen, size_t *klen)
{
if ((uintptr_t)uaddr + ulen > VM_MAXUSER_ADDRESS + PAGE_SIZE)
if (trunc_page((uintptr_t)uaddr + ulen) > VM_MAXUSER_ADDRESS)
return (EFAULT);
*kaddr = (void *)(uintptr_t)uaddr;
@ -2166,7 +2165,7 @@ mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user,
vm_offset_t *decoded_addr)
{
if (addr < VM_MAXUSER_ADDRESS)
if (trunc_page(addr) <= VM_MAXUSER_ADDRESS)
*is_user = 1;
else
*is_user = 0;
@ -4025,7 +4024,8 @@ tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_size_t size)
void
tlb1_init()
{
uint32_t mas0, mas1, mas2, mas3, mas7;
vm_offset_t mas2;
uint32_t mas0, mas1, mas3, mas7;
uint32_t tsz;
tlb1_get_tlbconf();
@ -4044,6 +4044,7 @@ tlb1_init()
tsz = (mas1 & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;
kernsize += (tsz > 0) ? tsize2size(tsz) : 0;
kernstart = trunc_page(mas2);
/* Setup TLB miss defaults */
set_mas4_defaults();

View File

@ -103,7 +103,7 @@
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
#define PAGE_SHIFT 12
#define PAGE_SIZE (1L << PAGE_SHIFT) /* Page size */
#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */
#define PAGE_MASK (PAGE_SIZE - 1)
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))

View File

@ -72,53 +72,35 @@
#endif
#ifdef AIM
#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000)
#define VM_MAXUSER_ADDRESS32 0xfffff000
#else
#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0x7ffff000)
#define VM_MAXUSER_ADDRESS32 0x7ffff000
#endif
/*
* Would like to have MAX addresses = 0, but this doesn't (currently) work
*/
#if !defined(LOCORE)
#ifdef __powerpc64__
#define VM_MIN_ADDRESS (0x0000000000000000UL)
#define VM_MAXUSER_ADDRESS (0x3ffffffffffff000UL)
#define VM_MAX_ADDRESS (0xffffffffffffffffUL)
#else
#define VM_MIN_ADDRESS ((vm_offset_t)0)
#define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32
#define VM_MAX_ADDRESS ((vm_offset_t)0xffffffff)
#endif
#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE)
#else /* LOCORE */
#ifdef BOOKE
#define VM_MIN_ADDRESS 0
#ifdef __powerpc64__
#define VM_MIN_ADDRESS 0x0000000000000000
#define VM_MAXUSER_ADDRESS 0x3ffffffffffff000
#define VM_MAX_ADDRESS 0xffffffffffffffff
#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000
#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff
#define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
#else
#define VM_MAXUSER_ADDRESS 0x7ffff000
#define VM_MIN_ADDRESS 0
#define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32
#define VM_MAX_ADDRESS 0xffffffff
#endif
#endif
#endif /* LOCORE */
#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE)
#define FREEBSD32_SHAREDPAGE (VM_MAXUSER_ADDRESS32 - PAGE_SIZE)
#define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE
#ifdef __powerpc64__
#ifndef LOCORE
#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000UL
#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffffUL
#else
#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000
#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff
#endif
#define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
#endif
#ifdef AIM
#define KERNBASE 0x00100100 /* start of kernel virtual */
#ifdef AIM
#ifndef __powerpc64__
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)
#define VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1)
@ -136,12 +118,9 @@
/* Use the direct map for UMA small allocs on powerpc64. */
#ifdef __powerpc64__
#define UMA_MD_SMALL_ALLOC
#endif
#define KERNBASE 0x04000100 /* start of kernel physical */
#ifndef __powerpc64__
#define VM_MIN_KERNEL_ADDRESS 0xc0000000
#define VM_MAX_KERNEL_ADDRESS 0xffffefff
#else
#define VM_MIN_KERNEL_ADDRESS 0xc0000000
#define VM_MAX_KERNEL_ADDRESS 0xffffefff
#define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
#endif