All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
@ 2015-02-18 13:51 Julien Grall
  2015-02-18 13:51 ` [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present Julien Grall
                   ` (5 more replies)
  0 siblings, 6 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This small patch series moves the detection of running on Xen earlier. This is
required in order to support earlyprintk via Xen and selecting preferred console.

Actually, the last patch of this patch series adds HVC0 as preferred console
when running on Xen. The patch [1] was previously separetly sent by Ard.

For the maintainers, does this patch series should go in upstream via the ARM
tree or Xen tree?

Regards,

[1] https://patches.linaro.org/44633/ 

Tested-by: Ard Biesheuvel <ard@linaro.org>

Ard Biesheuvel (1):
  xen/arm: allow console=hvc0 to be omitted for guests

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              | 62 ++++++++++++++++++++++-------------
 arch/arm64/kernel/setup.c             |  2 ++
 4 files changed, 51 insertions(+), 23 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
  2015-02-18 13:51 ` [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present Julien Grall
@ 2015-02-18 13:51 ` Julien Grall
  2015-02-26 18:08   ` Stefano Stabellini
  2015-02-26 18:08   ` Stefano Stabellini
  2015-02-18 13:51   ` [PATCH v2 2/3] arm, arm64/xen: " Julien Grall
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

The function irq_of_parse_and_map returns 0 when the IRQ is not found.

Futhermore, move the check before notifying the user that we are running on
Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

---
    Changes in v2:
        - Add Ian's ack
        - Re-add __read_mostly
---
 arch/arm/xen/enlighten.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 263a204..c8d3a17 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -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 __read_mostly 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();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
@ 2015-02-18 13:51 ` Julien Grall
  2015-02-18 13:51 ` Julien Grall
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: xen-devel, stefano.stabellini, linux-arm-kernel, linux,
	catalin.marinas, will.deacon
  Cc: Julien Grall, tim, ian.campbell, leif.lindholm, ard.biesheuvel

The function irq_of_parse_and_map returns 0 when the IRQ is not found.

Futhermore, move the check before notifying the user that we are running on
Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

---
    Changes in v2:
        - Add Ian's ack
        - Re-add __read_mostly
---
 arch/arm/xen/enlighten.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 263a204..c8d3a17 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -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 __read_mostly 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();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 2/3] arm,arm64/xen: move Xen initialization earlier
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
@ 2015-02-18 13:51   ` Julien Grall
  2015-02-18 13:51 ` Julien Grall
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>

---
    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

    Changes in v2:
        - Add Ian's ack
---
 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(-)

diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
index 1317ee4..04ff8e7 100644
--- a/arch/arm/include/asm/xen/hypervisor.h
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -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 */
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index e55408e..8b59d0d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -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()) {
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index c8d3a17..1660432 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
 
 static __read_mostly unsigned int xen_events_irq;
 
+static __initdata struct device_node *xen_node;
+
 /* map fgmfn of domid to lpfn in the current domain */
 static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
 			    unsigned int domid)
@@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
  * documentation of the Xen Device Tree format.
  */
 #define GRANT_TABLE_PHYSADDR 0
-static int __init xen_guest_init(void)
+void __init xen_early_init(void)
 {
-	struct xen_add_to_physmap xatp;
-	static struct shared_info *shared_info_page = 0;
-	struct device_node *node;
 	int len;
 	const char *s = NULL;
 	const char *version = NULL;
 	const char *xen_prefix = "xen,xen-";
-	struct resource res;
-	phys_addr_t grant_frames;
 
-	node = of_find_compatible_node(NULL, NULL, "xen,xen");
-	if (!node) {
+	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
+	if (!xen_node) {
 		pr_debug("No Xen support\n");
-		return 0;
+		return;
 	}
-	s = of_get_property(node, "compatible", &len);
+	s = of_get_property(xen_node, "compatible", &len);
 	if (strlen(xen_prefix) + 3  < len &&
 			!strncmp(xen_prefix, s, strlen(xen_prefix)))
 		version = s + strlen(xen_prefix);
 	if (version == NULL) {
 		pr_debug("Xen version not found\n");
-		return 0;
-	}
-	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
-		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;
+		return;
 	}
 
-	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
-			version, xen_events_irq, &grant_frames);
+	pr_info("Xen %s support found\n", version);
 
 	xen_domain_type = XEN_HVM_DOMAIN;
 
@@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+}
+
+static int __init xen_guest_init(void)
+{
+	struct xen_add_to_physmap xatp;
+	struct shared_info *shared_info_page = NULL;
+	struct resource res;
+	phys_addr_t grant_frames;
+
+	if (!xen_domain())
+		return 0;
+
+	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
+		pr_err("Xen grant table base address not found\n");
+		return -ENODEV;
+	}
+	grant_frames = res.start;
+
+	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
+	if (!xen_events_irq) {
+		pr_err("Xen event channel interrupt not found\n");
+		return -ENODEV;
+	}
+
+	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
 
-	if (!shared_info_page)
-		shared_info_page = (struct shared_info *)
-			get_zeroed_page(GFP_KERNEL);
 	if (!shared_info_page) {
 		pr_err("not enough memory\n");
 		return -ENOMEM;
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8420f6..c00ae01 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 2/3] arm, arm64/xen: move Xen initialization earlier
@ 2015-02-18 13:51   ` Julien Grall
  0 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: xen-devel, stefano.stabellini, linux-arm-kernel, linux,
	catalin.marinas, will.deacon
  Cc: ard.biesheuvel, ian.campbell, Stefano Stabellini, Julien Grall,
	tim, leif.lindholm

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>

---
    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

    Changes in v2:
        - Add Ian's ack
---
 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(-)

diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
index 1317ee4..04ff8e7 100644
--- a/arch/arm/include/asm/xen/hypervisor.h
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -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 */
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index e55408e..8b59d0d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -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()) {
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index c8d3a17..1660432 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
 
 static __read_mostly unsigned int xen_events_irq;
 
+static __initdata struct device_node *xen_node;
+
 /* map fgmfn of domid to lpfn in the current domain */
 static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
 			    unsigned int domid)
@@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
  * documentation of the Xen Device Tree format.
  */
 #define GRANT_TABLE_PHYSADDR 0
-static int __init xen_guest_init(void)
+void __init xen_early_init(void)
 {
-	struct xen_add_to_physmap xatp;
-	static struct shared_info *shared_info_page = 0;
-	struct device_node *node;
 	int len;
 	const char *s = NULL;
 	const char *version = NULL;
 	const char *xen_prefix = "xen,xen-";
-	struct resource res;
-	phys_addr_t grant_frames;
 
-	node = of_find_compatible_node(NULL, NULL, "xen,xen");
-	if (!node) {
+	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
+	if (!xen_node) {
 		pr_debug("No Xen support\n");
-		return 0;
+		return;
 	}
-	s = of_get_property(node, "compatible", &len);
+	s = of_get_property(xen_node, "compatible", &len);
 	if (strlen(xen_prefix) + 3  < len &&
 			!strncmp(xen_prefix, s, strlen(xen_prefix)))
 		version = s + strlen(xen_prefix);
 	if (version == NULL) {
 		pr_debug("Xen version not found\n");
-		return 0;
-	}
-	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
-		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;
+		return;
 	}
 
-	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
-			version, xen_events_irq, &grant_frames);
+	pr_info("Xen %s support found\n", version);
 
 	xen_domain_type = XEN_HVM_DOMAIN;
 
@@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+}
+
+static int __init xen_guest_init(void)
+{
+	struct xen_add_to_physmap xatp;
+	struct shared_info *shared_info_page = NULL;
+	struct resource res;
+	phys_addr_t grant_frames;
+
+	if (!xen_domain())
+		return 0;
+
+	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
+		pr_err("Xen grant table base address not found\n");
+		return -ENODEV;
+	}
+	grant_frames = res.start;
+
+	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
+	if (!xen_events_irq) {
+		pr_err("Xen event channel interrupt not found\n");
+		return -ENODEV;
+	}
+
+	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
 
-	if (!shared_info_page)
-		shared_info_page = (struct shared_info *)
-			get_zeroed_page(GFP_KERNEL);
 	if (!shared_info_page) {
 		pr_err("not enough memory\n");
 		return -ENOMEM;
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8420f6..c00ae01 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
                   ` (2 preceding siblings ...)
  2015-02-18 13:51   ` [PATCH v2 2/3] arm, arm64/xen: " Julien Grall
@ 2015-02-18 13:51 ` Julien Grall
  2015-02-18 15:25   ` Ian Campbell
                     ` (3 more replies)
  2015-02-18 13:51 ` Julien Grall
  2015-02-25 16:22   ` Julien Grall
  5 siblings, 4 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

This patch registers hvc0 as the preferred console if no console
has been specified explicitly on the kernel command line.

The purpose is to allow platform agnostic kernels and boot images
(such as distro installers) to boot in a Xen/ARM domU without the
need to modify the command line by hand.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
---
 arch/arm/xen/enlighten.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 1660432..904bd2d 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -24,6 +24,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu.h>
+#include <linux/console.h>
 
 #include <linux/mm.h>
 
@@ -255,6 +256,9 @@ void __init xen_early_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+
+	if (!console_set_on_cmdline && !xen_initial_domain())
+		add_preferred_console("hvc", 0, NULL);
 }
 
 static int __init xen_guest_init(void)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
                   ` (3 preceding siblings ...)
  2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
@ 2015-02-18 13:51 ` Julien Grall
  2015-02-25 16:22   ` Julien Grall
  5 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-18 13:51 UTC (permalink / raw)
  To: xen-devel, stefano.stabellini, linux-arm-kernel, linux,
	catalin.marinas, will.deacon
  Cc: tim, ian.campbell, leif.lindholm, ard.biesheuvel

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

This patch registers hvc0 as the preferred console if no console
has been specified explicitly on the kernel command line.

The purpose is to allow platform agnostic kernels and boot images
(such as distro installers) to boot in a Xen/ARM domU without the
need to modify the command line by hand.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
---
 arch/arm/xen/enlighten.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 1660432..904bd2d 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -24,6 +24,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu.h>
+#include <linux/console.h>
 
 #include <linux/mm.h>
 
@@ -255,6 +256,9 @@ void __init xen_early_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+
+	if (!console_set_on_cmdline && !xen_initial_domain())
+		add_preferred_console("hvc", 0, NULL);
 }
 
 static int __init xen_guest_init(void)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
  2015-02-18 15:25   ` Ian Campbell
@ 2015-02-18 15:25   ` Ian Campbell
  2015-02-18 15:50   ` Rob Herring
  2015-02-18 15:50   ` Rob Herring
  3 siblings, 0 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-18 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-02-18 at 13:51 +0000, Julien Grall wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
> 
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
@ 2015-02-18 15:25   ` Ian Campbell
  2015-02-18 15:25   ` Ian Campbell
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-18 15:25 UTC (permalink / raw)
  To: Julien Grall
  Cc: linux, ard.biesheuvel, catalin.marinas, will.deacon,
	leif.lindholm, tim, stefano.stabellini, xen-devel,
	linux-arm-kernel

On Wed, 2015-02-18 at 13:51 +0000, Julien Grall wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
> 
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
  2015-02-18 15:25   ` Ian Campbell
  2015-02-18 15:25   ` Ian Campbell
@ 2015-02-18 15:50   ` Rob Herring
  2015-02-18 16:03     ` Ian Campbell
  2015-02-18 16:03     ` Ian Campbell
  2015-02-18 15:50   ` Rob Herring
  3 siblings, 2 replies; 35+ messages in thread
From: Rob Herring @ 2015-02-18 15:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
>
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.

How does this interact with DT chosen stdout-path?

Is there a node for hvc0?

Rob

>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
> ---
>  arch/arm/xen/enlighten.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 1660432..904bd2d 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -24,6 +24,7 @@
>  #include <linux/cpuidle.h>
>  #include <linux/cpufreq.h>
>  #include <linux/cpu.h>
> +#include <linux/console.h>
>
>  #include <linux/mm.h>
>
> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>                 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>         else
>                 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +
> +       if (!console_set_on_cmdline && !xen_initial_domain())
> +               add_preferred_console("hvc", 0, NULL);
>  }
>
>  static int __init xen_guest_init(void)
> --
> 2.1.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
                     ` (2 preceding siblings ...)
  2015-02-18 15:50   ` Rob Herring
@ 2015-02-18 15:50   ` Rob Herring
  3 siblings, 0 replies; 35+ messages in thread
From: Rob Herring @ 2015-02-18 15:50 UTC (permalink / raw)
  To: Julien Grall
  Cc: Russell King - ARM Linux, Ian Campbell, Ard Biesheuvel,
	Catalin Marinas, Will Deacon, Leif Lindholm, tim,
	Stefano Stabellini, xen-devel, linux-arm-kernel

On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
>
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.

How does this interact with DT chosen stdout-path?

Is there a node for hvc0?

Rob

>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
> ---
>  arch/arm/xen/enlighten.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 1660432..904bd2d 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -24,6 +24,7 @@
>  #include <linux/cpuidle.h>
>  #include <linux/cpufreq.h>
>  #include <linux/cpu.h>
> +#include <linux/console.h>
>
>  #include <linux/mm.h>
>
> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>                 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>         else
>                 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +
> +       if (!console_set_on_cmdline && !xen_initial_domain())
> +               add_preferred_console("hvc", 0, NULL);
>  }
>
>  static int __init xen_guest_init(void)
> --
> 2.1.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 15:50   ` Rob Herring
  2015-02-18 16:03     ` Ian Campbell
@ 2015-02-18 16:03     ` Ian Campbell
  2015-02-26 18:22       ` Stefano Stabellini
  2015-02-26 18:22       ` Stefano Stabellini
  1 sibling, 2 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-18 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >
> > This patch registers hvc0 as the preferred console if no console
> > has been specified explicitly on the kernel command line.
> >
> > The purpose is to allow platform agnostic kernels and boot images
> > (such as distro installers) to boot in a Xen/ARM domU without the
> > need to modify the command line by hand.
> 
> How does this interact with DT chosen stdout-path?

I think it shouldn't any more than the existing calls from e.g. the 8250
driver to preferred_console do.

> Is there a node for hvc0?

Not a direct one, it is inferred from the presence of the general Xen
node. I did vaguely consider handling a stdout-path pointing to that --
but it seemed a bit of an abuse.

Ian.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 15:50   ` Rob Herring
@ 2015-02-18 16:03     ` Ian Campbell
  2015-02-18 16:03     ` Ian Campbell
  1 sibling, 0 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-18 16:03 UTC (permalink / raw)
  To: Rob Herring
  Cc: Russell King - ARM Linux, Ard Biesheuvel, Catalin Marinas,
	Julien Grall, Will Deacon, Leif Lindholm, tim,
	Stefano Stabellini, xen-devel, linux-arm-kernel

On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >
> > This patch registers hvc0 as the preferred console if no console
> > has been specified explicitly on the kernel command line.
> >
> > The purpose is to allow platform agnostic kernels and boot images
> > (such as distro installers) to boot in a Xen/ARM domU without the
> > need to modify the command line by hand.
> 
> How does this interact with DT chosen stdout-path?

I think it shouldn't any more than the existing calls from e.g. the 8250
driver to preferred_console do.

> Is there a node for hvc0?

Not a direct one, it is inferred from the presence of the general Xen
node. I did vaguely consider handling a stdout-path pointing to that --
but it seemed a bit of an abuse.

Ian.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
@ 2015-02-25 16:22   ` Julien Grall
  2015-02-18 13:51 ` Julien Grall
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-25 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

Ping? Any comments from ARM's maintainers on theses patches (at least #2)?

Regards,

On 18/02/15 13:51, Julien Grall wrote:
> Hello,
> 
> This small patch series moves the detection of running on Xen earlier. This is
> required in order to support earlyprintk via Xen and selecting preferred console.
> 
> Actually, the last patch of this patch series adds HVC0 as preferred console
> when running on Xen. The patch [1] was previously separetly sent by Ard.
> 
> For the maintainers, does this patch series should go in upstream via the ARM
> tree or Xen tree?
> 
> Regards,
> 
> [1] https://patches.linaro.org/44633/ 
> 
> Tested-by: Ard Biesheuvel <ard@linaro.org>
> 
> Ard Biesheuvel (1):
>   xen/arm: allow console=hvc0 to be omitted for guests
> 
> 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              | 62 ++++++++++++++++++++++-------------
>  arch/arm64/kernel/setup.c             |  2 ++
>  4 files changed, 51 insertions(+), 23 deletions(-)
> 


-- 
Julien Grall

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
@ 2015-02-25 16:22   ` Julien Grall
  0 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-25 16:22 UTC (permalink / raw)
  To: xen-devel, stefano.stabellini, linux-arm-kernel, linux,
	catalin.marinas, will.deacon
  Cc: tim, ian.campbell, leif.lindholm, ard.biesheuvel

Hello,

Ping? Any comments from ARM's maintainers on theses patches (at least #2)?

Regards,

On 18/02/15 13:51, Julien Grall wrote:
> Hello,
> 
> This small patch series moves the detection of running on Xen earlier. This is
> required in order to support earlyprintk via Xen and selecting preferred console.
> 
> Actually, the last patch of this patch series adds HVC0 as preferred console
> when running on Xen. The patch [1] was previously separetly sent by Ard.
> 
> For the maintainers, does this patch series should go in upstream via the ARM
> tree or Xen tree?
> 
> Regards,
> 
> [1] https://patches.linaro.org/44633/ 
> 
> Tested-by: Ard Biesheuvel <ard@linaro.org>
> 
> Ard Biesheuvel (1):
>   xen/arm: allow console=hvc0 to be omitted for guests
> 
> 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              | 62 ++++++++++++++++++++++-------------
>  arch/arm64/kernel/setup.c             |  2 ++
>  4 files changed, 51 insertions(+), 23 deletions(-)
> 


-- 
Julien Grall

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:22   ` Julien Grall
@ 2015-02-25 16:34     ` Will Deacon
  -1 siblings, 0 replies; 35+ messages in thread
From: Will Deacon @ 2015-02-25 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> Hello,
> 
> Ping? Any comments from ARM's maintainers on theses patches (at least #2)?

I couldn't care less :)

The arm64 part is boring in the good sense of the word.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
@ 2015-02-25 16:34     ` Will Deacon
  0 siblings, 0 replies; 35+ messages in thread
From: Will Deacon @ 2015-02-25 16:34 UTC (permalink / raw)
  To: Julien Grall
  Cc: linux, Ian.Campbell, ard.biesheuvel, Catalin Marinas, tim,
	leif.lindholm, stefano.stabellini, xen-devel, linux-arm-kernel

On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> Hello,
> 
> Ping? Any comments from ARM's maintainers on theses patches (at least #2)?

I couldn't care less :)

The arm64 part is boring in the good sense of the word.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:34     ` Will Deacon
@ 2015-02-25 16:38       ` Julien Grall
  -1 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-25 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 25/02/15 16:34, Will Deacon wrote:
> On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
>> Hello,
>>
>> Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> 
> I couldn't care less :)

> The arm64 part is boring in the good sense of the word.

I will still need a ack from you or Catalin because it's touching
arch/arm64/setup.c

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
@ 2015-02-25 16:38       ` Julien Grall
  0 siblings, 0 replies; 35+ messages in thread
From: Julien Grall @ 2015-02-25 16:38 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux, Ian.Campbell, ard.biesheuvel, Catalin Marinas, tim,
	leif.lindholm, stefano.stabellini, xen-devel, linux-arm-kernel

On 25/02/15 16:34, Will Deacon wrote:
> On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
>> Hello,
>>
>> Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> 
> I couldn't care less :)

> The arm64 part is boring in the good sense of the word.

I will still need a ack from you or Catalin because it's touching
arch/arm64/setup.c

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [Xen-devel] [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:34     ` Will Deacon
  (?)
  (?)
@ 2015-02-25 16:40     ` Ian Campbell
  2015-02-25 18:01       ` Will Deacon
  2015-02-25 18:01       ` Will Deacon
  -1 siblings, 2 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-25 16:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-02-25 at 16:34 +0000, Will Deacon wrote:
> On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> > Hello,
> > 
> > Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> 
> I couldn't care less :)
> 
> The arm64 part is boring in the good sense of the word.

May Julien take that as an Acked-by? ;-)

Given this is all about Xen really I suppose it makes most sense to take
it via the Xen tree.

Russell, does that work for you? (arch/arm bits are in patch #2 if you
want to take a look)

Ian.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:34     ` Will Deacon
                       ` (2 preceding siblings ...)
  (?)
@ 2015-02-25 16:40     ` Ian Campbell
  -1 siblings, 0 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-25 16:40 UTC (permalink / raw)
  To: Will Deacon, linux
  Cc: ard.biesheuvel, Catalin Marinas, Julien Grall, tim,
	leif.lindholm, stefano.stabellini, xen-devel, linux-arm-kernel

On Wed, 2015-02-25 at 16:34 +0000, Will Deacon wrote:
> On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> > Hello,
> > 
> > Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> 
> I couldn't care less :)
> 
> The arm64 part is boring in the good sense of the word.

May Julien take that as an Acked-by? ;-)

Given this is all about Xen really I suppose it makes most sense to take
it via the Xen tree.

Russell, does that work for you? (arch/arm bits are in patch #2 if you
want to take a look)

Ian.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [Xen-devel] [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:40     ` [Xen-devel] " Ian Campbell
@ 2015-02-25 18:01       ` Will Deacon
  2015-02-25 18:01       ` Will Deacon
  1 sibling, 0 replies; 35+ messages in thread
From: Will Deacon @ 2015-02-25 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 25, 2015 at 04:40:40PM +0000, Ian Campbell wrote:
> On Wed, 2015-02-25 at 16:34 +0000, Will Deacon wrote:
> > On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> > > Hello,
> > > 
> > > Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> > 
> > I couldn't care less :)
> > 
> > The arm64 part is boring in the good sense of the word.
> 
> May Julien take that as an Acked-by? ;-)

For the two lines under arch/arm64, sure!

> Given this is all about Xen really I suppose it makes most sense to take
> it via the Xen tree.

Fine by me.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 0/3] arm/arm64: Detect Xen support earlier
  2015-02-25 16:40     ` [Xen-devel] " Ian Campbell
  2015-02-25 18:01       ` Will Deacon
@ 2015-02-25 18:01       ` Will Deacon
  1 sibling, 0 replies; 35+ messages in thread
From: Will Deacon @ 2015-02-25 18:01 UTC (permalink / raw)
  To: Ian Campbell
  Cc: linux, ard.biesheuvel, Catalin Marinas, Julien Grall, tim,
	leif.lindholm, stefano.stabellini, xen-devel, linux-arm-kernel

On Wed, Feb 25, 2015 at 04:40:40PM +0000, Ian Campbell wrote:
> On Wed, 2015-02-25 at 16:34 +0000, Will Deacon wrote:
> > On Wed, Feb 25, 2015 at 04:22:33PM +0000, Julien Grall wrote:
> > > Hello,
> > > 
> > > Ping? Any comments from ARM's maintainers on theses patches (at least #2)?
> > 
> > I couldn't care less :)
> > 
> > The arm64 part is boring in the good sense of the word.
> 
> May Julien take that as an Acked-by? ;-)

For the two lines under arch/arm64, sure!

> Given this is all about Xen really I suppose it makes most sense to take
> it via the Xen tree.

Fine by me.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present
  2015-02-18 13:51 ` Julien Grall
  2015-02-26 18:08   ` Stefano Stabellini
@ 2015-02-26 18:08   ` Stefano Stabellini
  1 sibling, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-26 18:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Feb 2015, Julien Grall wrote:
> The function irq_of_parse_and_map returns 0 when the IRQ is not found.
> 
> Futhermore, move the check before notifying the user that we are running on
> Xen.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


> ---
>     Changes in v2:
>         - Add Ian's ack
>         - Re-add __read_mostly
> ---
>  arch/arm/xen/enlighten.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 263a204..c8d3a17 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -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 __read_mostly 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();
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present
  2015-02-18 13:51 ` Julien Grall
@ 2015-02-26 18:08   ` Stefano Stabellini
  2015-02-26 18:08   ` Stefano Stabellini
  1 sibling, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-26 18:08 UTC (permalink / raw)
  To: Julien Grall
  Cc: linux, ian.campbell, ard.biesheuvel, catalin.marinas,
	will.deacon, leif.lindholm, tim, stefano.stabellini, xen-devel,
	linux-arm-kernel

On Wed, 18 Feb 2015, Julien Grall wrote:
> The function irq_of_parse_and_map returns 0 when the IRQ is not found.
> 
> Futhermore, move the check before notifying the user that we are running on
> Xen.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


> ---
>     Changes in v2:
>         - Add Ian's ack
>         - Re-add __read_mostly
> ---
>  arch/arm/xen/enlighten.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 263a204..c8d3a17 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -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 __read_mostly 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();
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 16:03     ` Ian Campbell
@ 2015-02-26 18:22       ` Stefano Stabellini
  2015-02-27  9:34         ` Ian Campbell
  2015-02-27  9:34         ` Ian Campbell
  2015-02-26 18:22       ` Stefano Stabellini
  1 sibling, 2 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-26 18:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Feb 2015, Ian Campbell wrote:
> On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > >
> > > This patch registers hvc0 as the preferred console if no console
> > > has been specified explicitly on the kernel command line.
> > >
> > > The purpose is to allow platform agnostic kernels and boot images
> > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > need to modify the command line by hand.
> > 
> > How does this interact with DT chosen stdout-path?
> 
> I think it shouldn't any more than the existing calls from e.g. the 8250
> driver to preferred_console do.
>
> > Is there a node for hvc0?
> 
> Not a direct one, it is inferred from the presence of the general Xen
> node.

Xen PV consoles, including hvc0, as all the other Xen PV devices are
advertised on xenstore.


> I did vaguely consider handling a stdout-path pointing to that --
> but it seemed a bit of an abuse.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-18 16:03     ` Ian Campbell
  2015-02-26 18:22       ` Stefano Stabellini
@ 2015-02-26 18:22       ` Stefano Stabellini
  1 sibling, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-26 18:22 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Russell King - ARM Linux, Ard Biesheuvel, Catalin Marinas,
	Julien Grall, Will Deacon, Leif Lindholm, tim, Rob Herring,
	Stefano Stabellini, xen-devel, linux-arm-kernel

On Wed, 18 Feb 2015, Ian Campbell wrote:
> On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > >
> > > This patch registers hvc0 as the preferred console if no console
> > > has been specified explicitly on the kernel command line.
> > >
> > > The purpose is to allow platform agnostic kernels and boot images
> > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > need to modify the command line by hand.
> > 
> > How does this interact with DT chosen stdout-path?
> 
> I think it shouldn't any more than the existing calls from e.g. the 8250
> driver to preferred_console do.
>
> > Is there a node for hvc0?
> 
> Not a direct one, it is inferred from the presence of the general Xen
> node.

Xen PV consoles, including hvc0, as all the other Xen PV devices are
advertised on xenstore.


> I did vaguely consider handling a stdout-path pointing to that --
> but it seemed a bit of an abuse.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-26 18:22       ` Stefano Stabellini
  2015-02-27  9:34         ` Ian Campbell
@ 2015-02-27  9:34         ` Ian Campbell
  2015-02-27  9:47           ` Stefano Stabellini
  2015-02-27  9:47           ` Stefano Stabellini
  1 sibling, 2 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-27  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> On Wed, 18 Feb 2015, Ian Campbell wrote:
> > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > >
> > > > This patch registers hvc0 as the preferred console if no console
> > > > has been specified explicitly on the kernel command line.
> > > >
> > > > The purpose is to allow platform agnostic kernels and boot images
> > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > need to modify the command line by hand.
> > > 
> > > How does this interact with DT chosen stdout-path?
> > 
> > I think it shouldn't any more than the existing calls from e.g. the 8250
> > driver to preferred_console do.
> >
> > > Is there a node for hvc0?
> > 
> > Not a direct one, it is inferred from the presence of the general Xen
> > node.
> 
> Xen PV consoles, including hvc0, as all the other Xen PV devices are
> advertised on xenstore.

Do we actually use the xenstore node for hvc0? I thought we got it from
hvmparams (so the primary it can be used before xenstore is up)

> 
> 
> > I did vaguely consider handling a stdout-path pointing to that --
> > but it seemed a bit of an abuse.
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-26 18:22       ` Stefano Stabellini
@ 2015-02-27  9:34         ` Ian Campbell
  2015-02-27  9:34         ` Ian Campbell
  1 sibling, 0 replies; 35+ messages in thread
From: Ian Campbell @ 2015-02-27  9:34 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Russell King - ARM Linux, Ard Biesheuvel, Catalin Marinas,
	Julien Grall, Will Deacon, Leif Lindholm, tim, Rob Herring,
	Stefano Stabellini, xen-devel, linux-arm-kernel

On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> On Wed, 18 Feb 2015, Ian Campbell wrote:
> > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > >
> > > > This patch registers hvc0 as the preferred console if no console
> > > > has been specified explicitly on the kernel command line.
> > > >
> > > > The purpose is to allow platform agnostic kernels and boot images
> > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > need to modify the command line by hand.
> > > 
> > > How does this interact with DT chosen stdout-path?
> > 
> > I think it shouldn't any more than the existing calls from e.g. the 8250
> > driver to preferred_console do.
> >
> > > Is there a node for hvc0?
> > 
> > Not a direct one, it is inferred from the presence of the general Xen
> > node.
> 
> Xen PV consoles, including hvc0, as all the other Xen PV devices are
> advertised on xenstore.

Do we actually use the xenstore node for hvc0? I thought we got it from
hvmparams (so the primary it can be used before xenstore is up)

> 
> 
> > I did vaguely consider handling a stdout-path pointing to that --
> > but it seemed a bit of an abuse.
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-27  9:34         ` Ian Campbell
  2015-02-27  9:47           ` Stefano Stabellini
@ 2015-02-27  9:47           ` Stefano Stabellini
  1 sibling, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-27  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 27 Feb 2015, Ian Campbell wrote:
> On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> > On Wed, 18 Feb 2015, Ian Campbell wrote:
> > > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > > >
> > > > > This patch registers hvc0 as the preferred console if no console
> > > > > has been specified explicitly on the kernel command line.
> > > > >
> > > > > The purpose is to allow platform agnostic kernels and boot images
> > > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > > need to modify the command line by hand.
> > > > 
> > > > How does this interact with DT chosen stdout-path?
> > > 
> > > I think it shouldn't any more than the existing calls from e.g. the 8250
> > > driver to preferred_console do.
> > >
> > > > Is there a node for hvc0?
> > > 
> > > Not a direct one, it is inferred from the presence of the general Xen
> > > node.
> > 
> > Xen PV consoles, including hvc0, as all the other Xen PV devices are
> > advertised on xenstore.
> 
> Do we actually use the xenstore node for hvc0? I thought we got it from
> hvmparams (so the primary it can be used before xenstore is up)

We always assume that at least one PV console is available and the first
one is a bit special because it can be setup before the xenstore driver
for early boot messages and debugging purposes. However even the first
console is advertised on xenstore.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-27  9:34         ` Ian Campbell
@ 2015-02-27  9:47           ` Stefano Stabellini
  2015-02-27  9:47           ` Stefano Stabellini
  1 sibling, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-02-27  9:47 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Ard Biesheuvel, Russell King - ARM Linux, Stefano Stabellini,
	Catalin Marinas, Julien Grall, Will Deacon, Leif Lindholm, tim,
	Rob Herring, Stefano Stabellini, xen-devel, linux-arm-kernel

On Fri, 27 Feb 2015, Ian Campbell wrote:
> On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> > On Wed, 18 Feb 2015, Ian Campbell wrote:
> > > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > > >
> > > > > This patch registers hvc0 as the preferred console if no console
> > > > > has been specified explicitly on the kernel command line.
> > > > >
> > > > > The purpose is to allow platform agnostic kernels and boot images
> > > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > > need to modify the command line by hand.
> > > > 
> > > > How does this interact with DT chosen stdout-path?
> > > 
> > > I think it shouldn't any more than the existing calls from e.g. the 8250
> > > driver to preferred_console do.
> > >
> > > > Is there a node for hvc0?
> > > 
> > > Not a direct one, it is inferred from the presence of the general Xen
> > > node.
> > 
> > Xen PV consoles, including hvc0, as all the other Xen PV devices are
> > advertised on xenstore.
> 
> Do we actually use the xenstore node for hvc0? I thought we got it from
> hvmparams (so the primary it can be used before xenstore is up)

We always assume that at least one PV console is available and the first
one is a bit special because it can be setup before the xenstore driver
for early boot messages and debugging purposes. However even the first
console is advertised on xenstore.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 2/3] arm,arm64/xen: move Xen initialization earlier
  2015-02-18 13:51   ` [PATCH v2 2/3] arm, arm64/xen: " Julien Grall
@ 2015-04-07 17:26     ` Stefano Stabellini
  -1 siblings, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-04-07 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Russell,

I think that this patch should go via the Xen tree, however as it
touches arch/arm/kernel/setup.c, I would like your Acked-by before
adding it to the Xen queue.

Thanks,

Stefano


On Wed, 18 Feb 2015, Julien Grall wrote:
> From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> 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.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> 
> ---
>     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
> 
>     Changes in v2:
>         - Add Ian's ack
> ---
>  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(-)
> 
> diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
> index 1317ee4..04ff8e7 100644
> --- a/arch/arm/include/asm/xen/hypervisor.h
> +++ b/arch/arm/include/asm/xen/hypervisor.h
> @@ -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 */
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index e55408e..8b59d0d 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -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()) {
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index c8d3a17..1660432 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
>  
>  static __read_mostly unsigned int xen_events_irq;
>  
> +static __initdata struct device_node *xen_node;
> +
>  /* map fgmfn of domid to lpfn in the current domain */
>  static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
>  			    unsigned int domid)
> @@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
>   * documentation of the Xen Device Tree format.
>   */
>  #define GRANT_TABLE_PHYSADDR 0
> -static int __init xen_guest_init(void)
> +void __init xen_early_init(void)
>  {
> -	struct xen_add_to_physmap xatp;
> -	static struct shared_info *shared_info_page = 0;
> -	struct device_node *node;
>  	int len;
>  	const char *s = NULL;
>  	const char *version = NULL;
>  	const char *xen_prefix = "xen,xen-";
> -	struct resource res;
> -	phys_addr_t grant_frames;
>  
> -	node = of_find_compatible_node(NULL, NULL, "xen,xen");
> -	if (!node) {
> +	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> +	if (!xen_node) {
>  		pr_debug("No Xen support\n");
> -		return 0;
> +		return;
>  	}
> -	s = of_get_property(node, "compatible", &len);
> +	s = of_get_property(xen_node, "compatible", &len);
>  	if (strlen(xen_prefix) + 3  < len &&
>  			!strncmp(xen_prefix, s, strlen(xen_prefix)))
>  		version = s + strlen(xen_prefix);
>  	if (version == NULL) {
>  		pr_debug("Xen version not found\n");
> -		return 0;
> -	}
> -	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
> -		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;
> +		return;
>  	}
>  
> -	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
> -			version, xen_events_irq, &grant_frames);
> +	pr_info("Xen %s support found\n", version);
>  
>  	xen_domain_type = XEN_HVM_DOMAIN;
>  
> @@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
>  		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>  	else
>  		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +}
> +
> +static int __init xen_guest_init(void)
> +{
> +	struct xen_add_to_physmap xatp;
> +	struct shared_info *shared_info_page = NULL;
> +	struct resource res;
> +	phys_addr_t grant_frames;
> +
> +	if (!xen_domain())
> +		return 0;
> +
> +	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
> +		pr_err("Xen grant table base address not found\n");
> +		return -ENODEV;
> +	}
> +	grant_frames = res.start;
> +
> +	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> +	if (!xen_events_irq) {
> +		pr_err("Xen event channel interrupt not found\n");
> +		return -ENODEV;
> +	}
> +
> +	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
>  
> -	if (!shared_info_page)
> -		shared_info_page = (struct shared_info *)
> -			get_zeroed_page(GFP_KERNEL);
>  	if (!shared_info_page) {
>  		pr_err("not enough memory\n");
>  		return -ENOMEM;
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index e8420f6..c00ae01 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -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
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 2/3] arm, arm64/xen: move Xen initialization earlier
@ 2015-04-07 17:26     ` Stefano Stabellini
  0 siblings, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-04-07 17:26 UTC (permalink / raw)
  To: linux
  Cc: Ian Campbell, ard.biesheuvel, catalin.marinas,
	Stefano Stabellini, will.deacon, leif.lindholm, tim,
	Julien Grall, stefano.stabellini, xen-devel, linux-arm-kernel

Russell,

I think that this patch should go via the Xen tree, however as it
touches arch/arm/kernel/setup.c, I would like your Acked-by before
adding it to the Xen queue.

Thanks,

Stefano


On Wed, 18 Feb 2015, Julien Grall wrote:
> From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> 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.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> 
> ---
>     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
> 
>     Changes in v2:
>         - Add Ian's ack
> ---
>  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(-)
> 
> diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
> index 1317ee4..04ff8e7 100644
> --- a/arch/arm/include/asm/xen/hypervisor.h
> +++ b/arch/arm/include/asm/xen/hypervisor.h
> @@ -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 */
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index e55408e..8b59d0d 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -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()) {
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index c8d3a17..1660432 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
>  
>  static __read_mostly unsigned int xen_events_irq;
>  
> +static __initdata struct device_node *xen_node;
> +
>  /* map fgmfn of domid to lpfn in the current domain */
>  static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
>  			    unsigned int domid)
> @@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
>   * documentation of the Xen Device Tree format.
>   */
>  #define GRANT_TABLE_PHYSADDR 0
> -static int __init xen_guest_init(void)
> +void __init xen_early_init(void)
>  {
> -	struct xen_add_to_physmap xatp;
> -	static struct shared_info *shared_info_page = 0;
> -	struct device_node *node;
>  	int len;
>  	const char *s = NULL;
>  	const char *version = NULL;
>  	const char *xen_prefix = "xen,xen-";
> -	struct resource res;
> -	phys_addr_t grant_frames;
>  
> -	node = of_find_compatible_node(NULL, NULL, "xen,xen");
> -	if (!node) {
> +	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> +	if (!xen_node) {
>  		pr_debug("No Xen support\n");
> -		return 0;
> +		return;
>  	}
> -	s = of_get_property(node, "compatible", &len);
> +	s = of_get_property(xen_node, "compatible", &len);
>  	if (strlen(xen_prefix) + 3  < len &&
>  			!strncmp(xen_prefix, s, strlen(xen_prefix)))
>  		version = s + strlen(xen_prefix);
>  	if (version == NULL) {
>  		pr_debug("Xen version not found\n");
> -		return 0;
> -	}
> -	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
> -		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;
> +		return;
>  	}
>  
> -	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
> -			version, xen_events_irq, &grant_frames);
> +	pr_info("Xen %s support found\n", version);
>  
>  	xen_domain_type = XEN_HVM_DOMAIN;
>  
> @@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
>  		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>  	else
>  		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +}
> +
> +static int __init xen_guest_init(void)
> +{
> +	struct xen_add_to_physmap xatp;
> +	struct shared_info *shared_info_page = NULL;
> +	struct resource res;
> +	phys_addr_t grant_frames;
> +
> +	if (!xen_domain())
> +		return 0;
> +
> +	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
> +		pr_err("Xen grant table base address not found\n");
> +		return -ENODEV;
> +	}
> +	grant_frames = res.start;
> +
> +	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> +	if (!xen_events_irq) {
> +		pr_err("Xen event channel interrupt not found\n");
> +		return -ENODEV;
> +	}
> +
> +	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
>  
> -	if (!shared_info_page)
> -		shared_info_page = (struct shared_info *)
> -			get_zeroed_page(GFP_KERNEL);
>  	if (!shared_info_page) {
>  		pr_err("not enough memory\n");
>  		return -ENOMEM;
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index e8420f6..c00ae01 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -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
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 2/3] arm,arm64/xen: move Xen initialization earlier
  2015-04-07 17:26     ` [PATCH v2 2/3] arm, arm64/xen: " Stefano Stabellini
  (?)
  (?)
@ 2015-05-06 14:04     ` Stefano Stabellini
  -1 siblings, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-05-06 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

I am going to queue this up in the xentip tree for 4.2, let me know if
you have any issues.

Cheers,

Stefano

On Tue, 7 Apr 2015, Stefano Stabellini wrote:
> Russell,
> 
> I think that this patch should go via the Xen tree, however as it
> touches arch/arm/kernel/setup.c, I would like your Acked-by before
> adding it to the Xen queue.
> 
> Thanks,
> 
> Stefano
> 
> 
> On Wed, 18 Feb 2015, Julien Grall wrote:
> > From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > 
> > 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.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > Cc: Russell King <linux@arm.linux.org.uk>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > 
> > ---
> >     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
> > 
> >     Changes in v2:
> >         - Add Ian's ack
> > ---
> >  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(-)
> > 
> > diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
> > index 1317ee4..04ff8e7 100644
> > --- a/arch/arm/include/asm/xen/hypervisor.h
> > +++ b/arch/arm/include/asm/xen/hypervisor.h
> > @@ -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 */
> > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> > index e55408e..8b59d0d 100644
> > --- a/arch/arm/kernel/setup.c
> > +++ b/arch/arm/kernel/setup.c
> > @@ -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()) {
> > diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> > index c8d3a17..1660432 100644
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
> >  
> >  static __read_mostly unsigned int xen_events_irq;
> >  
> > +static __initdata struct device_node *xen_node;
> > +
> >  /* map fgmfn of domid to lpfn in the current domain */
> >  static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
> >  			    unsigned int domid)
> > @@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
> >   * documentation of the Xen Device Tree format.
> >   */
> >  #define GRANT_TABLE_PHYSADDR 0
> > -static int __init xen_guest_init(void)
> > +void __init xen_early_init(void)
> >  {
> > -	struct xen_add_to_physmap xatp;
> > -	static struct shared_info *shared_info_page = 0;
> > -	struct device_node *node;
> >  	int len;
> >  	const char *s = NULL;
> >  	const char *version = NULL;
> >  	const char *xen_prefix = "xen,xen-";
> > -	struct resource res;
> > -	phys_addr_t grant_frames;
> >  
> > -	node = of_find_compatible_node(NULL, NULL, "xen,xen");
> > -	if (!node) {
> > +	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> > +	if (!xen_node) {
> >  		pr_debug("No Xen support\n");
> > -		return 0;
> > +		return;
> >  	}
> > -	s = of_get_property(node, "compatible", &len);
> > +	s = of_get_property(xen_node, "compatible", &len);
> >  	if (strlen(xen_prefix) + 3  < len &&
> >  			!strncmp(xen_prefix, s, strlen(xen_prefix)))
> >  		version = s + strlen(xen_prefix);
> >  	if (version == NULL) {
> >  		pr_debug("Xen version not found\n");
> > -		return 0;
> > -	}
> > -	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
> > -		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;
> > +		return;
> >  	}
> >  
> > -	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
> > -			version, xen_events_irq, &grant_frames);
> > +	pr_info("Xen %s support found\n", version);
> >  
> >  	xen_domain_type = XEN_HVM_DOMAIN;
> >  
> > @@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
> >  		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
> >  	else
> >  		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> > +}
> > +
> > +static int __init xen_guest_init(void)
> > +{
> > +	struct xen_add_to_physmap xatp;
> > +	struct shared_info *shared_info_page = NULL;
> > +	struct resource res;
> > +	phys_addr_t grant_frames;
> > +
> > +	if (!xen_domain())
> > +		return 0;
> > +
> > +	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
> > +		pr_err("Xen grant table base address not found\n");
> > +		return -ENODEV;
> > +	}
> > +	grant_frames = res.start;
> > +
> > +	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> > +	if (!xen_events_irq) {
> > +		pr_err("Xen event channel interrupt not found\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
> >  
> > -	if (!shared_info_page)
> > -		shared_info_page = (struct shared_info *)
> > -			get_zeroed_page(GFP_KERNEL);
> >  	if (!shared_info_page) {
> >  		pr_err("not enough memory\n");
> >  		return -ENOMEM;
> > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> > index e8420f6..c00ae01 100644
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -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
> > -- 
> > 2.1.4
> > 
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 2/3] arm, arm64/xen: move Xen initialization earlier
  2015-04-07 17:26     ` [PATCH v2 2/3] arm, arm64/xen: " Stefano Stabellini
  (?)
@ 2015-05-06 14:04     ` Stefano Stabellini
  -1 siblings, 0 replies; 35+ messages in thread
From: Stefano Stabellini @ 2015-05-06 14:04 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: linux, Ian Campbell, ard.biesheuvel, catalin.marinas,
	will.deacon, leif.lindholm, tim, Julien Grall,
	stefano.stabellini, xen-devel, linux-arm-kernel

Hi Russell,

I am going to queue this up in the xentip tree for 4.2, let me know if
you have any issues.

Cheers,

Stefano

On Tue, 7 Apr 2015, Stefano Stabellini wrote:
> Russell,
> 
> I think that this patch should go via the Xen tree, however as it
> touches arch/arm/kernel/setup.c, I would like your Acked-by before
> adding it to the Xen queue.
> 
> Thanks,
> 
> Stefano
> 
> 
> On Wed, 18 Feb 2015, Julien Grall wrote:
> > From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > 
> > 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.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > Cc: Russell King <linux@arm.linux.org.uk>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > 
> > ---
> >     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
> > 
> >     Changes in v2:
> >         - Add Ian's ack
> > ---
> >  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(-)
> > 
> > diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
> > index 1317ee4..04ff8e7 100644
> > --- a/arch/arm/include/asm/xen/hypervisor.h
> > +++ b/arch/arm/include/asm/xen/hypervisor.h
> > @@ -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 */
> > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> > index e55408e..8b59d0d 100644
> > --- a/arch/arm/kernel/setup.c
> > +++ b/arch/arm/kernel/setup.c
> > @@ -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()) {
> > diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> > index c8d3a17..1660432 100644
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -53,6 +53,8 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
> >  
> >  static __read_mostly unsigned int xen_events_irq;
> >  
> > +static __initdata struct device_node *xen_node;
> > +
> >  /* map fgmfn of domid to lpfn in the current domain */
> >  static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
> >  			    unsigned int domid)
> > @@ -222,42 +224,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
> >   * documentation of the Xen Device Tree format.
> >   */
> >  #define GRANT_TABLE_PHYSADDR 0
> > -static int __init xen_guest_init(void)
> > +void __init xen_early_init(void)
> >  {
> > -	struct xen_add_to_physmap xatp;
> > -	static struct shared_info *shared_info_page = 0;
> > -	struct device_node *node;
> >  	int len;
> >  	const char *s = NULL;
> >  	const char *version = NULL;
> >  	const char *xen_prefix = "xen,xen-";
> > -	struct resource res;
> > -	phys_addr_t grant_frames;
> >  
> > -	node = of_find_compatible_node(NULL, NULL, "xen,xen");
> > -	if (!node) {
> > +	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> > +	if (!xen_node) {
> >  		pr_debug("No Xen support\n");
> > -		return 0;
> > +		return;
> >  	}
> > -	s = of_get_property(node, "compatible", &len);
> > +	s = of_get_property(xen_node, "compatible", &len);
> >  	if (strlen(xen_prefix) + 3  < len &&
> >  			!strncmp(xen_prefix, s, strlen(xen_prefix)))
> >  		version = s + strlen(xen_prefix);
> >  	if (version == NULL) {
> >  		pr_debug("Xen version not found\n");
> > -		return 0;
> > -	}
> > -	if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
> > -		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;
> > +		return;
> >  	}
> >  
> > -	pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
> > -			version, xen_events_irq, &grant_frames);
> > +	pr_info("Xen %s support found\n", version);
> >  
> >  	xen_domain_type = XEN_HVM_DOMAIN;
> >  
> > @@ -267,10 +255,32 @@ static int __init xen_guest_init(void)
> >  		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
> >  	else
> >  		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> > +}
> > +
> > +static int __init xen_guest_init(void)
> > +{
> > +	struct xen_add_to_physmap xatp;
> > +	struct shared_info *shared_info_page = NULL;
> > +	struct resource res;
> > +	phys_addr_t grant_frames;
> > +
> > +	if (!xen_domain())
> > +		return 0;
> > +
> > +	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
> > +		pr_err("Xen grant table base address not found\n");
> > +		return -ENODEV;
> > +	}
> > +	grant_frames = res.start;
> > +
> > +	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> > +	if (!xen_events_irq) {
> > +		pr_err("Xen event channel interrupt not found\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
> >  
> > -	if (!shared_info_page)
> > -		shared_info_page = (struct shared_info *)
> > -			get_zeroed_page(GFP_KERNEL);
> >  	if (!shared_info_page) {
> >  		pr_err("not enough memory\n");
> >  		return -ENOMEM;
> > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> > index e8420f6..c00ae01 100644
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -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
> > -- 
> > 2.1.4
> > 
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2015-05-06 14:05 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 13:51 [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
2015-02-18 13:51 ` [PATCH v2 1/3] arm/xen: Correctly check if the event channel interrupt is present Julien Grall
2015-02-18 13:51 ` Julien Grall
2015-02-26 18:08   ` Stefano Stabellini
2015-02-26 18:08   ` Stefano Stabellini
2015-02-18 13:51 ` [PATCH v2 2/3] arm,arm64/xen: move Xen initialization earlier Julien Grall
2015-02-18 13:51   ` [PATCH v2 2/3] arm, arm64/xen: " Julien Grall
2015-04-07 17:26   ` [PATCH v2 2/3] arm,arm64/xen: " Stefano Stabellini
2015-04-07 17:26     ` [PATCH v2 2/3] arm, arm64/xen: " Stefano Stabellini
2015-05-06 14:04     ` Stefano Stabellini
2015-05-06 14:04     ` [PATCH v2 2/3] arm,arm64/xen: " Stefano Stabellini
2015-02-18 13:51 ` [PATCH v2 3/3] xen/arm: allow console=hvc0 to be omitted for guests Julien Grall
2015-02-18 15:25   ` Ian Campbell
2015-02-18 15:25   ` Ian Campbell
2015-02-18 15:50   ` Rob Herring
2015-02-18 16:03     ` Ian Campbell
2015-02-18 16:03     ` Ian Campbell
2015-02-26 18:22       ` Stefano Stabellini
2015-02-27  9:34         ` Ian Campbell
2015-02-27  9:34         ` Ian Campbell
2015-02-27  9:47           ` Stefano Stabellini
2015-02-27  9:47           ` Stefano Stabellini
2015-02-26 18:22       ` Stefano Stabellini
2015-02-18 15:50   ` Rob Herring
2015-02-18 13:51 ` Julien Grall
2015-02-25 16:22 ` [PATCH v2 0/3] arm/arm64: Detect Xen support earlier Julien Grall
2015-02-25 16:22   ` Julien Grall
2015-02-25 16:34   ` Will Deacon
2015-02-25 16:34     ` Will Deacon
2015-02-25 16:38     ` Julien Grall
2015-02-25 16:38       ` Julien Grall
2015-02-25 16:40     ` [Xen-devel] " Ian Campbell
2015-02-25 18:01       ` Will Deacon
2015-02-25 18:01       ` Will Deacon
2015-02-25 16:40     ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.