blob: 6b9293e984a929e80b6c73c066ec40aecc17d1dc (
plain)
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
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2024 Rivos, Inc
*/
#ifndef _ASM_RISCV_SYS_HWPROBE_H
#define _ASM_RISCV_SYS_HWPROBE_H
#include <asm/cpufeature.h>
#define VENDOR_EXT_KEY(ext) \
do { \
if (__riscv_isa_extension_available(isainfo->isa, RISCV_ISA_VENDOR_EXT_##ext)) \
pair->value |= RISCV_HWPROBE_VENDOR_EXT_##ext; \
else \
missing |= RISCV_HWPROBE_VENDOR_EXT_##ext; \
} while (false)
/*
* Loop through and record extensions that 1) anyone has, and 2) anyone
* doesn't have.
*
* _extension_checks is an arbitrary C block to set the values of pair->value
* and missing. It should be filled with VENDOR_EXT_KEY expressions.
*/
#define VENDOR_EXTENSION_SUPPORTED(pair, cpus, per_hart_vendor_bitmap, _extension_checks) \
do { \
int cpu; \
u64 missing = 0; \
for_each_cpu(cpu, (cpus)) { \
struct riscv_isavendorinfo *isainfo = &(per_hart_vendor_bitmap)[cpu]; \
_extension_checks \
} \
(pair)->value &= ~missing; \
} while (false) \
#endif /* _ASM_RISCV_SYS_HWPROBE_H */
|