18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2003, 04, 07 Ralf Baechle <ralf@linux-mips.org>
78c2ecf20Sopenharmony_ci * Copyright (C) MIPS Technologies, Inc.
88c2ecf20Sopenharmony_ci *   written by Ralf Baechle <ralf@linux-mips.org>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef _ASM_HAZARDS_H
118c2ecf20Sopenharmony_ci#define _ASM_HAZARDS_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/stringify.h>
148c2ecf20Sopenharmony_ci#include <asm/compiler.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define ___ssnop							\
178c2ecf20Sopenharmony_ci	sll	$0, $0, 1
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define ___ehb								\
208c2ecf20Sopenharmony_ci	sll	$0, $0, 3
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/*
238c2ecf20Sopenharmony_ci * TLB hazards
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#if (defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
268c2ecf20Sopenharmony_ci     defined(CONFIG_CPU_MIPSR6)) && \
278c2ecf20Sopenharmony_ci    !defined(CONFIG_CPU_CAVIUM_OCTEON) && !defined(CONFIG_CPU_LOONGSON64)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/*
308c2ecf20Sopenharmony_ci * MIPSR2 defines ehb for hazard avoidance
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define __mtc0_tlbw_hazard						\
348c2ecf20Sopenharmony_ci	___ehb
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define __mtc0_tlbr_hazard						\
378c2ecf20Sopenharmony_ci	___ehb
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define __tlbw_use_hazard						\
408c2ecf20Sopenharmony_ci	___ehb
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define __tlb_read_hazard						\
438c2ecf20Sopenharmony_ci	___ehb
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define __tlb_probe_hazard						\
468c2ecf20Sopenharmony_ci	___ehb
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define __irq_enable_hazard						\
498c2ecf20Sopenharmony_ci	___ehb
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define __irq_disable_hazard						\
528c2ecf20Sopenharmony_ci	___ehb
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define __back_to_back_c0_hazard					\
558c2ecf20Sopenharmony_ci	___ehb
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/*
588c2ecf20Sopenharmony_ci * gcc has a tradition of misscompiling the previous construct using the
598c2ecf20Sopenharmony_ci * address of a label as argument to inline assembler.	Gas otoh has the
608c2ecf20Sopenharmony_ci * annoying difference between la and dla which are only usable for 32-bit
618c2ecf20Sopenharmony_ci * rsp. 64-bit code, so can't be used without conditional compilation.
628c2ecf20Sopenharmony_ci * The alternative is switching the assembler to 64-bit code which happens
638c2ecf20Sopenharmony_ci * to work right even for 32-bit code...
648c2ecf20Sopenharmony_ci */
658c2ecf20Sopenharmony_ci#define instruction_hazard()						\
668c2ecf20Sopenharmony_cido {									\
678c2ecf20Sopenharmony_ci	unsigned long tmp;						\
688c2ecf20Sopenharmony_ci									\
698c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
708c2ecf20Sopenharmony_ci	"	.set	push					\n"	\
718c2ecf20Sopenharmony_ci	"	.set "MIPS_ISA_LEVEL"				\n"	\
728c2ecf20Sopenharmony_ci	"	dla	%0, 1f					\n"	\
738c2ecf20Sopenharmony_ci	"	jr.hb	%0					\n"	\
748c2ecf20Sopenharmony_ci	"	.set	pop					\n"	\
758c2ecf20Sopenharmony_ci	"1:							\n"	\
768c2ecf20Sopenharmony_ci	: "=r" (tmp));							\
778c2ecf20Sopenharmony_ci} while (0)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#elif (defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MIPS_ALCHEMY)) || \
808c2ecf20Sopenharmony_ci	defined(CONFIG_CPU_BMIPS)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/*
838c2ecf20Sopenharmony_ci * These are slightly complicated by the fact that we guarantee R1 kernels to
848c2ecf20Sopenharmony_ci * run fine on R2 processors.
858c2ecf20Sopenharmony_ci */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define __mtc0_tlbw_hazard						\
888c2ecf20Sopenharmony_ci	___ssnop;							\
898c2ecf20Sopenharmony_ci	___ssnop;							\
908c2ecf20Sopenharmony_ci	___ehb
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define __mtc0_tlbr_hazard						\
938c2ecf20Sopenharmony_ci	___ssnop;							\
948c2ecf20Sopenharmony_ci	___ssnop;							\
958c2ecf20Sopenharmony_ci	___ehb
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define __tlbw_use_hazard						\
988c2ecf20Sopenharmony_ci	___ssnop;							\
998c2ecf20Sopenharmony_ci	___ssnop;							\
1008c2ecf20Sopenharmony_ci	___ssnop;							\
1018c2ecf20Sopenharmony_ci	___ehb
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define __tlb_read_hazard						\
1048c2ecf20Sopenharmony_ci	___ssnop;							\
1058c2ecf20Sopenharmony_ci	___ssnop;							\
1068c2ecf20Sopenharmony_ci	___ssnop;							\
1078c2ecf20Sopenharmony_ci	___ehb
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define __tlb_probe_hazard						\
1108c2ecf20Sopenharmony_ci	___ssnop;							\
1118c2ecf20Sopenharmony_ci	___ssnop;							\
1128c2ecf20Sopenharmony_ci	___ssnop;							\
1138c2ecf20Sopenharmony_ci	___ehb
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define __irq_enable_hazard						\
1168c2ecf20Sopenharmony_ci	___ssnop;							\
1178c2ecf20Sopenharmony_ci	___ssnop;							\
1188c2ecf20Sopenharmony_ci	___ssnop;							\
1198c2ecf20Sopenharmony_ci	___ehb
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define __irq_disable_hazard						\
1228c2ecf20Sopenharmony_ci	___ssnop;							\
1238c2ecf20Sopenharmony_ci	___ssnop;							\
1248c2ecf20Sopenharmony_ci	___ssnop;							\
1258c2ecf20Sopenharmony_ci	___ehb
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define __back_to_back_c0_hazard					\
1288c2ecf20Sopenharmony_ci	___ssnop;							\
1298c2ecf20Sopenharmony_ci	___ssnop;							\
1308c2ecf20Sopenharmony_ci	___ssnop;							\
1318c2ecf20Sopenharmony_ci	___ehb
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci * gcc has a tradition of misscompiling the previous construct using the
1358c2ecf20Sopenharmony_ci * address of a label as argument to inline assembler.	Gas otoh has the
1368c2ecf20Sopenharmony_ci * annoying difference between la and dla which are only usable for 32-bit
1378c2ecf20Sopenharmony_ci * rsp. 64-bit code, so can't be used without conditional compilation.
1388c2ecf20Sopenharmony_ci * The alternative is switching the assembler to 64-bit code which happens
1398c2ecf20Sopenharmony_ci * to work right even for 32-bit code...
1408c2ecf20Sopenharmony_ci */
1418c2ecf20Sopenharmony_ci#define __instruction_hazard()						\
1428c2ecf20Sopenharmony_cido {									\
1438c2ecf20Sopenharmony_ci	unsigned long tmp;						\
1448c2ecf20Sopenharmony_ci									\
1458c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
1468c2ecf20Sopenharmony_ci	"	.set	push					\n"	\
1478c2ecf20Sopenharmony_ci	"	.set	mips64r2				\n"	\
1488c2ecf20Sopenharmony_ci	"	dla	%0, 1f					\n"	\
1498c2ecf20Sopenharmony_ci	"	jr.hb	%0					\n"	\
1508c2ecf20Sopenharmony_ci	"	.set	pop					\n"	\
1518c2ecf20Sopenharmony_ci	"1:							\n"	\
1528c2ecf20Sopenharmony_ci	: "=r" (tmp));							\
1538c2ecf20Sopenharmony_ci} while (0)
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define instruction_hazard()						\
1568c2ecf20Sopenharmony_cido {									\
1578c2ecf20Sopenharmony_ci	if (cpu_has_mips_r2_r6)						\
1588c2ecf20Sopenharmony_ci		__instruction_hazard();					\
1598c2ecf20Sopenharmony_ci} while (0)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
1628c2ecf20Sopenharmony_ci	defined(CONFIG_CPU_LOONGSON2EF) || defined(CONFIG_CPU_LOONGSON64) || \
1638c2ecf20Sopenharmony_ci	defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_XLR)
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/*
1668c2ecf20Sopenharmony_ci * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
1678c2ecf20Sopenharmony_ci */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define __mtc0_tlbw_hazard
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci#define __mtc0_tlbr_hazard
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci#define __tlbw_use_hazard
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define __tlb_read_hazard
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define __tlb_probe_hazard
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define __irq_enable_hazard
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#define __irq_disable_hazard
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define __back_to_back_c0_hazard
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#define instruction_hazard() do { } while (0)
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci#elif defined(CONFIG_CPU_SB1)
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/*
1908c2ecf20Sopenharmony_ci * Mostly like R4000 for historic reasons
1918c2ecf20Sopenharmony_ci */
1928c2ecf20Sopenharmony_ci#define __mtc0_tlbw_hazard
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define __mtc0_tlbr_hazard
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define __tlbw_use_hazard
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define __tlb_read_hazard
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define __tlb_probe_hazard
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#define __irq_enable_hazard
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define __irq_disable_hazard						\
2058c2ecf20Sopenharmony_ci	___ssnop;							\
2068c2ecf20Sopenharmony_ci	___ssnop;							\
2078c2ecf20Sopenharmony_ci	___ssnop
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define __back_to_back_c0_hazard
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci#define instruction_hazard() do { } while (0)
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci#else
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/*
2168c2ecf20Sopenharmony_ci * Finally the catchall case for all other processors including R4000, R4400,
2178c2ecf20Sopenharmony_ci * R4600, R4700, R5000, RM7000, NEC VR41xx etc.
2188c2ecf20Sopenharmony_ci *
2198c2ecf20Sopenharmony_ci * The taken branch will result in a two cycle penalty for the two killed
2208c2ecf20Sopenharmony_ci * instructions on R4000 / R4400.  Other processors only have a single cycle
2218c2ecf20Sopenharmony_ci * hazard so this is nice trick to have an optimal code for a range of
2228c2ecf20Sopenharmony_ci * processors.
2238c2ecf20Sopenharmony_ci */
2248c2ecf20Sopenharmony_ci#define __mtc0_tlbw_hazard						\
2258c2ecf20Sopenharmony_ci	nop;								\
2268c2ecf20Sopenharmony_ci	nop
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define __mtc0_tlbr_hazard						\
2298c2ecf20Sopenharmony_ci	nop;								\
2308c2ecf20Sopenharmony_ci	nop
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci#define __tlbw_use_hazard						\
2338c2ecf20Sopenharmony_ci	nop;								\
2348c2ecf20Sopenharmony_ci	nop;								\
2358c2ecf20Sopenharmony_ci	nop
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci#define __tlb_read_hazard						\
2388c2ecf20Sopenharmony_ci	nop;								\
2398c2ecf20Sopenharmony_ci	nop;								\
2408c2ecf20Sopenharmony_ci	nop
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci#define __tlb_probe_hazard						\
2438c2ecf20Sopenharmony_ci	nop;								\
2448c2ecf20Sopenharmony_ci	nop;								\
2458c2ecf20Sopenharmony_ci	nop
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci#define __irq_enable_hazard						\
2488c2ecf20Sopenharmony_ci	___ssnop;							\
2498c2ecf20Sopenharmony_ci	___ssnop;							\
2508c2ecf20Sopenharmony_ci	___ssnop
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci#define __irq_disable_hazard						\
2538c2ecf20Sopenharmony_ci	nop;								\
2548c2ecf20Sopenharmony_ci	nop;								\
2558c2ecf20Sopenharmony_ci	nop
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci#define __back_to_back_c0_hazard					\
2588c2ecf20Sopenharmony_ci	___ssnop;							\
2598c2ecf20Sopenharmony_ci	___ssnop;							\
2608c2ecf20Sopenharmony_ci	___ssnop
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci#define instruction_hazard() do { } while (0)
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#endif
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci/* FPU hazards */
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#if defined(CONFIG_CPU_SB1)
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci#define __enable_fpu_hazard						\
2728c2ecf20Sopenharmony_ci	.set	push;							\
2738c2ecf20Sopenharmony_ci	.set	mips64;							\
2748c2ecf20Sopenharmony_ci	.set	noreorder;						\
2758c2ecf20Sopenharmony_ci	___ssnop;							\
2768c2ecf20Sopenharmony_ci	bnezl	$0, .+4;						\
2778c2ecf20Sopenharmony_ci	___ssnop;							\
2788c2ecf20Sopenharmony_ci	.set	pop
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci#define __disable_fpu_hazard
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#elif defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
2838c2ecf20Sopenharmony_ci      defined(CONFIG_CPU_MIPSR6)
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci#define __enable_fpu_hazard						\
2868c2ecf20Sopenharmony_ci	___ehb
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci#define __disable_fpu_hazard						\
2898c2ecf20Sopenharmony_ci	___ehb
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci#else
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci#define __enable_fpu_hazard						\
2948c2ecf20Sopenharmony_ci	nop;								\
2958c2ecf20Sopenharmony_ci	nop;								\
2968c2ecf20Sopenharmony_ci	nop;								\
2978c2ecf20Sopenharmony_ci	nop
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci#define __disable_fpu_hazard						\
3008c2ecf20Sopenharmony_ci	___ehb
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci#endif
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci#define _ssnop ___ssnop
3078c2ecf20Sopenharmony_ci#define	_ehb ___ehb
3088c2ecf20Sopenharmony_ci#define mtc0_tlbw_hazard __mtc0_tlbw_hazard
3098c2ecf20Sopenharmony_ci#define mtc0_tlbr_hazard __mtc0_tlbr_hazard
3108c2ecf20Sopenharmony_ci#define tlbw_use_hazard __tlbw_use_hazard
3118c2ecf20Sopenharmony_ci#define tlb_read_hazard __tlb_read_hazard
3128c2ecf20Sopenharmony_ci#define tlb_probe_hazard __tlb_probe_hazard
3138c2ecf20Sopenharmony_ci#define irq_enable_hazard __irq_enable_hazard
3148c2ecf20Sopenharmony_ci#define irq_disable_hazard __irq_disable_hazard
3158c2ecf20Sopenharmony_ci#define back_to_back_c0_hazard __back_to_back_c0_hazard
3168c2ecf20Sopenharmony_ci#define enable_fpu_hazard __enable_fpu_hazard
3178c2ecf20Sopenharmony_ci#define disable_fpu_hazard __disable_fpu_hazard
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#else
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci#define _ssnop()							\
3228c2ecf20Sopenharmony_cido {									\
3238c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3248c2ecf20Sopenharmony_ci	__stringify(___ssnop)						\
3258c2ecf20Sopenharmony_ci	);								\
3268c2ecf20Sopenharmony_ci} while (0)
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci#define	_ehb()								\
3298c2ecf20Sopenharmony_cido {									\
3308c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3318c2ecf20Sopenharmony_ci	__stringify(___ehb)						\
3328c2ecf20Sopenharmony_ci	);								\
3338c2ecf20Sopenharmony_ci} while (0)
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci#define mtc0_tlbw_hazard()						\
3378c2ecf20Sopenharmony_cido {									\
3388c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3398c2ecf20Sopenharmony_ci	__stringify(__mtc0_tlbw_hazard)					\
3408c2ecf20Sopenharmony_ci	);								\
3418c2ecf20Sopenharmony_ci} while (0)
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci#define mtc0_tlbr_hazard()						\
3458c2ecf20Sopenharmony_cido {									\
3468c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3478c2ecf20Sopenharmony_ci	__stringify(__mtc0_tlbr_hazard)					\
3488c2ecf20Sopenharmony_ci	);								\
3498c2ecf20Sopenharmony_ci} while (0)
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci#define tlbw_use_hazard()						\
3538c2ecf20Sopenharmony_cido {									\
3548c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3558c2ecf20Sopenharmony_ci	__stringify(__tlbw_use_hazard)					\
3568c2ecf20Sopenharmony_ci	);								\
3578c2ecf20Sopenharmony_ci} while (0)
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci#define tlb_read_hazard()						\
3618c2ecf20Sopenharmony_cido {									\
3628c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3638c2ecf20Sopenharmony_ci	__stringify(__tlb_read_hazard)					\
3648c2ecf20Sopenharmony_ci	);								\
3658c2ecf20Sopenharmony_ci} while (0)
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci#define tlb_probe_hazard()						\
3698c2ecf20Sopenharmony_cido {									\
3708c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3718c2ecf20Sopenharmony_ci	__stringify(__tlb_probe_hazard)					\
3728c2ecf20Sopenharmony_ci	);								\
3738c2ecf20Sopenharmony_ci} while (0)
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci#define irq_enable_hazard()						\
3778c2ecf20Sopenharmony_cido {									\
3788c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3798c2ecf20Sopenharmony_ci	__stringify(__irq_enable_hazard)				\
3808c2ecf20Sopenharmony_ci	);								\
3818c2ecf20Sopenharmony_ci} while (0)
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci#define irq_disable_hazard()						\
3858c2ecf20Sopenharmony_cido {									\
3868c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3878c2ecf20Sopenharmony_ci	__stringify(__irq_disable_hazard)				\
3888c2ecf20Sopenharmony_ci	);								\
3898c2ecf20Sopenharmony_ci} while (0)
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci#define back_to_back_c0_hazard() 					\
3938c2ecf20Sopenharmony_cido {									\
3948c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
3958c2ecf20Sopenharmony_ci	__stringify(__back_to_back_c0_hazard)				\
3968c2ecf20Sopenharmony_ci	);								\
3978c2ecf20Sopenharmony_ci} while (0)
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci#define enable_fpu_hazard()						\
4018c2ecf20Sopenharmony_cido {									\
4028c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
4038c2ecf20Sopenharmony_ci	__stringify(__enable_fpu_hazard)				\
4048c2ecf20Sopenharmony_ci	);								\
4058c2ecf20Sopenharmony_ci} while (0)
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci#define disable_fpu_hazard()						\
4098c2ecf20Sopenharmony_cido {									\
4108c2ecf20Sopenharmony_ci	__asm__ __volatile__(						\
4118c2ecf20Sopenharmony_ci	__stringify(__disable_fpu_hazard)				\
4128c2ecf20Sopenharmony_ci	);								\
4138c2ecf20Sopenharmony_ci} while (0)
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/*
4168c2ecf20Sopenharmony_ci * MIPS R2 instruction hazard barrier.   Needs to be called as a subroutine.
4178c2ecf20Sopenharmony_ci */
4188c2ecf20Sopenharmony_ciextern void mips_ihb(void);
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__  */
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci#endif /* _ASM_HAZARDS_H */
423