bhyve - map user-space buffer in the VM

Stefano Garzarella stefanogarzarella at gmail.com
Tue Jun 30 09:58:13 UTC 2015


Hi all,
I'm working on bhyve to support ptnetmap (netmap passthrough) for my GSoC.
http://wiki.freebsd.org/SummerOfCode2015/ptnetmapOnBhyve

I've already implemented it on QEMU/KVM and, to expose the netmap memory in
the VM, I used a PCI BAR and I mapped the netmap memory (the buffer
returned by mmap() on netmap fd in the user space) on the BAR in the VM
through KVM API.

In bhyve I able to create a PCI BAR but I only found vm_map_pptdev_mmio()
API to map physical host page into the VM. I saw that this IOCTL is
implemented in the kernel module with sglist_append_phys() to populate a
scatter/gather list, than it is mapped in VM.

I would like to add a new function in the API to map a user buffer in the
VM:
int vm_map_user_buf(struct vmctx *ctx, vm_paddr_t gpa, size_t len, void
*host_buf)

I would implement it adding a new IOCTL and I would create, in the kernel
module, a new function like vmm_mmio_alloc() (sys/amd64/vmm/vmm_mem.c) but
using sglist_append_user() instead of sglist_append_phys().

What do you think about it?
There is another way to map an user-space buffer in the VM?

Thanks,
Stefano


More information about the freebsd-virtualization mailing list