Avoid cache flush on EPT when removing a UC- range, since when used
this type gets converted to UC anyway (there's no UC- among the types
valid in MTRRs and hence EPT's emt field).
We might further wwant to consider only forcing write buffer flushes
when removing WC ranges.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
type = range->type;
call_rcu(&range->rcu, free_pinned_cacheattr_entry);
p2m_memory_type_changed(d);
- if ( type != PAT_TYPE_UNCACHABLE )
+ switch ( type )
+ {
+ case PAT_TYPE_UC_MINUS:
+ /*
+ * For EPT we can also avoid the flush in this case;
+ * see epte_get_entry_emt().
+ */
+ if ( hap_enabled(d) && cpu_has_vmx )
+ case PAT_TYPE_UNCACHABLE:
+ break;
+ /* fall through */
+ default:
flush_all(FLUSH_CACHE);
+ break;
+ }
return 0;
}
rcu_read_unlock(&pinned_cacheattr_rcu_lock);