Skip to contentSkip to conversation

ARM: xen: only set pm function ptrs for Xen guests

PATCH Superseded Rob Herring 3 participants 3 messages Aug 28, 2013 – Aug 29, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: xen: only set pm function ptrs for Xen guests

From: Rob Herring <[email protected]>

xen_pm_init was unconditionally setting pm_power_off and arm_pm_restart function pointers. This breaks multi-platform kernels. Make this conditional on running as a Xen guest and make it a late_initcall to ensure it is setup after platform code for Dom0.

Cc Stefano Stabellini <[email protected]>
---
 arch/arm/xen/enlighten.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/xen/enlighten.c +4 -1
index 8a6295c..13a7d1f 100644
@@ -273,12 +273,15 @@ core_initcall(xen_guest_init);
 
 static int __init xen_pm_init(void)
 {
+	if (!of_find_compatible_node(NULL, NULL, "xen,xen"))
+		return -ENODEV;
+
 	pm_power_off = xen_power_off;
 	arm_pm_restart = xen_restart;
 
 	return 0;
 }
-subsys_initcall(xen_pm_init);
+late_initcall(xen_pm_init);
 
 static irqreturn_t xen_arm_callback(int irq, void *arg)
 {
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

xen_pm_init was unconditionally setting pm_power_off and arm_pm_restart function pointers. This breaks multi-platform kernels. Make this conditional on running as a Xen guest and make it a late_initcall to ensure it is setup after platform code for Dom0.

Cc Stefano Stabellini <[email protected]>
---
 arch/arm/xen/enlighten.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/xen/enlighten.c +0 -0
index 8a6295c..13a7d1f 100644

arch/arm/xen/enlighten.c core_initcall(xen_guest_init); · line 278

Quoted 6 lines
arch/arm/xen/enlighten.c +3 -0
@@ -273,12 +273,15 @@ core_initcall(xen_guest_init);
 
 static int __init xen_pm_init(void)
 {
+       if (!of_find_compatible_node(NULL, NULL, "xen,xen"))
+               return -ENODEV;
+

You should use the macro xen_domain() to check if we are running in a Xen guest.

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw
Quoted 20 lines · Julien Grall
Quoted 19 lines · Rob Herring

From: Rob Herring <[email protected]>

xen_pm_init was unconditionally setting pm_power_off and arm_pm_restart function pointers. This breaks multi-platform kernels. Make this conditional on running as a Xen guest and make it a late_initcall to ensure it is setup after platform code for Dom0.

Cc Stefano Stabellini <[email protected]>
---
 arch/arm/xen/enlighten.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/xen/enlighten.c +0 -0
index 8a6295c..13a7d1f 100644
@@ -273,12 +273,15 @@ core_initcall(xen_guest_init);
 
Quoted 8 lines

arch/arm/xen/enlighten.c core_initcall(xen_guest_init); · line 278

Quoted 5 lines
arch/arm/xen/enlighten.c +3 -0
 static int __init xen_pm_init(void)
 {
+       if (!of_find_compatible_node(NULL, NULL, "xen,xen"))
+               return -ENODEV;
+

You should use the macro xen_domain() to check if we are running in a Xen guest.

Yep.
Aside from that the patch is fine. Thanks for spotting and fixing this issue.
I'll add the next version of this patch to the xen queue.