Skip to content

Commit c420ddd

Browse files
committed
Merge tag 'mips_fixes_5.5_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fixes from Paul Burton: "A collection of MIPS fixes: - Fill the struct cacheinfo shared_cpu_map field with sensible values, notably avoiding issues with perf which was unhappy in the absence of these values. - A boot fix for Loongson 2E & 2F machines which was fallout from some refactoring performed this cycle. - A Kconfig dependency fix for the Loongson CPU HWMon driver. - A couple of VDSO fixes, ensuring gettimeofday() behaves appropriately for kernel configurations that don't include support for a clocksource the VDSO can use & fixing the calling convention for the n32 & n64 VDSOs which would previously clobber the $gp/$28 register. - A build fix for vmlinuz compressed images which were inappropriately building with -fsanitize-coverage despite not being part of the kernel proper, then failing to link due to the missing __sanitizer_cov_trace_pc() function. - A couple of eBPF JIT fixes, including disabling it for MIPS32 due to a large number of issues with the code generated there & reflecting ISA dependencies in Kconfig to enforce that systems which don't support the JIT must include the interpreter" * tag 'mips_fixes_5.5_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: Avoid VDSO ABI breakage due to global register variable MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig MIPS: BPF: Disable MIPS32 eBPF JIT MIPS: Prevent link failure with kcov instrumentation MIPS: Kconfig: Use correct form for 'depends on' mips: Fix gettimeofday() in the vdso library MIPS: Fix boot on Fuloong2 systems mips: cacheinfo: report shared CPU map
2 parents 5613970 + bbcc567 commit c420ddd

File tree

9 files changed

+73
-19
lines changed

9 files changed

+73
-19
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ config MIPS
4747
select HAVE_ARCH_TRACEHOOK
4848
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
4949
select HAVE_ASM_MODVERSIONS
50-
select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
50+
select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
5151
select HAVE_CONTEXT_TRACKING
5252
select HAVE_COPY_THREAD_TLS
5353
select HAVE_C_RECORDMCOUNT

arch/mips/boot/compressed/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
2929
-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
3030
-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
3131

32+
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
33+
KCOV_INSTRUMENT := n
34+
3235
# decompressor objects (linked with vmlinuz)
3336
vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
3437

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
static inline int __pure __get_cpu_type(const int cpu_type)
1616
{
1717
switch (cpu_type) {
18-
#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2EF)
18+
#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19+
defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
1920
case CPU_LOONGSON2EF:
2021
#endif
2122

arch/mips/include/asm/thread_info.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,26 @@ struct thread_info {
4949
.addr_limit = KERNEL_DS, \
5050
}
5151

52-
/* How to get the thread information struct from C. */
52+
/*
53+
* A pointer to the struct thread_info for the currently executing thread is
54+
* held in register $28/$gp.
55+
*
56+
* We declare __current_thread_info as a global register variable rather than a
57+
* local register variable within current_thread_info() because clang doesn't
58+
* support explicit local register variables.
59+
*
60+
* When building the VDSO we take care not to declare the global register
61+
* variable because this causes GCC to not preserve the value of $28/$gp in
62+
* functions that change its value (which is common in the PIC VDSO when
63+
* accessing the GOT). Since the VDSO shouldn't be accessing
64+
* __current_thread_info anyway we declare it extern in order to cause a link
65+
* failure if it's referenced.
66+
*/
67+
#ifdef __VDSO__
68+
extern struct thread_info *__current_thread_info;
69+
#else
5370
register struct thread_info *__current_thread_info __asm__("$28");
71+
#endif
5472

5573
static inline struct thread_info *current_thread_info(void)
5674
{

arch/mips/include/asm/vdso/gettimeofday.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#define __VDSO_USE_SYSCALL ULLONG_MAX
2828

29-
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
30-
3129
static __always_inline long gettimeofday_fallback(
3230
struct __kernel_old_timeval *_tv,
3331
struct timezone *_tz)
@@ -48,17 +46,6 @@ static __always_inline long gettimeofday_fallback(
4846
return error ? -ret : ret;
4947
}
5048

51-
#else
52-
53-
static __always_inline long gettimeofday_fallback(
54-
struct __kernel_old_timeval *_tv,
55-
struct timezone *_tz)
56-
{
57-
return -1;
58-
}
59-
60-
#endif
61-
6249
static __always_inline long clock_gettime_fallback(
6350
clockid_t _clkid,
6451
struct __kernel_timespec *_ts)

arch/mips/kernel/cacheinfo.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,46 @@ static int __init_cache_level(unsigned int cpu)
5050
return 0;
5151
}
5252

53+
static void fill_cpumask_siblings(int cpu, cpumask_t *cpu_map)
54+
{
55+
int cpu1;
56+
57+
for_each_possible_cpu(cpu1)
58+
if (cpus_are_siblings(cpu, cpu1))
59+
cpumask_set_cpu(cpu1, cpu_map);
60+
}
61+
62+
static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map)
63+
{
64+
int cpu1;
65+
int cluster = cpu_cluster(&cpu_data[cpu]);
66+
67+
for_each_possible_cpu(cpu1)
68+
if (cpu_cluster(&cpu_data[cpu1]) == cluster)
69+
cpumask_set_cpu(cpu1, cpu_map);
70+
}
71+
5372
static int __populate_cache_leaves(unsigned int cpu)
5473
{
5574
struct cpuinfo_mips *c = &current_cpu_data;
5675
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
5776
struct cacheinfo *this_leaf = this_cpu_ci->info_list;
5877

5978
if (c->icache.waysize) {
79+
/* L1 caches are per core */
80+
fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6081
populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA);
82+
fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6183
populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST);
6284
} else {
6385
populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED);
6486
}
6587

66-
if (c->scache.waysize)
88+
if (c->scache.waysize) {
89+
/* L2 cache is per cluster */
90+
fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map);
6791
populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED);
92+
}
6893

6994
if (c->tcache.waysize)
7095
populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED);

arch/mips/net/ebpf_jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
18041804
unsigned int image_size;
18051805
u8 *image_ptr;
18061806

1807-
if (!prog->jit_requested || MIPS_ISA_REV < 2)
1807+
if (!prog->jit_requested)
18081808
return prog;
18091809

18101810
tmp = bpf_jit_blind_constants(prog);

arch/mips/vdso/vgettimeofday.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@ int __vdso_clock_gettime(clockid_t clock,
1717
return __cvdso_clock_gettime32(clock, ts);
1818
}
1919

20+
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
21+
22+
/*
23+
* This is behind the ifdef so that we don't provide the symbol when there's no
24+
* possibility of there being a usable clocksource, because there's nothing we
25+
* can do without it. When libc fails the symbol lookup it should fall back on
26+
* the standard syscall path.
27+
*/
2028
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
2129
struct timezone *tz)
2230
{
2331
return __cvdso_gettimeofday(tv, tz);
2432
}
2533

34+
#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
35+
2636
int __vdso_clock_getres(clockid_t clock_id,
2737
struct old_timespec32 *res)
2838
{
@@ -43,12 +53,22 @@ int __vdso_clock_gettime(clockid_t clock,
4353
return __cvdso_clock_gettime(clock, ts);
4454
}
4555

56+
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
57+
58+
/*
59+
* This is behind the ifdef so that we don't provide the symbol when there's no
60+
* possibility of there being a usable clocksource, because there's nothing we
61+
* can do without it. When libc fails the symbol lookup it should fall back on
62+
* the standard syscall path.
63+
*/
4664
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
4765
struct timezone *tz)
4866
{
4967
return __cvdso_gettimeofday(tv, tz);
5068
}
5169

70+
#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
71+
5272
int __vdso_clock_getres(clockid_t clock_id,
5373
struct __kernel_timespec *res)
5474
{

drivers/platform/mips/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if MIPS_PLATFORM_DEVICES
1818

1919
config CPU_HWMON
2020
tristate "Loongson-3 CPU HWMon Driver"
21-
depends on CONFIG_MACH_LOONGSON64
21+
depends on MACH_LOONGSON64
2222
select HWMON
2323
default y
2424
help

0 commit comments

Comments
 (0)