Skip to content

Commit a22a9a9

Browse files
committed
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] Probe initrd header only if explicitly specified [MIPS] TX39xx: Add missing local_flush_icache_range initialization [MIPS] TXx9: Fix txx9_pcode initialization [MIPS] Fix WARNING: at kernel/smp.c:290 [MIPS] Fix data bus error recovery
2 parents 70bb089 + 0011036 commit a22a9a9

File tree

10 files changed

+59
-31
lines changed

10 files changed

+59
-31
lines changed

arch/mips/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,15 @@ config STACKTRACE_SUPPORT
18861886

18871887
source "init/Kconfig"
18881888

1889+
config PROBE_INITRD_HEADER
1890+
bool "Probe initrd header created by addinitrd"
1891+
depends on BLK_DEV_INITRD
1892+
help
1893+
Probe initrd header at the last page of kernel image.
1894+
Say Y here if you are using arch/mips/boot/addinitrd.c to
1895+
add initrd or initramfs image to the kernel image.
1896+
Otherwise, say N.
1897+
18891898
menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
18901899

18911900
config HW_HAS_EISA

arch/mips/kernel/setup.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,30 +160,33 @@ early_param("rd_size", rd_size_early);
160160
static unsigned long __init init_initrd(void)
161161
{
162162
unsigned long end;
163-
u32 *initrd_header;
164163

165164
/*
166165
* Board specific code or command line parser should have
167166
* already set up initrd_start and initrd_end. In these cases
168167
* perfom sanity checks and use them if all looks good.
169168
*/
170-
if (initrd_start && initrd_end > initrd_start)
171-
goto sanitize;
169+
if (!initrd_start || initrd_end <= initrd_start) {
170+
#ifdef CONFIG_PROBE_INITRD_HEADER
171+
u32 *initrd_header;
172172

173-
/*
174-
* See if initrd has been added to the kernel image by
175-
* arch/mips/boot/addinitrd.c. In that case a header is
176-
* prepended to initrd and is made up by 8 bytes. The fisrt
177-
* word is a magic number and the second one is the size of
178-
* initrd. Initrd start must be page aligned in any cases.
179-
*/
180-
initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181-
if (initrd_header[0] != 0x494E5244)
173+
/*
174+
* See if initrd has been added to the kernel image by
175+
* arch/mips/boot/addinitrd.c. In that case a header is
176+
* prepended to initrd and is made up by 8 bytes. The first
177+
* word is a magic number and the second one is the size of
178+
* initrd. Initrd start must be page aligned in any cases.
179+
*/
180+
initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181+
if (initrd_header[0] != 0x494E5244)
182+
goto disable;
183+
initrd_start = (unsigned long)(initrd_header + 2);
184+
initrd_end = initrd_start + initrd_header[1];
185+
#else
182186
goto disable;
183-
initrd_start = (unsigned long)(initrd_header + 2);
184-
initrd_end = initrd_start + initrd_header[1];
187+
#endif
188+
}
185189

186-
sanitize:
187190
if (initrd_start & ~PAGE_MASK) {
188191
pr_err("initrd start must be page aligned\n");
189192
goto disable;

arch/mips/kernel/traps.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ void __noreturn die(const char * str, const struct pt_regs * regs)
373373
do_exit(SIGSEGV);
374374
}
375375

376-
extern const struct exception_table_entry __start___dbe_table[];
377-
extern const struct exception_table_entry __stop___dbe_table[];
376+
extern struct exception_table_entry __start___dbe_table[];
377+
extern struct exception_table_entry __stop___dbe_table[];
378378

379379
__asm__(
380380
" .section __dbe_table, \"a\"\n"
@@ -1200,7 +1200,7 @@ void *set_except_vector(int n, void *addr)
12001200
if (n == 0 && cpu_has_divec) {
12011201
*(u32 *)(ebase + 0x200) = 0x08000000 |
12021202
(0x03ffffff & (handler >> 2));
1203-
flush_icache_range(ebase + 0x200, ebase + 0x204);
1203+
local_flush_icache_range(ebase + 0x200, ebase + 0x204);
12041204
}
12051205
return (void *)old_handler;
12061206
}
@@ -1283,7 +1283,8 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
12831283
*w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff);
12841284
w = (u32 *)(b + ori_offset);
12851285
*w = (*w & 0xffff0000) | ((u32)handler & 0xffff);
1286-
flush_icache_range((unsigned long)b, (unsigned long)(b+handler_len));
1286+
local_flush_icache_range((unsigned long)b,
1287+
(unsigned long)(b+handler_len));
12871288
}
12881289
else {
12891290
/*
@@ -1295,7 +1296,8 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
12951296
w = (u32 *)b;
12961297
*w++ = 0x08000000 | (((u32)handler >> 2) & 0x03fffff); /* j handler */
12971298
*w = 0;
1298-
flush_icache_range((unsigned long)b, (unsigned long)(b+8));
1299+
local_flush_icache_range((unsigned long)b,
1300+
(unsigned long)(b+8));
12991301
}
13001302

13011303
return (void *)old_handler;
@@ -1515,7 +1517,7 @@ void __cpuinit per_cpu_trap_init(void)
15151517
void __init set_handler(unsigned long offset, void *addr, unsigned long size)
15161518
{
15171519
memcpy((void *)(ebase + offset), addr, size);
1518-
flush_icache_range(ebase + offset, ebase + offset + size);
1520+
local_flush_icache_range(ebase + offset, ebase + offset + size);
15191521
}
15201522

15211523
static char panic_null_cerr[] __cpuinitdata =
@@ -1680,6 +1682,8 @@ void __init trap_init(void)
16801682
signal32_init();
16811683
#endif
16821684

1683-
flush_icache_range(ebase, ebase + 0x400);
1685+
local_flush_icache_range(ebase, ebase + 0x400);
16841686
flush_tlb_handlers();
1687+
1688+
sort_extable(__start___dbe_table, __stop___dbe_table);
16851689
}

arch/mips/mm/c-r3k.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ void __cpuinit r3k_cache_init(void)
320320
flush_cache_range = r3k_flush_cache_range;
321321
flush_cache_page = r3k_flush_cache_page;
322322
flush_icache_range = r3k_flush_icache_range;
323+
local_flush_icache_range = r3k_flush_icache_range;
323324

324325
flush_cache_sigtramp = r3k_flush_cache_sigtramp;
325326
local_flush_data_cache_page = local_r3k_flush_data_cache_page;

arch/mips/mm/c-r4k.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,8 @@ struct flush_icache_range_args {
543543
unsigned long end;
544544
};
545545

546-
static inline void local_r4k_flush_icache_range(void *args)
546+
static inline void local_r4k_flush_icache_range(unsigned long start, unsigned long end)
547547
{
548-
struct flush_icache_range_args *fir_args = args;
549-
unsigned long start = fir_args->start;
550-
unsigned long end = fir_args->end;
551-
552548
if (!cpu_has_ic_fills_f_dc) {
553549
if (end - start >= dcache_size) {
554550
r4k_blast_dcache();
@@ -564,14 +560,23 @@ static inline void local_r4k_flush_icache_range(void *args)
564560
protected_blast_icache_range(start, end);
565561
}
566562

563+
static inline void local_r4k_flush_icache_range_ipi(void *args)
564+
{
565+
struct flush_icache_range_args *fir_args = args;
566+
unsigned long start = fir_args->start;
567+
unsigned long end = fir_args->end;
568+
569+
local_r4k_flush_icache_range(start, end);
570+
}
571+
567572
static void r4k_flush_icache_range(unsigned long start, unsigned long end)
568573
{
569574
struct flush_icache_range_args args;
570575

571576
args.start = start;
572577
args.end = end;
573578

574-
r4k_on_each_cpu(local_r4k_flush_icache_range, &args, 1);
579+
r4k_on_each_cpu(local_r4k_flush_icache_range_ipi, &args, 1);
575580
instruction_hazard();
576581
}
577582

@@ -1375,6 +1380,7 @@ void __cpuinit r4k_cache_init(void)
13751380
local_flush_data_cache_page = local_r4k_flush_data_cache_page;
13761381
flush_data_cache_page = r4k_flush_data_cache_page;
13771382
flush_icache_range = r4k_flush_icache_range;
1383+
local_flush_icache_range = local_r4k_flush_icache_range;
13781384

13791385
#if defined(CONFIG_DMA_NONCOHERENT)
13801386
if (coherentio) {

arch/mips/mm/c-tx39.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ void __cpuinit tx39_cache_init(void)
362362
flush_cache_range = (void *) tx39h_flush_icache_all;
363363
flush_cache_page = (void *) tx39h_flush_icache_all;
364364
flush_icache_range = (void *) tx39h_flush_icache_all;
365+
local_flush_icache_range = (void *) tx39h_flush_icache_all;
365366

366367
flush_cache_sigtramp = (void *) tx39h_flush_icache_all;
367368
local_flush_data_cache_page = (void *) tx39h_flush_icache_all;
@@ -390,6 +391,7 @@ void __cpuinit tx39_cache_init(void)
390391
flush_cache_range = tx39_flush_cache_range;
391392
flush_cache_page = tx39_flush_cache_page;
392393
flush_icache_range = tx39_flush_icache_range;
394+
local_flush_icache_range = tx39_flush_icache_range;
393395

394396
flush_cache_sigtramp = tx39_flush_cache_sigtramp;
395397
local_flush_data_cache_page = local_tx39_flush_data_cache_page;

arch/mips/mm/cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
2929
void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page,
3030
unsigned long pfn);
3131
void (*flush_icache_range)(unsigned long start, unsigned long end);
32+
void (*local_flush_icache_range)(unsigned long start, unsigned long end);
3233

3334
void (*__flush_cache_vmap)(void);
3435
void (*__flush_cache_vunmap)(void);

arch/mips/mm/tlbex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,10 +1273,10 @@ void __cpuinit build_tlb_refill_handler(void)
12731273

12741274
void __cpuinit flush_tlb_handlers(void)
12751275
{
1276-
flush_icache_range((unsigned long)handle_tlbl,
1276+
local_flush_icache_range((unsigned long)handle_tlbl,
12771277
(unsigned long)handle_tlbl + sizeof(handle_tlbl));
1278-
flush_icache_range((unsigned long)handle_tlbs,
1278+
local_flush_icache_range((unsigned long)handle_tlbs,
12791279
(unsigned long)handle_tlbs + sizeof(handle_tlbs));
1280-
flush_icache_range((unsigned long)handle_tlbm,
1280+
local_flush_icache_range((unsigned long)handle_tlbm,
12811281
(unsigned long)handle_tlbm + sizeof(handle_tlbm));
12821282
}

arch/mips/txx9/generic/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ txx9_reg_res_init(unsigned int pcode, unsigned long base, unsigned long size)
5353
txx9_ce_res[i].name = txx9_ce_res_name[i];
5454
}
5555

56+
txx9_pcode = pcode;
5657
sprintf(txx9_pcode_str, "TX%x", pcode);
5758
if (base) {
5859
txx9_reg_res.start = base & 0xfffffffffULL;

include/asm-mips/cacheflush.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static inline void flush_icache_page(struct vm_area_struct *vma,
6363
}
6464

6565
extern void (*flush_icache_range)(unsigned long start, unsigned long end);
66+
extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);
6667

6768
extern void (*__flush_cache_vmap)(void);
6869

0 commit comments

Comments
 (0)