This commit makes altp2m_init_by_id compatible with ARM by replacing the
x86 domain validity check with an architecture independent check. This
makes it possible to call the function in the common
HVMOP_altp2m_set_domain state implementation.
This is commit 2/2 of the altp2m_init_by_id phase.
Signed-off-by: Rose Spangler <Rose.Spangler@elektrobit.com>
---
v6: Introduced this patch.
---
xen/common/altp2m.c | 5 +----
xen/include/xen/altp2m.h | 2 --
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/xen/common/altp2m.c b/xen/common/altp2m.c
index 9f5f98e1e8a5..929449b1b03c 100644
--- a/xen/common/altp2m.c
+++ b/xen/common/altp2m.c
@@ -106,7 +106,6 @@ void altp2m_vcpu_destroy(struct vcpu *v)
vcpu_unpause(v);
}
-#ifdef CONFIG_X86
int altp2m_init_by_id(struct domain *d, unsigned int idx)
{
int rc = -EINVAL;
@@ -117,14 +116,12 @@ int altp2m_init_by_id(struct domain *d, unsigned int idx)
altp2m_lock(d);
- if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] ==
- mfn_x(INVALID_MFN) )
+ if ( !altp2m_view_is_valid(d, idx) )
rc = altp2m_activate_altp2m(d, idx, hostp2m->default_access);
altp2m_unlock(d);
return rc;
}
-#endif
/*
* altp2m operations are envisioned as being used in several different
diff --git a/xen/include/xen/altp2m.h b/xen/include/xen/altp2m.h
index cd96c3b4792a..8fc16346d95b 100644
--- a/xen/include/xen/altp2m.h
+++ b/xen/include/xen/altp2m.h
@@ -71,10 +71,8 @@ static inline bool altp2m_set_altp2m(struct vcpu *v, unsigned int idx)
int do_altp2m_op(XEN_GUEST_HANDLE_PARAM(void) arg);
-#ifdef CONFIG_X86
/* Make a specific alternate p2m valid */
int altp2m_init_by_id(struct domain *d, unsigned int idx);
-#endif
#else /* CONFIG_ALTP2M */
--
2.34.1