Skip to contentSkip to conversation

riscv: remove RISCV_ISA_EXT_BUNDLE[_VALIDATE]

RFC New Conor Dooley 1 participant 1 message Oct 6 RISC-V

lore
Share & tools
lore
#0 lore raw

RFC 1/1 riscv: remove RISCV_ISA_EXT_BUNDLE[_VALIDATE]

From: Conor Dooley <[email protected]>

RISCV_ISA_EXT_BUNDLE actually made sense when it was originally added, since it presented a simple interface where users (be that in kernel or userspace via things they are presented by the kernel) would check the exact extension needed for a feature, rather than muddying the water with parent extensions. As a result, the kernel does not track the status of the parent extension in the bundle, nor expose it to userspace.

This is in comparison to RISCV_ISA_EXT_SUPERSET,
where the parent extension provided some explicit value, and would have to be checked for itself for some potential feature, and therefore we actually track the status of both child and parent extensions, and let userspace detect them independently.

Since we added this stuff, there's been some retroactive extension releases by RVI that have made previous monolithic extensions into pure wrappers that we intended using RISCV_ISA_EXT_BUNDLE for. Since we previously tracked that as one extension, and exported it to users as one extension, we can't just use RISCV_ISA_EXT_BUNDLE, and have to use RISCV_ISA_EXT_SUPERSET instead and nobody seems to know what to use each actually for anymore.

Just delete RISCV_ISA_EXT_BUNDLE for the sake of consistency between things that were always a bundle from ratification and for those retroactively made into bundles, with the side benefit of being less confusing for those adding extensions to the kernel.

---

No idea if this works properly, I wrote it in the middle of a talk on a laptop that has nothing needed to do the testing on it.
I brought this up during some view the other day, dunno if people actually latched onto what I was getting at, so just posting it to see what folks think.

Not 100% on if my comments on the initial rationale are right, they're just my recollection...

Cheers,
Conor

---
 arch/riscv/include/asm/cpufeature.h |  8 ---
 arch/riscv/include/asm/hwcap.h      | 10 +++
 arch/riscv/kernel/cpufeature.c      | 97 ++++++++++++++++-------------
 3 files changed, 63 insertions(+), 52 deletions(-)
arch/riscv/include/asm/cpufeature.h +0 -8
index 739fcc84b..74b3e34b5 100644
@@ -54,14 +54,6 @@ void __init riscv_user_isa_enable(void);
 #define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \
 			_RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate)
 
-/* Used to declare pure "lasso" extension (Zk for instance) */
-#define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \
-	_RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \
-			    ARRAY_SIZE(_bundled_exts), NULL)
-#define __RISCV_ISA_EXT_BUNDLE_VALIDATE(_name, _bundled_exts, _validate) \
-	_RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \
-			    ARRAY_SIZE(_bundled_exts), _validate)
-
 /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */
 #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \
 	_RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL)
arch/riscv/include/asm/hwcap.h +10 -0
index f8db798b2..823e8506c 100644
@@ -122,6 +122,16 @@
 #define RISCV_ISA_EXT_ZICCAMOA		113
 #define RISCV_ISA_EXT_ZICCIF		114
 #define RISCV_ISA_EXT_ZA64RS		115
+#define RISCV_ISA_EXT_ZK		116
+#define RISCV_ISA_EXT_ZKN		117
+#define RISCV_ISA_EXT_ZKS		118
+#define RISCV_ISA_EXT_ZVKN		119
+#define RISCV_ISA_EXT_ZVKNC		120
+#define RISCV_ISA_EXT_ZVKNG		121
+#define RISCV_ISA_EXT_ZVKS		122
+#define RISCV_ISA_EXT_ZVKSC		123
+#define RISCV_ISA_EXT_ZVKSG		124
+
 
 #define RISCV_ISA_EXT_XLINUXENVCFG	127
 
arch/riscv/kernel/cpufeature.c +53 -44

157 lines not on this page · raw message

Signature · 1 line
2.55.0

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv