Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2013 11:58:15 -0600
From:      Alan Cox <alc@rice.edu>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        "arm@freebsd.org" <arm@freebsd.org>, Alan Cox <alc@rice.edu>
Subject:   Re: svn commit: r246926 - in head/sys: arm/arm arm/include vm
Message-ID:  <5123BD37.7070709@rice.edu>
In-Reply-To: <20130219083455.176129d3@bender>
References:  <201302180102.r1I12nMX049209@svn.freebsd.org> <20130219083455.176129d3@bender>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030801040601070908060009
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 02/18/2013 13:34, Andrew Turner wrote:
> On Mon, 18 Feb 2013 01:02:49 +0000 (UTC)
> Alan Cox <alc@FreeBSD.org> wrote:
>
>> Author: alc
>> Date: Mon Feb 18 01:02:48 2013
>> New Revision: 246926
>> URL: http://svnweb.freebsd.org/changeset/base/246926
>>
>> Log:
>>   On arm, like sparc64, the end of the kernel map varies from one
>> type of machine to another.  Therefore, VM_MAX_KERNEL_ADDRESS can't
>> be a constant. Instead, #define it to be a variable,
>> vm_max_kernel_address, just like we do on sparc64.
> This looks to be broken on non-FDT ARM. There are still a number of
> copies of initarm for older ports without FDT that will need
> vm_max_kernel_address to be set.

Thanks for pointing this out.  I believe that the attached patch adds
the necessary initialization to all of the non-FDT platforms.  Since I
had to edit most of the pmap_bootstrap() calls, I also eliminated the
redundant second argument.

Alan


--------------030801040601070908060009
Content-Type: text/plain; charset=ISO-8859-15;
 name="arm_vm_max_kernel_address2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="arm_vm_max_kernel_address2.patch"

Index: arm/arm/machdep.c
===================================================================
--- arm/arm/machdep.c	(revision 246926)
+++ arm/arm/machdep.c	(working copy)
@@ -1476,7 +1476,7 @@ initarm(struct arm_boot_params *abp)
 	arm_intrnames_init();
 	arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 	arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0]));
-	pmap_bootstrap(freemempos, vm_max_kernel_address, &kernel_l1pt);
+	pmap_bootstrap(freemempos, &kernel_l1pt);
 	msgbufp = (void *)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/arm/pmap-v6.c
===================================================================
--- arm/arm/pmap-v6.c	(revision 246926)
+++ arm/arm/pmap-v6.c	(working copy)
@@ -1538,7 +1538,7 @@ pmap_alloc_specials(vm_offset_t *availp, int pages
 #define PMAP_STATIC_L2_SIZE 16
 
 void
-pmap_bootstrap(vm_offset_t firstaddr, vm_offset_t lastaddr, struct pv_addr *l1pt)
+pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
 {
 	static struct l1_ttable static_l1;
 	static struct l2_dtable static_l2[PMAP_STATIC_L2_SIZE];
@@ -1554,7 +1554,7 @@ void
 	int l1idx, l2idx, l2next = 0;
 
 	PDEBUG(1, printf("firstaddr = %08x, lastaddr = %08x\n",
-	    firstaddr, lastaddr));
+	    firstaddr, vm_max_kernel_address));
 
 	virtual_avail = firstaddr;
 	kernel_pmap->pm_l1 = l1;
@@ -1670,7 +1670,8 @@ void
 	pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)csrc_pte);
 	pmap_alloc_specials(&virtual_avail, 1, &cdstp, &cdst_pte);
 	pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)cdst_pte);
-	size = ((lastaddr - pmap_curmaxkvaddr) + L1_S_OFFSET) / L1_S_SIZE;
+	size = ((vm_max_kernel_address - pmap_curmaxkvaddr) + L1_S_OFFSET) /
+	    L1_S_SIZE;
 	pmap_alloc_specials(&virtual_avail,
 	    round_page(size * L2_TABLE_SIZE_REAL) / PAGE_SIZE,
 	    &pmap_kernel_l2ptp_kva, NULL);
@@ -1692,9 +1693,9 @@ void
 	cpu_l2cache_wbinv_all();
 
 	virtual_avail = round_page(virtual_avail);
-	virtual_end = lastaddr;
+	virtual_end = vm_max_kernel_address;
 	kernel_vm_end = pmap_curmaxkvaddr;
-	arm_nocache_startaddr = lastaddr;
+	arm_nocache_startaddr = vm_max_kernel_address;
 	mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF);
 
 	pmap_set_pcb_pagedir(kernel_pmap, thread0.td_pcb);
Index: arm/arm/pmap.c
===================================================================
--- arm/arm/pmap.c	(revision 246926)
+++ arm/arm/pmap.c	(working copy)
@@ -2254,7 +2254,7 @@ extern struct mtx smallalloc_mtx;
 #endif
 
 void
-pmap_bootstrap(vm_offset_t firstaddr, vm_offset_t lastaddr, struct pv_addr *l1pt)
+pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
 {
 	static struct l1_ttable static_l1;
 	static struct l2_dtable static_l2[PMAP_STATIC_L2_SIZE];
@@ -2270,7 +2270,7 @@ void
 	int l1idx, l2idx, l2next = 0;
 
 	PDEBUG(1, printf("firstaddr = %08x, lastaddr = %08x\n",
-	    firstaddr, lastaddr));
+	    firstaddr, vm_max_kernel_address));
 	
 	virtual_avail = firstaddr;
 	kernel_pmap->pm_l1 = l1;
@@ -2388,7 +2388,8 @@ void
 	pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)csrc_pte);
 	pmap_alloc_specials(&virtual_avail, 1, &cdstp, &cdst_pte);
 	pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)cdst_pte);
-	size = ((lastaddr - pmap_curmaxkvaddr) + L1_S_OFFSET) / L1_S_SIZE;
+	size = ((vm_max_kernel_address - pmap_curmaxkvaddr) + L1_S_OFFSET) /
+	    L1_S_SIZE;
 	pmap_alloc_specials(&virtual_avail,
 	    round_page(size * L2_TABLE_SIZE_REAL) / PAGE_SIZE,
 	    &pmap_kernel_l2ptp_kva, NULL);
@@ -2410,9 +2411,9 @@ void
 	cpu_l2cache_wbinv_all();
 
 	virtual_avail = round_page(virtual_avail);
-	virtual_end = lastaddr;
+	virtual_end = vm_max_kernel_address;
 	kernel_vm_end = pmap_curmaxkvaddr;
-	arm_nocache_startaddr = lastaddr;
+	arm_nocache_startaddr = vm_max_kernel_address;
 	mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF);
 
 #ifdef ARM_USE_SMALL_ALLOC
Index: arm/at91/at91_machdep.c
===================================================================
--- arm/at91/at91_machdep.c	(revision 246900)
+++ arm/at91/at91_machdep.c	(working copy)
@@ -624,7 +624,8 @@ initarm(struct arm_boot_params *abp)
 
 	pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1);
 	arm_dump_avail_init(memsize, sizeof(dump_avail)/sizeof(dump_avail[0]));
-	pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt);
+	vm_max_kernel_address = KERNVIRTADDR + 3 * memsize;
+	pmap_bootstrap(freemempos, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/econa/econa_machdep.c
===================================================================
--- arm/econa/econa_machdep.c	(revision 246900)
+++ arm/econa/econa_machdep.c	(working copy)
@@ -324,7 +324,8 @@ initarm(struct arm_boot_params *abp)
 
 	pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1);
 	arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0]));
-	pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt);
+	vm_max_kernel_address = KERNVIRTADDR + 3 * memsize;
+	pmap_bootstrap(freemempos, &kernel_l1pt);
 
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
Index: arm/include/pmap.h
===================================================================
--- arm/include/pmap.h	(revision 246900)
+++ arm/include/pmap.h	(working copy)
@@ -222,7 +222,7 @@ extern vm_paddr_t phys_avail[];
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
 
-void	pmap_bootstrap(vm_offset_t, vm_offset_t, struct pv_addr *);
+void	pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt);
 int	pmap_change_attr(vm_offset_t, vm_size_t, int);
 void	pmap_kenter(vm_offset_t va, vm_paddr_t pa);
 void	pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa);
Index: arm/s3c2xx0/s3c24x0_machdep.c
===================================================================
--- arm/s3c2xx0/s3c24x0_machdep.c	(revision 246900)
+++ arm/s3c2xx0/s3c24x0_machdep.c	(working copy)
@@ -386,7 +386,8 @@ initarm(struct arm_boot_params *abp)
 
 	pmap_curmaxkvaddr = afterkern + 0x100000 * (KERNEL_PT_KERN_NUM - 1);
 	arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0]));
-	pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt);
+	vm_max_kernel_address = KERNVIRTADDR + 3 * memsize;
+	pmap_bootstrap(freemempos, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/sa11x0/assabet_machdep.c
===================================================================
--- arm/sa11x0/assabet_machdep.c	(revision 246900)
+++ arm/sa11x0/assabet_machdep.c	(working copy)
@@ -381,7 +381,8 @@ initarm(struct arm_boot_params *abp)
 	dump_avail[3] = phys_avail[3] = 0;
 					
 	mutex_init();
-	pmap_bootstrap(freemempos, 0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(freemempos, &kernel_l1pt);
 
 	init_param2(physmem);
 	kdb_init();
Index: arm/xscale/i80321/ep80219_machdep.c
===================================================================
--- arm/xscale/i80321/ep80219_machdep.c	(revision 246900)
+++ arm/xscale/i80321/ep80219_machdep.c	(working copy)
@@ -368,8 +368,8 @@ initarm(struct arm_boot_params *abp)
 	dump_avail[2] = 0;
 	dump_avail[3] = 0;
 					
-	pmap_bootstrap(pmap_curmaxkvaddr,
-	    0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/xscale/i80321/iq31244_machdep.c
===================================================================
--- arm/xscale/i80321/iq31244_machdep.c	(revision 246900)
+++ arm/xscale/i80321/iq31244_machdep.c	(working copy)
@@ -369,8 +369,8 @@ initarm(struct arm_boot_params *abp)
 	dump_avail[2] = 0;
 	dump_avail[3] = 0;
 					
-	pmap_bootstrap(pmap_curmaxkvaddr,
-	    0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/xscale/i8134x/crb_machdep.c
===================================================================
--- arm/xscale/i8134x/crb_machdep.c	(revision 246900)
+++ arm/xscale/i8134x/crb_machdep.c	(working copy)
@@ -347,8 +347,8 @@ initarm(struct arm_boot_params *abp)
 	dump_avail[2] = 0;
 	dump_avail[3] = 0;
 					
-	pmap_bootstrap(pmap_curmaxkvaddr,
-	    0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/xscale/ixp425/avila_machdep.c
===================================================================
--- arm/xscale/ixp425/avila_machdep.c	(revision 246900)
+++ arm/xscale/ixp425/avila_machdep.c	(working copy)
@@ -432,7 +432,8 @@ initarm(struct arm_boot_params *abp)
 
 	pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
 	arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0]));
-	pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
Index: arm/xscale/pxa/pxa_machdep.c
===================================================================
--- arm/xscale/pxa/pxa_machdep.c	(revision 246900)
+++ arm/xscale/pxa/pxa_machdep.c	(working copy)
@@ -365,7 +365,8 @@ initarm(struct arm_boot_params *abp)
 	}
 	dump_avail[i] = 0;
 	dump_avail[i] = 0;
-	pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt);
+	vm_max_kernel_address = 0xd0000000;
+	pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
 	msgbufp = (void*)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();

--------------030801040601070908060009--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5123BD37.7070709>