]> xenbits.xensource.com Git - people/sstabellini/linux-pvhvm-deprecated.git/commitdiff
xen/arm: get privilege status
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 22 Jun 2012 13:51:42 +0000 (13:51 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 22 Jun 2012 13:51:42 +0000 (13:51 +0000)
Use Xen features to figure out if we are privileged.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
arch/arm/xen/enlighten.c
include/xen/interface/features.h

index e1c2e4d896e21d8eed8889396b3ab7c62c7c96e2..ddacecfafa40f13f93384d265dc44293445f6125 100644 (file)
@@ -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;
index b6ca39a069d80c984962db4659e2f9bbe3256573..131a6ccdba25693e6899b7813d99a6934e846ce4 100644 (file)
@@ -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__ */