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>
This commit is contained in:
Roger Pau Monne 2018-06-08 10:40:38 +02:00 committed by Juergen Gross
parent 7f47e1c52d
commit 1fe83888a2
5 changed files with 18 additions and 4 deletions

View File

@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
static __read_mostly unsigned int xen_events_irq; static __read_mostly unsigned int xen_events_irq;
uint32_t xen_start_flags;
EXPORT_SYMBOL(xen_start_flags);
int xen_remap_domain_gfn_array(struct vm_area_struct *vma, int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
unsigned long addr, unsigned long addr,
xen_pfn_t *gfn, int nr, xen_pfn_t *gfn, int nr,
@ -293,9 +296,7 @@ void __init xen_early_init(void)
xen_setup_features(); xen_setup_features();
if (xen_feature(XENFEAT_dom0)) if (xen_feature(XENFEAT_dom0))
xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; xen_start_flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
else
xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
if (!console_set_on_cmdline && !xen_initial_domain()) if (!console_set_on_cmdline && !xen_initial_domain())
add_preferred_console("hvc", 0, NULL); add_preferred_console("hvc", 0, NULL);

View File

@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;
__read_mostly int xen_have_vector_callback; __read_mostly int xen_have_vector_callback;
EXPORT_SYMBOL_GPL(xen_have_vector_callback); EXPORT_SYMBOL_GPL(xen_have_vector_callback);
/*
* NB: needs to live in .data because it's used by xen_prepare_pvh which runs
* before clearing the bss.
*/
uint32_t xen_start_flags __attribute__((section(".data"))) = 0;
EXPORT_SYMBOL(xen_start_flags);
/* /*
* Point at some empty memory to start with. We map the real shared_info * Point at some empty memory to start with. We map the real shared_info
* page as soon as fixmap is up and running. * page as soon as fixmap is up and running.

View File

@ -1203,6 +1203,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
return; return;
xen_domain_type = XEN_PV_DOMAIN; xen_domain_type = XEN_PV_DOMAIN;
xen_start_flags = xen_start_info->flags;
xen_setup_features(); xen_setup_features();

View File

@ -97,6 +97,7 @@ void __init xen_prepare_pvh(void)
} }
xen_pvh = 1; xen_pvh = 1;
xen_start_flags = pvh_start_info.flags;
msr = cpuid_ebx(xen_cpuid_base() + 2); msr = cpuid_ebx(xen_cpuid_base() + 2);
pfn = __pa(hypercall_page); pfn = __pa(hypercall_page);

View File

@ -25,12 +25,16 @@ extern bool xen_pvh;
#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
#define xen_pvh_domain() (xen_pvh) #define xen_pvh_domain() (xen_pvh)
#include <linux/types.h>
extern uint32_t xen_start_flags;
#ifdef CONFIG_XEN_DOM0 #ifdef CONFIG_XEN_DOM0
#include <xen/interface/xen.h> #include <xen/interface/xen.h>
#include <asm/xen/hypervisor.h> #include <asm/xen/hypervisor.h>
#define xen_initial_domain() (xen_domain() && \ #define xen_initial_domain() (xen_domain() && \
xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) (xen_start_flags & SIF_INITDOMAIN))
#else /* !CONFIG_XEN_DOM0 */ #else /* !CONFIG_XEN_DOM0 */
#define xen_initial_domain() (0) #define xen_initial_domain() (0)
#endif /* CONFIG_XEN_DOM0 */ #endif /* CONFIG_XEN_DOM0 */