|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v6 32/43] x86/altp2m: Add altp2m_set_view_visibility_locked
From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
This commit splits the altp2m_set_view_visibility into two functions, where
the altp2m_set_view_visibility_locked variant has the preconditions that
the altp2m lock is held. This makes it possible to change a view's
visibility in an architecture independent way in code that already holds
the altp2m lock (namely, altp2m_flush).
This is commit 3/5 of the altp2m view validity/visibility phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
---
xen/arch/x86/include/asm/altp2m.h | 4 ++++
xen/arch/x86/mm/altp2m.c | 14 +++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/include/asm/altp2m.h
b/xen/arch/x86/include/asm/altp2m.h
index 56ae19b24b42..99c4cfa5a68b 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -106,6 +106,10 @@ int altp2m_change_gfn(struct domain *d, unsigned int idx,
gfn_t old_gfn,
int altp2m_set_view_visibility(struct domain *d, unsigned int altp2m_idx,
uint8_t visible);
+/* Set a specific p2m view visibility (with lock already held) */
+int altp2m_set_view_visibility_locked(struct domain *d, unsigned int
altp2m_idx,
+ uint8_t visible);
+
/*
* Looks up altp2m entry. If the entry is not found it looks up the entry in
* hostp2m.
diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c
index 0542e3ef9196..8672b8c061d3 100644
--- a/xen/arch/x86/mm/altp2m.c
+++ b/xen/arch/x86/mm/altp2m.c
@@ -685,9 +685,19 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool
*suppress_ve,
int altp2m_set_view_visibility(struct domain *d, unsigned int altp2m_idx,
uint8_t visible)
{
- int rc = 0;
+ int rc;
altp2m_lock(d);
+ rc = altp2m_set_view_visibility_locked(d, altp2m_idx, visible);
+ altp2m_unlock(d);
+
+ return rc;
+}
+
+int altp2m_set_view_visibility_locked(struct domain *d, unsigned int
altp2m_idx,
+ uint8_t visible)
+{
+ int rc = 0;
if ( !altp2m_is_eptp_valid(d, altp2m_idx) )
rc = -EINVAL;
@@ -698,8 +708,6 @@ int altp2m_set_view_visibility(struct domain *d, unsigned
int altp2m_idx,
d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] =
mfn_x(INVALID_MFN);
- altp2m_unlock(d);
-
return rc;
}
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |