Bug #14511
closedbhyve needs devmem access for all segments
100%
Description
On FreeBSD, bhyve instances enjoy multiple minor nodes from which to provide access to resources associated with a given VM. Chief among them are the memory "segments" (read: objects), which are the blocks of memory which back the guest-physical address space of the instance. While the guest-physical AS itself can be mapped by userspace (and is, indeed, for driver emulation), there are cases where direct access to the underlying memory segments is required. The common case is writing the contents of the "bootrom" segment, which is mapped read-only into the guest-physical AS. The illumos bhyve interface exposes these "devmem" mappings (those which access the memory segment directly, rather than through the guest-physical AS) by placing them at a magic offset in the singular minor node allocated to the instance. Userspace can then query the offset for a given segment id through an ioctl, allowing it to then mmap() it. Presently this is limited to non-"sysmem" segments only -- basically just the bootrom. There is other functionality (such as live migration) which will benefit from those same direct mappings to the "sysmem" objects making up the bulk of guest RAM. We should loosen the restriction so all segments within an instance can be mapped that way.