Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Alloc userspace process to access mapped grant memory regions


I'm trying to port something similar to Linux gntdev to NetBSD, but I'm
finding some problems. The basic functionality of gntdev is that using a
set of ioctls you can map a grant ref, and then you can access it doing
a mmap to the gntdev pseudo-device. I've tried to do the same in NetBSD,
but I'm finding some problems in the mmap device handler. What I've done
is basically the following (very simplified of course):

gntdev_mmap(...) {
        xen_shm_map(nentries, domid, grefp, &va, handlep, flags);
        pmap_extract(pmap_kernel(), va, &pa);
        return x86_btop(pa);

This however doesn't work. The user-space caller ends up with a vaddr
that points to the same physical address as the kernel vaddr (so pa is
equal in kernel and userspace), but the userspace vaddr doesn't point to
the same mfn as the kernel vaddr (va in the example). Does someone know
of a way of returning a mfn instead of a pfn from the device mmap
handler? Or is there anyway to get the vaddr that will be returned to
the userspace program, so I can map the mfn directly to that vaddr?

Thanks, Roger.

Home | Main Index | Thread Index | Old Index