Skip to contentSkip to conversation

ARM: sharpsl_param: Fix hang on boot in sharpsl_save_param().

PATCH New dromede at gmail.com 2 participants 2 messages Nov 28, 2012 – Nov 29, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: sharpsl_param: Fix hang on boot in sharpsl_save_param().

From: Marko Katic <dromede.gmail.com>

Devices that call sharpsl_save_param() will hang on boot due to a memcpy call that uses a physical address that is no longer accessible. This is caused by the following commit:

commit 72662e01088394577be4a3f14da94cf87bea2591

Author: Will Deacon <[email protected]>
Date:   Wed Nov 23 12:03:27 2011 +0000

ARM: head.S: only include __turn_mmu_on in the initial identity mapping

I suspect that due to the abovementioned commit the mmu gets turned on earlier and thus, memcpy in sharpsl_save_param() will fail.

Fix this by converting the physical address into a virtual one.

---
 arch/arm/common/sharpsl_param.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/common/sharpsl_param.c +3 -1
index d56c932..04555dc 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <asm/memory.h>
 #include <asm/mach/sharpsl_param.h>
 
 /*
@@ -41,7 +42,8 @@ EXPORT_SYMBOL(sharpsl_param);
 
 void sharpsl_save_param(void)
 {
-	memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info));
+	void *param_start = phys_to_virt(PARAM_BASE);
+	memcpy(&sharpsl_param, param_start, sizeof(struct sharpsl_param_info));
 
 	if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
 		sharpsl_param.comadj=-1;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 ARM: sharpsl_param: Fix hang on boot in sharpsl_save_param().

Quoted 48 lines · On Wed, Nov 28, 2012 at 10:35 PM, <[email protected]> wrote:

From: Marko Katic <dromede.gmail.com>

Devices that call sharpsl_save_param() will hang on boot due to a memcpy call that uses a physical address that is no longer accessible. This is caused by the following commit:

commit 72662e01088394577be4a3f14da94cf87bea2591

Author: Will Deacon <[email protected]>
Date:   Wed Nov 23 12:03:27 2011 +0000

ARM: head.S: only include __turn_mmu_on in the initial identity mapping

I suspect that due to the abovementioned commit the mmu gets turned on earlier and thus, memcpy in sharpsl_save_param() will fail.

Fix this by converting the physical address into a virtual one.

---
 arch/arm/common/sharpsl_param.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/common/sharpsl_param.c +3 -2
index d56c932..04555dc 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <asm/memory.h>
 #include <asm/mach/sharpsl_param.h>
 
 /*
@@ -41,7 +42,8 @@ EXPORT_SYMBOL(sharpsl_param);
 
 void sharpsl_save_param(void)
 {
-       memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info));
+       void *param_start = phys_to_virt(PARAM_BASE);
+       memcpy(&sharpsl_param, param_start, sizeof(struct sharpsl_param_info));
 
        if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
                sharpsl_param.comadj=-1;
--

1.7.10.4

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

With this patch Zaurus corgi/poodle/spitz can boot kernels 3.3, 3.4 and 3.6