mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 03:55:32 +07:00
55dd0df781
Wrap asm/jump_label.h for all archs with #ifndef __ASSEMBLY__. Since these are kernel only headers, we don't need #ifdef __KERNEL__ so can simplify things a bit. If an architecture wants to use jump labels in assembly, it will still need to define a macro to create the __jump_table entries (see ARCH_STATIC_BRANCH in the powerpc asm/jump_label.h for an example). Signed-off-by: Anton Blanchard <anton@samba.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: benh@kernel.crashing.org Cc: catalin.marinas@arm.com Cc: davem@davemloft.net Cc: heiko.carstens@de.ibm.com Cc: jbaron@akamai.com Cc: linux@arm.linux.org.uk Cc: linuxppc-dev@lists.ozlabs.org Cc: liuj97@gmail.com Cc: mgorman@suse.de Cc: mmarek@suse.cz Cc: mpe@ellerman.id.au Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: rostedt@goodmis.org Cc: schwidefsky@de.ibm.com Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/1428551492-21977-1-git-send-email-anton@samba.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
46 lines
938 B
C
46 lines
938 B
C
#ifndef _ASM_S390_JUMP_LABEL_H
|
|
#define _ASM_S390_JUMP_LABEL_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define JUMP_LABEL_NOP_SIZE 6
|
|
#define JUMP_LABEL_NOP_OFFSET 2
|
|
|
|
#ifdef CONFIG_64BIT
|
|
#define ASM_PTR ".quad"
|
|
#define ASM_ALIGN ".balign 8"
|
|
#else
|
|
#define ASM_PTR ".long"
|
|
#define ASM_ALIGN ".balign 4"
|
|
#endif
|
|
|
|
/*
|
|
* We use a brcl 0,2 instruction for jump labels at compile time so it
|
|
* can be easily distinguished from a hotpatch generated instruction.
|
|
*/
|
|
static __always_inline bool arch_static_branch(struct static_key *key)
|
|
{
|
|
asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
|
|
".pushsection __jump_table, \"aw\"\n"
|
|
ASM_ALIGN "\n"
|
|
ASM_PTR " 0b, %l[label], %0\n"
|
|
".popsection\n"
|
|
: : "X" (key) : : label);
|
|
return false;
|
|
label:
|
|
return true;
|
|
}
|
|
|
|
typedef unsigned long jump_label_t;
|
|
|
|
struct jump_entry {
|
|
jump_label_t code;
|
|
jump_label_t target;
|
|
jump_label_t key;
|
|
};
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif
|