linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Add support fo the zihintpause extension
@ 2022-08-11  5:33 Palmer Dabbelt
  2022-08-12  8:33 ` Conor Dooley
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2022-08-11  5:33 UTC (permalink / raw)
  To: luc.vanoostenryck, linux-sparse; +Cc: Palmer Dabbelt

This was recently added to binutils and with any luck will soon be in
Linux, without it sparse will fail when trying to build new kernels on
systems with new toolchains.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
I re-indented the other extensions to match, and this one is on top of
the Zicbom patch as I figured that'd be easier.
---
 target-riscv.c | 50 +++++++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/target-riscv.c b/target-riscv.c
index db0f7e57..23d28d0e 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -5,21 +5,22 @@
 #include <string.h>
 #include <stdio.h>
 
-#define RISCV_32BIT	(1 << 0)
-#define RISCV_64BIT	(1 << 1)
-#define RISCV_MUL	(1 << 2)
-#define RISCV_DIV	(1 << 3)
-#define RISCV_ATOMIC	(1 << 4)
-#define RISCV_FLOAT	(1 << 5)
-#define RISCV_DOUBLE	(1 << 6)
-#define RISCV_FDIV	(1 << 7)
-#define RISCV_COMP	(1 << 8)
-#define RISCV_EMBD	(1 << 9)
-#define RISCV_FPU	(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
-#define RISCV_GENERIC	(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
-#define RISCV_ZICSR	(1 << 10)
-#define RISCV_ZIFENCEI	(1 << 11)
-#define RISCV_ZICBOM	(1 << 12)
+#define RISCV_32BIT		(1 << 0)
+#define RISCV_64BIT		(1 << 1)
+#define RISCV_MUL		(1 << 2)
+#define RISCV_DIV		(1 << 3)
+#define RISCV_ATOMIC		(1 << 4)
+#define RISCV_FLOAT		(1 << 5)
+#define RISCV_DOUBLE		(1 << 6)
+#define RISCV_FDIV		(1 << 7)
+#define RISCV_COMP		(1 << 8)
+#define RISCV_EMBD		(1 << 9)
+#define RISCV_FPU		(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
+#define RISCV_GENERIC		(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
+#define RISCV_ZICSR		(1 << 10)
+#define RISCV_ZIFENCEI		(1 << 11)
+#define RISCV_ZICBOM		(1 << 12)
+#define RISCV_ZIHINTPAUSE	(1 << 13)
 
 static unsigned int riscv_flags;
 
@@ -35,14 +36,15 @@ static void parse_march_riscv(const char *arg)
 		{ "rv64i",	RISCV_64BIT },
 		{ "rv64g",	RISCV_64BIT|RISCV_GENERIC },
 	}, extensions[] = {
-		{ "m",		RISCV_MUL|RISCV_DIV },
-		{ "a",		RISCV_ATOMIC },
-		{ "f",		RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
-		{ "d",		RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
-		{ "c",		RISCV_COMP },
-		{ "_zicsr",	RISCV_ZICSR },
-		{ "_zifencei",	RISCV_ZIFENCEI },
-		{ "_zicbom",	RISCV_ZICBOM },
+		{ "m",			RISCV_MUL|RISCV_DIV },
+		{ "a",			RISCV_ATOMIC },
+		{ "f",			RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
+		{ "d",			RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
+		{ "c",			RISCV_COMP },
+		{ "_zicsr",		RISCV_ZICSR },
+		{ "_zifencei",		RISCV_ZIFENCEI },
+		{ "_zicbom",		RISCV_ZICBOM },
+		{ "_zihintpause",	RISCV_ZIHINTPAUSE },
 	};
 	int i;
 
@@ -135,6 +137,8 @@ static void predefine_riscv(const struct target *self)
 		predefine("__riscv_zifencei", 1, "1");
 	if (riscv_flags & RISCV_ZICBOM)
 		predefine("__riscv_zicbom", 1, "1");
+	if (riscv_flags & RISCV_ZIHINTPAUSE)
+		predefine("__riscv_zihintpause", 1, "1");
 
 	if (cmodel)
 		predefine_strong("__riscv_cmodel_%s", cmodel);
-- 
2.34.1


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

* Re: [PATCH] RISC-V: Add support fo the zihintpause extension
  2022-08-11  5:33 [PATCH] RISC-V: Add support fo the zihintpause extension Palmer Dabbelt
@ 2022-08-12  8:33 ` Conor Dooley
  2023-12-15 12:41 ` Geert Uytterhoeven
  2023-12-18 13:59 ` Luc Van Oostenryck
  2 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2022-08-12  8:33 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-sparse, luc.vanoostenryck

On Wed, Aug 10, 2022 at 10:33:56PM -0700, Palmer Dabbelt wrote:
> This was recently added to binutils and with any luck will soon be in
> Linux, without it sparse will fail when trying to build new kernels on
> systems with new toolchains.

Replied once already but I am not too familar with mutt and screwed up
the CC list.
Not too keen on the released version of sparse not working during the
merge window, but w/e I'll upgrade my CI manually.

Tested-by: Conor Dooley <conor.dooley@microchip.com>
(with riscv-gnu-toolchain 2022.03.09 & clang-15/LLVM=1)

> 
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> ---
> I re-indented the other extensions to match, and this one is on top of
> the Zicbom patch as I figured that'd be easier.
> ---
>  target-riscv.c | 50 +++++++++++++++++++++++++++-----------------------
>  1 file changed, 27 insertions(+), 23 deletions(-)
> 
> diff --git a/target-riscv.c b/target-riscv.c
> index db0f7e57..23d28d0e 100644
> --- a/target-riscv.c
> +++ b/target-riscv.c
> @@ -5,21 +5,22 @@
>  #include <string.h>
>  #include <stdio.h>
>  
> -#define RISCV_32BIT	(1 << 0)
> -#define RISCV_64BIT	(1 << 1)
> -#define RISCV_MUL	(1 << 2)
> -#define RISCV_DIV	(1 << 3)
> -#define RISCV_ATOMIC	(1 << 4)
> -#define RISCV_FLOAT	(1 << 5)
> -#define RISCV_DOUBLE	(1 << 6)
> -#define RISCV_FDIV	(1 << 7)
> -#define RISCV_COMP	(1 << 8)
> -#define RISCV_EMBD	(1 << 9)
> -#define RISCV_FPU	(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
> -#define RISCV_GENERIC	(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
> -#define RISCV_ZICSR	(1 << 10)
> -#define RISCV_ZIFENCEI	(1 << 11)
> -#define RISCV_ZICBOM	(1 << 12)
> +#define RISCV_32BIT		(1 << 0)
> +#define RISCV_64BIT		(1 << 1)
> +#define RISCV_MUL		(1 << 2)
> +#define RISCV_DIV		(1 << 3)
> +#define RISCV_ATOMIC		(1 << 4)
> +#define RISCV_FLOAT		(1 << 5)
> +#define RISCV_DOUBLE		(1 << 6)
> +#define RISCV_FDIV		(1 << 7)
> +#define RISCV_COMP		(1 << 8)
> +#define RISCV_EMBD		(1 << 9)
> +#define RISCV_FPU		(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
> +#define RISCV_GENERIC		(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
> +#define RISCV_ZICSR		(1 << 10)
> +#define RISCV_ZIFENCEI		(1 << 11)
> +#define RISCV_ZICBOM		(1 << 12)
> +#define RISCV_ZIHINTPAUSE	(1 << 13)
>  
>  static unsigned int riscv_flags;
>  
> @@ -35,14 +36,15 @@ static void parse_march_riscv(const char *arg)
>  		{ "rv64i",	RISCV_64BIT },
>  		{ "rv64g",	RISCV_64BIT|RISCV_GENERIC },
>  	}, extensions[] = {
> -		{ "m",		RISCV_MUL|RISCV_DIV },
> -		{ "a",		RISCV_ATOMIC },
> -		{ "f",		RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
> -		{ "d",		RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
> -		{ "c",		RISCV_COMP },
> -		{ "_zicsr",	RISCV_ZICSR },
> -		{ "_zifencei",	RISCV_ZIFENCEI },
> -		{ "_zicbom",	RISCV_ZICBOM },
> +		{ "m",			RISCV_MUL|RISCV_DIV },
> +		{ "a",			RISCV_ATOMIC },
> +		{ "f",			RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
> +		{ "d",			RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
> +		{ "c",			RISCV_COMP },
> +		{ "_zicsr",		RISCV_ZICSR },
> +		{ "_zifencei",		RISCV_ZIFENCEI },
> +		{ "_zicbom",		RISCV_ZICBOM },
> +		{ "_zihintpause",	RISCV_ZIHINTPAUSE },
>  	};
>  	int i;
>  
> @@ -135,6 +137,8 @@ static void predefine_riscv(const struct target *self)
>  		predefine("__riscv_zifencei", 1, "1");
>  	if (riscv_flags & RISCV_ZICBOM)
>  		predefine("__riscv_zicbom", 1, "1");
> +	if (riscv_flags & RISCV_ZIHINTPAUSE)
> +		predefine("__riscv_zihintpause", 1, "1");
>  
>  	if (cmodel)
>  		predefine_strong("__riscv_cmodel_%s", cmodel);
> -- 
> 2.34.1
> 

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

* Re: [PATCH] RISC-V: Add support fo the zihintpause extension
  2022-08-11  5:33 [PATCH] RISC-V: Add support fo the zihintpause extension Palmer Dabbelt
  2022-08-12  8:33 ` Conor Dooley
@ 2023-12-15 12:41 ` Geert Uytterhoeven
  2023-12-18 13:59 ` Luc Van Oostenryck
  2 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-12-15 12:41 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: luc.vanoostenryck, linux-sparse

On Wed, 10 Aug 2022, Palmer Dabbelt wrote:
> This was recently added to binutils and with any luck will soon be in
> Linux, without it sparse will fail when trying to build new kernels on
> systems with new toolchains.
>
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

As I've just run into

     .../linux$ make C=1

     [...]

     invalid argument to '-march': '_zicsr_zifencei_zihintpause'

and needed to apply this patch before upgrading sparse:

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

 						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
 							    -- Linus Torvalds

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

* Re: [PATCH] RISC-V: Add support fo the zihintpause extension
  2022-08-11  5:33 [PATCH] RISC-V: Add support fo the zihintpause extension Palmer Dabbelt
  2022-08-12  8:33 ` Conor Dooley
  2023-12-15 12:41 ` Geert Uytterhoeven
@ 2023-12-18 13:59 ` Luc Van Oostenryck
  2 siblings, 0 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2023-12-18 13:59 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: luc.vanoostenryck, linux-sparse

On Wed, Aug 10, 2022 at 10:33:56PM -0700, Palmer Dabbelt wrote:
> This was recently added to binutils and with any luck will soon be in
> Linux, without it sparse will fail when trying to build new kernels on
> systems with new toolchains.
> 
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

Pushed to mainline now. Sorry for this very long delay.
-- Luc

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

* [PATCH] RISC-V: Add support fo the zihintpause extension
@ 2022-08-11  5:29 Palmer Dabbelt
  0 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2022-08-11  5:29 UTC (permalink / raw)
  To: luc.vanoostenryck, linux-sparse; +Cc: Palmer Dabbelt

This was recently added to binutils and with any luck will soon be in
Linux, without it sparse will fail when trying to build new kernels on
systems with new toolchains.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
I re-indented the other extensions to match, and this one is on top of
the Zicbom patch as I figured that'd be easier.
---
 target-riscv.c | 50 +++++++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/target-riscv.c b/target-riscv.c
index db0f7e57..23d28d0e 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -5,21 +5,22 @@
 #include <string.h>
 #include <stdio.h>
 
-#define RISCV_32BIT	(1 << 0)
-#define RISCV_64BIT	(1 << 1)
-#define RISCV_MUL	(1 << 2)
-#define RISCV_DIV	(1 << 3)
-#define RISCV_ATOMIC	(1 << 4)
-#define RISCV_FLOAT	(1 << 5)
-#define RISCV_DOUBLE	(1 << 6)
-#define RISCV_FDIV	(1 << 7)
-#define RISCV_COMP	(1 << 8)
-#define RISCV_EMBD	(1 << 9)
-#define RISCV_FPU	(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
-#define RISCV_GENERIC	(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
-#define RISCV_ZICSR	(1 << 10)
-#define RISCV_ZIFENCEI	(1 << 11)
-#define RISCV_ZICBOM	(1 << 12)
+#define RISCV_32BIT		(1 << 0)
+#define RISCV_64BIT		(1 << 1)
+#define RISCV_MUL		(1 << 2)
+#define RISCV_DIV		(1 << 3)
+#define RISCV_ATOMIC		(1 << 4)
+#define RISCV_FLOAT		(1 << 5)
+#define RISCV_DOUBLE		(1 << 6)
+#define RISCV_FDIV		(1 << 7)
+#define RISCV_COMP		(1 << 8)
+#define RISCV_EMBD		(1 << 9)
+#define RISCV_FPU		(RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
+#define RISCV_GENERIC		(RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
+#define RISCV_ZICSR		(1 << 10)
+#define RISCV_ZIFENCEI		(1 << 11)
+#define RISCV_ZICBOM		(1 << 12)
+#define RISCV_ZIHINTPAUSE	(1 << 13)
 
 static unsigned int riscv_flags;
 
@@ -35,14 +36,15 @@ static void parse_march_riscv(const char *arg)
 		{ "rv64i",	RISCV_64BIT },
 		{ "rv64g",	RISCV_64BIT|RISCV_GENERIC },
 	}, extensions[] = {
-		{ "m",		RISCV_MUL|RISCV_DIV },
-		{ "a",		RISCV_ATOMIC },
-		{ "f",		RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
-		{ "d",		RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
-		{ "c",		RISCV_COMP },
-		{ "_zicsr",	RISCV_ZICSR },
-		{ "_zifencei",	RISCV_ZIFENCEI },
-		{ "_zicbom",	RISCV_ZICBOM },
+		{ "m",			RISCV_MUL|RISCV_DIV },
+		{ "a",			RISCV_ATOMIC },
+		{ "f",			RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
+		{ "d",			RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
+		{ "c",			RISCV_COMP },
+		{ "_zicsr",		RISCV_ZICSR },
+		{ "_zifencei",		RISCV_ZIFENCEI },
+		{ "_zicbom",		RISCV_ZICBOM },
+		{ "_zihintpause",	RISCV_ZIHINTPAUSE },
 	};
 	int i;
 
@@ -135,6 +137,8 @@ static void predefine_riscv(const struct target *self)
 		predefine("__riscv_zifencei", 1, "1");
 	if (riscv_flags & RISCV_ZICBOM)
 		predefine("__riscv_zicbom", 1, "1");
+	if (riscv_flags & RISCV_ZIHINTPAUSE)
+		predefine("__riscv_zihintpause", 1, "1");
 
 	if (cmodel)
 		predefine_strong("__riscv_cmodel_%s", cmodel);
-- 
2.34.1


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

end of thread, other threads:[~2023-12-18 13:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  5:33 [PATCH] RISC-V: Add support fo the zihintpause extension Palmer Dabbelt
2022-08-12  8:33 ` Conor Dooley
2023-12-15 12:41 ` Geert Uytterhoeven
2023-12-18 13:59 ` Luc Van Oostenryck
  -- strict thread matches above, loose matches on Subject: below --
2022-08-11  5:29 Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).