Skip to content

Commit d23b779

Browse files
committed
LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE
LoongArch has hardware page coloring for L1 Cache, so we don't have cache aliases. But SFB (Store Fill Buffer) still has aliases. So we define SHMLBA to SZ_64K previously. But there are losts of applications use PAGE_SIZE rather than SHMLBA to mmap() file pages and shared pages. Of course we can fix them one by one, but not easy. On the other hand, we can simply disable SFB for 4KB page size to fix cache alias (there will be performance decrease, but acceptable), and in future we will fix SFB in hardware. So we can safely define SHMLBA to PAGE_SIZE (use the generic shmparam.h) to make life easier. Signed-off-by: Huacai Chen <[email protected]>
1 parent 9499dae commit d23b779

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

arch/loongarch/include/asm/shmparam.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

arch/loongarch/kernel/head.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ SYM_CODE_START(kernel_entry) # kernel entry point
7575
la.pcrel t0, fw_arg2
7676
st.d a2, t0, 0
7777

78+
#ifdef CONFIG_PAGE_SIZE_4KB
79+
li.d t0, 0
80+
li.d t1, CSR_STFILL
81+
csrxchg t0, t1, LOONGARCH_CSR_IMPCTL1
82+
#endif
7883
/* KSave3 used for percpu base, initialized as 0 */
7984
csrwr zero, PERCPU_BASE_KS
8085
/* GPR21 used for percpu base (runtime), initialized as 0 */
@@ -127,6 +132,11 @@ SYM_CODE_START(smpboot_entry)
127132

128133
JUMP_VIRT_ADDR t0, t1
129134

135+
#ifdef CONFIG_PAGE_SIZE_4KB
136+
li.d t0, 0
137+
li.d t1, CSR_STFILL
138+
csrxchg t0, t1, LOONGARCH_CSR_IMPCTL1
139+
#endif
130140
/* Enable PG */
131141
li.w t0, 0xb0 # PLV=0, IE=0, PG=1
132142
csrwr t0, LOONGARCH_CSR_CRMD

0 commit comments

Comments
 (0)