|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v6 37/43] altp2m: Move altp2m_init_by_id to common code
This commit moves the altp2m_init_by_id function to common code, gated to
only compile on x86. This makes it possible to call in the common
HVMOP_altp2m_set_domain_state command implementation.
This commit contains only code movement, and no change in functionality is
intended.
This is commit 1/2 of the altp2m_init_by_id phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
---
xen/arch/x86/include/asm/altp2m.h | 3 ---
xen/arch/x86/mm/altp2m.c | 18 ------------------
xen/common/altp2m.c | 20 ++++++++++++++++++++
xen/include/xen/altp2m.h | 5 +++++
4 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/xen/arch/x86/include/asm/altp2m.h
b/xen/arch/x86/include/asm/altp2m.h
index 203dba44e2bf..e7239326c71d 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -85,9 +85,6 @@ bool altp2m_switch_vcpu_by_id(struct vcpu *v, unsigned int
idx);
/* Flush all the alternate p2m's for a domain */
void altp2m_flush(struct domain *d);
-/* Make a specific alternate p2m valid */
-int altp2m_init_by_id(struct domain *d, unsigned int idx);
-
/* Find an available alternate p2m and make it valid */
int altp2m_init_next_available(struct domain *d, uint16_t *idx,
xenmem_access_t hvmmem_default_access);
diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c
index 40c6ea72a621..edbaf54c3761 100644
--- a/xen/arch/x86/mm/altp2m.c
+++ b/xen/arch/x86/mm/altp2m.c
@@ -315,24 +315,6 @@ int altp2m_activate_altp2m(struct domain *d, unsigned int
idx,
return rc;
}
-int altp2m_init_by_id(struct domain *d, unsigned int idx)
-{
- int rc = -EINVAL;
- struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
-
- if ( idx >= d->nr_altp2m )
- return rc;
-
- altp2m_lock(d);
-
- if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] ==
- mfn_x(INVALID_MFN) )
- rc = altp2m_activate_altp2m(d, idx, hostp2m->default_access);
-
- altp2m_unlock(d);
- return rc;
-}
-
int altp2m_init_next_available(struct domain *d, uint16_t *idx,
xenmem_access_t hvmmem_default_access)
{
diff --git a/xen/common/altp2m.c b/xen/common/altp2m.c
index c234bb3774f4..9f5f98e1e8a5 100644
--- a/xen/common/altp2m.c
+++ b/xen/common/altp2m.c
@@ -106,6 +106,26 @@ 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;
+ struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
+
+ if ( idx >= d->nr_altp2m )
+ return rc;
+
+ altp2m_lock(d);
+
+ if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] ==
+ mfn_x(INVALID_MFN) )
+ 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
* modes:
diff --git a/xen/include/xen/altp2m.h b/xen/include/xen/altp2m.h
index 37c875a52327..cd96c3b4792a 100644
--- a/xen/include/xen/altp2m.h
+++ b/xen/include/xen/altp2m.h
@@ -71,6 +71,11 @@ 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 */
static inline bool altp2m_active(const struct domain *d)
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |