xen: share start flags between PV and PVH
Subsystems (5)
PATCH v3 1/1 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.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v2:
- Declare xen_start_flags outside of the XEN_DOM0 guard and include types.h.
Changes since v1:
- Switch ARM to also use the new xen_start_flags.
--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 6 +++++- 5 files changed, 18 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +4 -3
@@ -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; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,
@@ -282,9 +285,7 @@ void __init xen_early_init(void)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 ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );
arch/x86/xen/enlighten.c +7 -0
@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int 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 * page as soon as fixmap is up and running.
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1203,6 +1203,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();
arch/x86/xen/enlighten_pvh.c +1 -0
@@ -97,6 +97,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags; msr =cpuid_ebx (xen_cpuid_base () +2 ); pfn =__pa (hypercall_page);
include/xen/xen.h +5 -1
@@ -25,12 +25,16 @@ extern bool xen_pvh;#define xen_hvm_domain () (xen_domain_type == XEN_HVM_DOMAIN)#define xen_pvh_domain () (xen_pvh) +#include <linux/types.h> + +extern uint32_t xen_start_flags; +#ifdef CONFIG_XEN_DOM0 #include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> #define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */
Signature · 1 line
2.17.1
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Juergen
Stefano Stabellini
maintainerQuoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
As I already mentioned, the ARM part is OK. However, is the issue that xen_start_info is not available on PVH? We had the same problem on ARM and solved it by faking a xen_start_info page, see the top of arch/arm/xen/enlighten.c.
I would love to get rid of that, but to do that, we also need to remove the xen_start_info referece at drivers/tty/hvc/hvc_xen.c:255:
if (!xen_start_info->console.domU.evtchn)
return -ENODEV;
Quoted 112 lines
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v2:
- Declarexen_start_flagsoutside of theXEN_DOM0guard and includetypes.h.Changes since v1:
- Switch ARM to also use the newxen_start_flags.--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 6 +++++- 5 files changed, 18 insertions(+), 4 deletions(-)arch/arm/xen/enlighten.c +4
-3@@ -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; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,@@ -282,9 +285,7 @@ void __init xen_early_init(void)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 ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );arch/x86/xen/enlighten.c +7
-0@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int 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 * page as soon as fixmap is up and running. arch/x86/xen/enlighten_pv.c +1
-0@@ -1203,6 +1203,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();arch/x86/xen/enlighten_pvh.c +1
-0@@ -97,6 +97,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags; msr =cpuid_ebx (xen_cpuid_base () +2 ); pfn =__pa (hypercall_page);include/xen/xen.h +5
-1@@ -25,12 +25,16 @@ extern bool xen_pvh;#define xen_hvm_domain () (xen_domain_type == XEN_HVM_DOMAIN)#define xen_pvh_domain () (xen_pvh) +#include <linux/types.h> + +extern uint32_t xen_start_flags; +#ifdef CONFIG_XEN_DOM0 #include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> #define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */ Signature · 1 line
2.17.1
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
maintainerQuoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
As I already mentioned, the ARM part is OK. However, is the issue that xen_start_info is not available on PVH? We had the same problem on ARM and solved it by faking a xen_start_info page, see the top of arch/arm/xen/enlighten.c.
I would love to get rid of that, but to do that, we also need to remove the xen_start_info referece at drivers/tty/hvc/hvc_xen.c:255:
if (!xen_start_info->console.domU.evtchn)
return -ENODEV;
Quoted 112 lines
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v2:
- Declarexen_start_flagsoutside of theXEN_DOM0guard and includetypes.h.Changes since v1:
- Switch ARM to also use the newxen_start_flags.--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 6 +++++- 5 files changed, 18 insertions(+), 4 deletions(-)arch/arm/xen/enlighten.c +4
-3@@ -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; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,@@ -282,9 +285,7 @@ void __init xen_early_init(void)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 ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );arch/x86/xen/enlighten.c +7
-0@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int 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 * page as soon as fixmap is up and running. arch/x86/xen/enlighten_pv.c +1
-0@@ -1203,6 +1203,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();arch/x86/xen/enlighten_pvh.c +1
-0@@ -97,6 +97,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags; msr =cpuid_ebx (xen_cpuid_base () +2 ); pfn =__pa (hypercall_page);include/xen/xen.h +5
-1@@ -25,12 +25,16 @@ extern bool xen_pvh;#define xen_hvm_domain () (xen_domain_type == XEN_HVM_DOMAIN)#define xen_pvh_domain () (xen_pvh) +#include <linux/types.h> + +extern uint32_t xen_start_flags; +#ifdef CONFIG_XEN_DOM0 #include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> #define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */ Signature · 1 line
2.17.1
Quoted 14 lines · Stefano Stabellini
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>As I already mentioned, the ARM part is OK. However, is the issue that
xen_start_infois not available on PVH? We had the same problem on ARM and solved it by faking axen_start_infopage, see the top ofarch/arm/xen/enlighten.c.
Quoted 5 lines
I would love to get rid of that, but to do that, we also need to remove the
xen_start_inforeferece atdrivers/tty/hvc/hvc_xen.c:255:if (!xen_start_info->console.domU.evtchn)
return -ENODEV;
We could likely guard xen_pv_console_init (and other PV related console functions) with CONFIG_PV. HVM/PVH use xen_hvm_console_init.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Stefano Stabellini
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>As I already mentioned, the ARM part is OK. However, is the issue that
xen_start_infois not available on PVH? We had the same problem on ARM and solved it by faking axen_start_infopage, see the top ofarch/arm/xen/enlighten.c.
Quoted 5 lines
I would love to get rid of that, but to do that, we also need to remove the
xen_start_inforeferece atdrivers/tty/hvc/hvc_xen.c:255:if (!xen_start_info->console.domU.evtchn)
return -ENODEV;
We could likely guard xen_pv_console_init (and other PV related console functions) with CONFIG_PV. HVM/PVH use xen_hvm_console_init.
Roger.
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Pushed to xen/tip.git for-linus-4.18
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Pushed to xen/tip.git for-linus-4.18
Juergen