Skip to contentSkip to conversation

RFC: arm: add call to cleanup things before jumping into kernel

PATCH New Ajay Kumar 4 participants 11 messages Oct 3, 2013 – Oct 4, 2013

Subsystems (3)
lore
Share & tools
lore

Ajay Kumar

author
#0 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

Add infrasturcture to cleanup any of those architecture related settings done for u-boot, if they can cause problem during kernel boot.

---
 arch/arm/cpu/armv7/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/cpu/armv7/cpu.c +6 -0
index 01cdb7e..edf4604 100644
@@ -23,6 +23,7 @@
 #include <linux/compiler.h>
 
 void __weak cpu_cache_initialization(void){}
+void __weak arch_cleanup_before_linux(void){}
 
 int cleanup_before_linux(void)
 {
@@ -35,6 +36,11 @@ int cleanup_before_linux(void)
 #ifndef CONFIG_SPL_BUILD
 	disable_interrupts();
 #endif
+	/*
+	 * Cleanup any of those architecture related settings done for u-boot,
+	 * if they can cause problem during kernel boot.
+	 */
+	arch_cleanup_before_linux();
 
 	/*
 	 * Turn off I-cache and invalidate it
Signature · 1 line
1.7.12.4
author
#1 lore raw

PATCH 2/2 RFC: exynos: Disable the display controller when starting Linux

If the exynos display controller is still active when Linux starts, then it will result in a kernel panic while FIMD sysmmu driver is getting probed.
Calling exynos_fimd_lcd_disable() before jumping into kernel disables the display controller by switching off the windows, hence resolving the kernel panic which arises from sysmmu driver.

Create an Exynos specific definition for the weak function arch_cleanup_before_linux(), and then place the call to exynos_fimd_lcd_disable() inside the overrided definition of arch_cleanup_before_linux().

---
 arch/arm/cpu/armv7/exynos/system.c        | 9 +++++++++
 arch/arm/include/asm/arch-exynos/system.h | 9 +++++++++
 drivers/video/exynos_fimd.c               | 8 ++++++++
 3 files changed, 26 insertions(+)
arch/arm/cpu/armv7/exynos/system.c +9 -0
index ad12445..977169b 100644
@@ -69,3 +69,12 @@ void set_system_display_ctrl(void)
 	else
 		exynos5_set_system_display();
 }
+
+/*
+ * Cleanup any Exynos specific setting here,
+ * if they can cause problem during kernel boot.
+ */
+void arch_cleanup_before_linux(void)
+{
+	exynos_fimd_lcd_disable();
+}
arch/arm/include/asm/arch-exynos/system.h +9 -0
index 7e2057c..ed0c984 100644
@@ -40,4 +40,13 @@ struct exynos5_sysreg {
 void set_usbhost_mode(unsigned int mode);
 void set_system_display_ctrl(void);
 
+#ifdef CONFIG_EXYNOS_FB
+/* Disable the display */
+void exynos_fimd_lcd_disable(void);
+#else
+static inline void exynos_fimd_lcd_disable(void)
+{
+}
+#endif
+
 #endif	/* _EXYNOS4_SYSTEM_H */
drivers/video/exynos_fimd.c +8 -0
index 8c2de4e..6a13d03 100644
@@ -363,3 +363,11 @@ unsigned long exynos_fimd_calc_fbsize(void)
 {
 	return pvid->vl_col * pvid->vl_row * (NBITS(pvid->vl_bpix) / 8);
 }
+
+void exynos_fimd_lcd_disable(void)
+{
+	int i;
+
+	for (i = 0; i < 4; i++)
+		exynos_fimd_window_off(i);
+}
Signature · 1 line
1.7.12.4
#2 lore raw

PATCH 2/2 RFC: exynos: Disable the display controller when starting Linux

Hi Ajay,

Quoted 7 lines · Ajay Kumar

If the exynos display controller is still active when Linux starts, then it will result in a kernel panic while FIMD sysmmu driver is getting probed.
Calling exynos_fimd_lcd_disable() before jumping into kernel disables the display controller by switching off the windows, hence resolving the kernel panic which arises from sysmmu driver.

Quoted 8 lines

Create an Exynos specific definition for the weak function arch_cleanup_before_linux(), and then place the call to exynos_fimd_lcd_disable() inside the overrided definition of arch_cleanup_before_linux().

---

Why should the fix to this situation be making U-Boot disable the display controller rather than making Linux able to cope with an already active display controller?

Besides, fixing Linux would allow seamless booting displays, without an ugly off-on glitch.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 2/2 RFC: exynos: Disable the display controller when starting Linux

+Simon Glass

Quoted 36 lines · Albert ARIBAUD

Hi Ajay,

Quoted 7 lines · Ajay Kumar

If the exynos display controller is still active when Linux starts, then it will result in a kernel panic while FIMD sysmmu driver is getting probed.
Calling exynos_fimd_lcd_disable() before jumping into kernel disables the display controller by switching off the windows, hence resolving the kernel panic which arises from sysmmu driver.

Quoted 8 lines

Create an Exynos specific definition for the weak function arch_cleanup_before_linux(), and then place the call to exynos_fimd_lcd_disable() inside the overrided definition of arch_cleanup_before_linux().

---

Why should the fix to this situation be making U-Boot disable the display controller rather than making Linux able to cope with an already active display controller?

Besides, fixing Linux would allow seamless booting displays, without an ugly off-on glitch.

Amicalement,
--
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH 2/2 RFC: exynos: Disable the display controller when starting Linux

Hi,

Quoted 33 lines · Ajay kumar

+Simon Glass

Quoted 28 lines · Albert ARIBAUD

Hi Ajay,

Quoted 7 lines · Ajay Kumar

If the exynos display controller is still active when Linux starts, then it will result in a kernel panic while FIMD sysmmu driver is getting probed.
Calling exynos_fimd_lcd_disable() before jumping into kernel disables the display controller by switching off the windows, hence resolving the kernel panic which arises from sysmmu driver.

Quoted 8 lines

Create an Exynos specific definition for the weak function arch_cleanup_before_linux(), and then place the call to exynos_fimd_lcd_disable() inside the overrided definition of arch_cleanup_before_linux().

---

Why should the fix to this situation be making U-Boot disable the display controller rather than making Linux able to cope with an already active display controller?

Besides, fixing Linux would allow seamless booting displays, without an ugly off-on glitch.

Yes, I believe this bug was fixed in Linux - Ajay do you know? Perhaps the fix has not been upstreamed yet?

Regards,
Simon

Quoted 10 lines
Quoted 8 lines

Amicalement,
--
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#5 lore raw

PATCH 2/2 RFC: exynos: Disable the display controller when starting Linux

Hi Simon,

Quoted 38 lines · Simon Glass

Hi,

Quoted 4 lines · Ajay kumar

+Simon Glass

On Thu, Oct 3, 2013 at 2:25 PM, Albert ARIBAUD <

albert.u.boot at aribaud.net>

Quoted 23 lines
Quoted 22 lines · wrote:

Hi Ajay,

Quoted 15 lines · Ajay Kumar

If the exynos display controller is still active when Linux starts, then it will result in a kernel panic while FIMD sysmmu driver is getting probed.
Calling exynos_fimd_lcd_disable() before jumping into kernel disables the display controller by switching off the windows, hence resolving the kernel panic which arises from sysmmu driver.

Create an Exynos specific definition for the weak function arch_cleanup_before_linux(), and then place the call to exynos_fimd_lcd_disable() inside the overrided definition of arch_cleanup_before_linux().

---

Quoted 6 lines
Quoted 6 lines

Why should the fix to this situation be making U-Boot disable the display controller rather than making Linux able to cope with an already active display controller?

Besides, fixing Linux would allow seamless booting displays, without an ugly off-on glitch.

Quoted 7 lines

Yes, I believe this bug was fixed in Linux - Ajay do you know? Perhaps the fix has not been upstreamed yet?

Regards,
Simon

You are right. I found it.

http://permalink.gmane.org/gmane.comp.video.dri.devel/78840
This patch would be resent in next series of iommu patches. So, we would not need the u-boot patch anymore!

Quoted 11 lines
Quoted 10 lines
Quoted 8 lines

Amicalement,
--
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Thanks and regards,
Ajay Kumar

#6 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

In reply to Ajay Kumar

Hi Ajay,

Quoted 5 lines · Ajay Kumar

Add infrasturcture to cleanup any of those architecture related settings done for u-boot, if they can cause problem during kernel boot.

---

Regardless to ma question re fixing the issue in U-Boot or Linux: does something prevent using the already existing cleanup_before_linux() function, and if not, what made you choose to create another one instead?

Amicalement,

Signature · 1 line
Albert.
#7 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

Hi Albert,

Quoted 11 lines · Albert ARIBAUD

Hi Ajay,

Quoted 5 lines · Ajay Kumar

Add infrasturcture to cleanup any of those architecture related settings done for u-boot, if they can cause problem during kernel boot.

---

Quoted 6 lines

Regardless to ma question re fixing the issue in U-Boot or Linux: does something prevent using the already existing cleanup_before_linux() function, and if not, what made you choose to create another one instead?

cleanup_before_linux() generally cleans up things specific to the

processor.
I thought of introducing a cleanup function which would allow us to cleanup things which are SOC specific(all SOC under armv7 as per the patch). And, used the same function to cleanup some exynos specific stuff before booting linux.
May be, I should have used a different name instead of arch_cleanup_before_linux?

Quoted 8 lines

Amicalement,
--
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#8 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

Hi Ajay,

Quoted 21 lines · Ajay kumar

Hi Albert,

Quoted 16 lines · Albert ARIBAUD

Hi Ajay,

Quoted 5 lines · Ajay Kumar

Add infrasturcture to cleanup any of those architecture related settings done for u-boot, if they can cause problem during kernel boot.

---

Regardless to ma question re fixing the issue in U-Boot or Linux: does something prevent using the already existing cleanup_before_linux() function, and if not, what made you choose to create another one instead?

(fixed quote glitch here that put the start of your reply inside mine.)

Quoted 8 lines

cleanup_before_linux() generally cleans up things specific to the processor.
I thought of introducing a cleanup function which would allow us to cleanup things which are SOC specific(all SOC under armv7 as per the patch). And, used the same function to cleanup some exynos specific stuff before booting linux.
May be, I should have used a different name instead of arch_cleanup_before_linux?

Well, if it is *SoC* specific, then it is not *arch* specific, so yes, the name should be changed. Now, we don't really have a concept of 'SoC-specific' in U-Boot, so board-specific, as suggested by Simon, is the 'next not-too-worst thing'.

Still, don't rush to provide a new patch. According to Simon, the Linux panic was solved and might just not have hit mainline yet; if that is confirmed, then renaming arch_cleanup_before_linux() becomes moot.

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

Quoted 46 lines · Albert ARIBAUD

Hi Ajay,

Quoted 4 lines · Ajay kumar

Hi Albert,

On Thu, Oct 3, 2013 at 2:28 PM, Albert ARIBAUD <

Quoted 7 lines · albert.u.boot at aribaud.net>wrote:
Quoted 7 lines

Hi Ajay,

Quoted 1 line · Ajay Kumar

Add infrasturcture to cleanup any of those architecture related

settings

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

done for u-boot, if they can cause problem during kernel boot.

---

Regardless to ma question re fixing the issue in U-Boot or Linux: does something prevent using the already existing cleanup_before_linux() function, and if not, what made you choose to create another one instead?

(fixed quote glitch here that put the start of your reply inside mine.)

Quoted 3 lines

cleanup_before_linux() generally cleans up things specific to the processor.
I thought of introducing a cleanup function which would allow us to

cleanup

Quoted 5 lines

things which are SOC specific(all SOC under armv7 as per the patch). And, used the same function to cleanup some exynos specific stuff before booting linux.
May be, I should have used a different name instead of arch_cleanup_before_linux?

Well, if it is *SoC* specific, then it is not *arch* specific, so yes, the name should be changed. Now, we don't really have a concept of 'SoC-specific' in U-Boot, so board-specific, as suggested by Simon, is the 'next not-too-worst thing'.

Quoted 5 lines

Still, don't rush to provide a new patch. According to Simon, the Linux panic was solved and might just not have hit mainline yet; if that is confirmed, then renaming arch_cleanup_before_linux() becomes moot.

Ok. I found the kernel patch:

http://permalink.gmane.org/gmane.comp.video.dri.devel/78840
So, this patch is not needed.

Thanks and Regards,
Ajay Kumar

#10 lore raw

PATCH 1/2 RFC: arm: add call to cleanup things before jumping into kernel

In reply to Albert ARIBAUD

Hi Albert,

Quoted 8 lines · Albert ARIBAUD

Hi Ajay,

Quoted 3 lines · Ajay Kumar

Add infrasturcture to cleanup any of those architecture related settings done for u-boot, if they can cause problem during kernel boot.

Quoted 7 lines
Quoted 2 lines

---

Regardless to ma question re fixing the issue in U-Boot or Linux: does something prevent using the already existing cleanup_before_linux() function, and if not, what made you choose to create another one instead?

That function is in generic ARM code - I think the intent here is to add something SoC-specific. Perhaps it should be board-specific?

Regards,
Simon