Subject: Re: allocate virtual address space without physical
To: Jason Thorpe <thorpej@shagadelic.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 02/14/2005 17:28:50
On Sun, Feb 13, 2005 at 09:06:49PM -0800, Jason Thorpe wrote:
> 
> On Feb 13, 2005, at 3:13 PM, Manuel Bouyer wrote:
> 
> >for Xen, I need to allocate some kernel virtual address space, into 
> >which I'll
> >map physical pages loaned by foreign domains for I/O. The management 
> >of these
> >pages will be done in the backend drivers, and so will bypass pmap(9).
> >It there a way to reserve some kernel virtual address space from UVM, 
> >but
> >without physical memory backing it ? I didn't find an obvious way to 
> >do this
> >in the uvm(9) man page.
> 
> Look at how the i386 bus_space does this.

Hum, OK. i looked yesterday, but only at the mmap() function, which of course
isn't the right one.

So uvm_km_valloc() does work for me. But the uvm(9) man page isn't clear about
this:
     uvm_km_valloc() and uvm_km_valloc_wait() return a newly allocated zero-
     filled address in the kernel map of size size.  uvm_km_valloc_wait() will
     also wait for kernel memory to become available, if there is a memory
     shortage.

I took "zero-filled" as being memset to 0, which imply that physical memory
is associated with it.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--