kernel: define RB_ID_HW_OPTIONS in include/linux/routerboot.h
[openwrt.git] / target / linux / generic / patches-3.10 / 063-arm-fix-fiq-vivt.patch
1 From 2ba85e7af4c639d933c9a87a6d7363f2983d5ada Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@arm.linux.org.uk>
3 Date: Thu, 08 Aug 2013 10:51:21 +0000
4 Subject: ARM: Fix FIQ code on VIVT CPUs
5
6 Aaro Koskinen reports the following oops:
7 Installing fiq handler from c001b110, length 0x164
8 Unable to handle kernel paging request at virtual address ffff1224
9 pgd = c0004000
10 [ffff1224] *pgd=00000000, *pte=11fff0cb, *ppte=11fff00a
11 ...
12 [<c0013154>] (set_fiq_handler+0x0/0x6c) from [<c0365d38>] (ams_delta_init_fiq+0xa8/0x160)
13  r6:00000164 r5:c001b110 r4:00000000 r3:fefecb4c
14 [<c0365c90>] (ams_delta_init_fiq+0x0/0x160) from [<c0365b14>] (ams_delta_init+0xd4/0x114)
15  r6:00000000 r5:fffece10 r4:c037a9e0
16 [<c0365a40>] (ams_delta_init+0x0/0x114) from [<c03613b4>] (customize_machine+0x24/0x30)
17
18 This is because the vectors page is now write-protected, and to change
19 code in there we must write to its original alias.  Make that change,
20 and adjust the cache flushing such that the code will become visible
21 to the instruction stream on VIVT CPUs.
22
23 Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
24 Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
25 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
26 ---
27 (limited to 'arch/arm/kernel/fiq.c')
28
29 --- a/arch/arm/kernel/fiq.c
30 +++ b/arch/arm/kernel/fiq.c
31 @@ -84,17 +84,13 @@ int show_fiq_list(struct seq_file *p, in
32  
33  void set_fiq_handler(void *start, unsigned int length)
34  {
35 -#if defined(CONFIG_CPU_USE_DOMAINS)
36 -       void *base = (void *)0xffff0000;
37 -#else
38         void *base = vectors_page;
39 -#endif
40         unsigned offset = FIQ_OFFSET;
41  
42         memcpy(base + offset, start, length);
43 +       if (!cache_is_vipt_nonaliasing())
44 +               flush_icache_range(base + offset, offset + length);
45         flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length);
46 -       if (!vectors_high())
47 -               flush_icache_range(offset, offset + length);
48  }
49  
50  int claim_fiq(struct fiq_handler *f)