mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 09:15:03 +07:00
eb7c825bf7
This tag contains fixes, defconfig, and DT data changes for the v5.2-rc series. The fixes are relatively straightforward: - Addition of a TLB fence in the vmalloc_fault path, so the CPU doesn't enter an infinite page fault loop; - Readdition of the pm_power_off export, so device drivers that reassign it can now be built as modules; - A udelay() fix for RV32, fixing a miscomputation of the delay time; - Removal of deprecated smp_mb__*() barriers. The tag also adds initial DT data infrastructure for arch/riscv, along with initial data for the SiFive FU540-C000 SoC and the corresponding HiFive Unleashed board. We also update the RV64 defconfig to include some core drivers for the FU540 in the build. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEElRDoIDdEz9/svf2Kx4+xDQu9KksFAl0HtEkACgkQx4+xDQu9 KkuRIw//f2vSrUyMh44sevr6euVD0K++hQ0AbteQ94cGHqYWWaNxfwMHFD91Gxbj wowTwgssq7H9nePsKANjiiLULnZNIkWXAlIncjzv3aXkH6JG3f9nEGR49yzvCbIZ yN8wgElJ8rcVWLd096E53Su84CzxuJJ2o3wOI1nQi8aI4h3LwkM2b/O4GxZFpnWb vIhWXqjvbUb8XL7Y+VPewtxnZItOUDHkuIkup4kP2bTgl2iDW93hzWwxNKbt6v+m 9wTzAChjcepCAXSmEGeeZ/h2HNqw2crs+NWOe0drcKxL2vKPZ6gS8ZRX/NuIoDr4 JgMILzYSO28z8N6w1cJJUdN4eGhCTvdxVTQXvkk/yZoT08X6M0xb5A1MbtizgOJ6 mZK/vM9gtuoUSZG0SRNeNoqHbWu1tIm29z435Be8hWAtzXlEfewJm8ntgFO4dGmb E8TRSgjLzdHY0Nvwx/KVtvYmE/TMybVVRsxJJ525dqJlHT7f3VuRstvw7VQJQpz2 +JfsZbYk1KjbUc25QpAqF1LUxrRQFn2JL0Cqw+L49J8eshY77rsTcAKP6ZZWiSFZ qodU0oPF4BkS1t0bnFuNwlqsAr/q9EiAnQO7+SvqQY/ZUnMNk9gCNn5k/rHMCfyD 2Dyo6iAbj+Yyb1rrQxX6QnlbHgpFxsG3N4s9E5jOPgKyEQM4JQ4= =aotJ -----END PGP SIGNATURE----- Merge tag 'riscv-for-v5.2/fixes-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux Pull RISC-V fixes from Paul Walmsley: "This contains fixes, defconfig, and DT data changes for the v5.2-rc series. The fixes are relatively straightforward: - Addition of a TLB fence in the vmalloc_fault path, so the CPU doesn't enter an infinite page fault loop - Readdition of the pm_power_off export, so device drivers that reassign it can now be built as modules - A udelay() fix for RV32, fixing a miscomputation of the delay time - Removal of deprecated smp_mb__*() barriers This also adds initial DT data infrastructure for arch/riscv, along with initial data for the SiFive FU540-C000 SoC and the corresponding HiFive Unleashed board. We also update the RV64 defconfig to include some core drivers for the FU540 in the build" * tag 'riscv-for-v5.2/fixes-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: remove unused barrier defines riscv: mm: synchronize MMU after pte change riscv: dts: add initial board data for the SiFive HiFive Unleashed riscv: dts: add initial support for the SiFive FU540-C000 SoC dt-bindings: riscv: convert cpu binding to json-schema dt-bindings: riscv: sifive: add YAML documentation for the SiFive FU540 arch: riscv: add support for building DTB files from DT source data riscv: Fix udelay in RV32. riscv: export pm_power_off again RISC-V: defconfig: enable clocks, serial console
206 lines
5.7 KiB
C
206 lines
5.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2012 Regents of the University of California
|
|
*/
|
|
|
|
#ifndef _ASM_RISCV_BITOPS_H
|
|
#define _ASM_RISCV_BITOPS_H
|
|
|
|
#ifndef _LINUX_BITOPS_H
|
|
#error "Only <linux/bitops.h> can be included directly"
|
|
#endif /* _LINUX_BITOPS_H */
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/irqflags.h>
|
|
#include <asm/barrier.h>
|
|
#include <asm/bitsperlong.h>
|
|
|
|
#include <asm-generic/bitops/__ffs.h>
|
|
#include <asm-generic/bitops/ffz.h>
|
|
#include <asm-generic/bitops/fls.h>
|
|
#include <asm-generic/bitops/__fls.h>
|
|
#include <asm-generic/bitops/fls64.h>
|
|
#include <asm-generic/bitops/find.h>
|
|
#include <asm-generic/bitops/sched.h>
|
|
#include <asm-generic/bitops/ffs.h>
|
|
|
|
#include <asm-generic/bitops/hweight.h>
|
|
|
|
#if (BITS_PER_LONG == 64)
|
|
#define __AMO(op) "amo" #op ".d"
|
|
#elif (BITS_PER_LONG == 32)
|
|
#define __AMO(op) "amo" #op ".w"
|
|
#else
|
|
#error "Unexpected BITS_PER_LONG"
|
|
#endif
|
|
|
|
#define __test_and_op_bit_ord(op, mod, nr, addr, ord) \
|
|
({ \
|
|
unsigned long __res, __mask; \
|
|
__mask = BIT_MASK(nr); \
|
|
__asm__ __volatile__ ( \
|
|
__AMO(op) #ord " %0, %2, %1" \
|
|
: "=r" (__res), "+A" (addr[BIT_WORD(nr)]) \
|
|
: "r" (mod(__mask)) \
|
|
: "memory"); \
|
|
((__res & __mask) != 0); \
|
|
})
|
|
|
|
#define __op_bit_ord(op, mod, nr, addr, ord) \
|
|
__asm__ __volatile__ ( \
|
|
__AMO(op) #ord " zero, %1, %0" \
|
|
: "+A" (addr[BIT_WORD(nr)]) \
|
|
: "r" (mod(BIT_MASK(nr))) \
|
|
: "memory");
|
|
|
|
#define __test_and_op_bit(op, mod, nr, addr) \
|
|
__test_and_op_bit_ord(op, mod, nr, addr, .aqrl)
|
|
#define __op_bit(op, mod, nr, addr) \
|
|
__op_bit_ord(op, mod, nr, addr, )
|
|
|
|
/* Bitmask modifiers */
|
|
#define __NOP(x) (x)
|
|
#define __NOT(x) (~(x))
|
|
|
|
/**
|
|
* test_and_set_bit - Set a bit and return its old value
|
|
* @nr: Bit to set
|
|
* @addr: Address to count from
|
|
*
|
|
* This operation may be reordered on other architectures than x86.
|
|
*/
|
|
static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
return __test_and_op_bit(or, __NOP, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* test_and_clear_bit - Clear a bit and return its old value
|
|
* @nr: Bit to clear
|
|
* @addr: Address to count from
|
|
*
|
|
* This operation can be reordered on other architectures other than x86.
|
|
*/
|
|
static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
return __test_and_op_bit(and, __NOT, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* test_and_change_bit - Change a bit and return its old value
|
|
* @nr: Bit to change
|
|
* @addr: Address to count from
|
|
*
|
|
* This operation is atomic and cannot be reordered.
|
|
* It also implies a memory barrier.
|
|
*/
|
|
static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
return __test_and_op_bit(xor, __NOP, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* set_bit - Atomically set a bit in memory
|
|
* @nr: the bit to set
|
|
* @addr: the address to start counting from
|
|
*
|
|
* Note: there are no guarantees that this function will not be reordered
|
|
* on non x86 architectures, so if you are writing portable code,
|
|
* make sure not to rely on its reordering guarantees.
|
|
*
|
|
* Note that @nr may be almost arbitrarily large; this function is not
|
|
* restricted to acting on a single-word quantity.
|
|
*/
|
|
static inline void set_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
__op_bit(or, __NOP, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* clear_bit - Clears a bit in memory
|
|
* @nr: Bit to clear
|
|
* @addr: Address to start counting from
|
|
*
|
|
* Note: there are no guarantees that this function will not be reordered
|
|
* on non x86 architectures, so if you are writing portable code,
|
|
* make sure not to rely on its reordering guarantees.
|
|
*/
|
|
static inline void clear_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
__op_bit(and, __NOT, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* change_bit - Toggle a bit in memory
|
|
* @nr: Bit to change
|
|
* @addr: Address to start counting from
|
|
*
|
|
* change_bit() may be reordered on other architectures than x86.
|
|
* Note that @nr may be almost arbitrarily large; this function is not
|
|
* restricted to acting on a single-word quantity.
|
|
*/
|
|
static inline void change_bit(int nr, volatile unsigned long *addr)
|
|
{
|
|
__op_bit(xor, __NOP, nr, addr);
|
|
}
|
|
|
|
/**
|
|
* test_and_set_bit_lock - Set a bit and return its old value, for lock
|
|
* @nr: Bit to set
|
|
* @addr: Address to count from
|
|
*
|
|
* This operation is atomic and provides acquire barrier semantics.
|
|
* It can be used to implement bit locks.
|
|
*/
|
|
static inline int test_and_set_bit_lock(
|
|
unsigned long nr, volatile unsigned long *addr)
|
|
{
|
|
return __test_and_op_bit_ord(or, __NOP, nr, addr, .aq);
|
|
}
|
|
|
|
/**
|
|
* clear_bit_unlock - Clear a bit in memory, for unlock
|
|
* @nr: the bit to set
|
|
* @addr: the address to start counting from
|
|
*
|
|
* This operation is atomic and provides release barrier semantics.
|
|
*/
|
|
static inline void clear_bit_unlock(
|
|
unsigned long nr, volatile unsigned long *addr)
|
|
{
|
|
__op_bit_ord(and, __NOT, nr, addr, .rl);
|
|
}
|
|
|
|
/**
|
|
* __clear_bit_unlock - Clear a bit in memory, for unlock
|
|
* @nr: the bit to set
|
|
* @addr: the address to start counting from
|
|
*
|
|
* This operation is like clear_bit_unlock, however it is not atomic.
|
|
* It does provide release barrier semantics so it can be used to unlock
|
|
* a bit lock, however it would only be used if no other CPU can modify
|
|
* any bits in the memory until the lock is released (a good example is
|
|
* if the bit lock itself protects access to the other bits in the word).
|
|
*
|
|
* On RISC-V systems there seems to be no benefit to taking advantage of the
|
|
* non-atomic property here: it's a lot more instructions and we still have to
|
|
* provide release semantics anyway.
|
|
*/
|
|
static inline void __clear_bit_unlock(
|
|
unsigned long nr, volatile unsigned long *addr)
|
|
{
|
|
clear_bit_unlock(nr, addr);
|
|
}
|
|
|
|
#undef __test_and_op_bit
|
|
#undef __op_bit
|
|
#undef __NOP
|
|
#undef __NOT
|
|
#undef __AMO
|
|
|
|
#include <asm-generic/bitops/non-atomic.h>
|
|
#include <asm-generic/bitops/le.h>
|
|
#include <asm-generic/bitops/ext2-atomic.h>
|
|
|
|
#endif /* _ASM_RISCV_BITOPS_H */
|