Skip to contentSkip to conversation

RISC-V: Stop warning about Zabha and Zacas

PATCH New Ben Dooks 1 participant 2 messages Jan 7

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH v2 1/2 RISC-V: Stop warning about Zabha and Zacas

The zabha (atomic byte and halfword) and zacas (atomic compare/swap) are now being used by the kernel, so parse these and stop the warnings when running make C=1 on current kernels.

WARNING: invalid argument to '-march': '_zacas_zabha'

---
 target-riscv.c | 4 ++++
 1 file changed, 4 insertions(+)
target-riscv.c +4 -0
index d30be04b..80c25285 100644
@@ -22,6 +22,8 @@
 #define RISCV_ZICBOM	(1 << 12)
 #define RISCV_ZIHINTPAUSE	(1 << 13)
 #define RISCV_VECTOR	(1 << 14)
+#define RISCV_ATOMIC_CAS (1 << 15)
+#define RISCV_ATOMIC_BH	 (1 << 16)
 
 static unsigned int riscv_flags;
 
@@ -43,6 +45,8 @@ static void parse_march_riscv(const char *arg)
 		{ "d",		RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
 		{ "c",		RISCV_COMP },
 		{ "v",		RISCV_VECTOR|RISCV_FPU|RISCV_ZICSR },
+		{ "_zacas",	RISCV_ATOMIC_CAS },
+		{ "_zabha",	RISCV_ATOMIC_BH },
 		{ "_zicsr",	RISCV_ZICSR },
 		{ "_zifencei",	RISCV_ZIFENCEI },
 		{ "_zicbom",	RISCV_ZICBOM },
Signature · 1 line
2.37.2.352.g3c44437643
author
#1 lore raw

PATCH v2 2/2 RISC-V: restart extension search on match

If we are passed multiple extensions in -march, don't assume these will be in any sort of order. If we do match, then restart the loop by setting the search back to 0, and retrying.

This sorts out issues with the current kernel build where there are now lots of extensions for the rv64i and even adding zacas doesn't silence the warnings generated.

---
v2:
- fixed accidental whitespace change.

---
 target-riscv.c | 1 +
 1 file changed, 1 insertion(+)
target-riscv.c +1 -0
index 80c25285..cd6104b2 100644
@@ -80,6 +80,7 @@ ext:
 		if (!strncmp(arg, pat, len)) {
 			riscv_flags |= extensions[i].flags;
 			arg += len;
+			i = 0;
 		}
 	}
 	if (arg[0])
Signature · 1 line
2.37.2.352.g3c44437643