From owner-freebsd-arm@FreeBSD.ORG Tue Feb 1 01:02:39 2011 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91D1A106564A for ; Tue, 1 Feb 2011 01:02:39 +0000 (UTC) (envelope-from deveshkr@marvell.com) Received: from na3sys009aog114.obsmtp.com (na3sys009aog114.obsmtp.com [74.125.149.211]) by mx1.freebsd.org (Postfix) with ESMTP id 301628FC14 for ; Tue, 1 Feb 2011 01:02:37 +0000 (UTC) Received: from source ([65.219.4.129]) (using TLSv1) by na3sys009aob114.postini.com ([74.125.148.12]) with SMTP ID DSNKTUdbqkRy+HPk+ENdSpXbNp2lKMTDDEbb@postini.com; Mon, 31 Jan 2011 17:02:39 PST Received: from SC-vEXCH2.marvell.com ([10.93.76.134]) by SC-OWA01.marvell.com ([10.93.76.21]) with mapi; Mon, 31 Jan 2011 17:02:01 -0800 From: Devesh Rai To: Mark Tinguely Date: Mon, 31 Jan 2011 17:01:59 -0800 Thread-Topic: Changing virtual adress space layout Thread-Index: Acu++LzxOW22HAOmR2y4XE2MYMM8XACrhGdQ Message-ID: <0DB595A2CB707F458400BE9663B6A7225E42E92B10@SC-VEXCH2.marvell.com> In-Reply-To: <4D42D45D.5080200@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "freebsd-arm@freebsd.org" Subject: RE: Changing virtual adress space layout X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2011 01:02:39 -0000 Hi Mark, After going through "Hardware Page Table Translation" section of manual, it= looks like section based mapping is more beneficial. Because it requires j= ust one "First Level" fetch by MMU for virtual to physical address translat= ion. What you told me in your previous response is making sense to me. I can now= play around with code a bit. Thanks a lot for you help and time. Thanks & Regards Devesh =20 -----Original Message----- From: Mark Tinguely [mailto:marktinguely@gmail.com]=20 Sent: Friday, January 28, 2011 8:06 PM To: Devesh Rai Cc: freebsd-arm@freebsd.org Subject: Re: Changing virtual adress space layout On 1/28/2011 7:35 AM, Devesh Rai wrote: > Hi Mark, > > Thank you very much for your detail response. Trick of not changing KERNV= IRTADDR worked. > I was able to map 1GB of RAM into kva from KERNBASE(0x8000_0000) to OLD_K= ERNBASE(0xC000_0000) using pmap_map_chunk api. > I was able to write some data into mapped space and print it back. > > But some doubt I still have > > 1) What is L1 and L2 page table in FreeBSD? Is there document which expla= ins these vm concepts for arm? > 2) How do I verify that this mapping indeed happened? > > Thanks& Regards > Devesh Good news. The ARM(r) Architecture Reference Manual is available for download on the=20 website www.arm.com. There is a document that covers ARMv4-ARMv6 and a=20 document for ARMv7. The L1 maps 1MB of contiguous memory or has a pointer to a 1KB l2 page=20 table entry that maps 256 4KB pages. Sounds like you are mapping a 1MB contiuous area of memory that is on a=20 1 MB boundary, but If you were not then, you first need to allocate 1KB=20 for the l2 page table and install it into the kernel page table using=20 the pmap_link_l2pt() routine. The pmap_map_chunk() routine can then be=20 used to install the l1/l2 mapping. You may want to think about the appropriate caching of this memory. You can look at the l1 (and l2 if used) page tables to verify that the=20 KVA is mapped to the proper PA. I suppose you could remap the PA to=20 another KVA to verify values too, but you have to understand caching=20 principles to do this correctly. --Mark.