Skip to contentSkip to conversation

Fix loading kernel on RK3288 Radxa Rock2 Square

PATCH New Sandy Patterson 4 participants 11 messages Jul 22, 2016 – Aug 9, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix loading kernel on RK3288 Radxa Rock2 Square

I wasn't able to load the linux kernel using a Rock2 board using the latest master branch. The board hangs after it has handed executing over to the kernel. I found that the latest release that worked was v2016.03.

This patchset fixes kernel loading on rk3288 rock2 square board. I tested with with 3.14 adn 4.7-rc6 kernels.
I used gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabi.

Before fixing, the console output was:

Starting kernel ...

### ERROR ### Please RESET the board ###

Changes for v2:
- Remove patch to change to high mem limit.
- Rebase to u-boot/master.

Sandy Patterson (3):
Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL)
with asm code"
Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_INVAL_ALL) with
asm code"
CONFIG_EFI_LOADER breaks rock2 kernel loading

 arch/arm/cpu/armv7/Makefile                  |   2 +-
 arch/arm/cpu/armv7/cache_v7.c                | 134 ++++++++++++++++++++++-
 arch/arm/cpu/armv7/cache_v7_asm.S            | 154 ---------------------------
 arch/arm/mach-uniphier/arm32/lowlevel_init.S |  67 +++++++++++-
 configs/rock2_defconfig                      |   1 +
 5 files changed, 198 insertions(+), 160 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/cache_v7_asm.S
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/3 Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL) with asm code"

Commit c09d29057a and df120142f36 break kernel loading on rock2 board.

console output:
Starting kernel ...

### ERROR ### Please RESET the board ###

This reverts commit c09d29057ab0b04db0857d319c6bff74de31b9c3.

Conflicts:

	arch/arm/cpu/armv7/cache_v7.c
	arch/arm/cpu/armv7/cache_v7_asm.S

---

 arch/arm/cpu/armv7/Makefile                  |   2 +-
 arch/arm/cpu/armv7/cache_v7.c                | 114 +++++++++++++++++++-
 arch/arm/cpu/armv7/cache_v7_asm.S            | 154 ---------------------------
 arch/arm/mach-uniphier/arm32/lowlevel_init.S |  67 +++++++++++-
 4 files changed, 180 insertions(+), 157 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/cache_v7_asm.S
arch/arm/cpu/armv7/Makefile +1 -1
index 0d4bfbc..9d20f17 100644
@@ -7,7 +7,7 @@
 
 extra-y	:= start.o
 
-obj-y	+= cache_v7.o cache_v7_asm.o
+obj-y	+= cache_v7.o
 
 obj-y	+= cpu.o cp15.o
 obj-y	+= syslib.o
arch/arm/cpu/armv7/cache_v7.c +113 -1

126 lines not on this page · raw message

arch/arm/cpu/armv7/cache_v7_asm.S deleted +0 -154

154 lines not on this page · raw message

arch/arm/mach-uniphier/arm32/lowlevel_init.S +66 -1

76 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 2/3 Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_INVAL_ALL) with asm code"

In reply to Sandy Patterson

Commit c09d29057a and df120142f36 break kernel loading on rock2 board.

console output:
Starting kernel ...

### ERROR ### Please RESET the board ###

This reverts commit df120142f36b6ff8b12187b8860269763b2b3203.

Conflicts:

	arch/arm/cpu/armv7/cache_v7.c
	arch/arm/cpu/armv7/cache_v7_asm.S

---

 arch/arm/cpu/armv7/cache_v7.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +17 -3
index 9fbabb4..e72bed5 100644
@@ -10,8 +10,10 @@
 #include <asm/armv7.h>
 #include <asm/utils.h>
 
-#define ARMV7_DCACHE_INVAL_RANGE	1
-#define ARMV7_DCACHE_CLEAN_INVAL_RANGE	2
+#define ARMV7_DCACHE_INVAL_ALL		1
+#define ARMV7_DCACHE_CLEAN_INVAL_ALL	2
+#define ARMV7_DCACHE_INVAL_RANGE	3
+#define ARMV7_DCACHE_CLEAN_INVAL_RANGE	4
 
 #ifndef CONFIG_SYS_DCACHE_OFF
 
@@ -19,6 +21,18 @@
 void v7_flush_dcache_all(void);
 void v7_invalidate_dcache_all(void);
 
+/*
+ * Write the level and type you want to Cache Size Selection Register(CSSELR)
+ * to get size details from Current Cache Size ID Register(CCSIDR)
+ */
+static void set_csselr(u32 level, u32 type)
+{
+	u32 csselr = level << 1 | type;
+
+	/* Write to Cache Size Selection Register(CSSELR) */
+	asm volatile ("mcr p15, 2, %0, c0, c0, 0" : : "r" (csselr));
+}
+
 static u32 get_ccsidr(void)
 {
 	u32 ccsidr;
@@ -207,7 +221,7 @@ static void v7_inval_tlb(void)
 
 void invalidate_dcache_all(void)
 {
-	v7_invalidate_dcache_all();
+	v7_maint_dcache_all(ARMV7_DCACHE_INVAL_ALL);
 
 	v7_outer_cache_inval_all();
 }
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 3/3 CONFIG_EFI_LOADER breaks rock2 kernel loading

In reply to Sandy Patterson

The problem seems to be invalidate_icache_all() inside the runtime. This patch just disables EFI_LOADER for rock2 board.

---

 configs/rock2_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/rock2_defconfig +1 -0
index 3e16b80..3a06b7e 100644
@@ -67,3 +67,4 @@ CONFIG_USE_PRIVATE_LIBGCC=y
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
+# CONFIG_EFI_LOADER is not set
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/3 Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL) with asm code"

In reply to Sandy Patterson
Quoted 7 lines · Sandy Patterson

Commit c09d29057a and df120142f36 break kernel loading on rock2 board.

console output:
Starting kernel ...

### ERROR ### Please RESET the board ###

Quoted 7 lines

This reverts commit c09d29057ab0b04db0857d319c6bff74de31b9c3.

Conflicts:

	arch/arm/cpu/armv7/cache_v7.c
	arch/arm/cpu/armv7/cache_v7_asm.S

So, we cannot do this. The problem is two-fold. First, newer GCCs will cause failure to boot with the way the code was, which is how we found this problem. The second is that after some offline conversations with ARM Ltd people (and some other smart folks too, these operations cannot safely be done in C, there's just no way. So we borrowed what the kernel does. You need to figure out what behavior the (old?) kernel is relying on and either emulate that with a flag (like sunxi does, or at least did, at one point for some other issues of correct behavior vs existing kernels) or just not support those older kernels.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/60ad0cd2/attachment.sig>
#3 lore raw

PATCH v2 1/3 Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL) with asm code"

I see the problem with 4.7-rc6. Is there a different kernel I should test with?

Quoted 30 lines · Tom Rini
Quoted 7 lines · Sandy Patterson

Commit c09d29057a and df120142f36 break kernel loading on rock2 board.

console output:
Starting kernel ...

### ERROR ### Please RESET the board ###

Quoted 7 lines

This reverts commit c09d29057ab0b04db0857d319c6bff74de31b9c3.

Conflicts:

      arch/arm/cpu/armv7/cache_v7.c
      arch/arm/cpu/armv7/cache_v7_asm.S

So, we cannot do this. The problem is two-fold. First, newer GCCs will cause failure to boot with the way the code was, which is how we found this problem. The second is that after some offline conversations with ARM Ltd people (and some other smart folks too, these operations cannot safely be done in C, there's just no way. So we borrowed what the kernel does. You need to figure out what behavior the (old?) kernel is relying on and either emulate that with a flag (like sunxi does, or at least did, at one point for some other issues of correct behavior vs existing kernels) or just not support those older kernels.

--
Tom

#4 lore raw

PATCH v2 1/3 Revert "arm: Replace v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL) with asm code"

Quoted 2 lines · Sandy Patterson

I see the problem with 4.7-rc6. Is there a different kernel I should test with?

No, I was hoping (from some other threads I had skimmed) that this was a problem only with an older 3.14.y. You need to figure out where / why the hang is happening.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/9a71e3c4/attachment.sig>
#7 lore raw

PATCH v2 3/3 CONFIG_EFI_LOADER breaks rock2 kernel loading

In reply to Sandy Patterson

Hi Sandy,

Quoted 8 lines · Sandy Patterson

The problem seems to be invalidate_icache_all() inside the runtime. This patch just disables EFI_LOADER for rock2 board.

---

 configs/rock2_defconfig | 1 +
 1 file changed, 1 insertion(+)

Can you please give me an update on these patches? Did you discover the root cause? What patches do you think need to be applied for this release. I'd like to get a few more test reports too if possible.

Regards,
Simon

#8 lore raw

PATCH v2 3/3 CONFIG_EFI_LOADER breaks rock2 kernel loading

Hi Simon,

I think you can drop this patch due to it fixes by a78cd86 - ARM: Rework and correct barrier which Tom had merge it into u-boot/master.

Quoted 20 lines · Simon Glass

Hi Sandy,

Quoted 8 lines · Sandy Patterson

The problem seems to be invalidate_icache_all() inside the runtime. This patch just disables EFI_LOADER for rock2 board.

---

  configs/rock2_defconfig | 1 +
  1 file changed, 1 insertion(+)

Can you please give me an update on these patches? Did you discover the root cause? What patches do you think need to be applied for this release. I'd like to get a few more test reports too if possible.

Regards,
Simon

#9 lore raw

PATCH v2 3/3 CONFIG_EFI_LOADER breaks rock2 kernel loading

I also found that once the barrier stuff was in, the EFI_LOADER change was unnecessary.

Quoted 34 lines · Ziyuan Xu

Hi Simon,

I think you can drop this patch due to it fixes by a78cd86 - ARM: Rework and correct barrier which Tom had merge it into u-boot/master.

Quoted 24 lines · Simon Glass

Hi Sandy,

Quoted 9 lines · Sandy Patterson

The problem seems to be invalidate_icache_all() inside the runtime. This patch just disables EFI_LOADER for rock2 board.

---

  configs/rock2_defconfig | 1 +
  1 file changed, 1 insertion(+)

Can you please give me an update on these patches? Did you discover the root cause? What patches do you think need to be applied for this release. I'd like to get a few more test reports too if possible.

Regards,
Simon

#10 lore raw

PATCH v2 3/3 CONFIG_EFI_LOADER breaks rock2 kernel loading

Hi Sandy,

Quoted 9 lines · Sandy Patterson

I also found that once the barrier stuff was in, the EFI_LOADER change was unnecessary.

Quoted 5 lines · Ziyuan Xu

Hi Simon,

I think you can drop this patch due to it fixes by a78cd86 - ARM: Rework and correct barrier which Tom had merge it into u-boot/master.

That's great, thanks for letting me know.

BTW for the mailing list can you please avoid top-posting?

Regards,
Simon

Quoted 30 lines
Quoted 29 lines · Simon Glass
Quoted 24 lines

Hi Sandy,

Quoted 9 lines · Sandy Patterson

The problem seems to be invalidate_icache_all() inside the runtime. This patch just disables EFI_LOADER for rock2 board.

---

  configs/rock2_defconfig | 1 +
  1 file changed, 1 insertion(+)

Can you please give me an update on these patches? Did you discover the root cause? What patches do you think need to be applied for this release. I'd like to get a few more test reports too if possible.

Regards,
Simon