Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
662a601
Documentation
LICENSES
arch
alpha
arc
arm
arm64
csky
hexagon
ia64
loongarch
m68k
microblaze
mips
nios2
openrisc
parisc
powerpc
riscv
boot
configs
errata
include
asm
vdso
Kbuild
acenv.h
acpi.h
alternative-macros.h
alternative.h
asm-extable.h
asm-offsets.h
asm-prototypes.h
asm.h
assembler.h
atomic.h
barrier.h
bitops.h
bug.h
cache.h
cacheflush.h
cacheinfo.h
cfi.h
clint.h
clocksource.h
cmpxchg.h
compat.h
cpu.h
cpu_ops.h
cpu_ops_sbi.h
cpufeature.h
cpuidle.h
csr.h
current.h
delay.h
dma-noncoherent.h
efi.h
elf.h
entry-common.h
errata_list.h
extable.h
fence.h
fixmap.h
ftrace.h
futex.h
gdb_xml.h
gpr-num.h
hugetlb.h
hwcap.h
hwprobe.h
image.h
insn-def.h
insn.h
io.h
irq.h
irq_stack.h
irq_work.h
irqflags.h
jump_label.h
kasan.h
kdebug.h
kexec.h
kfence.h
kgdb.h
kprobes.h
kvm_aia.h
kvm_aia_aplic.h
kvm_aia_imsic.h
kvm_host.h
kvm_types.h
kvm_vcpu_fp.h
kvm_vcpu_insn.h
kvm_vcpu_pmu.h
kvm_vcpu_sbi.h
kvm_vcpu_timer.h
kvm_vcpu_vector.h
linkage.h
mmio.h
mmiowb.h
mmu.h
mmu_context.h
mmzone.h
module.h
module.lds.h
numa.h
page.h
patch.h
pci.h
perf_event.h
pgalloc.h
pgtable-32.h
pgtable-64.h
pgtable-bits.h
pgtable.h
probes.h
processor.h
ptdump.h
ptrace.h
sbi.h
seccomp.h
sections.h
semihost.h
set_memory.h
signal.h
signal32.h
smp.h
soc.h
sparsemem.h
stackprotector.h
stacktrace.h
string.h
suspend.h
switch_to.h
syscall.h
syscall_wrapper.h
thread_info.h
timex.h
tlb.h
tlbflush.h
topology.h
uaccess.h
unistd.h
uprobes.h
vdso.h
vector.h
vendorid_list.h
vermagic.h
vmalloc.h
word-at-a-time.h
xip_fixup.h
uapi
kernel
kvm
lib
mm
net
purgatory
tools
Kbuild
Kconfig
Kconfig.debug
Kconfig.errata
Kconfig.socs
Makefile
Makefile.postlink
s390
sh
sparc
um
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
fs
include
init
io_uring
ipc
kernel
lib
mm
net
rust
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
riscv
/
include
/
asm
/
hwcap.h
Copy path
Blame
Blame
Latest commit
History
History
144 lines (122 loc) · 3.72 KB
Breadcrumbs
linux
/
arch
/
riscv
/
include
/
asm
/
hwcap.h
Top
File metadata and controls
Code
Blame
144 lines (122 loc) · 3.72 KB
Raw
/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copied from arch/arm64/include/asm/hwcap.h * * Copyright (C) 2012 ARM Ltd. * Copyright (C) 2017 SiFive */ #ifndef _ASM_RISCV_HWCAP_H #define _ASM_RISCV_HWCAP_H #include <asm/alternative-macros.h> #include <asm/errno.h> #include <linux/bits.h> #include <uapi/asm/hwcap.h> #define RISCV_ISA_EXT_a ('a' - 'a') #define RISCV_ISA_EXT_b ('b' - 'a') #define RISCV_ISA_EXT_c ('c' - 'a') #define RISCV_ISA_EXT_d ('d' - 'a') #define RISCV_ISA_EXT_f ('f' - 'a') #define RISCV_ISA_EXT_h ('h' - 'a') #define RISCV_ISA_EXT_i ('i' - 'a') #define RISCV_ISA_EXT_j ('j' - 'a') #define RISCV_ISA_EXT_k ('k' - 'a') #define RISCV_ISA_EXT_m ('m' - 'a') #define RISCV_ISA_EXT_p ('p' - 'a') #define RISCV_ISA_EXT_q ('q' - 'a') #define RISCV_ISA_EXT_s ('s' - 'a') #define RISCV_ISA_EXT_u ('u' - 'a') #define RISCV_ISA_EXT_v ('v' - 'a') /* * These macros represent the logical IDs of each multi-letter RISC-V ISA * extension and are used in the ISA bitmap. The logical IDs start from * RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single * letter extensions. The maximum, RISCV_ISA_EXT_MAX, is defined in order * to allocate the bitmap and may be increased when necessary. * * New extensions should just be added to the bottom, rather than added * alphabetically, in order to avoid unnecessary shuffling. */ #define RISCV_ISA_EXT_BASE 26 #define RISCV_ISA_EXT_SSCOFPMF 26 #define RISCV_ISA_EXT_SSTC 27 #define RISCV_ISA_EXT_SVINVAL 28 #define RISCV_ISA_EXT_SVPBMT 29 #define RISCV_ISA_EXT_ZBB 30 #define RISCV_ISA_EXT_ZICBOM 31 #define RISCV_ISA_EXT_ZIHINTPAUSE 32 #define RISCV_ISA_EXT_SVNAPOT 33 #define RISCV_ISA_EXT_ZICBOZ 34 #define RISCV_ISA_EXT_SMAIA 35 #define RISCV_ISA_EXT_SSAIA 36 #define RISCV_ISA_EXT_ZBA 37 #define RISCV_ISA_EXT_ZBS 38 #define RISCV_ISA_EXT_ZICNTR 39 #define RISCV_ISA_EXT_ZICSR 40 #define RISCV_ISA_EXT_ZIFENCEI 41 #define RISCV_ISA_EXT_ZIHPM 42 #define RISCV_ISA_EXT_SMSTATEEN 43 #define RISCV_ISA_EXT_ZICOND 44 #define RISCV_ISA_EXT_MAX 64 #ifdef CONFIG_RISCV_M_MODE #define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA #else #define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA #endif #ifndef __ASSEMBLY__ #include <linux/jump_label.h> unsigned long riscv_get_elf_hwcap(void); struct riscv_isa_ext_data { const unsigned int id; const char *name; const char *property; }; extern const struct riscv_isa_ext_data riscv_isa_ext[]; extern const size_t riscv_isa_ext_count; extern bool riscv_isa_fallback; unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap); #define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext) bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit); #define riscv_isa_extension_available(isa_bitmap, ext) \ __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext) static __always_inline bool riscv_has_extension_likely(const unsigned long ext) { compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { asm_volatile_goto( ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1) : : [ext] "i" (ext) : : l_no); } else { if (!__riscv_isa_extension_available(NULL, ext)) goto l_no; } return true; l_no: return false; } static __always_inline bool riscv_has_extension_unlikely(const unsigned long ext) { compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { asm_volatile_goto( ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1) : : [ext] "i" (ext) : : l_yes); } else { if (__riscv_isa_extension_available(NULL, ext)) goto l_yes; } return false; l_yes: return true; } #endif #endif /* _ASM_RISCV_HWCAP_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
You can’t perform that action at this time.