xen-hvm: try to use xenforeignmemory_map_resource() to map ioreq pages

Xen 4.11 has a new API to directly map guest resources. Among the resources
that can be mapped using this API are ioreq pages.

This patch modifies QEMU to attempt to use the new API should it exist,
falling back to the previous mechanism if it is unavailable.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Paul Durrant 2018-05-15 17:40:53 +01:00 committed by Stefano Stabellini
parent 04a8f72e87
commit d3c49ebbe2
4 changed files with 75 additions and 17 deletions

View file

@ -119,6 +119,22 @@ static inline int xendevicemodel_pin_memory_cacheattr(
return xc_domain_pin_memory_cacheattr(xen_xc, domid, start, end, type);
}
typedef void xenforeignmemory_resource_handle;
#define XENMEM_resource_ioreq_server 0
#define XENMEM_resource_ioreq_server_frame_bufioreq 0
#define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
static inline xenforeignmemory_resource_handle *xenforeignmemory_map_resource(
xenforeignmemory_handle *fmem, domid_t domid, unsigned int type,
unsigned int id, unsigned long frame, unsigned long nr_frames,
void **paddr, int prot, int flags)
{
errno = EOPNOTSUPP;
return NULL;
}
#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION < 41100 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 41000