Date: Tue, 30 Jun 2015 11:57:47 +0200 From: Stefano Garzarella <stefanogarzarella@gmail.com> To: freebsd-virtualization@freebsd.org Cc: Luigi Rizzo <rizzo@iet.unipi.it>, Peter Grehan <grehan@freebsd.org>, Neel Natu <neel@freebsd.org>, stefano@freebsd.org Subject: bhyve - map user-space buffer in the VM Message-ID: <CAO0mX5YTTgOZK0FKwuaY0%2BToz8FnR4gX3gPFQzwCoDdaoFuorw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAO0mX5YTTgOZK0FKwuaY0%2BToz8FnR4gX3gPFQzwCoDdaoFuorw>