From: "Edgar E. Iglesias" <[email protected]> Add function to check if the mapcache is enabled. No functional change.
Signed-off-by: Edgar E. Iglesias <[email protected]> --- hw/xen/xen-mapcache.c | 6 ++++++ hw/xen/xen_stubs.c | 5 +++++ include/system/xen-mapcache.h | 1 + 3 files changed, 12 insertions(+) diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index 517e5171b7..a3c162cd4c 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -80,6 +80,12 @@ static MapCache *mapcache_grants_ro; static MapCache *mapcache_grants_rw; static xengnttab_handle *xen_region_gnttabdev; +bool xen_map_cache_enabled(void) +{ + /* Map cache enabled implies xen_enabled(). */ + return xen_enabled() && mapcache; +} + static inline void mapcache_lock(MapCache *mc) { qemu_mutex_lock(&mc->lock); diff --git a/hw/xen/xen_stubs.c b/hw/xen/xen_stubs.c index 5e565df392..a39efb5062 100644 --- a/hw/xen/xen_stubs.c +++ b/hw/xen/xen_stubs.c @@ -29,6 +29,11 @@ bool xen_mr_is_memory(MemoryRegion *mr) g_assert_not_reached(); } +bool xen_map_cache_enabled(void) +{ + return false; +} + void xen_invalidate_map_cache_entry(uint8_t *buffer) { g_assert_not_reached(); diff --git a/include/system/xen-mapcache.h b/include/system/xen-mapcache.h index fa2cff38d1..c46190dd0c 100644 --- a/include/system/xen-mapcache.h +++ b/include/system/xen-mapcache.h @@ -13,6 +13,7 @@ typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset, ram_addr_t size); +bool xen_map_cache_enabled(void); void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque); uint8_t *xen_map_cache(MemoryRegion *mr, hwaddr phys_addr, hwaddr size, -- 2.43.0
