|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v6 33/43] arm/altp2m: Add altp2m_set_view_visibility{,_locked} support
From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
This commit adds the altp2m_set_view_visibility and
altp2m_set_view_visibility_locked functions on ARM. This makes it possible
to set the altp2m view visibility in common altp2m routines (namely,
altp2m_flush).
This is commit 4/5 of the altp2m view validity/visibility phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
---
xen/arch/arm/altp2m.c | 30 ++++++++++++++++++++++++++++++
xen/arch/arm/include/asm/altp2m.h | 8 ++++++++
2 files changed, 38 insertions(+)
diff --git a/xen/arch/arm/altp2m.c b/xen/arch/arm/altp2m.c
index 0e19e197e826..aa48c17e11a3 100644
--- a/xen/arch/arm/altp2m.c
+++ b/xen/arch/arm/altp2m.c
@@ -37,6 +37,36 @@ bool altp2m_view_is_visible(struct domain *d, unsigned int
idx)
return d->arch.altp2m_state[array_index_nospec(idx, d->nr_altp2m)] ==
ALTP2M_VISIBLE;
}
+int altp2m_set_view_visibility(struct domain *d, unsigned int altp2m_idx,
+ uint8_t visible)
+{
+ 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_idx >= d->nr_altp2m || !altp2m_view_is_valid(d, altp2m_idx) )
+ rc = -EINVAL;
+ else if ( visible )
+ d->arch.altp2m_state[array_index_nospec(altp2m_idx, d->nr_altp2m)] =
+ ALTP2M_VISIBLE;
+ else
+ d->arch.altp2m_state[array_index_nospec(altp2m_idx, d->nr_altp2m)] =
+ ALTP2M_INVISIBLE;
+
+ return rc;
+}
+
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/arm/include/asm/altp2m.h
b/xen/arch/arm/include/asm/altp2m.h
index fbe66ad5536d..f8d0dd799a4a 100644
--- a/xen/arch/arm/include/asm/altp2m.h
+++ b/xen/arch/arm/include/asm/altp2m.h
@@ -40,6 +40,14 @@ enum altp2m_view_state {
ALTP2M_INVISIBLE,
};
+/* Set a specific p2m view visibility */
+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);
+
#else /* CONFIG_ALTP2M */
static inline bool altp2m_supported(void)
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |