Skip to content

Commit

Permalink
Ugly workarounds for Loongson-3
Browse files Browse the repository at this point in the history
1, Remove redundant sync in llsc;
2, Use synci as smp_llsc_mb() for new Loongson-3.
  • Loading branch information
Si Zhiying authored and chenhuacai committed Sep 9, 2018
1 parent 96d9f67 commit 40fb233
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/mips/include/asm/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@
#define __WAR_LLSC_MB " \n"
#endif

#ifndef CONFIG_LOONGSON3_ENHANCEMENT
#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
#else
#define smp_llsc_mb() __asm__ __volatile__(".set mips64r2\n synci 0\n .set mips0\n" : : :"memory")
#endif

#ifdef CONFIG_CPU_CAVIUM_OCTEON
#define smp_mb__before_llsc() smp_wmb()
Expand Down
3 changes: 3 additions & 0 deletions arch/mips/loongson64/Platform
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap
ifneq ($(call as-option,-Wa$(comma)-mfix-loongson3-llsc,),)
cflags-$(CONFIG_CPU_LOONGSON3) += -Wa$(comma)-mno-fix-loongson3-llsc
endif
ifneq ($(call as-option,-Wa$(comma)-mfix-ls3a-llsc,),)
cflags-$(CONFIG_CPU_LOONGSON3) += -Wa$(comma)-mnofix-ls3a-llsc
endif
#
# binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a
# as MIPS64 R2; older versions as just R1. This leaves the possibility open
Expand Down

0 comments on commit 40fb233

Please sign in to comment.