xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: vijay.kilari@gmail.com
To: Ian.Campbell@citrix.com, julien.grall@linaro.org,
	stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
	tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
	Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
	manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: [RFC PATCH] xen/arm: check on domain type against hardware support
Date: Thu, 18 Sep 2014 17:43:47 +0530	[thread overview]
Message-ID: <1411042429-17108-2-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1411042429-17108-1-git-send-email-vijay.kilari@gmail.com>

From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>

Some arm64 platforms implement only aarch64 mode. So allow
domains that are only 64-bit

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
---
 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

  reply	other threads:[~2014-09-18 12:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 12:13 [PATCH] xen/arm: Use REG_RANK_INDEX macro vijay.kilari
2014-09-18 12:13 ` vijay.kilari [this message]
2014-09-23 16:31   ` [RFC PATCH] xen/arm: check on domain type against hardware support Ian Campbell
2014-09-25  8:31     ` Vijay Kilari
2014-09-25 11:08       ` Ian Campbell
2014-09-29 12:18         ` Julien Grall
2014-09-29 12:35           ` Ian Campbell
2014-09-29 12:42             ` Julien Grall
2014-09-18 12:13 ` [RFC PATCH] xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2 vijay.kilari
2014-09-23 16:32   ` Ian Campbell
2014-09-24  9:00     ` Ian Campbell
2014-09-18 12:13 ` [RFC PATCH] xen/arm: remove check for generic timer support for arm64 vijay.kilari
2014-09-23 16:33   ` Ian Campbell
2014-09-24  9:00     ` Ian Campbell
2014-09-23 16:19 ` [PATCH] xen/arm: Use REG_RANK_INDEX macro Ian Campbell
2014-09-23 16:45 ` Stefano Stabellini
2014-09-24  8:59   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411042429-17108-2-git-send-email-vijay.kilari@gmail.com \
    --to=vijay.kilari@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=julien.grall@linaro.org \
    --cc=manish.jaggi@caviumnetworks.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).