summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2018-06-08 04:40:38 -0400
committerJuergen Gross <jgross@suse.com>2018-06-19 07:51:00 -0400
commit1fe83888a2b776c204cb06629700adfb8e9cc123 (patch)
tree3d7ad3e848fceb53b69bc727af09b03839520af0
parent7f47e1c52d0c850cbd24aab763ce6bab11bdb4b2 (diff)
xen: share start flags between PV and PVH
Use a global variable to store the start flags for both PV and PVH. This allows the xen_initial_domain macro to work properly on PVH. Note that ARM is also switched to use the new variable. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com>
-rw-r--r--arch/arm/xen/enlighten.c7
-rw-r--r--arch/x86/xen/enlighten.c7
-rw-r--r--arch/x86/xen/enlighten_pv.c1
-rw-r--r--arch/x86/xen/enlighten_pvh.c1
-rw-r--r--include/xen/xen.h6
5 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 8073625371f5..07060e5b5864 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
59 59
60static __read_mostly unsigned int xen_events_irq; 60static __read_mostly unsigned int xen_events_irq;
61 61
62uint32_t xen_start_flags;
63EXPORT_SYMBOL(xen_start_flags);
64
62int xen_remap_domain_gfn_array(struct vm_area_struct *vma, 65int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
63 unsigned long addr, 66 unsigned long addr,
64 xen_pfn_t *gfn, int nr, 67 xen_pfn_t *gfn, int nr,
@@ -293,9 +296,7 @@ void __init xen_early_init(void)
293 xen_setup_features(); 296 xen_setup_features();
294 297
295 if (xen_feature(XENFEAT_dom0)) 298 if (xen_feature(XENFEAT_dom0))
296 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; 299 xen_start_flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
297 else
298 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
299 300
300 if (!console_set_on_cmdline && !xen_initial_domain()) 301 if (!console_set_on_cmdline && !xen_initial_domain())
301 add_preferred_console("hvc", 0, NULL); 302 add_preferred_console("hvc", 0, NULL);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c9081c6671f0..3b5318505c69 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -65,6 +65,13 @@ __read_mostly int xen_have_vector_callback;
65EXPORT_SYMBOL_GPL(xen_have_vector_callback); 65EXPORT_SYMBOL_GPL(xen_have_vector_callback);
66 66
67/* 67/*
68 * NB: needs to live in .data because it's used by xen_prepare_pvh which runs
69 * before clearing the bss.
70 */
71uint32_t xen_start_flags __attribute__((section(".data"))) = 0;
72EXPORT_SYMBOL(xen_start_flags);
73
74/*
68 * Point at some empty memory to start with. We map the real shared_info 75 * Point at some empty memory to start with. We map the real shared_info
69 * page as soon as fixmap is up and running. 76 * page as soon as fixmap is up and running.
70 */ 77 */
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 357969a3697c..8d4e2e1ae60b 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1203,6 +1203,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
1203 return; 1203 return;
1204 1204
1205 xen_domain_type = XEN_PV_DOMAIN; 1205 xen_domain_type = XEN_PV_DOMAIN;
1206 xen_start_flags = xen_start_info->flags;
1206 1207
1207 xen_setup_features(); 1208 xen_setup_features();
1208 1209
diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c
index aa1c6a6831a9..c85d1a88f476 100644
--- a/arch/x86/xen/enlighten_pvh.c
+++ b/arch/x86/xen/enlighten_pvh.c
@@ -97,6 +97,7 @@ void __init xen_prepare_pvh(void)
97 } 97 }
98 98
99 xen_pvh = 1; 99 xen_pvh = 1;
100 xen_start_flags = pvh_start_info.flags;
100 101
101 msr = cpuid_ebx(xen_cpuid_base() + 2); 102 msr = cpuid_ebx(xen_cpuid_base() + 2);
102 pfn = __pa(hypercall_page); 103 pfn = __pa(hypercall_page);
diff --git a/include/xen/xen.h b/include/xen/xen.h
index 9d4340c907d1..1e1d9bd0bd37 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -25,12 +25,16 @@ extern bool xen_pvh;
25#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) 25#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
26#define xen_pvh_domain() (xen_pvh) 26#define xen_pvh_domain() (xen_pvh)
27 27
28#include <linux/types.h>
29
30extern uint32_t xen_start_flags;
31
28#ifdef CONFIG_XEN_DOM0 32#ifdef CONFIG_XEN_DOM0
29#include <xen/interface/xen.h> 33#include <xen/interface/xen.h>
30#include <asm/xen/hypervisor.h> 34#include <asm/xen/hypervisor.h>
31 35
32#define xen_initial_domain() (xen_domain() && \ 36#define xen_initial_domain() (xen_domain() && \
33 xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) 37 (xen_start_flags & SIF_INITDOMAIN))
34#else /* !CONFIG_XEN_DOM0 */ 38#else /* !CONFIG_XEN_DOM0 */
35#define xen_initial_domain() (0) 39#define xen_initial_domain() (0)
36#endif /* CONFIG_XEN_DOM0 */ 40#endif /* CONFIG_XEN_DOM0 */