|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v6 10/43] altp2m: Add ARM support to do_altp2m_op
This commit makes the minimum required changes necessary for do_altp2m_op
to compile on ARM. All altp2m commands in the switch statement are gated by
CONFIG_X86, with a default case of returning EOPNOTSUPP. This allows future
commits to move the #ifdef CONFIG_X86 down as support for ARM is added.
Additionally, a call to do_altp2m_op is added in the ARM HVMOP code.
This is commit 2/2 of the common do_altp2m_op phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
v6: Replaced patches 2 and 3 from v4/v5 patch set with this patch.
Made HVM_PARAM_ALTP2M read-only, following the change to the x86
implementation in commit 0291089f6ea8. The DOMCTL to enable altp2m on
ARM is implemented in a later commit in this patch series.
---
xen/arch/arm/hvm.c | 9 +++++++++
xen/common/altp2m.c | 29 ++++++++++++++---------------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index 86e49bf47403..7c778795a280 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -5,6 +5,7 @@
* Arch-specific hardware virtual machine abstractions.
*/
+#include <xen/altp2m.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
@@ -23,6 +24,10 @@ static int hvm_allow_set_param(const struct domain *d,
unsigned int param)
{
switch ( param )
{
+ /* The following parameters are read-only. */
+ case HVM_PARAM_ALTP2M:
+ return -EEXIST;
+
/*
* The following parameters are intended for toolstack usage only.
* They may not be set by the domain.
@@ -123,6 +128,10 @@ long do_hvm_op(unsigned long op,
XEN_GUEST_HANDLE_PARAM(void) arg)
rc = -EINVAL;
break;
+ case HVMOP_altp2m:
+ rc = do_altp2m_op(arg);
+ break;
+
default:
{
gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
diff --git a/xen/common/altp2m.c b/xen/common/altp2m.c
index a43b3a3e34b3..6481fae1ed12 100644
--- a/xen/common/altp2m.c
+++ b/xen/common/altp2m.c
@@ -9,8 +9,10 @@
#include <xsm/xsm.h>
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) && defined(CONFIG_HVM)
#include <asm/hvm/nestedhvm.h>
+#endif
+
/*
* altp2m operations are envisioned as being used in several different
* modes:
@@ -18,13 +20,13 @@
* - external: All control and decisions are made by an external agent
* running domain 0.
*
- * - internal: altp2m operations are used exclusively by an in-guest
- * agent to protect itself from the guest kernel and in-guest
- * attackers.
+ * - internal (x86 only): altp2m operations are used exclusively by an
+ * in-guest agent to protect itself from the guest kernel and
+ * in-guest attackers.
*
- * - coordinated: An in-guest agent handles #VE and VMFUNCs locally,
- * but makes requests of an agent running outside the domain for
- * bigger changes (such as modifying altp2m entires).
+ * - coordinated (x86 only): An in-guest agent handles #VE and VMFUNCs
+ * locally, but makes requests of an agent running outside the
+ * domain for bigger changes (such as modifying altp2m entires).
*
* This corresponds to the three values for HVM_PARAM_ALTP2M
* (external, mixed, limited). All three models have advantages and
@@ -97,7 +99,7 @@ int do_altp2m_op(
if ( (a.cmd != HVMOP_altp2m_get_domain_state) &&
(a.cmd != HVMOP_altp2m_set_domain_state) &&
- !d->altp2m_active )
+ !altp2m_active(d) )
{
rc = -EOPNOTSUPP;
goto out;
@@ -122,6 +124,7 @@ int do_altp2m_op(
switch ( a.cmd )
{
+#ifdef CONFIG_X86
case HVMOP_altp2m_get_domain_state:
a.u.domain_state.state = altp2m_active(d);
rc = __copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
@@ -394,9 +397,12 @@ int do_altp2m_op(
rc = altp2m_set_view_visibility(d, idx,
a.u.set_visibility.visible);
break;
}
+#endif /* CONFIG_X86 */
default:
+#ifdef CONFIG_X86
ASSERT_UNREACHABLE();
+#endif
rc = -EOPNOTSUPP;
break;
}
@@ -406,13 +412,6 @@ int do_altp2m_op(
return rc;
}
-#else
-int do_altp2m_op(
- XEN_GUEST_HANDLE_PARAM(void) arg)
-{
- return -EOPNOTSUPP;
-}
-#endif
/*
* Local variables:
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |