Commit e50f0e31 authored by James Hogan's avatar James Hogan Committed by Ralf Baechle

MIPS: hazards: Add hazard macros for tlb read

Add hazard macros to <asm/hazards.h> for the following hazards around
tlbr (TLB read) instructions, which are used in TLB dumping code and
some KVM TLB management code:

- mtc0_tlbr_hazard
  Between mtc0 (Index) and tlbr. This is copied from mtc0_tlbw_hazard in
  all cases on the assumption that tlbr always has similar data user
  timings to tlbw.

- tlb_read_hazard
  Between tlbr and mfc0 (various TLB registers). This is copied from
  tlbw_use_hazard in all cases on the assumption that tlbr has similar
  data writer characteristics to tlbw, and mfc0 has similar data user
  characteristics to loads and stores.
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10078/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent d1e9a4f5
......@@ -31,9 +31,15 @@
#define __mtc0_tlbw_hazard \
___ehb
#define __mtc0_tlbr_hazard \
___ehb
#define __tlbw_use_hazard \
___ehb
#define __tlb_read_hazard \
___ehb
#define __tlb_probe_hazard \
___ehb
......@@ -80,12 +86,23 @@ do { \
___ssnop; \
___ehb
#define __mtc0_tlbr_hazard \
___ssnop; \
___ssnop; \
___ehb
#define __tlbw_use_hazard \
___ssnop; \
___ssnop; \
___ssnop; \
___ehb
#define __tlb_read_hazard \
___ssnop; \
___ssnop; \
___ssnop; \
___ehb
#define __tlb_probe_hazard \
___ssnop; \
___ssnop; \
......@@ -147,8 +164,12 @@ do { \
#define __mtc0_tlbw_hazard
#define __mtc0_tlbr_hazard
#define __tlbw_use_hazard
#define __tlb_read_hazard
#define __tlb_probe_hazard
#define __irq_enable_hazard
......@@ -166,8 +187,12 @@ do { \
*/
#define __mtc0_tlbw_hazard
#define __mtc0_tlbr_hazard
#define __tlbw_use_hazard
#define __tlb_read_hazard
#define __tlb_probe_hazard
#define __irq_enable_hazard
......@@ -196,11 +221,20 @@ do { \
nop; \
nop
#define __mtc0_tlbr_hazard \
nop; \
nop
#define __tlbw_use_hazard \
nop; \
nop; \
nop
#define __tlb_read_hazard \
nop; \
nop; \
nop
#define __tlb_probe_hazard \
nop; \
nop; \
......@@ -267,7 +301,9 @@ do { \
#define _ssnop ___ssnop
#define _ehb ___ehb
#define mtc0_tlbw_hazard __mtc0_tlbw_hazard
#define mtc0_tlbr_hazard __mtc0_tlbr_hazard
#define tlbw_use_hazard __tlbw_use_hazard
#define tlb_read_hazard __tlb_read_hazard
#define tlb_probe_hazard __tlb_probe_hazard
#define irq_enable_hazard __irq_enable_hazard
#define irq_disable_hazard __irq_disable_hazard
......@@ -300,6 +336,14 @@ do { \
} while (0)
#define mtc0_tlbr_hazard() \
do { \
__asm__ __volatile__( \
__stringify(__mtc0_tlbr_hazard) \
); \
} while (0)
#define tlbw_use_hazard() \
do { \
__asm__ __volatile__( \
......@@ -308,6 +352,14 @@ do { \
} while (0)
#define tlb_read_hazard() \
do { \
__asm__ __volatile__( \
__stringify(__tlb_read_hazard) \
); \
} while (0)
#define tlb_probe_hazard() \
do { \
__asm__ __volatile__( \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment