All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: enable imprecise aborts during early kernel startup
@ 2015-08-25 11:24 Lucas Stach
  2015-08-25 12:40 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Stach @ 2015-08-25 11:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabrice Gasnier <fabrice.gasnier@st.com>

This patch adds imprecise abort enable/disable macros and uses them to
enable imprecise aborts early when starting the kernel.

This helps in tracking down the real cause for such imprecise abort, as
they are handled as soon as they occur. Until now those aborts would
only be enabled when entering the userspace and as a consequence crash
the first userspace process if any abort had been raised during kernel
startup.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
lst:
- rebased to current kernel
- reworked commit message
- moved abort enable to point where handlers could run
  (tested by hacking bootloader to leave a dangling abort behind)
---
 arch/arm/include/asm/irqflags.h | 10 ++++++++++
 arch/arm/kernel/smp.c           |  1 +
 arch/arm/mm/mmu.c               |  3 +++
 3 files changed, 14 insertions(+)

diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h
index 43908146a5cf..e6b70d9d084e 100644
--- a/arch/arm/include/asm/irqflags.h
+++ b/arch/arm/include/asm/irqflags.h
@@ -54,6 +54,14 @@ static inline void arch_local_irq_disable(void)
 
 #define local_fiq_enable()  __asm__("cpsie f	@ __stf" : : : "memory", "cc")
 #define local_fiq_disable() __asm__("cpsid f	@ __clf" : : : "memory", "cc")
+
+#ifndef CONFIG_CPU_V7M
+#define local_abt_enable()  __asm__("cpsie a	@ __sta" : : : "memory", "cc")
+#define local_abt_disable() __asm__("cpsid a	@ __cla" : : : "memory", "cc")
+#else
+#define local_abt_enable()	do { } while (0)
+#define local_abt_disable()	do { } while (0)
+#endif
 #else
 
 /*
@@ -136,6 +144,8 @@ static inline void arch_local_irq_disable(void)
 	: "memory", "cc");					\
 	})
 
+#define local_abt_enable()	do { } while (0)
+#define local_abt_disable()	do { } while (0)
 #endif
 
 /*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 3d6b7821cff8..f6f0a76ee573 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -385,6 +385,7 @@ asmlinkage void secondary_start_kernel(void)
 
 	local_irq_enable();
 	local_fiq_enable();
+	local_abt_enable();
 
 	/*
 	 * OK, it's off to the idle thread for us
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 870838a46d52..862caeadcaf0 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1319,6 +1319,9 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)
 	 */
 	local_flush_tlb_all();
 	flush_cache_all();
+
+	/* Enable asynchronous aborts */
+	local_abt_enable();
 }
 
 static void __init kmap_init(void)
-- 
2.4.6

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

* [PATCH] ARM: enable imprecise aborts during early kernel startup
  2015-08-25 11:24 [PATCH] ARM: enable imprecise aborts during early kernel startup Lucas Stach
@ 2015-08-25 12:40 ` Russell King - ARM Linux
  2015-08-25 12:56   ` Lucas Stach
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2015-08-25 12:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 25, 2015 at 01:24:05PM +0200, Lucas Stach wrote:
> From: Fabrice Gasnier <fabrice.gasnier@st.com>
> 
> This patch adds imprecise abort enable/disable macros and uses them to
> enable imprecise aborts early when starting the kernel.
> 
> This helps in tracking down the real cause for such imprecise abort, as
> they are handled as soon as they occur. Until now those aborts would
> only be enabled when entering the userspace and as a consequence crash
> the first userspace process if any abort had been raised during kernel
> startup.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Looks fine to me.  I think as we know Keystone2 definitely has issues
with this, I'd like to delay it to the v4.4 merge window, but please
consider putting it in the patch system anyway so it doesn't get
forgotten about.  I'll queue it after 4.3-rc1 is out.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH] ARM: enable imprecise aborts during early kernel startup
  2015-08-25 12:40 ` Russell King - ARM Linux
@ 2015-08-25 12:56   ` Lucas Stach
  0 siblings, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2015-08-25 12:56 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, den 25.08.2015, 13:40 +0100 schrieb Russell King - ARM
Linux:
> On Tue, Aug 25, 2015 at 01:24:05PM +0200, Lucas Stach wrote:
> > From: Fabrice Gasnier <fabrice.gasnier@st.com>
> > 
> > This patch adds imprecise abort enable/disable macros and uses them to
> > enable imprecise aborts early when starting the kernel.
> > 
> > This helps in tracking down the real cause for such imprecise abort, as
> > they are handled as soon as they occur. Until now those aborts would
> > only be enabled when entering the userspace and as a consequence crash
> > the first userspace process if any abort had been raised during kernel
> > startup.
> > 
> > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> 
> Looks fine to me.  I think as we know Keystone2 definitely has issues
> with this, I'd like to delay it to the v4.4 merge window, but please
> consider putting it in the patch system anyway so it doesn't get
> forgotten about.  I'll queue it after 4.3-rc1 is out.
> 
That sounds sensible.

Patch is in the system as 8422/1.

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2015-08-25 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25 11:24 [PATCH] ARM: enable imprecise aborts during early kernel startup Lucas Stach
2015-08-25 12:40 ` Russell King - ARM Linux
2015-08-25 12:56   ` Lucas Stach

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.