Initialize and bring down altp2m only when it is supported by the platform,
e.g. VMX. Also guard p2m_altp2m_propagate_change().
The purpose of that is the possibility to disable altp2m support and exclude its
code from the build completely, when it's not supported by the target platform.
Here hvm_altp2m_supported() is being used to check for ALTP2M availability,
which is only defined if HVM enabled, so a stub for that routine added for
!HVM configuration as well.
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
return false;
}
+static inline bool hvm_altp2m_supported(void)
+{
+ return false;
+}
+
static inline bool hvm_nested_virt_supported(void)
{
return false;
return rc;
}
- rc = p2m_init_altp2m(d);
+ rc = hvm_altp2m_supported() ? p2m_init_altp2m(d) : 0;
if ( rc )
{
p2m_teardown_hostp2m(d);
{
if ( is_hvm_domain(d) )
{
+ if ( hvm_altp2m_supported() )
+ p2m_teardown_altp2m(d);
/*
- * We must tear down both of them unconditionally because
- * we initialise them unconditionally.
+ * We must tear down nestedp2m unconditionally because
+ * we initialise it unconditionally.
*/
- p2m_teardown_altp2m(d);
p2m_teardown_nestedp2m(d);
}
if ( is_epte_present(&old_entry) )
ept_free_entry(p2m, &old_entry, target);
- if ( entry_written && p2m_is_hostp2m(p2m) )
+ if ( hvm_altp2m_supported() && entry_written && p2m_is_hostp2m(p2m) )
{
ret = p2m_altp2m_propagate_change(d, _gfn(gfn), mfn, order, p2mt, p2ma);
if ( !rc )