@ -464,6 +464,8 @@ uint8_t *xen_map_cache(MemoryRegion *mr,
MapCache * mc = mapcache ;
uint8_t * p ;
assert ( mapcache ) ;
if ( grant ) {
mc = is_write ? mapcache_grants_rw : mapcache_grants_ro ;
}
@ -530,6 +532,8 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
{
ram_addr_t addr ;
assert ( mapcache ) ;
addr = xen_ram_addr_from_mapcache_single ( mapcache , ptr ) ;
if ( addr = = RAM_ADDR_INVALID ) {
addr = xen_ram_addr_from_mapcache_single ( mapcache_grants_ro , ptr ) ;
@ -652,6 +656,8 @@ static void xen_invalidate_map_cache_entry_bh(void *opaque)
void coroutine_mixed_fn xen_invalidate_map_cache_entry ( uint8_t * buffer )
{
assert ( mapcache ) ;
if ( qemu_in_coroutine ( ) ) {
XenMapCacheData data = {
. co = qemu_coroutine_self ( ) ,
@ -709,6 +715,8 @@ static void xen_invalidate_map_cache_single(MapCache *mc)
void xen_invalidate_map_cache ( void )
{
assert ( mapcache ) ;
/* Flush pending AIO before destroying the mapcache */
bdrv_drain_all ( ) ;
@ -776,6 +784,8 @@ uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr,
{
uint8_t * p ;
assert ( mapcache ) ;
mapcache_lock ( mapcache ) ;
p = xen_replace_cache_entry_unlocked ( mapcache , old_phys_addr ,
new_phys_addr , size ) ;