arm: mm: retry on QSD icache parity errors
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
From: Steve Muckle <[email protected]>
Parity errors in the icache on QSD can be worked around either by retrying the access, or invalidating the icache. The whole icache must be invalidated since the data abort is imprecise (the faulting address is not known).
--- arch/arm/mm/fault.c | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-)
arch/arm/mm/fault.c +35 -1
@@ -2,6 +2,7 @@* linux/arch/arm/mm/fault.c * * Copyright (C) 1995 Linus Torvalds +* Copyright (c) 2009, Code Aurora Forum. All rights reserved. * Modifications for ARM processor (c) 1995-2004 Russell King * * This program is free software; you can redistribute it and/or modify
@@ -442,6 +443,39 @@ do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)return 1 ; } +static int +do_imprecise_ext (unsigned long addr,unsigned int fsr,struct pt_regs *regs) +{ +#ifdef CONFIG_ARCH_MSM_SCORPION +unsigned int regval; +static unsigned char flush_toggle; + + asm("mrc p15, 0, %0, c5, c1, 0\n" /* read adfsr for fault status */ + :"=r" (regval)); +if (regval ==0x2 ) { +/* Fault was caused by icache parity error. Alternate +* simply retrying the access and flushing the icache. */ + flush_toggle ^=1 ; +if (flush_toggle) + asm("mcr p15, 0, %0, c7, c5, 0\n" + : + :"r" (regval));/* input value is ignored */ +/* Clear fault in EFSR. */ + asm("mcr p15, 7, %0, c15, c0, 1\n" + : + :"r" (regval)); +/* Clear fault in ADFSR. */ + regval =0 ; + asm("mcr p15, 0, %0, c5, c1, 0\n" + : + :"r" (regval)); +return 0 ; + } +#endif + +return 1 ; +} + static struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig;
@@ -479,7 +513,7 @@ static struct fsr_info { { do_bad, SIGBUS, 0, "unknown 19" }, { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 21" }, - { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ + { do_imprecise_ext, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 23" }, { do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 25" },
Signature · 1 line
1.6.3.3
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
Hi!
Quoted 32 lines
Parity errors in the icache on QSD can be worked around either by retrying the access, or invalidating the icache. The whole icache must be invalidated since the data abort is imprecise (the faulting address is not known).
Signed-off-by Steve Muckle <[email protected]>Signed-off-by Daniel Walker <[email protected]>arch/arm/mm/fault.c +19
-0@@ -442,6 +443,39 @@ do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)return 1 ; } +static int +do_imprecise_ext (unsigned long addr,unsigned int fsr,struct pt_regs *regs) +{ +#ifdef CONFIG_ARCH_MSM_SCORPION +unsigned int regval; +static unsigned char flush_toggle; + + asm("mrc p15, 0, %0, c5, c1, 0\n" /* read adfsr for fault status */ + :"=r" (regval)); +if (regval ==0x2 ) { +/* Fault was caused by icache parity error. Alternate +* simply retrying the access and flushing the icache. */ + flush_toggle ^=1 ; +if (flush_toggle) + asm("mcr p15, 0, %0, c7, c5, 0\n" + : + :"r" (regval));/* input value is ignored */ +/* Clear fault in EFSR. */ + asm("mcr p15, 7, %0, c15, c0, 1\n"
arch/arm/mm/fault.c do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · line 474
Quoted 10 lines
arch/arm/mm/fault.c +10
-0+ : + : "r" (regval)); +/* Clear fault in ADFSR. */ + regval =0 ; + asm("mcr p15, 0, %0, c5, c1, 0\n" + : + :"r" (regval)); + return 0; + } +#endif
Tell the user or at least keep the count, so cache going bad can be recognized?
Also you probably need asm volatile, and probably do not need those \n-s.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
In reply to Daniel WalkerQuoted 4 lines · Daniel Walker
arch/arm/mm/fault.c +0
-0
[...]
arch/arm/mm/fault.c static struct fsr_info { · line 516
Quoted 9 lines
static struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig;arch/arm/mm/fault.c +1
-1@@ -479,7 +513,7 @@ static struct fsr_info { { do_bad, SIGBUS, 0, "unknown 19" }, { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 21" }, - { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ + { do_imprecise_ext, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */
Can you not use hook_fault_code() and move the do_imprecise_ext() to a platform-specific file (under arch/arm/mach-* maybe)?
Signature · 1 line
Catalin
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
Quoted 6 lines · Catalin Marinas
Quoted 4 lines · Daniel Walker
arch/arm/mm/fault.c +0
-0[...]
Quoted 13 lines
arch/arm/mm/fault.c static struct fsr_info { · line 516
Quoted 9 lines
static struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig;arch/arm/mm/fault.c +1
-1@@ -479,7 +513,7 @@ static struct fsr_info { { do_bad, SIGBUS, 0, "unknown 19" }, { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 21" }, - { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ + { do_imprecise_ext, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */Can you not use
hook_fault_code()and move thedo_imprecise_ext()to a platform-specific file (underarch/arm/mach-*maybe)?
How do you mean? I'm not sure how we would move this into arch/arm/mach- ..
Daniel
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
Quoted 21 lines · Daniel Walker
Quoted 6 lines · Catalin Marinas
Quoted 4 lines · Daniel Walker
arch/arm/mm/fault.c +0
-0[...]
Quoted 13 lines
arch/arm/mm/fault.c static struct fsr_info { · line 516
Quoted 9 lines
static struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig;arch/arm/mm/fault.c +1
-1@@ -479,7 +513,7 @@ static struct fsr_info { { do_bad, SIGBUS, 0, "unknown 19" }, { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ { do_bad, SIGBUS, 0, "unknown 21" }, - { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ + { do_imprecise_ext, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */Can you not use
hook_fault_code()and move thedo_imprecise_ext()to a platform-specific file (underarch/arm/mach-*maybe)?
Quoted 2 lines
How do you mean? I'm not sure how we would move this into
arch/arm/mach-..
Err, exactly as Catalin says. Use hook_fault_code() to hook into the fault table at run time, just like platforms which have to handle imprecise exceptions on PCI and the alignment fault handler do.
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
Quoted 10 lines · Russell King - ARM Linux
Quoted 6 lines
Quoted 3 lines
Can you not use
hook_fault_code()and move thedo_imprecise_ext()to a platform-specific file (underarch/arm/mach-*maybe)?How do you mean? I'm not sure how we would move this into
arch/arm/mach-..Err, exactly as Catalin says. Use
hook_fault_code()to hook into the fault table at run time, just like platforms which have to handle imprecise exceptions on PCI and the alignment fault handler do.
"Can you not use hook_fault_code()"
Typo maybe ?
Daniel
RFC PATCH 5/12 arm: mm: retry on QSD icache parity errors
Quoted 9 lines · Daniel Walker
Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines
Quoted 3 lines
Can you not use
hook_fault_code()and move thedo_imprecise_ext()to a platform-specific file (underarch/arm/mach-*maybe)?How do you mean? I'm not sure how we would move this into
arch/arm/mach-..
Quoted 8 lines
Quoted 3 lines
Err, exactly as Catalin says. Use
hook_fault_code()to hook into the fault table at run time, just like platforms which have to handle imprecise exceptions on PCI and the alignment fault handler do."Can you not use
hook_fault_code()"Typo maybe ?
I don't think so. It's a request for you to use hook_fault_code().