]> xenbits.xensource.com Git - people/sstabellini/linux-pvhvm-deprecated.git/commitdiff
xen/arm: Introduce xen_guest_init
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 22 Jun 2012 15:30:30 +0000 (15:30 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 22 Jun 2012 15:30:30 +0000 (15:30 +0000)
We used to rely on a core_initcall to initialize Xen on ARM, however
core_initcalls are actually called after early consoles are initialized.
That means that hvc_xen.c is going to be initialized before Xen.

Given the lack of a better alternative, just call a new Xen
initialization function (xen_guest_init) from xen_cons_init.

xen_guest_init has to be arch independant, so write both an ARM and an
x86 implementation. The x86 implementation is currently empty because we
can be sure that xen_hvm_guest_init is called early enough.

Probably we can get rid of this as soon as we have better DT support.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
arch/arm/xen/enlighten.c
arch/x86/xen/enlighten.c
drivers/tty/hvc/hvc_xen.c
include/xen/xen.h

index 7d76962a63b7cab853cecbf54ca445cc0fd37989..e1c2e4d896e21d8eed8889396b3ab7c62c7c96e2 100644 (file)
@@ -127,12 +127,16 @@ out:
 }
 EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
 
-void __ref xen_hvm_init_shared_info(void)
+static void __init xen_hvm_init_shared_info(void)
 {
        int cpu;
        struct xen_add_to_physmap xatp;
        static struct shared_info *shared_info_page = 0;
 
+       /* already setup */
+       if (shared_info_page != 0 && HYPERVISOR_shared_info == shared_info_page)
+               return;
+
        if (!shared_info_page)
                shared_info_page = (struct shared_info *)
                        get_zeroed_page(GFP_KERNEL);
@@ -161,11 +165,11 @@ void __ref xen_hvm_init_shared_info(void)
                per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
        }
 }
+core_initcall(xen_hvm_init_shared_info);
 
-static int __init xen_hvm_guest_init(void)
+int __init xen_guest_init(void)
 {
        xen_hvm_init_shared_info();
        return 0;
 }
-
-core_initcall(xen_hvm_guest_init);
+EXPORT_SYMBOL(xen_guest_init);
index 1f928659c338e6e5cfcf6386446f087f41f1e22f..0bad7b5d152aa7f42cd90384ddecabe865acbfad 100644 (file)
@@ -1420,4 +1420,12 @@ const struct hypervisor_x86 x86_hyper_xen_hvm __refconst = {
        .init_platform          = xen_hvm_guest_init,
 };
 EXPORT_SYMBOL(x86_hyper_xen_hvm);
+
+int __init xen_guest_init(void)
+{
+       /* do nothing: rely on x86_hyper_xen_hvm for the initialization */
+       return 0;
+       
+}
+EXPORT_SYMBOL(xen_guest_init);
 #endif
index 3ae96a96372ce1653f89bce43f16701e6f42cac5..52a98ff79cbf0b943a0959a4b4be160ec5f41d55 100644 (file)
@@ -578,6 +578,9 @@ static int xen_cons_init(void)
        if (!xen_domain())
                return 0;
 
+       /* retrieve xen infos  */
+       xen_guest_init();
+
        if (xen_initial_domain())
                ops = &dom0_hvc_ops;
        else {
index 2c0d3a56c749c6145e07ef6537355bebd45a4c89..792a4d2fe24ce631b61d5344755d44fd77412efe 100644 (file)
@@ -9,8 +9,10 @@ enum xen_domain_type {
 
 #ifdef CONFIG_XEN
 extern enum xen_domain_type xen_domain_type;
+int xen_guest_init(void);
 #else
 #define xen_domain_type                XEN_NATIVE
+static inline int xen_guest_init(void) { return 0; }
 #endif
 
 #define xen_domain()           (xen_domain_type != XEN_NATIVE)