Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2001 01:18:54 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        "Eugene M. Kim" <gene@nttmcl.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: VM question (I hate Intel 810/815 chipsets...)
Message-ID:  <3BC4046E.8C6D7189@mindspring.com>
References:  <20011009165735.A22544@alicia.nttmcl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BC4046E.8C6D7189>