18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 ARM Ltd.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef __ASM_VDSO_PROCESSOR_H
68c2ecf20Sopenharmony_ci#define __ASM_VDSO_PROCESSOR_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_LOONGSON64
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a
138c2ecf20Sopenharmony_ci * tight read loop is executed, because reads take priority over writes & the
148c2ecf20Sopenharmony_ci * hardware (incorrectly) doesn't ensure that writes will eventually occur.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * Since spin loops of any kind should have a cpu_relax() in them, force an SFB
178c2ecf20Sopenharmony_ci * flush from cpu_relax() such that any pending writes will become visible as
188c2ecf20Sopenharmony_ci * expected.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define cpu_relax()	smp_mb()
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_ci#define cpu_relax()	barrier()
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#endif /* __ASM_VDSO_PROCESSOR_H */
28