-
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 'riscv-for-linus-6.8-mw4' of git://git.kernel.org/pub/scm/l…
…inux/kernel/git/riscv/linux Pull more RISC-V updates from Palmer Dabbelt: - Support for tuning for systems with fast misaligned accesses. - Support for SBI-based suspend. - Support for the new SBI debug console extension. - The T-Head CMOs now use PA-based flushes. - Support for enabling the V extension in kernel code. - Optimized IP checksum routines. - Various ftrace improvements. - Support for archrandom, which depends on the Zkr extension. - The build is no longer broken under NET=n, KUNIT=y for ports that don't define their own ipv6 checksum. * tag 'riscv-for-linus-6.8-mw4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (56 commits) lib: checksum: Fix build with CONFIG_NET=n riscv: lib: Check if output in asm goto supported riscv: Fix build error on rv32 + XIP riscv: optimize ELF relocation function in riscv RISC-V: Implement archrandom when Zkr is available riscv: Optimize hweight API with Zbb extension riscv: add dependency among Image(.gz), loader(.bin), and vmlinuz.efi samples: ftrace: Add RISC-V support for SAMPLE_FTRACE_DIRECT[_MULTI] riscv: ftrace: Add DYNAMIC_FTRACE_WITH_DIRECT_CALLS support riscv: ftrace: Make function graph use ftrace directly riscv: select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY lib/Kconfig.debug: Update AS_HAS_NON_CONST_LEB128 comment and name riscv: Restrict DWARF5 when building with LLVM to known working versions riscv: Hoist linker relaxation disabling logic into Kconfig kunit: Add tests for csum_ipv6_magic and ip_fast_csum riscv: Add checksum library riscv: Add checksum header riscv: Add static key for misaligned accesses asm-generic: Improve csum_fold RISC-V: selftests: cbo: Ensure asm operands match constraints ...
- Loading branch information
Showing
71 changed files
with
2,676 additions
and
213 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
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,78 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* Based on arch/x86/include/asm/arch_hweight.h | ||
*/ | ||
|
||
#ifndef _ASM_RISCV_HWEIGHT_H | ||
#define _ASM_RISCV_HWEIGHT_H | ||
|
||
#include <asm/alternative-macros.h> | ||
#include <asm/hwcap.h> | ||
|
||
#if (BITS_PER_LONG == 64) | ||
#define CPOPW "cpopw " | ||
#elif (BITS_PER_LONG == 32) | ||
#define CPOPW "cpop " | ||
#else | ||
#error "Unexpected BITS_PER_LONG" | ||
#endif | ||
|
||
static __always_inline unsigned int __arch_hweight32(unsigned int w) | ||
{ | ||
#ifdef CONFIG_RISCV_ISA_ZBB | ||
asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0, | ||
RISCV_ISA_EXT_ZBB, 1) | ||
: : : : legacy); | ||
|
||
asm (".option push\n" | ||
".option arch,+zbb\n" | ||
CPOPW "%0, %0\n" | ||
".option pop\n" | ||
: "+r" (w) : :); | ||
|
||
return w; | ||
|
||
legacy: | ||
#endif | ||
return __sw_hweight32(w); | ||
} | ||
|
||
static inline unsigned int __arch_hweight16(unsigned int w) | ||
{ | ||
return __arch_hweight32(w & 0xffff); | ||
} | ||
|
||
static inline unsigned int __arch_hweight8(unsigned int w) | ||
{ | ||
return __arch_hweight32(w & 0xff); | ||
} | ||
|
||
#if BITS_PER_LONG == 64 | ||
static __always_inline unsigned long __arch_hweight64(__u64 w) | ||
{ | ||
# ifdef CONFIG_RISCV_ISA_ZBB | ||
asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0, | ||
RISCV_ISA_EXT_ZBB, 1) | ||
: : : : legacy); | ||
|
||
asm (".option push\n" | ||
".option arch,+zbb\n" | ||
"cpop %0, %0\n" | ||
".option pop\n" | ||
: "+r" (w) : :); | ||
|
||
return w; | ||
|
||
legacy: | ||
# endif | ||
return __sw_hweight64(w); | ||
} | ||
#else /* BITS_PER_LONG == 64 */ | ||
static inline unsigned long __arch_hweight64(__u64 w) | ||
{ | ||
return __arch_hweight32((u32)w) + | ||
__arch_hweight32((u32)(w >> 32)); | ||
} | ||
#endif /* !(BITS_PER_LONG == 64) */ | ||
|
||
#endif /* _ASM_RISCV_HWEIGHT_H */ |
Oops, something went wrong.