diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-27 18:22:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-27 18:22:34 -0400 |
commit | 097f70b3c4d84ffccca15195bdfde3a37c0a7c0f (patch) | |
tree | 3338a83e351c980400bb524073b2bdfb5b0148be | |
parent | e3be4266d3488cbbaddf7fcc661f4473db341e46 (diff) | |
parent | e060f6ed281669b6d2f22d8dafd664b532386918 (diff) |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle:
- Properly setup irq handling for ATH79 platforms
- Fix bootmem mapstart calculation for contiguous maps
- Handle little endian and older CPUs correct in BPF
- Fix console for Fulong 2E systems
- Handle FTLB correctly on R6 CPUs
- Fixes for CM, GIC and MAAR support code
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
MIPS: Initialise MAARs on secondary CPUs
MIPS: print MAAR configuration during boot
MIPS: mm: compile maar_init unconditionally
irqchip: mips-gic: Fix pending & mask reads for MIPS64 with 32b GIC.
irqchip: mips-gic: Convert CPU numbers to VP IDs.
MIPS: CM: Provide a function to map from CPU to VP ID.
MIPS: Fix FTLB detection for R6
MIPS: cpu-features: Add cpu_has_ftlb
MIPS: ATH79: Add irq chip ar7240-misc-intc
MIPS: ATH79: Set missing irq ack handler for ar7100-misc-intc irq chip
MIPS: BPF: Fix build on pre-R2 little endian CPUs
MIPS: BPF: Avoid unreachable code on little endian
MIPS: bootmem: Fix mapstart calculation for contiguous maps
MIPS: Fix console output for Fulong2e system
-rw-r--r-- | Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt | 20 | ||||
-rw-r--r-- | arch/mips/ath79/irq.c | 22 | ||||
-rw-r--r-- | arch/mips/include/asm/cpu-features.h | 3 | ||||
-rw-r--r-- | arch/mips/include/asm/cpu.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/maar.h | 9 | ||||
-rw-r--r-- | arch/mips/include/asm/mips-cm.h | 39 | ||||
-rw-r--r-- | arch/mips/include/asm/mipsregs.h | 2 | ||||
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 21 | ||||
-rw-r--r-- | arch/mips/kernel/setup.c | 10 | ||||
-rw-r--r-- | arch/mips/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/mips/loongson64/common/env.c | 3 | ||||
-rw-r--r-- | arch/mips/mm/init.c | 177 | ||||
-rw-r--r-- | arch/mips/net/bpf_jit_asm.S | 50 | ||||
-rw-r--r-- | drivers/irqchip/irq-mips-gic.c | 12 |
14 files changed, 290 insertions, 81 deletions
diff --git a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt index 391717a68f3b..ec96b1f01478 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt | |||
@@ -4,8 +4,8 @@ The MISC interrupt controller is a secondary controller for lower priority | |||
4 | interrupt. | 4 | interrupt. |
5 | 5 | ||
6 | Required Properties: | 6 | Required Properties: |
7 | - compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-misc-intc" | 7 | - compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-misc-intc" or |
8 | as fallback | 8 | "qca,<soctype>-cpu-intc", "qca,ar7240-misc-intc" |
9 | - reg: Base address and size of the controllers memory area | 9 | - reg: Base address and size of the controllers memory area |
10 | - interrupt-parent: phandle of the parent interrupt controller. | 10 | - interrupt-parent: phandle of the parent interrupt controller. |
11 | - interrupts: Interrupt specifier for the controllers interrupt. | 11 | - interrupts: Interrupt specifier for the controllers interrupt. |
@@ -13,6 +13,9 @@ Required Properties: | |||
13 | - #interrupt-cells : Specifies the number of cells needed to encode interrupt | 13 | - #interrupt-cells : Specifies the number of cells needed to encode interrupt |
14 | source, should be 1 | 14 | source, should be 1 |
15 | 15 | ||
16 | Compatible fallback depends on the SoC. Use ar7100 for ar71xx and ar913x, | ||
17 | use ar7240 for all other SoCs. | ||
18 | |||
16 | Please refer to interrupts.txt in this directory for details of the common | 19 | Please refer to interrupts.txt in this directory for details of the common |
17 | Interrupt Controllers bindings used by client devices. | 20 | Interrupt Controllers bindings used by client devices. |
18 | 21 | ||
@@ -28,3 +31,16 @@ Example: | |||
28 | interrupt-controller; | 31 | interrupt-controller; |
29 | #interrupt-cells = <1>; | 32 | #interrupt-cells = <1>; |
30 | }; | 33 | }; |
34 | |||
35 | Another example: | ||
36 | |||
37 | interrupt-controller@18060010 { | ||
38 | compatible = "qca,ar9331-misc-intc", qca,ar7240-misc-intc"; | ||
39 | reg = <0x18060010 0x4>; | ||
40 | |||
41 | interrupt-parent = <&cpuintc>; | ||
42 | interrupts = <6>; | ||
43 | |||
44 | interrupt-controller; | ||
45 | #interrupt-cells = <1>; | ||
46 | }; | ||
diff --git a/arch/mips/ath79/irq.c b/arch/mips/ath79/irq.c index 15ecb4831e12..eeb3953ed8ac 100644 --- a/arch/mips/ath79/irq.c +++ b/arch/mips/ath79/irq.c | |||
@@ -293,8 +293,26 @@ static int __init ath79_misc_intc_of_init( | |||
293 | 293 | ||
294 | return 0; | 294 | return 0; |
295 | } | 295 | } |
296 | IRQCHIP_DECLARE(ath79_misc_intc, "qca,ar7100-misc-intc", | 296 | |
297 | ath79_misc_intc_of_init); | 297 | static int __init ar7100_misc_intc_of_init( |
298 | struct device_node *node, struct device_node *parent) | ||
299 | { | ||
300 | ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; | ||
301 | return ath79_misc_intc_of_init(node, parent); | ||
302 | } | ||
303 | |||
304 | IRQCHIP_DECLARE(ar7100_misc_intc, "qca,ar7100-misc-intc", | ||
305 | ar7100_misc_intc_of_init); | ||
306 | |||
307 | static int __init ar7240_misc_intc_of_init( | ||
308 | struct device_node *node, struct device_node *parent) | ||
309 | { | ||
310 | ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; | ||
311 | return ath79_misc_intc_of_init(node, parent); | ||
312 | } | ||
313 | |||
314 | IRQCHIP_DECLARE(ar7240_misc_intc, "qca,ar7240-misc-intc", | ||
315 | ar7240_misc_intc_of_init); | ||
298 | 316 | ||
299 | static int __init ar79_cpu_intc_of_init( | 317 | static int __init ar79_cpu_intc_of_init( |
300 | struct device_node *node, struct device_node *parent) | 318 | struct device_node *node, struct device_node *parent) |
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index 9801ac982655..fe67f12ac239 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -20,6 +20,9 @@ | |||
20 | #ifndef cpu_has_tlb | 20 | #ifndef cpu_has_tlb |
21 | #define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) | 21 | #define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) |
22 | #endif | 22 | #endif |
23 | #ifndef cpu_has_ftlb | ||
24 | #define cpu_has_ftlb (cpu_data[0].options & MIPS_CPU_FTLB) | ||
25 | #endif | ||
23 | #ifndef cpu_has_tlbinv | 26 | #ifndef cpu_has_tlbinv |
24 | #define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV) | 27 | #define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV) |
25 | #endif | 28 | #endif |
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index cd89e9855775..82ad15f11049 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -385,6 +385,7 @@ enum cpu_type_enum { | |||
385 | #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ | 385 | #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ |
386 | #define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */ | 386 | #define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */ |
387 | #define MIPS_CPU_SP 0x10000000000ull /* Small (1KB) page support */ | 387 | #define MIPS_CPU_SP 0x10000000000ull /* Small (1KB) page support */ |
388 | #define MIPS_CPU_FTLB 0x20000000000ull /* CPU has Fixed-page-size TLB */ | ||
388 | 389 | ||
389 | /* | 390 | /* |
390 | * CPU ASE encodings | 391 | * CPU ASE encodings |
diff --git a/arch/mips/include/asm/maar.h b/arch/mips/include/asm/maar.h index b02891f9caaf..21d9607c80d7 100644 --- a/arch/mips/include/asm/maar.h +++ b/arch/mips/include/asm/maar.h | |||
@@ -66,6 +66,15 @@ static inline void write_maar_pair(unsigned idx, phys_addr_t lower, | |||
66 | } | 66 | } |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * maar_init() - initialise MAARs | ||
70 | * | ||
71 | * Performs initialisation of MAARs for the current CPU, making use of the | ||
72 | * platforms implementation of platform_maar_init where necessary and | ||
73 | * duplicating the setup it provides on secondary CPUs. | ||
74 | */ | ||
75 | extern void maar_init(void); | ||
76 | |||
77 | /** | ||
69 | * struct maar_config - MAAR configuration data | 78 | * struct maar_config - MAAR configuration data |
70 | * @lower: The lowest address that the MAAR pair will affect. Must be | 79 | * @lower: The lowest address that the MAAR pair will affect. Must be |
71 | * aligned to a 2^16 byte boundary. | 80 | * aligned to a 2^16 byte boundary. |
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h index d75b75e78ebb..1f1927ab4269 100644 --- a/arch/mips/include/asm/mips-cm.h +++ b/arch/mips/include/asm/mips-cm.h | |||
@@ -194,6 +194,7 @@ BUILD_CM_RW(reg3_mask, MIPS_CM_GCB_OFS + 0xc8) | |||
194 | BUILD_CM_R_(gic_status, MIPS_CM_GCB_OFS + 0xd0) | 194 | BUILD_CM_R_(gic_status, MIPS_CM_GCB_OFS + 0xd0) |
195 | BUILD_CM_R_(cpc_status, MIPS_CM_GCB_OFS + 0xf0) | 195 | BUILD_CM_R_(cpc_status, MIPS_CM_GCB_OFS + 0xf0) |
196 | BUILD_CM_RW(l2_config, MIPS_CM_GCB_OFS + 0x130) | 196 | BUILD_CM_RW(l2_config, MIPS_CM_GCB_OFS + 0x130) |
197 | BUILD_CM_RW(sys_config2, MIPS_CM_GCB_OFS + 0x150) | ||
197 | 198 | ||
198 | /* Core Local & Core Other register accessor functions */ | 199 | /* Core Local & Core Other register accessor functions */ |
199 | BUILD_CM_Cx_RW(reset_release, 0x00) | 200 | BUILD_CM_Cx_RW(reset_release, 0x00) |
@@ -316,6 +317,10 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) | |||
316 | #define CM_GCR_L2_CONFIG_ASSOC_SHF 0 | 317 | #define CM_GCR_L2_CONFIG_ASSOC_SHF 0 |
317 | #define CM_GCR_L2_CONFIG_ASSOC_MSK (_ULCAST_(0xff) << 0) | 318 | #define CM_GCR_L2_CONFIG_ASSOC_MSK (_ULCAST_(0xff) << 0) |
318 | 319 | ||
320 | /* GCR_SYS_CONFIG2 register fields */ | ||
321 | #define CM_GCR_SYS_CONFIG2_MAXVPW_SHF 0 | ||
322 | #define CM_GCR_SYS_CONFIG2_MAXVPW_MSK (_ULCAST_(0xf) << 0) | ||
323 | |||
319 | /* GCR_Cx_COHERENCE register fields */ | 324 | /* GCR_Cx_COHERENCE register fields */ |
320 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 | 325 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 |
321 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) | 326 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) |
@@ -405,4 +410,38 @@ static inline int mips_cm_revision(void) | |||
405 | return read_gcr_rev(); | 410 | return read_gcr_rev(); |
406 | } | 411 | } |
407 | 412 | ||
413 | /** | ||
414 | * mips_cm_max_vp_width() - return the width in bits of VP indices | ||
415 | * | ||
416 | * Return: the width, in bits, of VP indices in fields that combine core & VP | ||
417 | * indices. | ||
418 | */ | ||
419 | static inline unsigned int mips_cm_max_vp_width(void) | ||
420 | { | ||
421 | extern int smp_num_siblings; | ||
422 | |||
423 | if (mips_cm_revision() >= CM_REV_CM3) | ||
424 | return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK; | ||
425 | |||
426 | return smp_num_siblings; | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * mips_cm_vp_id() - calculate the hardware VP ID for a CPU | ||
431 | * @cpu: the CPU whose VP ID to calculate | ||
432 | * | ||
433 | * Hardware such as the GIC uses identifiers for VPs which may not match the | ||
434 | * CPU numbers used by Linux. This function calculates the hardware VP | ||
435 | * identifier corresponding to a given CPU. | ||
436 | * | ||
437 | * Return: the VP ID for the CPU. | ||
438 | */ | ||
439 | static inline unsigned int mips_cm_vp_id(unsigned int cpu) | ||
440 | { | ||
441 | unsigned int core = cpu_data[cpu].core; | ||
442 | unsigned int vp = cpu_vpe_id(&cpu_data[cpu]); | ||
443 | |||
444 | return (core * mips_cm_max_vp_width()) + vp; | ||
445 | } | ||
446 | |||
408 | #endif /* __MIPS_ASM_MIPS_CM_H__ */ | 447 | #endif /* __MIPS_ASM_MIPS_CM_H__ */ |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index d3cd8eac81e3..c64781cf649f 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -487,6 +487,8 @@ | |||
487 | 487 | ||
488 | /* Bits specific to the MIPS32/64 PRA. */ | 488 | /* Bits specific to the MIPS32/64 PRA. */ |
489 | #define MIPS_CONF_MT (_ULCAST_(7) << 7) | 489 | #define MIPS_CONF_MT (_ULCAST_(7) << 7) |
490 | #define MIPS_CONF_MT_TLB (_ULCAST_(1) << 7) | ||
491 | #define MIPS_CONF_MT_FTLB (_ULCAST_(4) << 7) | ||
490 | #define MIPS_CONF_AR (_ULCAST_(7) << 10) | 492 | #define MIPS_CONF_AR (_ULCAST_(7) << 10) |
491 | #define MIPS_CONF_AT (_ULCAST_(3) << 13) | 493 | #define MIPS_CONF_AT (_ULCAST_(3) << 13) |
492 | #define MIPS_CONF_M (_ULCAST_(1) << 31) | 494 | #define MIPS_CONF_M (_ULCAST_(1) << 31) |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 571a8e6ea5bd..09a51d091941 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -410,16 +410,18 @@ static int set_ftlb_enable(struct cpuinfo_mips *c, int enable) | |||
410 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) | 410 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) |
411 | { | 411 | { |
412 | unsigned int config0; | 412 | unsigned int config0; |
413 | int isa; | 413 | int isa, mt; |
414 | 414 | ||
415 | config0 = read_c0_config(); | 415 | config0 = read_c0_config(); |
416 | 416 | ||
417 | /* | 417 | /* |
418 | * Look for Standard TLB or Dual VTLB and FTLB | 418 | * Look for Standard TLB or Dual VTLB and FTLB |
419 | */ | 419 | */ |
420 | if ((((config0 & MIPS_CONF_MT) >> 7) == 1) || | 420 | mt = config0 & MIPS_CONF_MT; |
421 | (((config0 & MIPS_CONF_MT) >> 7) == 4)) | 421 | if (mt == MIPS_CONF_MT_TLB) |
422 | c->options |= MIPS_CPU_TLB; | 422 | c->options |= MIPS_CPU_TLB; |
423 | else if (mt == MIPS_CONF_MT_FTLB) | ||
424 | c->options |= MIPS_CPU_TLB | MIPS_CPU_FTLB; | ||
423 | 425 | ||
424 | isa = (config0 & MIPS_CONF_AT) >> 13; | 426 | isa = (config0 & MIPS_CONF_AT) >> 13; |
425 | switch (isa) { | 427 | switch (isa) { |
@@ -559,15 +561,18 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c) | |||
559 | if (cpu_has_tlb) { | 561 | if (cpu_has_tlb) { |
560 | if (((config4 & MIPS_CONF4_IE) >> 29) == 2) | 562 | if (((config4 & MIPS_CONF4_IE) >> 29) == 2) |
561 | c->options |= MIPS_CPU_TLBINV; | 563 | c->options |= MIPS_CPU_TLBINV; |
564 | |||
562 | /* | 565 | /* |
563 | * This is a bit ugly. R6 has dropped that field from | 566 | * R6 has dropped the MMUExtDef field from config4. |
564 | * config4 and the only valid configuration is VTLB+FTLB so | 567 | * On R6 the fields always describe the FTLB, and only if it is |
565 | * set a good value for mmuextdef for that case. | 568 | * present according to Config.MT. |
566 | */ | 569 | */ |
567 | if (cpu_has_mips_r6) | 570 | if (!cpu_has_mips_r6) |
571 | mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF; | ||
572 | else if (cpu_has_ftlb) | ||
568 | mmuextdef = MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT; | 573 | mmuextdef = MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT; |
569 | else | 574 | else |
570 | mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF; | 575 | mmuextdef = 0; |
571 | 576 | ||
572 | switch (mmuextdef) { | 577 | switch (mmuextdef) { |
573 | case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT: | 578 | case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT: |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 35b8316002f8..479515109e5b 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -338,7 +338,7 @@ static void __init bootmem_init(void) | |||
338 | if (end <= reserved_end) | 338 | if (end <= reserved_end) |
339 | continue; | 339 | continue; |
340 | #ifdef CONFIG_BLK_DEV_INITRD | 340 | #ifdef CONFIG_BLK_DEV_INITRD |
341 | /* mapstart should be after initrd_end */ | 341 | /* Skip zones before initrd and initrd itself */ |
342 | if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end))) | 342 | if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end))) |
343 | continue; | 343 | continue; |
344 | #endif | 344 | #endif |
@@ -371,6 +371,14 @@ static void __init bootmem_init(void) | |||
371 | max_low_pfn = PFN_DOWN(HIGHMEM_START); | 371 | max_low_pfn = PFN_DOWN(HIGHMEM_START); |
372 | } | 372 | } |
373 | 373 | ||
374 | #ifdef CONFIG_BLK_DEV_INITRD | ||
375 | /* | ||
376 | * mapstart should be after initrd_end | ||
377 | */ | ||
378 | if (initrd_end) | ||
379 | mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end))); | ||
380 | #endif | ||
381 | |||
374 | /* | 382 | /* |
375 | * Initialize the boot-time allocator with low memory only. | 383 | * Initialize the boot-time allocator with low memory only. |
376 | */ | 384 | */ |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index a31896c33716..bd4385a8e6e8 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/mmu_context.h> | 42 | #include <asm/mmu_context.h> |
43 | #include <asm/time.h> | 43 | #include <asm/time.h> |
44 | #include <asm/setup.h> | 44 | #include <asm/setup.h> |
45 | #include <asm/maar.h> | ||
45 | 46 | ||
46 | cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ | 47 | cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ |
47 | 48 | ||
@@ -157,6 +158,7 @@ asmlinkage void start_secondary(void) | |||
157 | mips_clockevent_init(); | 158 | mips_clockevent_init(); |
158 | mp_ops->init_secondary(); | 159 | mp_ops->init_secondary(); |
159 | cpu_report(); | 160 | cpu_report(); |
161 | maar_init(); | ||
160 | 162 | ||
161 | /* | 163 | /* |
162 | * XXX parity protection should be folded in here when it's converted | 164 | * XXX parity protection should be folded in here when it's converted |
diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c index f6c44dd332e2..d6d07ad56180 100644 --- a/arch/mips/loongson64/common/env.c +++ b/arch/mips/loongson64/common/env.c | |||
@@ -64,6 +64,9 @@ void __init prom_init_env(void) | |||
64 | } | 64 | } |
65 | if (memsize == 0) | 65 | if (memsize == 0) |
66 | memsize = 256; | 66 | memsize = 256; |
67 | |||
68 | loongson_sysconf.nr_uarts = 1; | ||
69 | |||
67 | pr_info("memsize=%u, highmemsize=%u\n", memsize, highmemsize); | 70 | pr_info("memsize=%u, highmemsize=%u\n", memsize, highmemsize); |
68 | #else | 71 | #else |
69 | struct boot_params *boot_p; | 72 | struct boot_params *boot_p; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 66d0f49c5bec..8770e619185e 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/pgalloc.h> | 44 | #include <asm/pgalloc.h> |
45 | #include <asm/tlb.h> | 45 | #include <asm/tlb.h> |
46 | #include <asm/fixmap.h> | 46 | #include <asm/fixmap.h> |
47 | #include <asm/maar.h> | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * We have up to 8 empty zeroed pages so we can map one of the right colour | 50 | * We have up to 8 empty zeroed pages so we can map one of the right colour |
@@ -252,6 +253,119 @@ void __init fixrange_init(unsigned long start, unsigned long end, | |||
252 | #endif | 253 | #endif |
253 | } | 254 | } |
254 | 255 | ||
256 | unsigned __weak platform_maar_init(unsigned num_pairs) | ||
257 | { | ||
258 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; | ||
259 | unsigned i, num_configured, num_cfg = 0; | ||
260 | phys_addr_t skip; | ||
261 | |||
262 | for (i = 0; i < boot_mem_map.nr_map; i++) { | ||
263 | switch (boot_mem_map.map[i].type) { | ||
264 | case BOOT_MEM_RAM: | ||
265 | case BOOT_MEM_INIT_RAM: | ||
266 | break; | ||
267 | default: | ||
268 | continue; | ||
269 | } | ||
270 | |||
271 | skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | ||
272 | |||
273 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; | ||
274 | cfg[num_cfg].lower += skip; | ||
275 | |||
276 | cfg[num_cfg].upper = cfg[num_cfg].lower; | ||
277 | cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | ||
278 | cfg[num_cfg].upper -= skip; | ||
279 | |||
280 | cfg[num_cfg].attrs = MIPS_MAAR_S; | ||
281 | num_cfg++; | ||
282 | } | ||
283 | |||
284 | num_configured = maar_config(cfg, num_cfg, num_pairs); | ||
285 | if (num_configured < num_cfg) | ||
286 | pr_warn("Not enough MAAR pairs (%u) for all bootmem regions (%u)\n", | ||
287 | num_pairs, num_cfg); | ||
288 | |||
289 | return num_configured; | ||
290 | } | ||
291 | |||
292 | void maar_init(void) | ||
293 | { | ||
294 | unsigned num_maars, used, i; | ||
295 | phys_addr_t lower, upper, attr; | ||
296 | static struct { | ||
297 | struct maar_config cfgs[3]; | ||
298 | unsigned used; | ||
299 | } recorded = { { { 0 } }, 0 }; | ||
300 | |||
301 | if (!cpu_has_maar) | ||
302 | return; | ||
303 | |||
304 | /* Detect the number of MAARs */ | ||
305 | write_c0_maari(~0); | ||
306 | back_to_back_c0_hazard(); | ||
307 | num_maars = read_c0_maari() + 1; | ||
308 | |||
309 | /* MAARs should be in pairs */ | ||
310 | WARN_ON(num_maars % 2); | ||
311 | |||
312 | /* Set MAARs using values we recorded already */ | ||
313 | if (recorded.used) { | ||
314 | used = maar_config(recorded.cfgs, recorded.used, num_maars / 2); | ||
315 | BUG_ON(used != recorded.used); | ||
316 | } else { | ||
317 | /* Configure the required MAARs */ | ||
318 | used = platform_maar_init(num_maars / 2); | ||
319 | } | ||
320 | |||
321 | /* Disable any further MAARs */ | ||
322 | for (i = (used * 2); i < num_maars; i++) { | ||
323 | write_c0_maari(i); | ||
324 | back_to_back_c0_hazard(); | ||
325 | write_c0_maar(0); | ||
326 | back_to_back_c0_hazard(); | ||
327 | } | ||
328 | |||
329 | if (recorded.used) | ||
330 | return; | ||
331 | |||
332 | pr_info("MAAR configuration:\n"); | ||
333 | for (i = 0; i < num_maars; i += 2) { | ||
334 | write_c0_maari(i); | ||
335 | back_to_back_c0_hazard(); | ||
336 | upper = read_c0_maar(); | ||
337 | |||
338 | write_c0_maari(i + 1); | ||
339 | back_to_back_c0_hazard(); | ||
340 | lower = read_c0_maar(); | ||
341 | |||
342 | attr = lower & upper; | ||
343 | lower = (lower & MIPS_MAAR_ADDR) << 4; | ||
344 | upper = ((upper & MIPS_MAAR_ADDR) << 4) | 0xffff; | ||
345 | |||
346 | pr_info(" [%d]: ", i / 2); | ||
347 | if (!(attr & MIPS_MAAR_V)) { | ||
348 | pr_cont("disabled\n"); | ||
349 | continue; | ||
350 | } | ||
351 | |||
352 | pr_cont("%pa-%pa", &lower, &upper); | ||
353 | |||
354 | if (attr & MIPS_MAAR_S) | ||
355 | pr_cont(" speculate"); | ||
356 | |||
357 | pr_cont("\n"); | ||
358 | |||
359 | /* Record the setup for use on secondary CPUs */ | ||
360 | if (used <= ARRAY_SIZE(recorded.cfgs)) { | ||
361 | recorded.cfgs[recorded.used].lower = lower; | ||
362 | recorded.cfgs[recorded.used].upper = upper; | ||
363 | recorded.cfgs[recorded.used].attrs = attr; | ||
364 | recorded.used++; | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
255 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 369 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
256 | int page_is_ram(unsigned long pagenr) | 370 | int page_is_ram(unsigned long pagenr) |
257 | { | 371 | { |
@@ -334,69 +448,6 @@ static inline void mem_init_free_highmem(void) | |||
334 | #endif | 448 | #endif |
335 | } | 449 | } |
336 | 450 | ||
337 | unsigned __weak platform_maar_init(unsigned num_pairs) | ||
338 | { | ||
339 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; | ||
340 | unsigned i, num_configured, num_cfg = 0; | ||
341 | phys_addr_t skip; | ||
342 | |||
343 | for (i = 0; i < boot_mem_map.nr_map; i++) { | ||
344 | switch (boot_mem_map.map[i].type) { | ||
345 | case BOOT_MEM_RAM: | ||
346 | case BOOT_MEM_INIT_RAM: | ||
347 | break; | ||
348 | default: | ||
349 | continue; | ||
350 | } | ||
351 | |||
352 | skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | ||
353 | |||
354 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; | ||
355 | cfg[num_cfg].lower += skip; | ||
356 | |||
357 | cfg[num_cfg].upper = cfg[num_cfg].lower; | ||
358 | cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | ||
359 | cfg[num_cfg].upper -= skip; | ||
360 | |||
361 | cfg[num_cfg].attrs = MIPS_MAAR_S; | ||
362 | num_cfg++; | ||
363 | } | ||
364 | |||
365 | num_configured = maar_config(cfg, num_cfg, num_pairs); | ||
366 | if (num_configured < num_cfg) | ||
367 | pr_warn("Not enough MAAR pairs (%u) for all bootmem regions (%u)\n", | ||
368 | num_pairs, num_cfg); | ||
369 | |||
370 | return num_configured; | ||
371 | } | ||
372 | |||
373 | static void maar_init(void) | ||
374 | { | ||
375 | unsigned num_maars, used, i; | ||
376 | |||
377 | if (!cpu_has_maar) | ||
378 | return; | ||
379 | |||
380 | /* Detect the number of MAARs */ | ||
381 | write_c0_maari(~0); | ||
382 | back_to_back_c0_hazard(); | ||
383 | num_maars = read_c0_maari() + 1; | ||
384 | |||
385 | /* MAARs should be in pairs */ | ||
386 | WARN_ON(num_maars % 2); | ||
387 | |||
388 | /* Configure the required MAARs */ | ||
389 | used = platform_maar_init(num_maars / 2); | ||
390 | |||
391 | /* Disable any further MAARs */ | ||
392 | for (i = (used * 2); i < num_maars; i++) { | ||
393 | write_c0_maari(i); | ||
394 | back_to_back_c0_hazard(); | ||
395 | write_c0_maar(0); | ||
396 | back_to_back_c0_hazard(); | ||
397 | } | ||
398 | } | ||
399 | |||
400 | void __init mem_init(void) | 451 | void __init mem_init(void) |
401 | { | 452 | { |
402 | #ifdef CONFIG_HIGHMEM | 453 | #ifdef CONFIG_HIGHMEM |
diff --git a/arch/mips/net/bpf_jit_asm.S b/arch/mips/net/bpf_jit_asm.S index e92726099be0..dabf4179cd7e 100644 --- a/arch/mips/net/bpf_jit_asm.S +++ b/arch/mips/net/bpf_jit_asm.S | |||
@@ -64,8 +64,20 @@ sk_load_word_positive: | |||
64 | PTR_ADDU t1, $r_skb_data, offset | 64 | PTR_ADDU t1, $r_skb_data, offset |
65 | lw $r_A, 0(t1) | 65 | lw $r_A, 0(t1) |
66 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 66 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
67 | # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | ||
67 | wsbh t0, $r_A | 68 | wsbh t0, $r_A |
68 | rotr $r_A, t0, 16 | 69 | rotr $r_A, t0, 16 |
70 | # else | ||
71 | sll t0, $r_A, 24 | ||
72 | srl t1, $r_A, 24 | ||
73 | srl t2, $r_A, 8 | ||
74 | or t0, t0, t1 | ||
75 | andi t2, t2, 0xff00 | ||
76 | andi t1, $r_A, 0xff00 | ||
77 | or t0, t0, t2 | ||
78 | sll t1, t1, 8 | ||
79 | or $r_A, t0, t1 | ||
80 | # endif | ||
69 | #endif | 81 | #endif |
70 | jr $r_ra | 82 | jr $r_ra |
71 | move $r_ret, zero | 83 | move $r_ret, zero |
@@ -80,8 +92,16 @@ sk_load_half_positive: | |||
80 | PTR_ADDU t1, $r_skb_data, offset | 92 | PTR_ADDU t1, $r_skb_data, offset |
81 | lh $r_A, 0(t1) | 93 | lh $r_A, 0(t1) |
82 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 94 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
95 | # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | ||
83 | wsbh t0, $r_A | 96 | wsbh t0, $r_A |
84 | seh $r_A, t0 | 97 | seh $r_A, t0 |
98 | # else | ||
99 | sll t0, $r_A, 24 | ||
100 | andi t1, $r_A, 0xff00 | ||
101 | sra t0, t0, 16 | ||
102 | srl t1, t1, 8 | ||
103 | or $r_A, t0, t1 | ||
104 | # endif | ||
85 | #endif | 105 | #endif |
86 | jr $r_ra | 106 | jr $r_ra |
87 | move $r_ret, zero | 107 | move $r_ret, zero |
@@ -148,23 +168,47 @@ sk_load_byte_positive: | |||
148 | NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp) | 168 | NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp) |
149 | bpf_slow_path_common(4) | 169 | bpf_slow_path_common(4) |
150 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 170 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
171 | # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | ||
151 | wsbh t0, $r_s0 | 172 | wsbh t0, $r_s0 |
152 | jr $r_ra | 173 | jr $r_ra |
153 | rotr $r_A, t0, 16 | 174 | rotr $r_A, t0, 16 |
154 | #endif | 175 | # else |
176 | sll t0, $r_s0, 24 | ||
177 | srl t1, $r_s0, 24 | ||
178 | srl t2, $r_s0, 8 | ||
179 | or t0, t0, t1 | ||
180 | andi t2, t2, 0xff00 | ||
181 | andi t1, $r_s0, 0xff00 | ||
182 | or t0, t0, t2 | ||
183 | sll t1, t1, 8 | ||
184 | jr $r_ra | ||
185 | or $r_A, t0, t1 | ||
186 | # endif | ||
187 | #else | ||
155 | jr $r_ra | 188 | jr $r_ra |
156 | move $r_A, $r_s0 | 189 | move $r_A, $r_s0 |
190 | #endif | ||
157 | 191 | ||
158 | END(bpf_slow_path_word) | 192 | END(bpf_slow_path_word) |
159 | 193 | ||
160 | NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp) | 194 | NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp) |
161 | bpf_slow_path_common(2) | 195 | bpf_slow_path_common(2) |
162 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 196 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
197 | # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | ||
163 | jr $r_ra | 198 | jr $r_ra |
164 | wsbh $r_A, $r_s0 | 199 | wsbh $r_A, $r_s0 |
165 | #endif | 200 | # else |
201 | sll t0, $r_s0, 8 | ||
202 | andi t1, $r_s0, 0xff00 | ||
203 | andi t0, t0, 0xff00 | ||
204 | srl t1, t1, 8 | ||
205 | jr $r_ra | ||
206 | or $r_A, t0, t1 | ||
207 | # endif | ||
208 | #else | ||
166 | jr $r_ra | 209 | jr $r_ra |
167 | move $r_A, $r_s0 | 210 | move $r_A, $r_s0 |
211 | #endif | ||
168 | 212 | ||
169 | END(bpf_slow_path_half) | 213 | END(bpf_slow_path_half) |
170 | 214 | ||
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index af2f16bb8a94..aeaa061f0dbf 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
@@ -320,6 +320,14 @@ static void gic_handle_shared_int(bool chained) | |||
320 | intrmask[i] = gic_read(intrmask_reg); | 320 | intrmask[i] = gic_read(intrmask_reg); |
321 | pending_reg += gic_reg_step; | 321 | pending_reg += gic_reg_step; |
322 | intrmask_reg += gic_reg_step; | 322 | intrmask_reg += gic_reg_step; |
323 | |||
324 | if (!config_enabled(CONFIG_64BIT) || mips_cm_is64) | ||
325 | continue; | ||
326 | |||
327 | pending[i] |= (u64)gic_read(pending_reg) << 32; | ||
328 | intrmask[i] |= (u64)gic_read(intrmask_reg) << 32; | ||
329 | pending_reg += gic_reg_step; | ||
330 | intrmask_reg += gic_reg_step; | ||
323 | } | 331 | } |
324 | 332 | ||
325 | bitmap_and(pending, pending, intrmask, gic_shared_intrs); | 333 | bitmap_and(pending, pending, intrmask, gic_shared_intrs); |
@@ -426,7 +434,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, | |||
426 | spin_lock_irqsave(&gic_lock, flags); | 434 | spin_lock_irqsave(&gic_lock, flags); |
427 | 435 | ||
428 | /* Re-route this IRQ */ | 436 | /* Re-route this IRQ */ |
429 | gic_map_to_vpe(irq, cpumask_first(&tmp)); | 437 | gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp))); |
430 | 438 | ||
431 | /* Update the pcpu_masks */ | 439 | /* Update the pcpu_masks */ |
432 | for (i = 0; i < NR_CPUS; i++) | 440 | for (i = 0; i < NR_CPUS; i++) |
@@ -599,7 +607,7 @@ static __init void gic_ipi_init_one(unsigned int intr, int cpu, | |||
599 | GIC_SHARED_TO_HWIRQ(intr)); | 607 | GIC_SHARED_TO_HWIRQ(intr)); |
600 | int i; | 608 | int i; |
601 | 609 | ||
602 | gic_map_to_vpe(intr, cpu); | 610 | gic_map_to_vpe(intr, mips_cm_vp_id(cpu)); |
603 | for (i = 0; i < NR_CPUS; i++) | 611 | for (i = 0; i < NR_CPUS; i++) |
604 | clear_bit(intr, pcpu_masks[i].pcpu_mask); | 612 | clear_bit(intr, pcpu_masks[i].pcpu_mask); |
605 | set_bit(intr, pcpu_masks[cpu].pcpu_mask); | 613 | set_bit(intr, pcpu_masks[cpu].pcpu_mask); |