-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'csky-for-linus-6.0-rc1' of https://github.com/c-sky/csky-l…
…inux Pull csky updates from Guo Ren: - Add jump-label implementation - Add qspinlock support - Enable ARCH_INLINE_READ*/WRITE*/SPIN* - Some fixups and a coding convention * tag 'csky-for-linus-6.0-rc1' of https://github.com/c-sky/csky-linux: csky: abiv1: Fixup compile error csky: cmpxchg: Coding convention for BUILD_BUG() csky: Enable ARCH_INLINE_READ*/WRITE*/SPIN* csky: Add qspinlock support csky: Add jump-label implementation csky: Move HEAD_TEXT_SECTION out of __init_begin-end csky: Correct position of _stext csky: Use the bitmap API to allocate bitmaps csky/kprobe: reclaim insn_slot on kprobe unregistration
- Loading branch information
Showing
14 changed files
with
211 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#ifndef __ASM_CSKY_JUMP_LABEL_H | ||
#define __ASM_CSKY_JUMP_LABEL_H | ||
|
||
#ifndef __ASSEMBLY__ | ||
|
||
#include <linux/types.h> | ||
|
||
#define JUMP_LABEL_NOP_SIZE 4 | ||
|
||
static __always_inline bool arch_static_branch(struct static_key *key, | ||
bool branch) | ||
{ | ||
asm_volatile_goto( | ||
"1: nop32 \n" | ||
" .pushsection __jump_table, \"aw\" \n" | ||
" .align 2 \n" | ||
" .long 1b - ., %l[label] - . \n" | ||
" .long %0 - . \n" | ||
" .popsection \n" | ||
: : "i"(&((char *)key)[branch]) : : label); | ||
|
||
return false; | ||
label: | ||
return true; | ||
} | ||
|
||
static __always_inline bool arch_static_branch_jump(struct static_key *key, | ||
bool branch) | ||
{ | ||
asm_volatile_goto( | ||
"1: bsr32 %l[label] \n" | ||
" .pushsection __jump_table, \"aw\" \n" | ||
" .align 2 \n" | ||
" .long 1b - ., %l[label] - . \n" | ||
" .long %0 - . \n" | ||
" .popsection \n" | ||
: : "i"(&((char *)key)[branch]) : : label); | ||
|
||
return false; | ||
label: | ||
return true; | ||
} | ||
|
||
#endif /* __ASSEMBLY__ */ | ||
#endif /* __ASM_CSKY_JUMP_LABEL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#ifndef __ASM_SECTIONS_H | ||
#define __ASM_SECTIONS_H | ||
|
||
#include <asm-generic/sections.h> | ||
|
||
extern char _start[]; | ||
|
||
#endif /* __ASM_SECTIONS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#ifndef __ASM_CSKY_SPINLOCK_H | ||
#define __ASM_CSKY_SPINLOCK_H | ||
|
||
#include <asm/qspinlock.h> | ||
#include <asm/qrwlock.h> | ||
|
||
/* See include/linux/spinlock.h */ | ||
#define smp_mb__after_spinlock() smp_mb() | ||
|
||
#endif /* __ASM_CSKY_SPINLOCK_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#ifndef __ASM_CSKY_SPINLOCK_TYPES_H | ||
#define __ASM_CSKY_SPINLOCK_TYPES_H | ||
|
||
#include <asm-generic/qspinlock_types.h> | ||
#include <asm-generic/qrwlock_types.h> | ||
|
||
#endif /* __ASM_CSKY_SPINLOCK_TYPES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
#include <linux/jump_label.h> | ||
#include <linux/kernel.h> | ||
#include <linux/memory.h> | ||
#include <linux/mutex.h> | ||
#include <linux/uaccess.h> | ||
#include <asm/cacheflush.h> | ||
|
||
#define NOP32_HI 0xc400 | ||
#define NOP32_LO 0x4820 | ||
#define BSR_LINK 0xe000 | ||
|
||
void arch_jump_label_transform(struct jump_entry *entry, | ||
enum jump_label_type type) | ||
{ | ||
unsigned long addr = jump_entry_code(entry); | ||
u16 insn[2]; | ||
int ret = 0; | ||
|
||
if (type == JUMP_LABEL_JMP) { | ||
long offset = jump_entry_target(entry) - jump_entry_code(entry); | ||
|
||
if (WARN_ON(offset & 1 || offset < -67108864 || offset >= 67108864)) | ||
return; | ||
|
||
offset = offset >> 1; | ||
|
||
insn[0] = BSR_LINK | | ||
((uint16_t)((unsigned long) offset >> 16) & 0x3ff); | ||
insn[1] = (uint16_t)((unsigned long) offset & 0xffff); | ||
} else { | ||
insn[0] = NOP32_HI; | ||
insn[1] = NOP32_LO; | ||
} | ||
|
||
ret = copy_to_kernel_nofault((void *)addr, insn, 4); | ||
WARN_ON(ret); | ||
|
||
flush_icache_range(addr, addr + 4); | ||
} | ||
|
||
void arch_jump_label_transform_static(struct jump_entry *entry, | ||
enum jump_label_type type) | ||
{ | ||
/* | ||
* We use the same instructions in the arch_static_branch and | ||
* arch_static_branch_jump inline functions, so there's no | ||
* need to patch them up here. | ||
* The core will call arch_jump_label_transform when those | ||
* instructions need to be replaced. | ||
*/ | ||
arch_jump_label_transform(entry, type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters