#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)
{
switch ( domctl->u.address_size.size )
{
case 32:
+ if ( !cpu_has_el1_32 )
+ return -EINVAL;
return switch_mode(d, DOMAIN_32BIT);
case 64:
return switch_mode(d, DOMAIN_64BIT);
#include <asm/platform.h>
#include <asm/psci.h>
#include <asm/setup.h>
+#include <asm/cpufeature.h>
#include <asm/gic.h>
#include <xen/irq.h>
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
printk("32-bit Execution:\n");
printk(" Processor Features: %08"PRIx32":%08"PRIx32"\n",
boot_cpu_data.pfr32.bits[0], boot_cpu_data.pfr32.bits[1]);
- printk(" Instruction Sets:%s%s%s%s%s\n",
+ printk(" Instruction Sets:%s%s%s%s%s%s\n",
cpu_has_aarch32 ? " AArch32" : "",
+ cpu_has_arm ? " A32" : "",
cpu_has_thumb ? " Thumb" : "",
cpu_has_thumb2 ? " Thumb-2" : "",
cpu_has_thumbee ? " ThumbEE" : "",
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);
+ }
}
/*
#define cpu_feature32(c, feat) ((c)->pfr32.feat)
#define boot_cpu_feature32(feat) (boot_cpu_data.pfr32.feat)
-#define cpu_has_aarch32 (boot_cpu_feature32(arm) == 1)
+#define cpu_has_arm (boot_cpu_feature32(arm) == 1)
#define cpu_has_thumb (boot_cpu_feature32(thumb) >= 1)
#define cpu_has_thumb2 (boot_cpu_feature32(thumb) >= 3)
#define cpu_has_jazelle (boot_cpu_feature32(jazelle) >= 0)
#define cpu_has_thumbee (boot_cpu_feature32(thumbee) == 1)
+#define cpu_has_aarch32 (cpu_has_arm || cpu_has_thumb)
#ifdef CONFIG_ARM_32
#define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1)