mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 19:41:34 +07:00
892204e06c
These are the main MIPS changes for 4.15. Fixes: - ralink: Fix MT7620 PCI build issues (4.5) - Disable cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN for 32-bit SMP (4.1) - Fix MIPS64 FP save/restore on 32-bit kernels (4.0) - ptrace: Pick up ptrace/seccomp changed syscall numbers (3.19) - ralink: Fix MT7628 pinmux (3.19) - BCM47XX: Fix LED inversion on WRT54GSv1 (3.17) - Fix n32 core dumping as o32 since regset support (3.13) - ralink: Drop obsolete USB_ARCH_HAS_HCD select Build system: - Default to "generic" (multiplatform) system type instead of IP22 - Use generic little endian MIPS32 r2 configuration as default defconfig instead of ip22_defconfig FPU emulation: - Fix exception generation for certain R6 FPU instructions SMP: - Allow __cpu_number_map to be larger than NR_CPUS for sparse CPU id spaces Miscellaneous: - Add iomem resource for kernel bss section for kexec/kdump - Atomics: Nudge writes on bit unlock - DT files: Standardise "ok" -> "okay" Platform support: BMIPS: - Enable HARDIRQS_SW_RESEND Broadcom BCM63XX: - Add clkdev lookup support - Update clk driver, UART driver, DTs to handle named refclk from DTs - Split apart various clocks to more closely match hardware - Add ethernet clocks Cavium Octeon: - Remove usage of cvmx_wait() in favour of __delay() ImgTec Pistachio: - DT: Drop deprecated dwmmc num-slots property Ingenic JZ4780: - Add NFS root to Ci20 defconfig - Add watchdog to Ci20 DT & defconfig, and allow building of watchdog driver with this SoC Generic (multiplatform): - Migrate xilfpga (MIPSfpga) platform to the generic platform Lantiq xway: - Fix ASC0/ASC1 clocks Minor cleanups: - Define virt_to_pfn() - Make thread_saved_pc static - Simplify 32-bit sign extension in __read_64bit_c0_split() - DMA: Use vma_pages() helper - FPU emulation: Replace unsigned with unsigned int - MM: Removed unused lastpfn - Alchemy: Make clk_ops const - Lasat: Use setup_timer() helper - ralink: Use BIT() in MT7620 PCI driver -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAloJ8ecACgkQbAtpk944 dnqF3w/+IPcxcYl7QpVFvM3MsDgxJI8ENIkY5ffMi1UVM8gApAHuFSnGotikS8C8 jjnFyorrOkUKuuX9m9pfwfmvMHAy8j77so7kp2vpGjihe4iFntYJxJYUpYq8Ru8M jNzikrPbFv6eQyjwFEGuqxrJmsgTlJGiWA04a33LCfiFz5RZUSloHfPkjWiyWM1s xrbkbZpwvyX3jw39vguZvz5qjuUPViy/YOSyMhmTqnqDXqGmwlHgzev1/HEzISVe eN5n6bHGX5Dis4bCBPZuYbr6m96/z+xTKCKC7mlH0OnG/WWQtv9LFFU7o+ffRsI/ nPKEN/TFFA7V0b9zI/lxfVSoZ67IZa5TDA+PLnzX9UQAxOA/wgFHPOgqJZN3/BXo OBgTuguwq9D22uSrvrMoqmcU+zDXG4ZQQCgv7mUUw2E9gHnsYJykhVa4kQVj9MxE LkixhhE+Qabsh6L3wDtBntpgoOd58dxNiMJ7UAzDW3rmyjo+EEWN1eeCxQCrewlf 1aJaHeRoEOt/k7oPZWCd1InJ3vEsrNcO74KSZuQ+q0ytuqYOLUZ7ZXteA86VzroI 4qcftvR4cVOCz86B6NZdQQVOM95P7vgqBMJqh52i1pjQlVdvE92MBgzbm4BSOUAL Y+hybhhIwJriF8WtTq2goL8osvMODM1uM3Zlm0XtA5JfUYbWK/E= =xbL0 -----END PGP SIGNATURE----- Merge tag 'mips_4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips Pull MIPS updates from James Hogan: "These are the main MIPS changes for 4.15. Fixes: - ralink: Fix MT7620 PCI build issues (4.5) - Disable cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN for 32-bit SMP (4.1) - Fix MIPS64 FP save/restore on 32-bit kernels (4.0) - ptrace: Pick up ptrace/seccomp changed syscall numbers (3.19) - ralink: Fix MT7628 pinmux (3.19) - BCM47XX: Fix LED inversion on WRT54GSv1 (3.17) - Fix n32 core dumping as o32 since regset support (3.13) - ralink: Drop obsolete USB_ARCH_HAS_HCD select Build system: - Default to "generic" (multiplatform) system type instead of IP22 - Use generic little endian MIPS32 r2 configuration as default defconfig instead of ip22_defconfig FPU emulation: - Fix exception generation for certain R6 FPU instructions SMP: - Allow __cpu_number_map to be larger than NR_CPUS for sparse CPU id spaces Miscellaneous: - Add iomem resource for kernel bss section for kexec/kdump - Atomics: Nudge writes on bit unlock - DT files: Standardise "ok" -> "okay" Minor cleanups: - Define virt_to_pfn() - Make thread_saved_pc static - Simplify 32-bit sign extension in __read_64bit_c0_split() - DMA: Use vma_pages() helper - FPU emulation: Replace unsigned with unsigned int - MM: Removed unused lastpfn - Alchemy: Make clk_ops const - Lasat: Use setup_timer() helper - ralink: Use BIT() in MT7620 PCI driver Platform support: BMIPS: - Enable HARDIRQS_SW_RESEND Broadcom BCM63XX: - Add clkdev lookup support - Update clk driver, UART driver, DTs to handle named refclk from DTs - Split apart various clocks to more closely match hardware - Add ethernet clocks Cavium Octeon: - Remove usage of cvmx_wait() in favour of __delay() ImgTec Pistachio: - DT: Drop deprecated dwmmc num-slots property Ingenic JZ4780: - Add NFS root to Ci20 defconfig - Add watchdog to Ci20 DT & defconfig, and allow building of watchdog driver with this SoC Generic (multiplatform): - Migrate xilfpga (MIPSfpga) platform to the generic platform Lantiq xway: - Fix ASC0/ASC1 clocks" * tag 'mips_4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips: (46 commits) MIPS: Add iomem resource for kernel bss section. MIPS: cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN don't work for 32-bit SMP MIPS: BMIPS: Enable HARDIRQS_SW_RESEND MIPS: pci: Make use of the BIT() macro inside the mt7620 driver MIPS: pci: Remove KERN_WARN instance inside the mt7620 driver MIPS: pci: Remove duplicate define in mt7620 driver MIPS: ralink: Fix typo in mt7628 pinmux function MIPS: ralink: Fix MT7628 pinmux MIPS: Fix odd fp register warnings with MIPS64r2 watchdog: jz4780: Allow selection of jz4740-wdt driver MIPS/ptrace: Update syscall nr on register changes MIPS/ptrace: Pick up ptrace/seccomp changed syscalls MIPS: Fix an n32 core file generation regset support regression MIPS: Fix MIPS64 FP save/restore on 32-bit kernels MIPS: page.h: Define virt_to_pfn() MIPS: Xilfpga: Switch to using generic defconfigs MIPS: generic: Add support for MIPSfpga MIPS: Set defconfig target to a generic system for 32r2el MIPS: Kconfig: Set default MIPS system type as generic MIPS: DTS: Remove num-slots from Pistachio SoC ...
215 lines
5.3 KiB
C
215 lines
5.3 KiB
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2003, 06, 07 by Ralf Baechle (ralf@linux-mips.org)
|
|
*/
|
|
#ifndef __ASM_CMPXCHG_H
|
|
#define __ASM_CMPXCHG_H
|
|
|
|
#include <linux/bug.h>
|
|
#include <linux/irqflags.h>
|
|
#include <asm/compiler.h>
|
|
#include <asm/war.h>
|
|
|
|
/*
|
|
* Using a branch-likely instruction to check the result of an sc instruction
|
|
* works around a bug present in R10000 CPUs prior to revision 3.0 that could
|
|
* cause ll-sc sequences to execute non-atomically.
|
|
*/
|
|
#if R10000_LLSC_WAR
|
|
# define __scbeqz "beqzl"
|
|
#else
|
|
# define __scbeqz "beqz"
|
|
#endif
|
|
|
|
/*
|
|
* These functions doesn't exist, so if they are called you'll either:
|
|
*
|
|
* - Get an error at compile-time due to __compiletime_error, if supported by
|
|
* your compiler.
|
|
*
|
|
* or:
|
|
*
|
|
* - Get an error at link-time due to the call to the missing function.
|
|
*/
|
|
extern unsigned long __cmpxchg_called_with_bad_pointer(void)
|
|
__compiletime_error("Bad argument size for cmpxchg");
|
|
extern unsigned long __xchg_called_with_bad_pointer(void)
|
|
__compiletime_error("Bad argument size for xchg");
|
|
|
|
#define __xchg_asm(ld, st, m, val) \
|
|
({ \
|
|
__typeof(*(m)) __ret; \
|
|
\
|
|
if (kernel_uses_llsc) { \
|
|
__asm__ __volatile__( \
|
|
" .set push \n" \
|
|
" .set noat \n" \
|
|
" .set " MIPS_ISA_ARCH_LEVEL " \n" \
|
|
"1: " ld " %0, %2 # __xchg_asm \n" \
|
|
" .set mips0 \n" \
|
|
" move $1, %z3 \n" \
|
|
" .set " MIPS_ISA_ARCH_LEVEL " \n" \
|
|
" " st " $1, %1 \n" \
|
|
"\t" __scbeqz " $1, 1b \n" \
|
|
" .set pop \n" \
|
|
: "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
|
|
: GCC_OFF_SMALL_ASM() (*m), "Jr" (val) \
|
|
: "memory"); \
|
|
} else { \
|
|
unsigned long __flags; \
|
|
\
|
|
raw_local_irq_save(__flags); \
|
|
__ret = *m; \
|
|
*m = val; \
|
|
raw_local_irq_restore(__flags); \
|
|
} \
|
|
\
|
|
__ret; \
|
|
})
|
|
|
|
extern unsigned long __xchg_small(volatile void *ptr, unsigned long val,
|
|
unsigned int size);
|
|
|
|
static inline unsigned long __xchg(volatile void *ptr, unsigned long x,
|
|
int size)
|
|
{
|
|
switch (size) {
|
|
case 1:
|
|
case 2:
|
|
return __xchg_small(ptr, x, size);
|
|
|
|
case 4:
|
|
return __xchg_asm("ll", "sc", (volatile u32 *)ptr, x);
|
|
|
|
case 8:
|
|
if (!IS_ENABLED(CONFIG_64BIT))
|
|
return __xchg_called_with_bad_pointer();
|
|
|
|
return __xchg_asm("lld", "scd", (volatile u64 *)ptr, x);
|
|
|
|
default:
|
|
return __xchg_called_with_bad_pointer();
|
|
}
|
|
}
|
|
|
|
#define xchg(ptr, x) \
|
|
({ \
|
|
__typeof__(*(ptr)) __res; \
|
|
\
|
|
smp_mb__before_llsc(); \
|
|
\
|
|
__res = (__typeof__(*(ptr))) \
|
|
__xchg((ptr), (unsigned long)(x), sizeof(*(ptr))); \
|
|
\
|
|
smp_llsc_mb(); \
|
|
\
|
|
__res; \
|
|
})
|
|
|
|
#define __cmpxchg_asm(ld, st, m, old, new) \
|
|
({ \
|
|
__typeof(*(m)) __ret; \
|
|
\
|
|
if (kernel_uses_llsc) { \
|
|
__asm__ __volatile__( \
|
|
" .set push \n" \
|
|
" .set noat \n" \
|
|
" .set "MIPS_ISA_ARCH_LEVEL" \n" \
|
|
"1: " ld " %0, %2 # __cmpxchg_asm \n" \
|
|
" bne %0, %z3, 2f \n" \
|
|
" .set mips0 \n" \
|
|
" move $1, %z4 \n" \
|
|
" .set "MIPS_ISA_ARCH_LEVEL" \n" \
|
|
" " st " $1, %1 \n" \
|
|
"\t" __scbeqz " $1, 1b \n" \
|
|
" .set pop \n" \
|
|
"2: \n" \
|
|
: "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
|
|
: GCC_OFF_SMALL_ASM() (*m), "Jr" (old), "Jr" (new) \
|
|
: "memory"); \
|
|
} else { \
|
|
unsigned long __flags; \
|
|
\
|
|
raw_local_irq_save(__flags); \
|
|
__ret = *m; \
|
|
if (__ret == old) \
|
|
*m = new; \
|
|
raw_local_irq_restore(__flags); \
|
|
} \
|
|
\
|
|
__ret; \
|
|
})
|
|
|
|
extern unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old,
|
|
unsigned long new, unsigned int size);
|
|
|
|
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
|
unsigned long new, unsigned int size)
|
|
{
|
|
switch (size) {
|
|
case 1:
|
|
case 2:
|
|
return __cmpxchg_small(ptr, old, new, size);
|
|
|
|
case 4:
|
|
return __cmpxchg_asm("ll", "sc", (volatile u32 *)ptr,
|
|
(u32)old, new);
|
|
|
|
case 8:
|
|
/* lld/scd are only available for MIPS64 */
|
|
if (!IS_ENABLED(CONFIG_64BIT))
|
|
return __cmpxchg_called_with_bad_pointer();
|
|
|
|
return __cmpxchg_asm("lld", "scd", (volatile u64 *)ptr,
|
|
(u64)old, new);
|
|
|
|
default:
|
|
return __cmpxchg_called_with_bad_pointer();
|
|
}
|
|
}
|
|
|
|
#define cmpxchg_local(ptr, old, new) \
|
|
((__typeof__(*(ptr))) \
|
|
__cmpxchg((ptr), \
|
|
(unsigned long)(__typeof__(*(ptr)))(old), \
|
|
(unsigned long)(__typeof__(*(ptr)))(new), \
|
|
sizeof(*(ptr))))
|
|
|
|
#define cmpxchg(ptr, old, new) \
|
|
({ \
|
|
__typeof__(*(ptr)) __res; \
|
|
\
|
|
smp_mb__before_llsc(); \
|
|
__res = cmpxchg_local((ptr), (old), (new)); \
|
|
smp_llsc_mb(); \
|
|
\
|
|
__res; \
|
|
})
|
|
|
|
#ifdef CONFIG_64BIT
|
|
#define cmpxchg64_local(ptr, o, n) \
|
|
({ \
|
|
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
|
|
cmpxchg_local((ptr), (o), (n)); \
|
|
})
|
|
|
|
#define cmpxchg64(ptr, o, n) \
|
|
({ \
|
|
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
|
|
cmpxchg((ptr), (o), (n)); \
|
|
})
|
|
#else
|
|
#include <asm-generic/cmpxchg-local.h>
|
|
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
|
|
#ifndef CONFIG_SMP
|
|
#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
|
|
#endif
|
|
#endif
|
|
|
|
#undef __scbeqz
|
|
|
|
#endif /* __ASM_CMPXCHG_H */
|