Skip to content

Commit 92fab77

Browse files
committed
Merge tag 'mips_5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS updates from Paul Burton: - A set of memblock initialization improvements thanks to Serge Semin, tidying up after our conversion from bootmem to memblock back in v4.20. - Our eBPF JIT the previously supported only MIPS64r2 through MIPS64r5 is improved to also support MIPS64r6. Support for MIPS32 systems is introduced, with the caveat that it only works for programs that don't use 64 bit registers or operations - those will bail out & need to be interpreted. - Improvements to the allocation & configuration of our exception vector that should fix issues seen on some platforms using recent versions of U-Boot. - Some minor improvements to code generated for jump labels, along with enabling them by default for generic kernels. * tag 'mips_5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (27 commits) mips: Manually call fdt_init_reserved_mem() method mips: Make sure dt memory regions are valid mips: Perform early low memory test mips: Dump memblock regions for debugging mips: Add reserve-nomap memory type support mips: Use memblock to reserve the __nosave memory range mips: Discard post-CMA-init foreach loop mips: Reserve memory for the kernel image resources MIPS: Remove duplicate EBase configuration MIPS: Sync icache for whole exception vector MIPS: Always allocate exception vector for MIPSr2+ MIPS: Use memblock_phys_alloc() for exception vector mips: Combine memblock init and memory reservation loops mips: Discard rudiments from bootmem_init mips: Make sure kernel .bss exists in boot mem pool mips: vdso: drop unnecessary cc-ldoption Revert "MIPS: ralink: fix cpu clock of mt7621 and add dt clk devices" MIPS: generic: Enable CONFIG_JUMP_LABEL MIPS: jump_label: Use compact branches for >= r6 MIPS: jump_label: Remove redundant nops ...
2 parents ef75bd7 + 3751cbd commit 92fab77

22 files changed

Lines changed: 341 additions & 1825 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ config MIPS
4444
select HAVE_ARCH_SECCOMP_FILTER
4545
select HAVE_ARCH_TRACEHOOK
4646
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
47-
select HAVE_CBPF_JIT if (!64BIT && !CPU_MICROMIPS)
48-
select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS)
47+
select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
4948
select HAVE_CONTEXT_TRACKING
5049
select HAVE_COPY_THREAD_TLS
5150
select HAVE_C_RECORDMCOUNT
@@ -276,7 +275,7 @@ config BCM47XX
276275
select BCM47XX_SPROM
277276
select BCM47XX_SSB if !BCM47XX_BCMA
278277
help
279-
Support for BCM47XX based boards
278+
Support for BCM47XX based boards
280279

281280
config BCM63XX
282281
bool "Broadcom BCM63XX based boards"
@@ -295,7 +294,7 @@ config BCM63XX
295294
select MIPS_L1_CACHE_SHIFT_4
296295
select CLKDEV_LOOKUP
297296
help
298-
Support for BCM63XX based boards
297+
Support for BCM63XX based boards
299298

300299
config MIPS_COBALT
301300
bool "Cobalt Server"
@@ -374,10 +373,10 @@ config MACH_JAZZ
374373
select SYS_SUPPORTS_64BIT_KERNEL
375374
select SYS_SUPPORTS_100HZ
376375
help
377-
This a family of machines based on the MIPS R4030 chipset which was
378-
used by several vendors to build RISC/os and Windows NT workstations.
379-
Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and
380-
Olivetti M700-10 workstations.
376+
This a family of machines based on the MIPS R4030 chipset which was
377+
used by several vendors to build RISC/os and Windows NT workstations.
378+
Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and
379+
Olivetti M700-10 workstations.
381380

382381
config MACH_INGENIC
383382
bool "Ingenic SoC based machines"
@@ -573,14 +572,14 @@ config NXP_STB220
573572
bool "NXP STB220 board"
574573
select SOC_PNX833X
575574
help
576-
Support for NXP Semiconductors STB220 Development Board.
575+
Support for NXP Semiconductors STB220 Development Board.
577576

578577
config NXP_STB225
579578
bool "NXP 225 board"
580579
select SOC_PNX833X
581580
select SOC_PNX8335
582581
help
583-
Support for NXP Semiconductors STB225 Development Board.
582+
Support for NXP Semiconductors STB225 Development Board.
584583

585584
config PMC_MSP
586585
bool "PMC-Sierra MSP chipsets"
@@ -722,9 +721,9 @@ config SGI_IP28
722721
select SYS_SUPPORTS_64BIT_KERNEL
723722
select SYS_SUPPORTS_BIG_ENDIAN
724723
select MIPS_L1_CACHE_SHIFT_7
725-
help
726-
This is the SGI Indigo2 with R10000 processor. To compile a Linux
727-
kernel that runs on these, say Y here.
724+
help
725+
This is the SGI Indigo2 with R10000 processor. To compile a Linux
726+
kernel that runs on these, say Y here.
728727

729728
config SGI_IP32
730729
bool "SGI IP32 (O2)"
@@ -1168,9 +1167,9 @@ config HOLES_IN_ZONE
11681167
config SYS_SUPPORTS_RELOCATABLE
11691168
bool
11701169
help
1171-
Selected if the platform supports relocating the kernel.
1172-
The platform must provide plat_get_fdt() if it selects CONFIG_USE_OF
1173-
to allow access to command line and entropy sources.
1170+
Selected if the platform supports relocating the kernel.
1171+
The platform must provide plat_get_fdt() if it selects CONFIG_USE_OF
1172+
to allow access to command line and entropy sources.
11741173

11751174
config MIPS_CBPF_JIT
11761175
def_bool y
@@ -2113,8 +2112,8 @@ config MIPS_PGD_C0_CONTEXT
21132112
# Set to y for ptrace access to watch registers.
21142113
#
21152114
config HARDWARE_WATCHPOINTS
2116-
bool
2117-
default y if CPU_MIPSR1 || CPU_MIPSR2 || CPU_MIPSR6
2115+
bool
2116+
default y if CPU_MIPSR1 || CPU_MIPSR2 || CPU_MIPSR6
21182117

21192118
menu "Kernel type"
21202119

@@ -2178,10 +2177,10 @@ config PAGE_SIZE_4KB
21782177
bool "4kB"
21792178
depends on !CPU_LOONGSON2 && !CPU_LOONGSON3
21802179
help
2181-
This option select the standard 4kB Linux page size. On some
2182-
R3000-family processors this is the only available page size. Using
2183-
4kB page size will minimize memory consumption and is therefore
2184-
recommended for low memory systems.
2180+
This option select the standard 4kB Linux page size. On some
2181+
R3000-family processors this is the only available page size. Using
2182+
4kB page size will minimize memory consumption and is therefore
2183+
recommended for low memory systems.
21852184

21862185
config PAGE_SIZE_8KB
21872186
bool "8kB"
@@ -2474,7 +2473,6 @@ config SB1_PASS_2_1_WORKAROUNDS
24742473
depends on CPU_SB1 && CPU_SB1_PASS_2
24752474
default y
24762475

2477-
24782476
choice
24792477
prompt "SmartMIPS or microMIPS ASE support"
24802478

@@ -2682,16 +2680,16 @@ config RANDOMIZE_BASE
26822680
bool "Randomize the address of the kernel image"
26832681
depends on RELOCATABLE
26842682
---help---
2685-
Randomizes the physical and virtual address at which the
2686-
kernel image is loaded, as a security feature that
2687-
deters exploit attempts relying on knowledge of the location
2688-
of kernel internals.
2683+
Randomizes the physical and virtual address at which the
2684+
kernel image is loaded, as a security feature that
2685+
deters exploit attempts relying on knowledge of the location
2686+
of kernel internals.
26892687

2690-
Entropy is generated using any coprocessor 0 registers available.
2688+
Entropy is generated using any coprocessor 0 registers available.
26912689

2692-
The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET.
2690+
The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET.
26932691

2694-
If unsure, say N.
2692+
If unsure, say N.
26952693

26962694
config RANDOMIZE_BASE_MAX_OFFSET
26972695
hex "Maximum kASLR offset" if EXPERT
@@ -2821,7 +2819,7 @@ choice
28212819
prompt "Timer frequency"
28222820
default HZ_250
28232821
help
2824-
Allows the configuration of the timer frequency.
2822+
Allows the configuration of the timer frequency.
28252823

28262824
config HZ_24
28272825
bool "24 HZ" if SYS_SUPPORTS_24HZ || SYS_SUPPORTS_ARBIT_HZ
@@ -3121,10 +3119,10 @@ config ARCH_MMAP_RND_BITS_MAX
31213119
default 15
31223120

31233121
config ARCH_MMAP_RND_COMPAT_BITS_MIN
3124-
default 8
3122+
default 8
31253123

31263124
config ARCH_MMAP_RND_COMPAT_BITS_MAX
3127-
default 15
3125+
default 15
31283126

31293127
config I8253
31303128
bool

‎arch/mips/bcm47xx/Kconfig‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ config BCM47XX_SSB
1515
select SSB_DRIVER_GPIO
1616
default y
1717
help
18-
Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
18+
Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
1919

20-
This will generate an image with support for SSB and MIPS32 R1 instruction set.
20+
This will generate an image with support for SSB and MIPS32 R1 instruction set.
2121

2222
config BCM47XX_BCMA
2323
bool "BCMA Support for Broadcom BCM47XX"
@@ -31,8 +31,8 @@ config BCM47XX_BCMA
3131
select BCMA_DRIVER_GPIO
3232
default y
3333
help
34-
Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
34+
Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
3535

36-
This will generate an image with support for BCMA and MIPS32 R2 instruction set.
36+
This will generate an image with support for BCMA and MIPS32 R2 instruction set.
3737

3838
endif

‎arch/mips/bcm63xx/boards/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ choice
55
default BOARD_BCM963XX
66

77
config BOARD_BCM963XX
8-
bool "Generic Broadcom 963xx boards"
8+
bool "Generic Broadcom 963xx boards"
99
select SSB
1010

1111
endchoice

‎arch/mips/configs/generic_defconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ CONFIG_MIPS_CPS=y
2626
CONFIG_HIGHMEM=y
2727
CONFIG_NR_CPUS=16
2828
CONFIG_MIPS_O32_FP64_SUPPORT=y
29+
CONFIG_JUMP_LABEL=y
2930
CONFIG_MODULES=y
3031
CONFIG_MODULE_UNLOAD=y
3132
CONFIG_TRIM_UNUSED_KSYMS=y

‎arch/mips/include/asm/bootinfo.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ extern unsigned long mips_machtype;
9292
#define BOOT_MEM_ROM_DATA 2
9393
#define BOOT_MEM_RESERVED 3
9494
#define BOOT_MEM_INIT_RAM 4
95+
#define BOOT_MEM_NOMAP 5
9596

9697
/*
9798
* A memory map that's built upon what was determined

‎arch/mips/include/asm/jump_label.h‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef __ASSEMBLY__
1212

1313
#include <linux/types.h>
14+
#include <asm/isa-rev.h>
1415

1516
#define JUMP_LABEL_NOP_SIZE 4
1617

@@ -21,15 +22,20 @@
2122
#endif
2223

2324
#ifdef CONFIG_CPU_MICROMIPS
24-
#define B_INSN "b32"
25+
# define B_INSN "b32"
26+
# define J_INSN "j32"
27+
#elif MIPS_ISA_REV >= 6
28+
# define B_INSN "bc"
29+
# define J_INSN "bc"
2530
#else
26-
#define B_INSN "b"
31+
# define B_INSN "b"
32+
# define J_INSN "j"
2733
#endif
2834

2935
static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
3036
{
3137
asm_volatile_goto("1:\t" B_INSN " 2f\n\t"
32-
"2:\tnop\n\t"
38+
"2:\t.insn\n\t"
3339
".pushsection __jump_table, \"aw\"\n\t"
3440
WORD_INSN " 1b, %l[l_yes], %0\n\t"
3541
".popsection\n\t"
@@ -42,8 +48,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
4248

4349
static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
4450
{
45-
asm_volatile_goto("1:\tj %l[l_yes]\n\t"
46-
"nop\n\t"
51+
asm_volatile_goto("1:\t" J_INSN " %l[l_yes]\n\t"
4752
".pushsection __jump_table, \"aw\"\n\t"
4853
WORD_INSN " 1b, %l[l_yes], %0\n\t"
4954
".popsection\n\t"

‎arch/mips/include/asm/uasm.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,18 @@ Ip_u2u1(_ctcmsa);
8686
Ip_u2u1s3(_daddiu);
8787
Ip_u3u1u2(_daddu);
8888
Ip_u1u2(_ddivu);
89+
Ip_u3u1u2(_ddivu_r6);
8990
Ip_u1(_di);
9091
Ip_u2u1msbu3(_dins);
9192
Ip_u2u1msbu3(_dinsm);
9293
Ip_u2u1msbu3(_dinsu);
9394
Ip_u1u2(_divu);
95+
Ip_u3u1u2(_divu_r6);
9496
Ip_u1u2u3(_dmfc0);
97+
Ip_u3u1u2(_dmodu);
9598
Ip_u1u2u3(_dmtc0);
9699
Ip_u1u2(_dmultu);
100+
Ip_u3u1u2(_dmulu);
97101
Ip_u2u1u3(_drotr);
98102
Ip_u2u1u3(_drotr32);
99103
Ip_u2u1(_dsbh);
@@ -131,6 +135,7 @@ Ip_u1u2u3(_mfc0);
131135
Ip_u1u2u3(_mfhc0);
132136
Ip_u1(_mfhi);
133137
Ip_u1(_mflo);
138+
Ip_u3u1u2(_modu);
134139
Ip_u3u1u2(_movn);
135140
Ip_u3u1u2(_movz);
136141
Ip_u1u2u3(_mtc0);
@@ -139,6 +144,7 @@ Ip_u1(_mthi);
139144
Ip_u1(_mtlo);
140145
Ip_u3u1u2(_mul);
141146
Ip_u1u2(_multu);
147+
Ip_u3u1u2(_mulu);
142148
Ip_u3u1u2(_nor);
143149
Ip_u3u1u2(_or);
144150
Ip_u2u1u3(_ori);
@@ -149,6 +155,8 @@ Ip_u2s3u1(_sb);
149155
Ip_u2s3u1(_sc);
150156
Ip_u2s3u1(_scd);
151157
Ip_u2s3u1(_sd);
158+
Ip_u3u1u2(_seleqz);
159+
Ip_u3u1u2(_selnez);
152160
Ip_u2s3u1(_sh);
153161
Ip_u2u1u3(_sll);
154162
Ip_u3u2u1(_sllv);

‎arch/mips/include/uapi/asm/inst.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ enum spec_op {
5555
spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
5656
dadd_op, daddu_op, dsub_op, dsubu_op,
5757
tge_op, tgeu_op, tlt_op, tltu_op,
58-
teq_op, spec5_unused_op, tne_op, spec6_unused_op,
59-
dsll_op, spec7_unused_op, dsrl_op, dsra_op,
60-
dsll32_op, spec8_unused_op, dsrl32_op, dsra32_op
58+
teq_op, seleqz_op, tne_op, selnez_op,
59+
dsll_op, spec5_unused_op, dsrl_op, dsra_op,
60+
dsll32_op, spec6_unused_op, dsrl32_op, dsra32_op
6161
};
6262

6363
/*

‎arch/mips/kernel/entry.S‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ resume_kernel:
5858
local_irq_disable
5959
lw t0, TI_PRE_COUNT($28)
6060
bnez t0, restore_all
61-
need_resched:
6261
LONG_L t0, TI_FLAGS($28)
6362
andi t1, t0, _TIF_NEED_RESCHED
6463
beqz t1, restore_all
6564
LONG_L t0, PT_STATUS(sp) # Interrupts off?
6665
andi t0, 1
6766
beqz t0, restore_all
68-
jal preempt_schedule_irq
69-
b need_resched
67+
PTR_LA ra, restore_all
68+
j preempt_schedule_irq
7069
#endif
7170

7271
FEXPORT(ret_from_kernel_thread)

‎arch/mips/kernel/jump_label.c‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,38 @@ void arch_jump_label_transform(struct jump_entry *e,
4040
{
4141
union mips_instruction *insn_p;
4242
union mips_instruction insn;
43+
long offset;
4344

4445
insn_p = (union mips_instruction *)msk_isa16_mode(e->code);
4546

46-
/* Jump only works within an aligned region its delay slot is in. */
47-
BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK));
48-
4947
/* Target must have the right alignment and ISA must be preserved. */
5048
BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT);
5149

5250
if (type == JUMP_LABEL_JMP) {
53-
insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op;
54-
insn.j_format.target = e->target >> J_RANGE_SHIFT;
51+
if (!IS_ENABLED(CONFIG_CPU_MICROMIPS) && MIPS_ISA_REV >= 6) {
52+
offset = e->target - ((unsigned long)insn_p + 4);
53+
offset >>= 2;
54+
55+
/*
56+
* The branch offset must fit in the instruction's 26
57+
* bit field.
58+
*/
59+
WARN_ON((offset >= BIT(25)) ||
60+
(offset < -(long)BIT(25)));
61+
62+
insn.j_format.opcode = bc6_op;
63+
insn.j_format.target = offset;
64+
} else {
65+
/*
66+
* Jump only works within an aligned region its delay
67+
* slot is in.
68+
*/
69+
WARN_ON((e->target & ~J_RANGE_MASK) !=
70+
((e->code + 4) & ~J_RANGE_MASK));
71+
72+
insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op;
73+
insn.j_format.target = e->target >> J_RANGE_SHIFT;
74+
}
5575
} else {
5676
insn.word = 0; /* nop */
5777
}

0 commit comments

Comments
 (0)