All of lore.kernel.org
 help / color / mirror / Atom feed
* Two updates for RISC-V -march warnings
@ 2026-01-02 11:44 Ben Dooks
  2026-01-02 11:44 ` [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas Ben Dooks
  2026-01-02 11:44 ` [PATCH 2/2] RISC-V: restart extension search on match Ben Dooks
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Dooks @ 2026-01-02 11:44 UTC (permalink / raw)
  To: linux-sparse

Updates to remove warnings from latest kernel builds.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas
  2026-01-02 11:44 Two updates for RISC-V -march warnings Ben Dooks
@ 2026-01-02 11:44 ` Ben Dooks
  2026-01-07 20:41   ` Paul Walmsley
  2026-01-02 11:44 ` [PATCH 2/2] RISC-V: restart extension search on match Ben Dooks
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2026-01-02 11:44 UTC (permalink / raw)
  To: linux-sparse; +Cc: Ben Dooks

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'

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 target-riscv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target-riscv.c b/target-riscv.c
index d30be04b..80c25285 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -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 },
-- 
2.37.2.352.g3c44437643


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] RISC-V: restart extension search on match
  2026-01-02 11:44 Two updates for RISC-V -march warnings Ben Dooks
  2026-01-02 11:44 ` [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas Ben Dooks
@ 2026-01-02 11:44 ` Ben Dooks
  2026-01-07 20:42   ` Paul Walmsley
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2026-01-02 11:44 UTC (permalink / raw)
  To: linux-sparse; +Cc: Ben Dooks

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.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 target-riscv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target-riscv.c b/target-riscv.c
index 80c25285..ddf50e61 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -56,7 +56,7 @@ static void parse_march_riscv(const char *arg)
 
 	// Each -march=.. options entirely overrides previous ones
 	riscv_flags = 0;
-
+	
 	for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
 		const char *pat = basic_sets[i].pattern;
 		size_t len = strlen(pat);
@@ -80,6 +80,7 @@ ext:
 		if (!strncmp(arg, pat, len)) {
 			riscv_flags |= extensions[i].flags;
 			arg += len;
+			i = 0;
 		}
 	}
 	if (arg[0])
-- 
2.37.2.352.g3c44437643


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas
  2026-01-02 11:44 ` [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas Ben Dooks
@ 2026-01-07 20:41   ` Paul Walmsley
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Walmsley @ 2026-01-07 20:41 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-sparse

On Fri, 2 Jan 2026, Ben Dooks wrote:

> 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'
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Thanks Ben.  This saved me some time!

Tested-by: Paul Walmsley <pjw@kernel.org>


- Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] RISC-V: restart extension search on match
  2026-01-02 11:44 ` [PATCH 2/2] RISC-V: restart extension search on match Ben Dooks
@ 2026-01-07 20:42   ` Paul Walmsley
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Walmsley @ 2026-01-07 20:42 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-sparse

On Fri, 2 Jan 2026, Ben Dooks wrote:

> 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.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  target-riscv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target-riscv.c b/target-riscv.c
> index 80c25285..ddf50e61 100644
> --- a/target-riscv.c
> +++ b/target-riscv.c
> @@ -56,7 +56,7 @@ static void parse_march_riscv(const char *arg)
>  
>  	// Each -march=.. options entirely overrides previous ones
>  	riscv_flags = 0;
> -
> +	

Looks like some horizontal whitespace was inadvertently added here.

>  	for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
>  		const char *pat = basic_sets[i].pattern;
>  		size_t len = strlen(pat);
> @@ -80,6 +80,7 @@ ext:
>  		if (!strncmp(arg, pat, len)) {
>  			riscv_flags |= extensions[i].flags;
>  			arg += len;
> +			i = 0;
>  		}
>  	}
>  	if (arg[0])


Tested-by: Paul Walmsley <pjw@kernel.org>


- Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-07 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 11:44 Two updates for RISC-V -march warnings Ben Dooks
2026-01-02 11:44 ` [PATCH 1/2] RISC-V: Stop warning about Zabha and Zacas Ben Dooks
2026-01-07 20:41   ` Paul Walmsley
2026-01-02 11:44 ` [PATCH 2/2] RISC-V: restart extension search on match Ben Dooks
2026-01-07 20:42   ` Paul Walmsley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.