@samitouri / QOSamiQemu / commits / ded5f9a909

xen: mapcache: Add function to check if the mapcache is enabled

Add function to check if the mapcache is enabled. No functional change. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Edgar E. Iglesias committed Jul 23, 2025 at 11:41 UTC ded5f9a90925212b64da3bbad1651a1a455c14ea
3 files changed +12
hw/xen/xen-mapcache.c
+6
@@ -80,6 +80,12 @@ static MapCache *mapcache_grants_ro;
80 static MapCache *mapcache_grants_rw;
81 static xengnttab_handle *xen_region_gnttabdev;
82
83 +bool xen_map_cache_enabled(void)
84 +{
85 + /* Map cache enabled implies xen_enabled(). */
86 + return xen_enabled() && mapcache;
87 +}
88 +
89 static inline void mapcache_lock(MapCache *mc)
90 {
91 qemu_mutex_lock(&mc->lock);
hw/xen/xen_stubs.c
+5
@@ -29,6 +29,11 @@ bool xen_mr_is_memory(MemoryRegion *mr)
29 g_assert_not_reached();
30 }
31
32 +bool xen_map_cache_enabled(void)
33 +{
34 + return false;
35 +}
36 +
37 void xen_invalidate_map_cache_entry(uint8_t *buffer)
38 {
39 g_assert_not_reached();
include/system/xen-mapcache.h
+1
@@ -13,6 +13,7 @@
13
14 typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset,
15 ram_addr_t size);
16 +bool xen_map_cache_enabled(void);
17 void xen_map_cache_init(phys_offset_to_gaddr_t f,
18 void *opaque);
19 uint8_t *xen_map_cache(MemoryRegion *mr, hwaddr phys_addr, hwaddr size,