2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00

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: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10078/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
James Hogan 2015-05-19 09:50:30 +01:00 committed by Ralf Baechle
parent d1e9a4f547
commit e50f0e3135

View File

@ -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__( \