xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/vdso/processor.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 2020 ARM Ltd.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun #ifndef __ASM_VDSO_PROCESSOR_H
6*4882a593Smuzhiyun #define __ASM_VDSO_PROCESSOR_H
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef __ASSEMBLY__
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifdef CONFIG_CPU_LOONGSON64
11*4882a593Smuzhiyun /*
12*4882a593Smuzhiyun  * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a
13*4882a593Smuzhiyun  * tight read loop is executed, because reads take priority over writes & the
14*4882a593Smuzhiyun  * hardware (incorrectly) doesn't ensure that writes will eventually occur.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * Since spin loops of any kind should have a cpu_relax() in them, force an SFB
17*4882a593Smuzhiyun  * flush from cpu_relax() such that any pending writes will become visible as
18*4882a593Smuzhiyun  * expected.
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun #define cpu_relax()	smp_mb()
21*4882a593Smuzhiyun #else
22*4882a593Smuzhiyun #define cpu_relax()	barrier()
23*4882a593Smuzhiyun #endif
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #endif /* __ASM_VDSO_PROCESSOR_H */
28