Skip to content

Commit 914e618

Browse files
Merge patch series "Add support for a few Zc* extensions, Zcmop and Zimop"
Clément Léger <[email protected]> says: Add support for (yet again) more RVA23U64 missing extensions. Add support for Zimop, Zcmop, Zca, Zcf, Zcd and Zcb extensions ISA string parsing, hwprobe and kvm support. Zce, Zcmt and Zcmp extensions have been left out since they target microcontrollers/embedded CPUs and are not needed by RVA23U64. Since Zc* extensions states that C implies Zca, Zcf (if F and RV32), Zcd (if D), this series modifies the way ISA string is parsed and now does it in two phases. First one parses the string and the second one validates it for the final ISA description. * b4-shazam-merge: KVM: riscv: selftests: Add Zcmop extension to get-reg-list test RISC-V: KVM: Allow Zcmop extension for Guest/VM riscv: hwprobe: export Zcmop ISA extension riscv: add ISA extension parsing for Zcmop dt-bindings: riscv: add Zcmop ISA extension description KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb riscv: add ISA extensions validation callback dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description KVM: riscv: selftests: Add Zimop extension to get-reg-list test RISC-V: KVM: Allow Zimop extension for Guest/VM riscv: hwprobe: export Zimop ISA extension riscv: add ISA extension parsing for Zimop dt-bindings: riscv: add Zimop ISA extension description Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents d4b539a + e212d92 commit 914e618

File tree

10 files changed

+375
-86
lines changed

10 files changed

+375
-86
lines changed

Documentation/arch/riscv/hwprobe.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,34 @@ The following keys are defined:
207207
* :c:macro:`RISCV_HWPROBE_EXT_ZVE64D`: The Vector sub-extension Zve64d is
208208
supported, as defined by version 1.0 of the RISC-V Vector extension manual.
209209

210+
* :c:macro:`RISCV_HWPROBE_EXT_ZIMOP`: The Zimop May-Be-Operations extension is
211+
supported as defined in the RISC-V ISA manual starting from commit
212+
58220614a5f ("Zimop is ratified/1.0").
213+
214+
* :c:macro:`RISCV_HWPROBE_EXT_ZCA`: The Zca extension part of Zc* standard
215+
extensions for code size reduction, as ratified in commit 8be3419c1c0
216+
("Zcf doesn't exist on RV64 as it contains no instructions") of
217+
riscv-code-size-reduction.
218+
219+
* :c:macro:`RISCV_HWPROBE_EXT_ZCB`: The Zcb extension part of Zc* standard
220+
extensions for code size reduction, as ratified in commit 8be3419c1c0
221+
("Zcf doesn't exist on RV64 as it contains no instructions") of
222+
riscv-code-size-reduction.
223+
224+
* :c:macro:`RISCV_HWPROBE_EXT_ZCD`: The Zcd extension part of Zc* standard
225+
extensions for code size reduction, as ratified in commit 8be3419c1c0
226+
("Zcf doesn't exist on RV64 as it contains no instructions") of
227+
riscv-code-size-reduction.
228+
229+
* :c:macro:`RISCV_HWPROBE_EXT_ZCF`: The Zcf extension part of Zc* standard
230+
extensions for code size reduction, as ratified in commit 8be3419c1c0
231+
("Zcf doesn't exist on RV64 as it contains no instructions") of
232+
riscv-code-size-reduction.
233+
234+
* :c:macro:`RISCV_HWPROBE_EXT_ZCMOP`: The Zcmop May-Be-Operations extension is
235+
supported as defined in the RISC-V ISA manual starting from commit
236+
c732a4f39a4 ("Zcmop is ratified/1.0").
237+
210238
* :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance
211239
information about the selected set of processors.
212240

Documentation/devicetree/bindings/riscv/extensions.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,43 @@ properties:
220220
instructions as ratified at commit 6d33919 ("Merge pull request #158
221221
from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip.
222222
223+
- const: zca
224+
description: |
225+
The Zca extension part of Zc* standard extensions for code size
226+
reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on
227+
RV64 as it contains no instructions") of riscv-code-size-reduction,
228+
merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed
229+
of zc.adoc to src tree.").
230+
231+
- const: zcb
232+
description: |
233+
The Zcb extension part of Zc* standard extensions for code size
234+
reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on
235+
RV64 as it contains no instructions") of riscv-code-size-reduction,
236+
merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed
237+
of zc.adoc to src tree.").
238+
239+
- const: zcd
240+
description: |
241+
The Zcd extension part of Zc* standard extensions for code size
242+
reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on
243+
RV64 as it contains no instructions") of riscv-code-size-reduction,
244+
merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed
245+
of zc.adoc to src tree.").
246+
247+
- const: zcf
248+
description: |
249+
The Zcf extension part of Zc* standard extensions for code size
250+
reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on
251+
RV64 as it contains no instructions") of riscv-code-size-reduction,
252+
merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed
253+
of zc.adoc to src tree.").
254+
255+
- const: zcmop
256+
description:
257+
The standard Zcmop extension version 1.0, as ratified in commit
258+
c732a4f39a4 ("Zcmop is ratified/1.0") of the riscv-isa-manual.
259+
223260
- const: zfa
224261
description:
225262
The standard Zfa extension for additional floating point
@@ -363,6 +400,11 @@ properties:
363400
ratified in the 20191213 version of the unprivileged ISA
364401
specification.
365402

403+
- const: zimop
404+
description:
405+
The standard Zimop extension version 1.0, as ratified in commit
406+
58220614a5f ("Zimop is ratified/1.0") of the riscv-isa-manual.
407+
366408
- const: ztso
367409
description:
368410
The standard Ztso extension for total store ordering, as ratified
@@ -514,5 +556,58 @@ properties:
514556
Registers in the AX45MP datasheet.
515557
https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf
516558

559+
allOf:
560+
# Zcb depends on Zca
561+
- if:
562+
contains:
563+
const: zcb
564+
then:
565+
contains:
566+
const: zca
567+
# Zcd depends on Zca and D
568+
- if:
569+
contains:
570+
const: zcd
571+
then:
572+
allOf:
573+
- contains:
574+
const: zca
575+
- contains:
576+
const: d
577+
# Zcf depends on Zca and F
578+
- if:
579+
contains:
580+
const: zcf
581+
then:
582+
allOf:
583+
- contains:
584+
const: zca
585+
- contains:
586+
const: f
587+
# Zcmop depends on Zca
588+
- if:
589+
contains:
590+
const: zcmop
591+
then:
592+
contains:
593+
const: zca
594+
595+
allOf:
596+
# Zcf extension does not exist on rv64
597+
- if:
598+
properties:
599+
riscv,isa-extensions:
600+
contains:
601+
const: zcf
602+
riscv,isa-base:
603+
contains:
604+
const: rv64i
605+
then:
606+
properties:
607+
riscv,isa-extensions:
608+
not:
609+
contains:
610+
const: zcf
611+
517612
additionalProperties: true
518613
...

arch/riscv/include/asm/cpufeature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct riscv_isa_ext_data {
7070
const char *property;
7171
const unsigned int *subset_ext_ids;
7272
const unsigned int subset_ext_size;
73+
int (*validate)(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap);
7374
};
7475

7576
extern const struct riscv_isa_ext_data riscv_isa_ext[];

arch/riscv/include/asm/hwcap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@
8686
#define RISCV_ISA_EXT_ZVE64X 77
8787
#define RISCV_ISA_EXT_ZVE64F 78
8888
#define RISCV_ISA_EXT_ZVE64D 79
89+
#define RISCV_ISA_EXT_ZIMOP 80
90+
#define RISCV_ISA_EXT_ZCA 81
91+
#define RISCV_ISA_EXT_ZCB 82
92+
#define RISCV_ISA_EXT_ZCD 83
93+
#define RISCV_ISA_EXT_ZCF 84
94+
#define RISCV_ISA_EXT_ZCMOP 85
8995

9096
#define RISCV_ISA_EXT_XLINUXENVCFG 127
9197

arch/riscv/include/uapi/asm/hwprobe.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ struct riscv_hwprobe {
6565
#define RISCV_HWPROBE_EXT_ZVE64X (1ULL << 39)
6666
#define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 40)
6767
#define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 41)
68+
#define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 42)
69+
#define RISCV_HWPROBE_EXT_ZCA (1ULL << 43)
70+
#define RISCV_HWPROBE_EXT_ZCB (1ULL << 44)
71+
#define RISCV_HWPROBE_EXT_ZCD (1ULL << 45)
72+
#define RISCV_HWPROBE_EXT_ZCF (1ULL << 46)
73+
#define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47)
6874
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
6975
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
7076
#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)

arch/riscv/include/uapi/asm/kvm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ enum KVM_RISCV_ISA_EXT_ID {
168168
KVM_RISCV_ISA_EXT_ZTSO,
169169
KVM_RISCV_ISA_EXT_ZACAS,
170170
KVM_RISCV_ISA_EXT_SSCOFPMF,
171+
KVM_RISCV_ISA_EXT_ZIMOP,
172+
KVM_RISCV_ISA_EXT_ZCA,
173+
KVM_RISCV_ISA_EXT_ZCB,
174+
KVM_RISCV_ISA_EXT_ZCD,
175+
KVM_RISCV_ISA_EXT_ZCF,
176+
KVM_RISCV_ISA_EXT_ZCMOP,
171177
KVM_RISCV_ISA_EXT_MAX,
172178
};
173179

0 commit comments

Comments
 (0)