From owner-freebsd-hackers Wed Oct 10 1:18:11 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id E738E37B406 for ; Wed, 10 Oct 2001 01:18:06 -0700 (PDT) Received: from mindspring.com (dialup-209.247.137.241.Dial1.SanJose1.Level3.net [209.247.137.241]) by albatross.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id BAA05576; Wed, 10 Oct 2001 01:18:03 -0700 (PDT) Message-ID: <3BC4046E.8C6D7189@mindspring.com> Date: Wed, 10 Oct 2001 01:18:54 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "Eugene M. Kim" Cc: freebsd-hackers@freebsd.org Subject: Re: VM question (I hate Intel 810/815 chipsets...) References: <20011009165735.A22544@alicia.nttmcl.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "Eugene M. Kim" wrote: > > What would be the best way to allocate: > > 1) a VM page whose physical address falls within a certain boundary, and > 2) a VM object whose pages are contiguous in physical address space? > > Background: > The !@*%^*!&#^%*&!#^$!@ Intel 810/815 graphics controller requires its > instruction and hardware cursor buffers to reside within first 32MB and > 512MB of *physical* memory space respectively. :( :( ;( The XFree86 > driver assumes the Linux memory model (virtual addr == physical addr), > so it runs on Linux, but not always on FreeBSD. How strange. There is code to allocate from the first 16M of memory, for bounce buffers and the like, for the bus code, which has to deal with ISA devices that can't address greater than 16M when doing a DMA. So if you allocated there, it would be no problem. The Linux idea seems bad to me -- but, of course, it's certainly conceptually easier, if you don't have to think about address virtualization. Normally FreeBSD's kernel lives in virtual address space in the 1G above 3G, and the user programs all think they are along in the 3G at the bottom. This makes copying data in and out much easier. For the kernel address space itself, the "physical=virtual" may be true on Linux (I doubt it is, or they could not support more than 4G on the newer Intel systems with segmentation windows to move gigs of memory around at a time for up to 16G), but on FreeBSD, you really have very little to *no* control of the memory pages you are granted. You also don't say whether the memory needs to be physically contiguous. If it does, then you will need to do contigmalloc() to get the memory; I'm pretty sure you can't do this and get bounce (low 16M) memory at the same time. So what you want to do may require you to look at the bounce buffer and contigmalloc() code. Note that FreeBSD doesn't force swappable pages out in the case you are calling contigmalloc(), so it may be that you will only be able to successfully reserve memory at boot time. If so, you would probably be much better off doing the reservation as part of machdep.c, which is memory that is contiguous off the end of the kernel BSS, and can only be allocated at boot time. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message