mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
Switch to the batched version of the jump label update functions so instruction cache maintenance is deferred until the end of the update. Signed-off-by: Youling Tang <tangyouling@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
31 lines
674 B
C
31 lines
674 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2023 Loongson Technology Corporation Limited
|
|
*
|
|
* Based on arch/arm64/kernel/jump_label.c
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/jump_label.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/inst.h>
|
|
|
|
bool arch_jump_label_transform_queue(struct jump_entry *entry, enum jump_label_type type)
|
|
{
|
|
u32 insn;
|
|
void *addr = (void *)jump_entry_code(entry);
|
|
|
|
if (type == JUMP_LABEL_JMP)
|
|
insn = larch_insn_gen_b(jump_entry_code(entry), jump_entry_target(entry));
|
|
else
|
|
insn = larch_insn_gen_nop();
|
|
|
|
larch_insn_write(addr, insn);
|
|
|
|
return true;
|
|
}
|
|
|
|
void arch_jump_label_transform_apply(void)
|
|
{
|
|
flush_icache_all();
|
|
}
|