|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH] xen/arm: check on domain type against hardware support
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
Some arm64 platforms implement only aarch64 mode. So allow
domains that are only 64-bit
Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
xen/arch/arm/arm64/domctl.c | 6 +++++-
xen/arch/arm/domain_build.c | 7 +++++++
xen/arch/arm/setup.c | 7 +++++--
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/arm64/domctl.c b/xen/arch/arm/arm64/domctl.c
index 41e2562..b2f64ae 100644
--- a/xen/arch/arm/arm64/domctl.c
+++ b/xen/arch/arm/arm64/domctl.c
@@ -11,6 +11,7 @@
#include <xen/sched.h>
#include <xen/hypercall.h>
#include <public/domctl.h>
+#include <asm/cpufeature.h>
static long switch_mode(struct domain *d, enum domain_type type)
{
@@ -35,7 +36,10 @@ long subarch_do_domctl(struct xen_domctl *domctl, struct
domain *d,
switch ( domctl->u.address_size.size )
{
case 32:
- return switch_mode(d, DOMAIN_32BIT);
+ if ( cpu_has_el1_32 )
+ return switch_mode(d, DOMAIN_32BIT);
+ else
+ return -EINVAL;
case 64:
return switch_mode(d, DOMAIN_64BIT);
default:
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 90abc3a..8782185 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -17,6 +17,7 @@
#include <asm/platform.h>
#include <asm/psci.h>
#include <asm/setup.h>
+#include <asm/cpufeature.h>
#include <asm/gic.h>
#include <xen/irq.h>
@@ -1274,6 +1275,12 @@ int construct_dom0(struct domain *d)
return rc;
#ifdef CONFIG_ARM_64
+ /* if aarch32 mode is not supported at EL1 do not allow 32-bit domain */
+ if ( (!(cpu_has_el1_32)) && kinfo.type == DOMAIN_32BIT )
+ {
+ printk("Platform does not support 32-bit domain\n");
+ return -EINVAL;
+ }
d->arch.type = kinfo.type;
#endif
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2e80b5a..9fbd315 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -883,8 +883,11 @@ void arch_get_xen_caps(xen_capabilities_info_t *info)
snprintf(s, sizeof(s), "xen-%d.%d-aarch64 ", major, minor);
safe_strcat(*info, s);
#endif
- snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
- safe_strcat(*info, s);
+ if ( cpu_has_aarch32 )
+ {
+ snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
+ safe_strcat(*info, s);
+ }
}
/*
--
1.7.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |