arm/arm64: Detect Xen support earlier
Subsystems (3)
cover arm/arm64: Detect Xen support earlier
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Ard, the patch to move the call earlier (see #2) differed from the one I sent you privately mostly because it's not possible to translate an IRQ before the GIC has been initialized.
Let me know if it works for you.
Sincerely yours,
Julien Grall (1):
arm/xen: Correctly check if the event channel interrupt is present
Stefano Stabellini (1):
arm,arm64/xen: move Xen initialization earlier
arch/arm/include/asm/xen/hypervisor.h | 8 +++++ arch/arm/kernel/setup.c | 2 ++ arch/arm/xen/enlighten.c | 58 +++++++++++++++++++++-------------- arch/arm64/kernel/setup.c | 2 ++ 4 files changed, 47 insertions(+), 23 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/2 arm/xen: Correctly check if the event channel interrupt is present
The function irq_of_parse_and_map returns 0 when the IRQ is not found.
Furthermore xen_events_irq is only read when the CPU is bring up, so it's not necessary to use the attribute __read_mostly.
Lastly, move the check before notifying the user that we are running on Xen.
--- arch/arm/xen/enlighten.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +6 -4
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(xen_have_vector_callback);int xen_platform_pci_unplug =XEN_UNPLUG_ALL ;EXPORT_SYMBOL_GPL (xen_platform_pci_unplug); -static __read_mostly int xen_events_irq =-1 ; +static unsigned int xen_events_irq;/* map fgmfn of domid to lpfn in the current domain */ static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
@@ -251,12 +251,14 @@ static int __init xen_guest_init(void)return 0 ; grant_frames = res.start; xen_events_irq =irq_of_parse_and_map (node,0 ); +if (!xen_events_irq) { +pr_debug ("Xen event channel interrupt not found\n" ); +return -ENODEV ; + } +pr_info ("Xen %s support found, events_irq=%d gnttab_frame=%pa\n" , version, xen_events_irq, &grant_frames); -if (xen_events_irq <0 ) -return -ENODEV ; - xen_domain_type =XEN_HVM_DOMAIN ;xen_setup_features ();
Signature · 1 line
2.1.0
PATCH 1/2 arm/xen: Correctly check if the event channel interrupt is present
Quoted 4 lines · Julien Grall
The function
irq_of_parse_and_mapreturns 0 when the IRQ is not found.Furthermore
xen_events_irqis only read when the CPU is bring up, so it's not necessary to use the attribute__read_mostly.
Part of the purpose of __read_mostly is to move such things out of sharing cachelines with other more hot read/write things, as much as it is to group all the "read only" things together.
PATCH 1/2 arm/xen: Correctly check if the event channel interrupt is present
Hi Ian,
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Julien Grall
The function
irq_of_parse_and_mapreturns 0 when the IRQ is not found.Furthermore
xen_events_irqis only read when the CPU is bring up, so it's not necessary to use the attribute__read_mostly.Part of the purpose of
__read_mostlyis to move such things out of sharing cachelines with other more hot read/write things, as much as it is to group all the "read only" things together.
Hmmm... You are right. I didn't understand this macro like that.
I will resend the series with this patch drop and add Ard's patch [1].
Regards,
[1] https://patches.linaro.org/44633/
Signature · 1 line
Julien Grall
PATCH 1/2 arm/xen: Correctly check if the event channel interrupt is present
Quoted 9 lines · Julien Grall
Hi Ian,
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Julien Grall
The function
irq_of_parse_and_mapreturns 0 when the IRQ is not found.Furthermore
xen_events_irqis only read when the CPU is bring up, so it's not necessary to use the attribute__read_mostly.
Quoted 7 lines
Quoted 3 lines
Part of the purpose of
__read_mostlyis to move such things out of sharing cachelines with other more hot read/write things, as much as it is to group all the "read only" things together.Hmmm... You are right. I didn't understand this macro like that.
I will resend the series with this patch drop and add Ard's patch [1].
Actually I'm stupid... This patch is still useful except the __read_mostly.
Quoted 5 lines
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH 1/2] arm/xen: Correctly check if the event channel interrupt is present
In reply to Ian CampbellHi Ian,
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Julien Grall
The function
irq_of_parse_and_mapreturns 0 when the IRQ is not found.Furthermore
xen_events_irqis only read when the CPU is bring up, so it's not necessary to use the attribute__read_mostly.Part of the purpose of
__read_mostlyis to move such things out of sharing cachelines with other more hot read/write things, as much as it is to group all the "read only" things together.
Hmmm... You are right. I didn't understand this macro like that.
I will resend the series with this patch drop and add Ard's patch [1].
Regards,
[1] https://patches.linaro.org/44633/
Signature · 1 line
Julien Grall
Re: [PATCH 1/2] arm/xen: Correctly check if the event channel interrupt is present
In reply to Julien GrallQuoted 4 lines · Julien Grall
The function
irq_of_parse_and_mapreturns 0 when the IRQ is not found.Furthermore
xen_events_irqis only read when the CPU is bring up, so it's not necessary to use the attribute__read_mostly.
Part of the purpose of __read_mostly is to move such things out of sharing cachelines with other more hot read/write things, as much as it is to group all the "read only" things together.
PATCH 1/2 arm/xen: Correctly check if the event channel interrupt is present
In reply to Julien GrallThe function irq_of_parse_and_map returns 0 when the IRQ is not found.
Furthermore xen_events_irq is only read when the CPU is bring up, so it's not necessary to use the attribute __read_mostly.
Lastly, move the check before notifying the user that we are running on Xen.
--- arch/arm/xen/enlighten.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +6 -4
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(xen_have_vector_callback);int xen_platform_pci_unplug =XEN_UNPLUG_ALL ;EXPORT_SYMBOL_GPL (xen_platform_pci_unplug); -static __read_mostly int xen_events_irq =-1 ; +static unsigned int xen_events_irq;/* map fgmfn of domid to lpfn in the current domain */ static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
@@ -251,12 +251,14 @@ static int __init xen_guest_init(void)return 0 ; grant_frames = res.start; xen_events_irq =irq_of_parse_and_map (node,0 ); +if (!xen_events_irq) { +pr_debug ("Xen event channel interrupt not found\n" ); +return -ENODEV ; + } +pr_info ("Xen %s support found, events_irq=%d gnttab_frame=%pa\n" , version, xen_events_irq, &grant_frames); -if (xen_events_irq <0 ) -return -ENODEV ; - xen_domain_type =XEN_HVM_DOMAIN ;xen_setup_features ();
Signature · 1 line
2.1.0
PATCH 2/2 arm,arm64/xen: move Xen initialization earlier
In reply to Julien GrallFrom: Stefano Stabellini <[email protected]>
Currently, Xen is initialized/discovered in an initcall. This doesn't allow us to support earlyprintk or choosing the preferred console when running on Xen.
The current function xen_guest_init is now split in 2 parts:
- xen_early_init: Check if there is a Xen node in the device tree and setup domain type
- xen_guest_init: Retrieve the information from the device node and initialize Xen (grant table, shared page...)
The former is called in setup_arch, while the latter is an initcall.
---
It's based on a patch sent by Stefano nearly 2 years ago [1].
[1] http://lists.xen.org/archives/html/xen-devel/2013-08/msg02960.html
--- arch/arm/include/asm/xen/hypervisor.h | 8 +++++ arch/arm/kernel/setup.c | 2 ++ arch/arm/xen/enlighten.c | 58 ++++++++++++++++++++--------------- arch/arm64/kernel/setup.c | 2 ++ 4 files changed, 46 insertions(+), 24 deletions(-)
arch/arm/include/asm/xen/hypervisor.h +8 -0
@@ -1,6 +1,8 @@#ifndef _ASM_ARM_XEN_HYPERVISOR_H#define _ASM_ARM_XEN_HYPERVISOR_H +#include <linux/init.h> +extern struct shared_info *HYPERVISOR_shared_info;extern struct start_info *xen_start_info;
@@ -18,4 +20,10 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)extern struct dma_map_ops *xen_dma_ops; +#ifdef CONFIG_XEN +void __init xen_early_init (void ); +#else +static inline void xen_early_init (void ) {return ; } +#endif +#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
arch/arm/kernel/setup.c +2 -0
@@ -46,6 +46,7 @@#include <asm/cacheflush.h> #include <asm/cachetype.h> #include <asm/tlbflush.h> +#include <asm/xen/hypervisor.h> #include <asm/prom.h> #include <asm/mach/arch.h>
@@ -936,6 +937,7 @@ void __init setup_arch(char **cmdline_p)arm_dt_init_cpu_maps ();psci_init (); +xen_early_init ();#ifdef CONFIG_SMP if (is_smp ()) {if (!mdesc->smp_init || !mdesc->smp_init ()) {
arch/arm/xen/enlighten.c +34 -24
92 lines not on this page · raw message
arch/arm64/kernel/setup.c +2 -0
@@ -62,6 +62,7 @@#include <asm/memblock.h> #include <asm/psci.h> #include <asm/efi.h> +#include <asm/xen/hypervisor.h> unsigned int processor_id;EXPORT_SYMBOL (processor_id);
@@ -388,6 +389,7 @@ void __init setup_arch(char **cmdline_p)unflatten_device_tree ();psci_init (); +xen_early_init ();cpu_read_bootcpu_ops ();#ifdef CONFIG_SMP
Signature · 1 line
2.1.0
PATCH 2/2 arm, arm64/xen: move Xen initialization earlier
In reply to Julien GrallFrom: Stefano Stabellini <[email protected]>
Currently, Xen is initialized/discovered in an initcall. This doesn't allow us to support earlyprintk or choosing the preferred console when running on Xen.
The current function xen_guest_init is now split in 2 parts:
- xen_early_init: Check if there is a Xen node in the device tree and setup domain type
- xen_guest_init: Retrieve the information from the device node and initialize Xen (grant table, shared page...)
The former is called in setup_arch, while the latter is an initcall.
---
It's based on a patch sent by Stefano nearly 2 years ago [1].
[1] http://lists.xen.org/archives/html/xen-devel/2013-08/msg02960.html
--- arch/arm/include/asm/xen/hypervisor.h | 8 +++++ arch/arm/kernel/setup.c | 2 ++ arch/arm/xen/enlighten.c | 58 ++++++++++++++++++++--------------- arch/arm64/kernel/setup.c | 2 ++ 4 files changed, 46 insertions(+), 24 deletions(-)
arch/arm/include/asm/xen/hypervisor.h +8 -0
@@ -1,6 +1,8 @@#ifndef _ASM_ARM_XEN_HYPERVISOR_H#define _ASM_ARM_XEN_HYPERVISOR_H +#include <linux/init.h> +extern struct shared_info *HYPERVISOR_shared_info;extern struct start_info *xen_start_info;
@@ -18,4 +20,10 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)extern struct dma_map_ops *xen_dma_ops; +#ifdef CONFIG_XEN +void __init xen_early_init (void ); +#else +static inline void xen_early_init (void ) {return ; } +#endif +#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
arch/arm/kernel/setup.c +2 -0
@@ -46,6 +46,7 @@#include <asm/cacheflush.h> #include <asm/cachetype.h> #include <asm/tlbflush.h> +#include <asm/xen/hypervisor.h> #include <asm/prom.h> #include <asm/mach/arch.h>
@@ -936,6 +937,7 @@ void __init setup_arch(char **cmdline_p)arm_dt_init_cpu_maps ();psci_init (); +xen_early_init ();#ifdef CONFIG_SMP if (is_smp ()) {if (!mdesc->smp_init || !mdesc->smp_init ()) {
arch/arm/xen/enlighten.c +34 -24
92 lines not on this page · raw message
arch/arm64/kernel/setup.c +2 -0
@@ -62,6 +62,7 @@#include <asm/memblock.h> #include <asm/psci.h> #include <asm/efi.h> +#include <asm/xen/hypervisor.h> unsigned int processor_id;EXPORT_SYMBOL (processor_id);
@@ -388,6 +389,7 @@ void __init setup_arch(char **cmdline_p)unflatten_device_tree ();psci_init (); +xen_early_init ();cpu_read_bootcpu_ops ();#ifdef CONFIG_SMP
Signature · 1 line
2.1.0
cover arm/arm64: Detect Xen support earlier
In reply to Julien GrallQuoted 6 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Quoted 6 lines
Ard, the patch to move the call earlier (see #2) differed from the one I sent you privately mostly because it's not possible to translate an IRQ before the GIC has been initialized.
Let me know if it works for you.
I have tested these patches with my preferred console patch on top, and it results in console output without having to pass 'console=hvc0' on the command line.
I didn't check anything else, nor do I have enough of a clue about Xen to notice anything else out of the ordinary
So FWIW,
Quoted 17 lines
Sincerely yours,
Julien Grall (1):
arm/xen: Correctly check if the event channel interrupt is presentStefano Stabellini (1):
arm,arm64/xen: move Xen initialization earlierarch/arm/include/asm/xen/hypervisor.h | 8 +++++ arch/arm/kernel/setup.c | 2 ++ arch/arm/xen/enlighten.c | 58 +++++++++++++++++++++-------------- arch/arm64/kernel/setup.c | 2 ++ 4 files changed, 47 insertions(+), 23 deletions(-)--
2.1.0
Quoted 6 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Quoted 6 lines
Ard, the patch to move the call earlier (see #2) differed from the one I sent you privately mostly because it's not possible to translate an IRQ before the GIC has been initialized.
Let me know if it works for you.
I have tested these patches with my preferred console patch on top, and it results in console output without having to pass 'console=hvc0' on the command line.
I didn't check anything else, nor do I have enough of a clue about Xen to notice anything else out of the ordinary
So FWIW,
Quoted 17 lines
Sincerely yours,
Julien Grall (1):
arm/xen: Correctly check if the event channel interrupt is presentStefano Stabellini (1):
arm,arm64/xen: move Xen initialization earlierarch/arm/include/asm/xen/hypervisor.h | 8 +++++ arch/arm/kernel/setup.c | 2 ++ arch/arm/xen/enlighten.c | 58 +++++++++++++++++++++-------------- arch/arm64/kernel/setup.c | 2 ++ 4 files changed, 47 insertions(+), 23 deletions(-)--
2.1.0
cover arm/arm64: Detect Xen support earlier
In reply to Julien GrallQuoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Ian.
cover arm/arm64: Detect Xen support earlier
Hi Ian,
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Quoted 6 lines
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>
Can I keep you ack on the first one with the __read_mostly dropped?
Regards,
Signature · 1 line
Julien Grall
cover arm/arm64: Detect Xen support earlier
Quoted 10 lines · Julien Grall
Hi Ian,
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Quoted 8 lines
Quoted 6 lines
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>Can I keep you ack on the first one with the
__read_mostlydropped?
Sure.
BTW, when reposting you might want to CC the arch/arm* maintainers on this intro mail as well as just the second patch.
Ian.
cover arm/arm64: Detect Xen support earlier
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Julien Grall
Hi Ian,
Quoted 13 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>
Quoted 6 lines
Quoted 1 line
Can I keep you ack on the first one with the
__read_mostlydropped?Sure.
BTW, when reposting you might want to CC the
arch/arm*maintainers on this intro mail as well as just the second patch.
Ok. I wasn't sure if this patches should go via the Xen tree or ARM one.
Signature · 1 line
Julien Grall
cover arm/arm64: Detect Xen support earlier
Quoted 20 lines · Julien Grall
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Julien Grall
Hi Ian,
Quoted 13 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Can I keep you ack on the first one with the
__read_mostlydropped?Sure.
BTW, when reposting you might want to CC the
arch/arm*maintainers on this intro mail as well as just the second patch.Ok. I wasn't sure if this patches should go via the Xen tree or ARM one.
That's a question for all relevant maintainers to discuss -- and replies to the 0/N mail is a good place to do that. I suggest you explicitly ask the question in the intro next time around.
Ian.
Quoted 20 lines · Julien Grall
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Julien Grall
Hi Ian,
Quoted 13 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Can I keep you ack on the first one with the
__read_mostlydropped?Sure.
BTW, when reposting you might want to CC the
arch/arm*maintainers on this intro mail as well as just the second patch.Ok. I wasn't sure if this patches should go via the Xen tree or ARM one.
That's a question for all relevant maintainers to discuss -- and replies to the 0/N mail is a good place to do that. I suggest you explicitly ask the question in the intro next time around.
Ian.
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Julien Grall
Hi Ian,
Quoted 13 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>
Quoted 6 lines
Quoted 1 line
Can I keep you ack on the first one with the
__read_mostlydropped?Sure.
BTW, when reposting you might want to CC the
arch/arm*maintainers on this intro mail as well as just the second patch.
Ok. I wasn't sure if this patches should go via the Xen tree or ARM one.
Signature · 1 line
Julien Grall
Quoted 10 lines · Julien Grall
Hi Ian,
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Quoted 8 lines
Quoted 6 lines
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Acked-by Ian Campbell <[email protected]>Can I keep you ack on the first one with the
__read_mostlydropped?
Sure.
BTW, when reposting you might want to CC the arch/arm* maintainers on this intro mail as well as just the second patch.
Ian.
Quoted 5 lines · Julien Grall
Hello,
This small patch series move the detection of running on Xen earlier. This is required in order to support earlyprintk via Xen and selecting the preferred console.
Thanks for doing this, having all of the init done in an initcall (even a relatively early one) has been a niggle I've wanted address for ages, for exactly earlyprintk and preferred console reasons.
I had a very minor comment on #1 but nonetheless both patches:
Ian.