mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
LoongArch fixes for v6.6-rc7
-----BEGIN PGP SIGNATURE----- iQJKBAABCAA0FiEEzOlt8mkP+tbeiYy5AoYrw/LiJnoFAmUwqw8WHGNoZW5odWFj YWlAa2VybmVsLm9yZwAKCRAChivD8uImeu57EACCgpJMG4fO+aVb6jQRdHmwny2K SIfcYoLi7wu7UGqP5SXJANsYwh1JXyCdi8m6jmCxfyVzu/JkmszG0W8eJBgrBrra sqKE83dpti+v7G7GmB2dmAYxnkbdwDCaI0cnIsOaSOen0gYu5zQ9ImUhVyNrIgTS xyf60kLqmJ1VSlFUCB5ju2zz3+oN6nlBWvItI6kpWnsU6f5BnT61eWFEmQl9N5Q5 pFG4k3AUN7+Ppw3qtlWmj0YjXMkrefK3ffDXmpE5UUmdbqxTiCiOliZymhtgo04s mAvUS9gzJskGhith1+3WcNpQUn/Whtll7eteiYP0eM2kfe9MLehNSYdSfrH0V3IZ EThmiz2q+xwPERnxSSBLLBnWABZwOo0ENjb2F/lgpsBuMyVgzR+C/EmF8DWkkCqg O/GoQrbI+GXWX+gv+js9W4XoDhUKVwcfePqMX+dONgOBB8F8pFd1d/gL1Hcbt2HC P1rLNkH2CN49mCfuCWQAA/KsgTeTMfu/spRRIKJ4Fl7uTWcjZabqTujX/iAAgFD1 mR/l73Fz2nH9WKH7Uq47XlvSQGCAOf0uez3BYjjRPpzkJh2NNS/QhxJRROXogTne foSzN0qVGzNr1Z98Iyv9JSEQvY1MzB+rVuZJwN0Z05+4CFtqAFN10+FT7Cp8XE1S JsETlmF/dGagDprLyg== =RreE -----END PGP SIGNATURE----- Merge tag 'loongarch-fixes-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson Pull LoongArch fixes from Huacai ChenL "Fix 4-level pagetable building, disable WUC for pgprot_writecombine() like ioremap_wc(), use correct annotation for exception handlers, and a trivial cleanup" * tag 'loongarch-fixes-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: Disable WUC for pgprot_writecombine() like ioremap_wc() LoongArch: Replace kmap_atomic() with kmap_local_page() in copy_user_highpage() LoongArch: Export symbol invalid_pud_table for modules building LoongArch: Use SYM_CODE_* to annotate exception handlers
This commit is contained in:
commit
74e9347ebc
@ -52,10 +52,9 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
|
||||
* @offset: bus address of the memory
|
||||
* @size: size of the resource to map
|
||||
*/
|
||||
extern pgprot_t pgprot_wc;
|
||||
|
||||
#define ioremap_wc(offset, size) \
|
||||
ioremap_prot((offset), (size), pgprot_val(pgprot_wc))
|
||||
ioremap_prot((offset), (size), \
|
||||
pgprot_val(wc_enabled ? PAGE_KERNEL_WUC : PAGE_KERNEL_SUC))
|
||||
|
||||
#define ioremap_cache(offset, size) \
|
||||
ioremap_prot((offset), (size), pgprot_val(PAGE_KERNEL))
|
||||
|
@ -33,4 +33,12 @@
|
||||
.cfi_endproc; \
|
||||
SYM_END(name, SYM_T_FUNC)
|
||||
|
||||
#define SYM_CODE_START(name) \
|
||||
SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \
|
||||
.cfi_startproc;
|
||||
|
||||
#define SYM_CODE_END(name) \
|
||||
.cfi_endproc; \
|
||||
SYM_END(name, SYM_T_NONE)
|
||||
|
||||
#endif
|
||||
|
@ -105,13 +105,15 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
|
||||
return __pgprot(prot);
|
||||
}
|
||||
|
||||
extern bool wc_enabled;
|
||||
|
||||
#define pgprot_writecombine pgprot_writecombine
|
||||
|
||||
static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
|
||||
{
|
||||
unsigned long prot = pgprot_val(_prot);
|
||||
|
||||
prot = (prot & ~_CACHE_MASK) | _CACHE_WUC;
|
||||
prot = (prot & ~_CACHE_MASK) | (wc_enabled ? _CACHE_WUC : _CACHE_SUC);
|
||||
|
||||
return __pgprot(prot);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
.text
|
||||
.cfi_sections .debug_frame
|
||||
.align 5
|
||||
SYM_FUNC_START(handle_syscall)
|
||||
SYM_CODE_START(handle_syscall)
|
||||
csrrd t0, PERCPU_BASE_KS
|
||||
la.pcrel t1, kernelsp
|
||||
add.d t1, t1, t0
|
||||
@ -71,7 +71,7 @@ SYM_FUNC_START(handle_syscall)
|
||||
bl do_syscall
|
||||
|
||||
RESTORE_ALL_AND_RET
|
||||
SYM_FUNC_END(handle_syscall)
|
||||
SYM_CODE_END(handle_syscall)
|
||||
_ASM_NOKPROBE(handle_syscall)
|
||||
|
||||
SYM_CODE_START(ret_from_fork)
|
||||
|
@ -31,7 +31,7 @@ SYM_FUNC_START(__arch_cpu_idle)
|
||||
1: jr ra
|
||||
SYM_FUNC_END(__arch_cpu_idle)
|
||||
|
||||
SYM_FUNC_START(handle_vint)
|
||||
SYM_CODE_START(handle_vint)
|
||||
BACKUP_T0T1
|
||||
SAVE_ALL
|
||||
la_abs t1, __arch_cpu_idle
|
||||
@ -46,11 +46,11 @@ SYM_FUNC_START(handle_vint)
|
||||
la_abs t0, do_vint
|
||||
jirl ra, t0, 0
|
||||
RESTORE_ALL_AND_RET
|
||||
SYM_FUNC_END(handle_vint)
|
||||
SYM_CODE_END(handle_vint)
|
||||
|
||||
SYM_FUNC_START(except_vec_cex)
|
||||
SYM_CODE_START(except_vec_cex)
|
||||
b cache_parity_error
|
||||
SYM_FUNC_END(except_vec_cex)
|
||||
SYM_CODE_END(except_vec_cex)
|
||||
|
||||
.macro build_prep_badv
|
||||
csrrd t0, LOONGARCH_CSR_BADV
|
||||
@ -66,7 +66,7 @@ SYM_FUNC_END(except_vec_cex)
|
||||
|
||||
.macro BUILD_HANDLER exception handler prep
|
||||
.align 5
|
||||
SYM_FUNC_START(handle_\exception)
|
||||
SYM_CODE_START(handle_\exception)
|
||||
666:
|
||||
BACKUP_T0T1
|
||||
SAVE_ALL
|
||||
@ -76,7 +76,7 @@ SYM_FUNC_END(except_vec_cex)
|
||||
jirl ra, t0, 0
|
||||
668:
|
||||
RESTORE_ALL_AND_RET
|
||||
SYM_FUNC_END(handle_\exception)
|
||||
SYM_CODE_END(handle_\exception)
|
||||
SYM_DATA(unwind_hint_\exception, .word 668b - 666b)
|
||||
.endm
|
||||
|
||||
@ -93,7 +93,7 @@ SYM_FUNC_END(except_vec_cex)
|
||||
BUILD_HANDLER watch watch none
|
||||
BUILD_HANDLER reserved reserved none /* others */
|
||||
|
||||
SYM_FUNC_START(handle_sys)
|
||||
SYM_CODE_START(handle_sys)
|
||||
la_abs t0, handle_syscall
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_sys)
|
||||
SYM_CODE_END(handle_sys)
|
||||
|
@ -161,19 +161,19 @@ static void __init smbios_parse(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_WRITECOMBINE
|
||||
pgprot_t pgprot_wc = PAGE_KERNEL_WUC;
|
||||
bool wc_enabled = true;
|
||||
#else
|
||||
pgprot_t pgprot_wc = PAGE_KERNEL_SUC;
|
||||
bool wc_enabled = false;
|
||||
#endif
|
||||
|
||||
EXPORT_SYMBOL(pgprot_wc);
|
||||
EXPORT_SYMBOL(wc_enabled);
|
||||
|
||||
static int __init setup_writecombine(char *p)
|
||||
{
|
||||
if (!strcmp(p, "on"))
|
||||
pgprot_wc = PAGE_KERNEL_WUC;
|
||||
wc_enabled = true;
|
||||
else if (!strcmp(p, "off"))
|
||||
pgprot_wc = PAGE_KERNEL_SUC;
|
||||
wc_enabled = false;
|
||||
else
|
||||
pr_warn("Unknown writecombine setting \"%s\".\n", p);
|
||||
|
||||
|
@ -43,11 +43,11 @@ void copy_user_highpage(struct page *to, struct page *from,
|
||||
{
|
||||
void *vfrom, *vto;
|
||||
|
||||
vto = kmap_atomic(to);
|
||||
vfrom = kmap_atomic(from);
|
||||
vfrom = kmap_local_page(from);
|
||||
vto = kmap_local_page(to);
|
||||
copy_page(vto, vfrom);
|
||||
kunmap_atomic(vfrom);
|
||||
kunmap_atomic(vto);
|
||||
kunmap_local(vfrom);
|
||||
kunmap_local(vto);
|
||||
/* Make sure this page is cleared on other CPU's too before using it */
|
||||
smp_wmb();
|
||||
}
|
||||
@ -240,6 +240,7 @@ pgd_t swapper_pg_dir[_PTRS_PER_PGD] __section(".bss..swapper_pg_dir");
|
||||
pgd_t invalid_pg_dir[_PTRS_PER_PGD] __page_aligned_bss;
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
pud_t invalid_pud_table[PTRS_PER_PUD] __page_aligned_bss;
|
||||
EXPORT_SYMBOL(invalid_pud_table);
|
||||
#endif
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define PTRS_PER_PTE_BITS (PAGE_SHIFT - 3)
|
||||
|
||||
.macro tlb_do_page_fault, write
|
||||
SYM_FUNC_START(tlb_do_page_fault_\write)
|
||||
SYM_CODE_START(tlb_do_page_fault_\write)
|
||||
SAVE_ALL
|
||||
csrrd a2, LOONGARCH_CSR_BADV
|
||||
move a0, sp
|
||||
@ -25,13 +25,13 @@
|
||||
li.w a1, \write
|
||||
bl do_page_fault
|
||||
RESTORE_ALL_AND_RET
|
||||
SYM_FUNC_END(tlb_do_page_fault_\write)
|
||||
SYM_CODE_END(tlb_do_page_fault_\write)
|
||||
.endm
|
||||
|
||||
tlb_do_page_fault 0
|
||||
tlb_do_page_fault 1
|
||||
|
||||
SYM_FUNC_START(handle_tlb_protect)
|
||||
SYM_CODE_START(handle_tlb_protect)
|
||||
BACKUP_T0T1
|
||||
SAVE_ALL
|
||||
move a0, sp
|
||||
@ -41,9 +41,9 @@ SYM_FUNC_START(handle_tlb_protect)
|
||||
la_abs t0, do_page_fault
|
||||
jirl ra, t0, 0
|
||||
RESTORE_ALL_AND_RET
|
||||
SYM_FUNC_END(handle_tlb_protect)
|
||||
SYM_CODE_END(handle_tlb_protect)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_load)
|
||||
SYM_CODE_START(handle_tlb_load)
|
||||
csrwr t0, EXCEPTION_KS0
|
||||
csrwr t1, EXCEPTION_KS1
|
||||
csrwr ra, EXCEPTION_KS2
|
||||
@ -187,16 +187,16 @@ nopage_tlb_load:
|
||||
csrrd ra, EXCEPTION_KS2
|
||||
la_abs t0, tlb_do_page_fault_0
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_load)
|
||||
SYM_CODE_END(handle_tlb_load)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_load_ptw)
|
||||
SYM_CODE_START(handle_tlb_load_ptw)
|
||||
csrwr t0, LOONGARCH_CSR_KS0
|
||||
csrwr t1, LOONGARCH_CSR_KS1
|
||||
la_abs t0, tlb_do_page_fault_0
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_load_ptw)
|
||||
SYM_CODE_END(handle_tlb_load_ptw)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_store)
|
||||
SYM_CODE_START(handle_tlb_store)
|
||||
csrwr t0, EXCEPTION_KS0
|
||||
csrwr t1, EXCEPTION_KS1
|
||||
csrwr ra, EXCEPTION_KS2
|
||||
@ -343,16 +343,16 @@ nopage_tlb_store:
|
||||
csrrd ra, EXCEPTION_KS2
|
||||
la_abs t0, tlb_do_page_fault_1
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_store)
|
||||
SYM_CODE_END(handle_tlb_store)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_store_ptw)
|
||||
SYM_CODE_START(handle_tlb_store_ptw)
|
||||
csrwr t0, LOONGARCH_CSR_KS0
|
||||
csrwr t1, LOONGARCH_CSR_KS1
|
||||
la_abs t0, tlb_do_page_fault_1
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_store_ptw)
|
||||
SYM_CODE_END(handle_tlb_store_ptw)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_modify)
|
||||
SYM_CODE_START(handle_tlb_modify)
|
||||
csrwr t0, EXCEPTION_KS0
|
||||
csrwr t1, EXCEPTION_KS1
|
||||
csrwr ra, EXCEPTION_KS2
|
||||
@ -497,16 +497,16 @@ nopage_tlb_modify:
|
||||
csrrd ra, EXCEPTION_KS2
|
||||
la_abs t0, tlb_do_page_fault_1
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_modify)
|
||||
SYM_CODE_END(handle_tlb_modify)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_modify_ptw)
|
||||
SYM_CODE_START(handle_tlb_modify_ptw)
|
||||
csrwr t0, LOONGARCH_CSR_KS0
|
||||
csrwr t1, LOONGARCH_CSR_KS1
|
||||
la_abs t0, tlb_do_page_fault_1
|
||||
jr t0
|
||||
SYM_FUNC_END(handle_tlb_modify_ptw)
|
||||
SYM_CODE_END(handle_tlb_modify_ptw)
|
||||
|
||||
SYM_FUNC_START(handle_tlb_refill)
|
||||
SYM_CODE_START(handle_tlb_refill)
|
||||
csrwr t0, LOONGARCH_CSR_TLBRSAVE
|
||||
csrrd t0, LOONGARCH_CSR_PGD
|
||||
lddir t0, t0, 3
|
||||
@ -521,4 +521,4 @@ SYM_FUNC_START(handle_tlb_refill)
|
||||
tlbfill
|
||||
csrrd t0, LOONGARCH_CSR_TLBRSAVE
|
||||
ertn
|
||||
SYM_FUNC_END(handle_tlb_refill)
|
||||
SYM_CODE_END(handle_tlb_refill)
|
||||
|
Loading…
Reference in New Issue
Block a user