riscv: hwprobe: add Zicond, Zam, Zacas and Ztso support
Subsystems (3)
cover riscv: hwprobe: add Zicond, Zam, Zacas and Ztso support
This series add support for a few more extensions that are present in the RVA22U64/RVA23U64 (either mandatory or optional) and that are useful for userspace:
- Zicond
- Zam
- Zacas
- Ztso
Series currently based on riscv/for-next.
Clément Léger (9):
riscv: add ISA extension parsing for Ztso
riscv: hwprobe: export Ztso ISA extension
dt-bindings: riscv: add Zam ISA extension description
riscv: add ISA extension parsing for Zam
riscv: hwprobe: export Zam ISA extension
dt-bindings: riscv: add Zacas ISA extension description
riscv: add ISA extension parsing for Zacas
riscv: hwprobe: export Zacas ISA extension
riscv: hwprobe: export Zicond extension
Documentation/arch/riscv/hwprobe.rst | 16 ++++++++++++++++ .../devicetree/bindings/riscv/extensions.yaml | 11 +++++++++++ arch/riscv/include/asm/hwcap.h | 3 +++ arch/riscv/include/uapi/asm/hwprobe.h | 4 ++++ arch/riscv/kernel/cpufeature.c | 3 +++ arch/riscv/kernel/sys_riscv.c | 4 ++++ 6 files changed, 41 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/9 riscv: add ISA extension parsing for Ztso
Add support to parse the Ztso string in the riscv,isa string. The bindings already supports it but not the ISA parsing code.
--- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)
arch/riscv/include/asm/hwcap.h +1 -0
@@ -84,6 +84,7 @@#define RISCV_ISA_EXT_ZVFH 69#define RISCV_ISA_EXT_ZVFHMIN 70#define RISCV_ISA_EXT_ZFA 71 +#define RISCV_ISA_EXT_ZTSO 72#define RISCV_ISA_EXT_MAX 128#define RISCV_ISA_EXT_INVALID U32_MAX
arch/riscv/kernel/cpufeature.c +1 -0
@@ -279,6 +279,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {__RISCV_ISA_EXT_DATA (zkt,RISCV_ISA_EXT_ZKT ),__RISCV_ISA_EXT_DATA (zksed,RISCV_ISA_EXT_ZKSED ),__RISCV_ISA_EXT_DATA (zksh,RISCV_ISA_EXT_ZKSH ), +__RISCV_ISA_EXT_DATA (ztso,RISCV_ISA_EXT_ZTSO ),__RISCV_ISA_EXT_SUPERSET (zvbb,RISCV_ISA_EXT_ZVBB , riscv_zvbb_exts),__RISCV_ISA_EXT_DATA (zvbc,RISCV_ISA_EXT_ZVBC ), __RISCV_ISA_EXT_DATA(zvfh, RISCV_ISA_EXT_ZVFH),
Signature · 1 line
2.43.0
PATCH 2/9 riscv: hwprobe: export Ztso ISA extension
In reply to Clément LégerExport the Ztso extension to userspace.
--- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 6 insertions(+)
Documentation/arch/riscv/hwprobe.rst +4 -0
@@ -161,6 +161,10 @@ The following keys are defined: defined in the RISC-V ISA manual starting from commit 056b6ff467c7 ("Zfa is ratified"). + * :c:macro:`RISCV_HWPROBE_EXT_ZTSO`: The Ztso extension is supported as + defined in the RISC-V ISA manual starting from commit 5618fb5a216b + ("Ztso is now ratified.") + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors.
arch/riscv/include/uapi/asm/hwprobe.h +1 -0
@@ -56,6 +56,7 @@ struct riscv_hwprobe {#define RISCV_HWPROBE_EXT_ZVFH (1 << 30)#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 31)#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32) +#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)#define RISCV_HWPROBE_KEY_CPUPERF_0 5#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
arch/riscv/kernel/sys_riscv.c +1 -0
@@ -174,6 +174,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,EXT_KEY (ZKSH );EXT_KEY (ZKT );EXT_KEY (ZIHINTNTL ); +EXT_KEY (ZTSO );if (has_vector ()) {EXT_KEY (ZVBB );
Signature · 1 line
2.43.0
PATCH 3/9 dt-bindings: riscv: add Zam ISA extension description
In reply to Clément LégerAdd description for the Zam ISA extension.
--- Documentation/devicetree/bindings/riscv/extensions.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/riscv/extensions.yaml +5 -0
@@ -171,6 +171,11 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification. + - const: zam + description: | + The standard Zam extension for misaligned atomics is supported as + ratified in version 20191213 of the riscv-isa-manual. + - const: zba description: | The standard Zba bit-manipulation extension for address generation
Signature · 1 line
2.43.0
Re: [PATCH 3/9] dt-bindings: riscv: add Zam ISA extension description
Quoted 12 lines · Clément Léger
Add description for the Zam ISA extension.
Signed-off-by Clément Léger <[email protected]>--- Documentation/devicetree/bindings/riscv/extensions.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/riscv/extensions.yaml +0
-0
Documentation/devicetree/bindings/riscv/extensions.yaml properties: · line 177
Quoted 7 lines
Documentation/devicetree/bindings/riscv/extensions.yaml +4
-0@@ -171,6 +171,11 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification. + - const: zam + description: | + The standard Zam extension for misaligned atomics is supported as + ratified in version 20191213 of the riscv-isa-manual.
Is "20191213" an actual tag in that repo? Looking at that version of the spec (because it is a spec version, but I don't think it is a valid reference to that repo) Zam is listed as Draft. In fact, in the most recent thing I could find, Zam was still listed as draft.
Are you sure this is ratified?
Re: [PATCH 3/9] dt-bindings: riscv: add Zam ISA extension description
Quoted 16 lines · Conor Dooley
Quoted 15 lines · Clément Léger
Add description for the Zam ISA extension.
Signed-off-by Clément Léger <[email protected]>--- Documentation/devicetree/bindings/riscv/extensions.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/riscv/extensions.yaml +0
-0@@ -171,6 +171,11 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification.
Quoted 9 lines
Documentation/devicetree/bindings/riscv/extensions.yaml properties: · line 177
Quoted 4 lines
Documentation/devicetree/bindings/riscv/extensions.yaml +4
-0+ - const: zam + description: | + The standard Zam extension for misaligned atomics is supported as + ratified in version 20191213 of the riscv-isa-manual.Is "20191213" an actual tag in that repo? Looking at that version of the spec (because it is a spec version, but I don't think it is a valid reference to that repo) Zam is listed as Draft. In fact, in the most recent thing I could find, Zam was still listed as draft.
Whoops, my bad, I assumed that the chapter being present in the spec meant it was ratified and I did not checked the listing stating it is still in draft.
Will remove that from the next version.
Thanks,
Clément
Quoted 2 lines
Are you sure this is ratified?
PATCH 4/9 riscv: add ISA extension parsing for Zam
In reply to Clément LégerAdd parsing for Zam ISA extension which is part of the riscv-isa manual but was not added to ISA parsing up to now.
--- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)
arch/riscv/include/asm/hwcap.h +1 -0
@@ -85,6 +85,7 @@#define RISCV_ISA_EXT_ZVFHMIN 70#define RISCV_ISA_EXT_ZFA 71#define RISCV_ISA_EXT_ZTSO 72 +#define RISCV_ISA_EXT_ZAM 73#define RISCV_ISA_EXT_MAX 128#define RISCV_ISA_EXT_INVALID U32_MAX
arch/riscv/kernel/cpufeature.c +1 -0
@@ -259,6 +259,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {__RISCV_ISA_EXT_DATA (zihintntl,RISCV_ISA_EXT_ZIHINTNTL ),__RISCV_ISA_EXT_DATA (zihintpause,RISCV_ISA_EXT_ZIHINTPAUSE ),__RISCV_ISA_EXT_DATA (zihpm,RISCV_ISA_EXT_ZIHPM ), +__RISCV_ISA_EXT_DATA (zam,RISCV_ISA_EXT_ZAM ),__RISCV_ISA_EXT_DATA (zfa,RISCV_ISA_EXT_ZFA ),__RISCV_ISA_EXT_DATA (zfh,RISCV_ISA_EXT_ZFH ), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN),
Signature · 1 line
2.43.0
Re: [PATCH 4/9] riscv: add ISA extension parsing for Zam
Quoted 2 lines · Clément Léger
Add parsing for Zam ISA extension which is part of the riscv-isa manual but was not added to ISA parsing up to now.
This does not appear to be frozen or ratified, NAK.
Cheers,
Conor.
Quoted 34 lines
Signed-off-by Clément Léger <[email protected]>--- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)arch/riscv/include/asm/hwcap.h +1
-0@@ -85,6 +85,7 @@#define RISCV_ISA_EXT_ZVFHMIN 70#define RISCV_ISA_EXT_ZFA 71#define RISCV_ISA_EXT_ZTSO 72 +#define RISCV_ISA_EXT_ZAM 73#define RISCV_ISA_EXT_MAX 128#define RISCV_ISA_EXT_INVALID U32_MAXarch/riscv/kernel/cpufeature.c +1
-0@@ -259,6 +259,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {__RISCV_ISA_EXT_DATA (zihintntl,RISCV_ISA_EXT_ZIHINTNTL ),__RISCV_ISA_EXT_DATA (zihintpause,RISCV_ISA_EXT_ZIHINTPAUSE ),__RISCV_ISA_EXT_DATA (zihpm,RISCV_ISA_EXT_ZIHPM ), +__RISCV_ISA_EXT_DATA (zam,RISCV_ISA_EXT_ZAM ),__RISCV_ISA_EXT_DATA (zfa,RISCV_ISA_EXT_ZFA ),__RISCV_ISA_EXT_DATA (zfh,RISCV_ISA_EXT_ZFH ), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN),Signature · 1 line
2.43.0
PATCH 5/9 riscv: hwprobe: export Zam ISA extension
In reply to Clément LégerExport Zam ISA extension through hwprobe.
--- Documentation/arch/riscv/hwprobe.rst | 3 +++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 5 insertions(+)
Documentation/arch/riscv/hwprobe.rst +3 -0
@@ -165,6 +165,9 @@ The following keys are defined: defined in the RISC-V ISA manual starting from commit 5618fb5a216b ("Ztso is now ratified.") + * :c:macro:`RISCV_HWPROBE_EXT_ZAM`: The Zam extension v0.1 is supported as + defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors.
arch/riscv/include/uapi/asm/hwprobe.h +1 -0
@@ -57,6 +57,7 @@ struct riscv_hwprobe {#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 31)#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32)#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) +#define RISCV_HWPROBE_EXT_ZAM (1ULL << 34)#define RISCV_HWPROBE_KEY_CPUPERF_0 5#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
arch/riscv/kernel/sys_riscv.c +1 -0
@@ -175,6 +175,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,EXT_KEY (ZKT );EXT_KEY (ZIHINTNTL );EXT_KEY (ZTSO ); +EXT_KEY (ZAM );if (has_vector ()) {EXT_KEY (ZVBB );
Signature · 1 line
2.43.0
PATCH 6/9 dt-bindings: riscv: add Zacas ISA extension description
In reply to Clément LégerAdd description for the Zacas ISA extension which was ratified recently.
--- Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/riscv/extensions.yaml +6 -0
@@ -171,6 +171,12 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification. + - const: zacas + description: | + The Zacas extension for Atomic Compare-and-Swap (CAS) instructions + is supported as ratified at commit 5059e0ca641c ("update to + ratified") of the riscv-zacas. + - const: zam description: | The standard Zam extension for misaligned atomics is supported as
Signature · 1 line
2.43.0
Re: [PATCH 6/9] dt-bindings: riscv: add Zacas ISA extension description
Quoted 3 lines · Clément Léger
Add description for the Zacas ISA extension which was ratified recently.
Signed-off-by Clément Léger <[email protected]>
Cheers,
Conor.
PATCH 7/9 riscv: add ISA extension parsing for Zacas
In reply to Clément LégerAdd parsing for Zacas ISA extension which was ratified recently in the riscv-zacas manual.
--- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)
arch/riscv/include/asm/hwcap.h +1 -0
@@ -86,6 +86,7 @@#define RISCV_ISA_EXT_ZFA 71#define RISCV_ISA_EXT_ZTSO 72#define RISCV_ISA_EXT_ZAM 73 +#define RISCV_ISA_EXT_ZACAS 74#define RISCV_ISA_EXT_MAX 128#define RISCV_ISA_EXT_INVALID U32_MAX
arch/riscv/kernel/cpufeature.c +1 -0
@@ -259,6 +259,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {__RISCV_ISA_EXT_DATA (zihintntl,RISCV_ISA_EXT_ZIHINTNTL ),__RISCV_ISA_EXT_DATA (zihintpause,RISCV_ISA_EXT_ZIHINTPAUSE ),__RISCV_ISA_EXT_DATA (zihpm,RISCV_ISA_EXT_ZIHPM ), +__RISCV_ISA_EXT_DATA (zacas,RISCV_ISA_EXT_ZACAS ),__RISCV_ISA_EXT_DATA (zam,RISCV_ISA_EXT_ZAM ),__RISCV_ISA_EXT_DATA (zfa,RISCV_ISA_EXT_ZFA ), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH),
Signature · 1 line
2.43.0
PATCH 8/9 riscv: hwprobe: export Zacas ISA extension
In reply to Clément LégerExport Zacas ISA extension through hwprobe.
--- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 6 insertions(+)
Documentation/arch/riscv/hwprobe.rst +4 -0
@@ -168,6 +168,10 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZAM`: The Zam extension v0.1 is supported as defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZACAS`: The Zacas extension is supported as + defined in the Atomic Compare-and-Swap (CAS) instructions manual starting + from commit 5059e0ca641c ("update to ratified"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors.
arch/riscv/include/uapi/asm/hwprobe.h +1 -0
@@ -58,6 +58,7 @@ struct riscv_hwprobe {#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32)#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)#define RISCV_HWPROBE_EXT_ZAM (1ULL << 34) +#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 35)#define RISCV_HWPROBE_KEY_CPUPERF_0 5#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
arch/riscv/kernel/sys_riscv.c +1 -0
@@ -176,6 +176,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,EXT_KEY (ZIHINTNTL );EXT_KEY (ZTSO );EXT_KEY (ZAM ); +EXT_KEY (ZACAS );if (has_vector ()) {EXT_KEY (ZVBB );
Signature · 1 line
2.43.0
PATCH 9/9 riscv: hwprobe: export Zicond extension
In reply to Clément LégerExport the zicond extension to userspace using hwprobe.
--- Documentation/arch/riscv/hwprobe.rst | 5 +++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 7 insertions(+)
Documentation/arch/riscv/hwprobe.rst +5 -0
@@ -172,6 +172,11 @@ The following keys are defined: defined in the Atomic Compare-and-Swap (CAS) instructions manual starting from commit 5059e0ca641c ("update to ratified"). + * :c:macro:`RISCV_HWPROBE_EXT_ZICOND`: The Zicond extension is supported as + defined in the RISC-V Integer Conditional (Zicond) operations extension + manual starting from commit 95cf1f9 ("Add changes requested by Ved + during signoff") + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors.
arch/riscv/include/uapi/asm/hwprobe.h +1 -0
@@ -59,6 +59,7 @@ struct riscv_hwprobe {#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)#define RISCV_HWPROBE_EXT_ZAM (1ULL << 34)#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 35) +#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 36)#define RISCV_HWPROBE_KEY_CPUPERF_0 5#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
arch/riscv/kernel/sys_riscv.c +1 -0
@@ -177,6 +177,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,EXT_KEY (ZTSO );EXT_KEY (ZAM );EXT_KEY (ZACAS ); +EXT_KEY (ZICOND );if (has_vector ()) {EXT_KEY (ZVBB );
Signature · 1 line
2.43.0