Skip to content

Commit eb3765a

Browse files
committed
Merge tag 'mips-fixes_7.0_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fixes from Thomas Bogendoerfer: - Fix TLB uniquification for systems with TLB not initialised by firmware - Fix allocation in TLB uniquification - Fix SiByte cache initialisation - Check uart parameters from firmware on Loongson64 systems - Fix clock id mismatch for Ralink SoCs - Fix GCC version check for __mutli3 workaround * tag 'mips-fixes_7.0_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: mips: mm: Allocate tlb_vpn array atomically MIPS: mm: Rewrite TLB uniquification for the hidden bit feature MIPS: mm: Suppress TLB uniquification on EHINV hardware MIPS: Always record SEGBITS in cpu_data.vmbits MIPS: Fix the GCC version check for `__multi3' workaround MIPS: SiByte: Bring back cache initialisation mips: ralink: update CPU clock index MIPS: Loongson64: env: Check UARTs passed by LEFI cautiously
2 parents 1791c39 + 01cc50e commit eb3765a

10 files changed

Lines changed: 268 additions & 72 deletions

File tree

arch/mips/include/asm/cpu-features.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@
484484
# endif
485485
# ifndef cpu_vmbits
486486
# define cpu_vmbits cpu_data[0].vmbits
487-
# define __NEED_VMBITS_PROBE
488487
# endif
489488
#endif
490489

arch/mips/include/asm/cpu-info.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ struct cpuinfo_mips {
8080
int srsets; /* Shadow register sets */
8181
int package;/* physical package number */
8282
unsigned int globalnumber;
83-
#ifdef CONFIG_64BIT
8483
int vmbits; /* Virtual memory size in bits */
85-
#endif
8684
void *data; /* Additional data */
8785
unsigned int watch_reg_count; /* Number that exist */
8886
unsigned int watch_reg_use_cnt; /* Usable by ptrace */

arch/mips/include/asm/mipsregs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,8 @@ do { \
18711871

18721872
#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
18731873
#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
1874+
#define read_c0_entryhi_64() __read_64bit_c0_register($10, 0)
1875+
#define write_c0_entryhi_64(val) __write_64bit_c0_register($10, 0, val)
18741876

18751877
#define read_c0_guestctl1() __read_32bit_c0_register($10, 4)
18761878
#define write_c0_guestctl1(val) __write_32bit_c0_register($10, 4, val)

arch/mips/kernel/cpu-probe.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,14 @@ static inline void set_elf_base_platform(const char *plat)
210210

211211
static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
212212
{
213-
#ifdef __NEED_VMBITS_PROBE
214-
write_c0_entryhi(0x3fffffffffffe000ULL);
215-
back_to_back_c0_hazard();
216-
c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
217-
#endif
213+
int vmbits = 31;
214+
215+
if (cpu_has_64bits) {
216+
write_c0_entryhi_64(0x3fffffffffffe000ULL);
217+
back_to_back_c0_hazard();
218+
vmbits = fls64(read_c0_entryhi_64() & 0x3fffffffffffe000ULL);
219+
}
220+
c->vmbits = vmbits;
218221
}
219222

220223
static void set_isa(struct cpuinfo_mips *c, unsigned int isa)

arch/mips/kernel/cpu-r3k-probe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ void cpu_probe(void)
137137
else
138138
cpu_set_nofpu_opts(c);
139139

140+
c->vmbits = 31;
141+
140142
reserve_exception_space(0, 0x400);
141143
}
142144

arch/mips/lib/multi3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#include "libgcc.h"
55

66
/*
7-
* GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for
7+
* GCC 9 & older can suboptimally generate __multi3 calls for mips64r6, so for
88
* that specific case only we implement that intrinsic here.
99
*
1010
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981
1111
*/
12-
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8)
12+
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 10)
1313

1414
/* multiply 64-bit values, low 64-bits returned */
1515
static inline long long notrace dmulu(long long a, long long b)
@@ -51,4 +51,4 @@ ti_type notrace __multi3(ti_type a, ti_type b)
5151
}
5252
EXPORT_SYMBOL(__multi3);
5353

54-
#endif /* 64BIT && CPU_MIPSR6 && GCC7 */
54+
#endif /* 64BIT && CPU_MIPSR6 && GCC9 */

arch/mips/loongson64/env.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include <linux/dma-map-ops.h>
1818
#include <linux/export.h>
1919
#include <linux/libfdt.h>
20+
#include <linux/minmax.h>
2021
#include <linux/pci_ids.h>
22+
#include <linux/serial_core.h>
2123
#include <linux/string_choices.h>
2224
#include <asm/bootinfo.h>
2325
#include <loongson.h>
@@ -106,9 +108,23 @@ static void __init lefi_fixup_fdt(struct system_loongson *system)
106108

107109
is_loongson64g = (read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64G;
108110

109-
for (i = 0; i < system->nr_uarts; i++) {
111+
for (i = 0; i < min(system->nr_uarts, MAX_UARTS); i++) {
110112
uartdev = &system->uarts[i];
111113

114+
/*
115+
* Some firmware does not set nr_uarts properly and passes empty
116+
* items. Ignore them silently.
117+
*/
118+
if (uartdev->uart_base == 0)
119+
continue;
120+
121+
/* Our DT only works with UPIO_MEM. */
122+
if (uartdev->iotype != UPIO_MEM) {
123+
pr_warn("Ignore UART 0x%llx with iotype %u passed by firmware\n",
124+
uartdev->uart_base, uartdev->iotype);
125+
continue;
126+
}
127+
112128
ret = lefi_fixup_fdt_serial(fdt_buf, uartdev->uart_base,
113129
uartdev->uartclk);
114130
/*

arch/mips/mm/cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ void cpu_cache_init(void)
207207
{
208208
if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache)
209209
r3k_cache_init();
210-
if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache)
210+
if ((IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) ||
211+
IS_ENABLED(CONFIG_CPU_SB1)) && cpu_has_4k_cache)
211212
r4k_cache_init();
212213

213214
if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache)

0 commit comments

Comments
 (0)