mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
xen: Use newly added dmops for mapping VGA memory
Xen unstable (to be in 4.11) has two new dmops, relocate_memory and pin_memory_cacheattr. Use these to set up the VGA memory, replacing the previous calls to libxc. This allows the VGA console to work properly when QEMU is running restricted (-xen-domid-restrict). Wrapper functions are provided to allow QEMU to work with older versions of Xen. Tweak the error handling while making this change: * Report pin_memory_cacheattr errors. * Report errors even when DEBUG_HVM is not set. This is useful for trying to understand why VGA is not working, since otherwise it just fails silently. * Fix the return values when an error occurs. The functions now consistently return -1 and set errno. CC: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
parent
2c42f1e801
commit
2cbf890353
3 changed files with 76 additions and 21 deletions
|
@ -89,6 +89,38 @@ typedef xc_interface xendevicemodel_handle;
|
|||
|
||||
#endif
|
||||
|
||||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 41100
|
||||
|
||||
static inline int xendevicemodel_relocate_memory(
|
||||
xendevicemodel_handle *dmod, domid_t domid, uint32_t size, uint64_t src_gfn,
|
||||
uint64_t dst_gfn)
|
||||
{
|
||||
uint32_t i;
|
||||
int rc;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
unsigned long idx = src_gfn + i;
|
||||
xen_pfn_t gpfn = dst_gfn + i;
|
||||
|
||||
rc = xc_domain_add_to_physmap(xen_xc, domid, XENMAPSPACE_gmfn, idx,
|
||||
gpfn);
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int xendevicemodel_pin_memory_cacheattr(
|
||||
xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end,
|
||||
uint32_t type)
|
||||
{
|
||||
return xc_domain_pin_memory_cacheattr(xen_xc, domid, start, end, type);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION < 41100 */
|
||||
|
||||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 41000
|
||||
|
||||
#define XEN_COMPAT_PHYSMAP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue