The current logic partially open-codes memory_type_changed(), but doesn't
check whether the type change or the cache flush is actually needed.
Instead switch to using memory_type_changed(), at possibly a higher expense
cost of not exclusively issuing cache flushes when limiting cacheability.
However using memory_type_changed() has the benefit of limiting
recalculations and cache flushes to strictly only when it's meaningful due
to the guest configuration, like having devices or IO regions assigned.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
type = range->type;
call_rcu(&range->rcu, free_pinned_cacheattr_entry);
- p2m_memory_type_changed(d);
- switch ( type )
- {
- case X86_MT_UCM:
- /*
- * For EPT we can also avoid the flush in this case;
- * see epte_get_entry_emt().
- */
- if ( hap_enabled(d) && cpu_has_vmx )
- case X86_MT_UC:
- break;
- /* fall through */
- default:
- flush_all(FLUSH_CACHE);
- break;
- }
+ memory_type_changed(d);
+
return 0;
}
domain_unlock(d);
xfree(newr);
- p2m_memory_type_changed(d);
- if ( type != X86_MT_WB )
- flush_all(FLUSH_CACHE);
+ memory_type_changed(d);
return rc;
}