[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1340381685-22529-3-git-send-email-stefano.stabellini@eu.citrix.com>
Date: Fri, 22 Jun 2012 17:14:42 +0100
From: Stefano Stabellini <stefano.stabellini@...citrix.com>
To: <linux-kernel@...r.kernel.org>
CC: <xen-devel@...ts.xensource.com>,
<Stefano.Stabellini@...citrix.com>, <Ian.Campbell@...rix.com>,
<tim@....org>,
Stefano Stabellini <stefano.stabellini@...citrix.com>
Subject: [PATCH WIP 3/6] xen/arm: get privilege status
Use Xen features to figure out if we are privileged.
Signed-off-by: Stefano Stabellini <stefano.stabellini@...citrix.com>
---
arch/arm/xen/enlighten.c | 9 ++++++++-
include/xen/interface/features.h | 3 +++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index e1c2e4d..ddacecf 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -3,6 +3,7 @@
#include <xen/interface/memory.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
+#include <xen/features.h>
#include <linux/module.h>
@@ -11,7 +12,7 @@
#include <asm/pgtable.h>
-struct start_info _xen_start_info = { .flags = (SIF_INITDOMAIN|SIF_PRIVILEGED) };
+struct start_info _xen_start_info;
struct start_info *xen_start_info = &_xen_start_info;
EXPORT_SYMBOL_GPL(xen_start_info);
@@ -133,6 +134,12 @@ static void __init xen_hvm_init_shared_info(void)
struct xen_add_to_physmap xatp;
static struct shared_info *shared_info_page = 0;
+ xen_setup_features();
+ if (xen_feature(XENFEAT_dom0))
+ xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
+ else
+ xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+
/* already setup */
if (shared_info_page != 0 && HYPERVISOR_shared_info == shared_info_page)
return;
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index b6ca39a..131a6cc 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -50,6 +50,9 @@
/* x86: pirq can be used by HVM guests */
#define XENFEAT_hvm_pirqs 10
+/* operation as Dom0 is supported */
+#define XENFEAT_dom0 11
+
#define XENFEAT_NR_SUBMAPS 1
#endif /* __XEN_PUBLIC_FEATURES_H__ */
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists