gasp_map_sys()

Map a guest physical address range into the qvm process address space for virtual firmware access

Synopsis:

#include <qvm/gasp.h>
void* gasp_map_sys(struct guest_system *gsp,
                   int prot,
                   uint64_t guest_paddr,
                   size_t length)

Arguments:

gsp
A pointer to the guest system for the host physical address space.
prot
PROT_* protection bits for the mappings, optionally GMF_MAP_ANY.
guest_paddr
The starting guest physical address to be mapped in.
length
The number of bytes to be mapped in.

Library:

Provided by qvm; no external library is required.

Description:

Use this function to map a guest-physical address range into the qvm process (guest-physical) address space to provide access to virtual firmware in the VM.

This function uses a gsp guest_system pointer and doesn't include a vdev argument. Use this function if you would be passing NULL as the vdev argument. If your vdev argument is not NULL, use gasp_map_vdma().

When deciding whether to use gasp_map_sys() or gasp_map_vdma(), consider the following:
  • If you have allocated the guest-physical address, you should use gasp_map_sys(), unless you're in a context where it makes sense to allow the guest to decide if mapping is permitted.
  • If the guest has provided the guest-physical address you want to map, you shall use gasp_map_vdma(), because with this function the mapping goes through the guest-controlled simulated IOMMU.

The above are guidelines, and your design may require that you use the function not recommended in the guidelines. If you don't follow the guidelines, though, be sure that you can justify your decision, and understand the implications of not following them.

Call gasp_unmap() to unmap the address range.

Returns:

A qvm process pointer that maps the guest physical address, or NULL if unsuccessful.