Skip to contentSkip to conversation

riscv: cleanup svpbmt cpufeature probing

PATCH Superseded Heiko Stuebner 5 participants 22 messages Sep 1, 2022 – Sep 2, 2022 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 riscv: cleanup svpbmt cpufeature probing

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -8
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-	switch (stage) {
-	case RISCV_ALTERNATIVES_EARLY_BOOT:
+	if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
 		return false;
-	default:
-		return riscv_isa_extension_available(NULL, SVPBMT);
-	}
-#endif
 
-	return false;
+	if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+		return false;
+
+	return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/4 riscv: drop some idefs from CMO initialization

Wrapping things in #ifdefs makes the code harder to read while we also have IS_ENABLED() macros to do this in regular code and the extension detection is not _that_ runtime critical.

So define a stub for riscv_noncoherent_supported() in the non-CONFIG_RISCV_DMA_NONCOHERENT case and move the code to us IS_ENABLED.

---
 arch/riscv/errata/thead/errata.c    |  7 +++----
 arch/riscv/include/asm/cacheflush.h |  2 ++
 arch/riscv/kernel/cpufeature.c      | 22 +++++++++-------------
 3 files changed, 14 insertions(+), 17 deletions(-)
arch/riscv/errata/thead/errata.c +3 -4
index 202c83f677b2..bffa711aaf64 100644
@@ -30,7 +30,9 @@ static bool errata_probe_pbmt(unsigned int stage,
 static bool errata_probe_cmo(unsigned int stage,
 			     unsigned long arch_id, unsigned long impid)
 {
-#ifdef CONFIG_ERRATA_THEAD_CMO
+	if (!IS_ENABLED(CONFIG_ERRATA_THEAD_CMO))
+		return false;
+
 	if (arch_id != 0 || impid != 0)
 		return false;
 
@@ -39,9 +41,6 @@ static bool errata_probe_cmo(unsigned int stage,
 
 	riscv_noncoherent_supported();
 	return true;
-#else
-	return false;
-#endif
 }
 
 static u32 thead_errata_probe(unsigned int stage,
arch/riscv/include/asm/cacheflush.h +2 -0
index a60acaecfeda..4363d0beb38a 100644
@@ -50,6 +50,8 @@ static inline void riscv_init_cbom_blocksize(void) { }
 
 #ifdef CONFIG_RISCV_DMA_NONCOHERENT
 void riscv_noncoherent_supported(void);
+#else
+static inline void riscv_noncoherent_supported(void) {}
 #endif
 
 /*
arch/riscv/kernel/cpufeature.c +9 -13
index 764ea220161f..729f7a218093 100644
@@ -264,21 +264,17 @@ static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_ZICBOM
-	switch (stage) {
-	case RISCV_ALTERNATIVES_EARLY_BOOT:
+	if (!IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM))
+		return false;
+
+	if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+		return false;
+
+	if (!riscv_isa_extension_available(NULL, ZICBOM))
 		return false;
-	default:
-		if (riscv_isa_extension_available(NULL, ZICBOM)) {
-			riscv_noncoherent_supported();
-			return true;
-		} else {
-			return false;
-		}
-	}
-#endif
 
-	return false;
+	riscv_noncoherent_supported();
+	return true;
 }
 
 /*
Signature · 1 line
2.35.1
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] riscv: drop some idefs from CMO initialization

Quoted 93 lines · Heiko Stuebner

Wrapping things in #ifdefs makes the code harder to read while we also have IS_ENABLED() macros to do this in regular code and the extension detection is not _that_ runtime critical.

So define a stub for riscv_noncoherent_supported() in the non-CONFIG_RISCV_DMA_NONCOHERENT case and move the code to us IS_ENABLED.

---
 arch/riscv/errata/thead/errata.c    |  7 +++----
 arch/riscv/include/asm/cacheflush.h |  2 ++
 arch/riscv/kernel/cpufeature.c      | 22 +++++++++-------------
 3 files changed, 14 insertions(+), 17 deletions(-)
arch/riscv/errata/thead/errata.c +3 -4
index 202c83f677b2..bffa711aaf64 100644
@@ -30,7 +30,9 @@ static bool errata_probe_pbmt(unsigned int stage,
 static bool errata_probe_cmo(unsigned int stage,
                             unsigned long arch_id, unsigned long impid)
 {
-#ifdef CONFIG_ERRATA_THEAD_CMO
+       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_CMO))
+               return false;
+
        if (arch_id != 0 || impid != 0)
                return false;
 
@@ -39,9 +41,6 @@ static bool errata_probe_cmo(unsigned int stage,
 
        riscv_noncoherent_supported();
        return true;
-#else
-       return false;
-#endif
 }
 
 static u32 thead_errata_probe(unsigned int stage,
arch/riscv/include/asm/cacheflush.h +2 -0
index a60acaecfeda..4363d0beb38a 100644
@@ -50,6 +50,8 @@ static inline void riscv_init_cbom_blocksize(void) { }
 
 #ifdef CONFIG_RISCV_DMA_NONCOHERENT
 void riscv_noncoherent_supported(void);
+#else
+static inline void riscv_noncoherent_supported(void) {}
 #endif
 
 /*
arch/riscv/kernel/cpufeature.c +9 -14
index 764ea220161f..729f7a218093 100644
@@ -264,21 +264,17 @@ static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_ZICBOM
-       switch (stage) {
-       case RISCV_ALTERNATIVES_EARLY_BOOT:
+       if (!IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM))
+               return false;
+
+       if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+               return false;
+
+       if (!riscv_isa_extension_available(NULL, ZICBOM))
                return false;
-       default:
-               if (riscv_isa_extension_available(NULL, ZICBOM)) {
-                       riscv_noncoherent_supported();
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-#endif
 
-       return false;
+       riscv_noncoherent_supported();
+       return true;
 }
 
 /*
--

2.35.1

Signature · 2 lines
Best Regards
 Guo Ren
Reviewed-by on v1 2/4
#3 lore raw

Re: [PATCH 2/4] riscv: drop some idefs from CMO initialization

In reply to Heiko Stuebner
Quoted 11 lines · Heiko Stuebner

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Wrapping things in #ifdefs makes the code harder to read while we also have IS_ENABLED() macros to do this in regular code and the extension detection is not _that_ runtime critical.

So define a stub for riscv_noncoherent_supported() in the non-CONFIG_RISCV_DMA_NONCOHERENT case and move the code to us IS_ENABLED.

To my "sensitive" eyes, this looks a lot nicer!

Quoted 83 lines
---
  arch/riscv/errata/thead/errata.c    |  7 +++----
  arch/riscv/include/asm/cacheflush.h |  2 ++
  arch/riscv/kernel/cpufeature.c      | 22 +++++++++-------------
  3 files changed, 14 insertions(+), 17 deletions(-)
arch/riscv/errata/thead/errata.c +3 -4
index 202c83f677b2..bffa711aaf64 100644
@@ -30,7 +30,9 @@ static bool errata_probe_pbmt(unsigned int stage,
  static bool errata_probe_cmo(unsigned int stage,
                              unsigned long arch_id, unsigned long impid)
  {
-#ifdef CONFIG_ERRATA_THEAD_CMO
+       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_CMO))
+               return false;
+
         if (arch_id != 0 || impid != 0)
                 return false;
 
@@ -39,9 +41,6 @@ static bool errata_probe_cmo(unsigned int stage,
 
         riscv_noncoherent_supported();
         return true;
-#else
-       return false;
-#endif
  }
 
  static u32 thead_errata_probe(unsigned int stage,
arch/riscv/include/asm/cacheflush.h +2 -0
index a60acaecfeda..4363d0beb38a 100644
@@ -50,6 +50,8 @@ static inline void riscv_init_cbom_blocksize(void) { }
 
  #ifdef CONFIG_RISCV_DMA_NONCOHERENT
  void riscv_noncoherent_supported(void);
+#else
+static inline void riscv_noncoherent_supported(void) {}
  #endif
 
  /*
arch/riscv/kernel/cpufeature.c +9 -14
index 764ea220161f..729f7a218093 100644
@@ -264,21 +264,17 @@ static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 
  static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
  {
-#ifdef CONFIG_RISCV_ISA_ZICBOM
-       switch (stage) {
-       case RISCV_ALTERNATIVES_EARLY_BOOT:
+       if (!IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM))
+               return false;
+
+       if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+               return false;
+
+       if (!riscv_isa_extension_available(NULL, ZICBOM))
                 return false;
-       default:
-               if (riscv_isa_extension_available(NULL, ZICBOM)) {
-                       riscv_noncoherent_supported();
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-#endif
 
-       return false;
+       riscv_noncoherent_supported();
+       return true;
  }
 
  /*
--

2.35.1

Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] riscv: drop some idefs from CMO initialization

In reply to Heiko Stuebner
Quoted 8 lines · Heiko Stuebner

Wrapping things in #ifdefs makes the code harder to read while we also have IS_ENABLED() macros to do this in regular code and the extension detection is not _that_ runtime critical.

So define a stub for riscv_noncoherent_supported() in the non-CONFIG_RISCV_DMA_NONCOHERENT case and move the code to us IS_ENABLED.

Quoted 8 lines
---
 arch/riscv/errata/thead/errata.c    |  7 +++----
 arch/riscv/include/asm/cacheflush.h |  2 ++
 arch/riscv/kernel/cpufeature.c      | 22 +++++++++-------------
 3 files changed, 14 insertions(+), 17 deletions(-)

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

#5 lore raw

PATCH 3/4 riscv: use BIT macros in t-head errata init

In reply to Heiko Stuebner

Using the appropriate BIT macro makes the code better readable.

---
 arch/riscv/errata/thead/errata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/errata/thead/errata.c +2 -2
index bffa711aaf64..a6f4bd8ccf3f 100644
@@ -49,10 +49,10 @@ static u32 thead_errata_probe(unsigned int stage,
 	u32 cpu_req_errata = 0;
 
 	if (errata_probe_pbmt(stage, archid, impid))
-		cpu_req_errata |= (1U << ERRATA_THEAD_PBMT);
+		cpu_req_errata |= BIT(ERRATA_THEAD_PBMT);
 
 	if (errata_probe_cmo(stage, archid, impid))
-		cpu_req_errata |= (1U << ERRATA_THEAD_CMO);
+		cpu_req_errata |= BIT(ERRATA_THEAD_CMO);
 
 	return cpu_req_errata;
 }
Signature · 1 line
2.35.1
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] riscv: use BIT macros in t-head errata init

Quoted 29 lines · Heiko Stuebner

Using the appropriate BIT macro makes the code better readable.

---
 arch/riscv/errata/thead/errata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/errata/thead/errata.c +2 -3
index bffa711aaf64..a6f4bd8ccf3f 100644
@@ -49,10 +49,10 @@ static u32 thead_errata_probe(unsigned int stage,
        u32 cpu_req_errata = 0;
 
        if (errata_probe_pbmt(stage, archid, impid))
-               cpu_req_errata |= (1U << ERRATA_THEAD_PBMT);
+               cpu_req_errata |= BIT(ERRATA_THEAD_PBMT);
 
        if (errata_probe_cmo(stage, archid, impid))
-               cpu_req_errata |= (1U << ERRATA_THEAD_CMO);
+               cpu_req_errata |= BIT(ERRATA_THEAD_CMO);
 
        return cpu_req_errata;
 }
--

2.35.1

Signature · 2 lines
Best Regards
 Guo Ren
Reviewed-by on v1 3/4
#7 lore raw

Re: [PATCH 3/4] riscv: use BIT macros in t-head errata init

In reply to Heiko Stuebner
Quoted 3 lines · Heiko Stuebner

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Using the appropriate BIT macro makes the code better readable.

As you might imagine, I agree!

Quoted 25 lines
---
  arch/riscv/errata/thead/errata.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/errata/thead/errata.c +2 -3
index bffa711aaf64..a6f4bd8ccf3f 100644
@@ -49,10 +49,10 @@ static u32 thead_errata_probe(unsigned int stage,
         u32 cpu_req_errata = 0;
 
         if (errata_probe_pbmt(stage, archid, impid))
-               cpu_req_errata |= (1U << ERRATA_THEAD_PBMT);
+               cpu_req_errata |= BIT(ERRATA_THEAD_PBMT);
 
         if (errata_probe_cmo(stage, archid, impid))
-               cpu_req_errata |= (1U << ERRATA_THEAD_CMO);
+               cpu_req_errata |= BIT(ERRATA_THEAD_CMO);
 
         return cpu_req_errata;
  }
--
Quoted 2 lines

2.35.1

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

Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] riscv: use BIT macros in t-head errata init

In reply to Heiko Stuebner
Quoted 28 lines · Heiko Stuebner

Using the appropriate BIT macro makes the code better readable.

---
 arch/riscv/errata/thead/errata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/errata/thead/errata.c +2 -2
index bffa711aaf64..a6f4bd8ccf3f 100644
@@ -49,10 +49,10 @@ static u32 thead_errata_probe(unsigned int stage,
 	u32 cpu_req_errata = 0;
 
 	if (errata_probe_pbmt(stage, archid, impid))
-		cpu_req_errata |= (1U << ERRATA_THEAD_PBMT);
+		cpu_req_errata |= BIT(ERRATA_THEAD_PBMT);
 
 	if (errata_probe_cmo(stage, archid, impid))
-		cpu_req_errata |= (1U << ERRATA_THEAD_CMO);
+		cpu_req_errata |= BIT(ERRATA_THEAD_CMO);
 
 	return cpu_req_errata;
 }
Signature · 1 line
2.35.1

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

#9 lore raw

PATCH 4/4 riscv: check for kernel config option in t-head memory types errata

In reply to Heiko Stuebner

The t-head variant of page-based memory types should also check first for the enabled kernel config option.

---
 arch/riscv/errata/thead/errata.c | 3 +++
 1 file changed, 3 insertions(+)
arch/riscv/errata/thead/errata.c +3 -0
index a6f4bd8ccf3f..902e12452821 100644
@@ -17,6 +17,9 @@
 static bool errata_probe_pbmt(unsigned int stage,
 			      unsigned long arch_id, unsigned long impid)
 {
+	if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT))
+		return false;
+
 	if (arch_id != 0 || impid != 0)
 		return false;
 
Signature · 1 line
2.35.1
#10 lore raw

Re: [PATCH 4/4] riscv: check for kernel config option in t-head memory types errata

Is it a Fixes?

Quoted 26 lines · Heiko Stuebner

The t-head variant of page-based memory types should also check first for the enabled kernel config option.

---
 arch/riscv/errata/thead/errata.c | 3 +++
 1 file changed, 3 insertions(+)
arch/riscv/errata/thead/errata.c +3 -1
index a6f4bd8ccf3f..902e12452821 100644
@@ -17,6 +17,9 @@
 static bool errata_probe_pbmt(unsigned int stage,
                              unsigned long arch_id, unsigned long impid)
 {
+       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT))
+               return false;
+
        if (arch_id != 0 || impid != 0)
                return false;
 
--

2.35.1

Signature · 2 lines
Best Regards
 Guo Ren
Reviewed-by
#11 lore raw

Re: [PATCH 4/4] riscv: check for kernel config option in t-head memory types errata

Quoted 3 lines · Guo Ren

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Is it a Fixes?

Looks like one to me, seems a fixes tag would be good to have here... Either way:

Quoted 33 lines · Heiko Stuebner
Quoted 24 lines

The t-head variant of page-based memory types should also check first for the enabled kernel config option.

---
  arch/riscv/errata/thead/errata.c | 3 +++
  1 file changed, 3 insertions(+)
arch/riscv/errata/thead/errata.c +3 -1
index a6f4bd8ccf3f..902e12452821 100644
@@ -17,6 +17,9 @@
  static bool errata_probe_pbmt(unsigned int stage,
                               unsigned long arch_id, unsigned long impid)
  {
+       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT))
+               return false;
+
         if (arch_id != 0 || impid != 0)
                 return false;
 
--
Quoted 2 lines

2.35.1

--
Best Regards
Guo Ren

#12 lore raw

Re: [PATCH 4/4] riscv: check for kernel config option in t-head memory types errata

Am Freitag, 2. September 2022, 11:33:27 CEST schrieb [email protected]:

Quoted 8 lines · Guo Ren
Quoted 3 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Is it a Fixes?

Looks like one to me, seems a fixes tag would be good to have here... Either way:

The alternative itself also is protected by the kconfig-option, so even if probe says "yes", nothing will be patched when CONFIG_ERRATA_THEAD_PBMT is not enabled.

So for the memory-types it's more a change to keep it consistent with the other extensions. But I guess we can add the fixes-tag anyway, as it makes sure that doesn't get copy-pasted somewhere else :-)

Heiko

Quoted 25 lines
Quoted 25 lines · Heiko Stuebner
Quoted 23 lines

The t-head variant of page-based memory types should also check first for the enabled kernel config option.

---
  arch/riscv/errata/thead/errata.c | 3 +++
  1 file changed, 3 insertions(+)
arch/riscv/errata/thead/errata.c +3 -0
index a6f4bd8ccf3f..902e12452821 100644
@@ -17,6 +17,9 @@
  static bool errata_probe_pbmt(unsigned int stage,
                               unsigned long arch_id, unsigned long impid)
  {
+       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT))
+               return false;
+
         if (arch_id != 0 || impid != 0)
                 return false;
 
Quoted 10 lines
Quoted 8 lines
Quoted 3 lines

--
2.35.1

--
Best Regards
Guo Ren

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

Reviewed-by on v1 4/4
#13 lore raw

Re: [PATCH 4/4] riscv: check for kernel config option in t-head memory types errata

In reply to Heiko Stuebner
Quoted 25 lines · Heiko Stuebner

The t-head variant of page-based memory types should also check first for the enabled kernel config option.

---
 arch/riscv/errata/thead/errata.c | 3 +++
 1 file changed, 3 insertions(+)
arch/riscv/errata/thead/errata.c +3 -0
index a6f4bd8ccf3f..902e12452821 100644
@@ -17,6 +17,9 @@
 static bool errata_probe_pbmt(unsigned int stage,
 			      unsigned long arch_id, unsigned long impid)
 {
+	if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT))
+		return false;
+
 	if (arch_id != 0 || impid != 0)
 		return false;
 
Signature · 1 line
2.35.1

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

Reviewed-by on v1 1/4
#14 lore raw
In reply to Heiko Stuebner
Quoted 39 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -9
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-       switch (stage) {
-       case RISCV_ALTERNATIVES_EARLY_BOOT:
+       if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
                return false;
-       default:
-               return riscv_isa_extension_available(NULL, SVPBMT);
-       }
-#endif
 
-       return false;
+       if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+               return false;
+
+       return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
--

2.35.1

Signature · 2 lines
Best Regards
 Guo Ren
Reviewed-by on v1 1/4
#15 lore raw
In reply to Heiko Stuebner
Quoted 5 lines · Heiko Stuebner

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

The change itself looks great to me, but the commit message here does not stand by itself - the "also" stuff reads a bit oddly. How about:
---8<---
For better readability (and compile time coverage) use IS_ENABLED instead of ifdef and drop the new unneeded switch statement. ---8<---

Call me biased, but I much prefer how this looks now...

Quoted 33 lines
---
  arch/riscv/kernel/cpufeature.c | 13 +++++--------
  1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -9
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
  #ifdef CONFIG_RISCV_ALTERNATIVE
  static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
  {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-       switch (stage) {
-       case RISCV_ALTERNATIVES_EARLY_BOOT:
+       if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
                 return false;
-       default:
-               return riscv_isa_extension_available(NULL, SVPBMT);
-       }
-#endif
 
-       return false;
+       if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+               return false;
+
+       return riscv_isa_extension_available(NULL, SVPBMT);
  }
 
  static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
--
Quoted 2 lines

2.35.1

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

Reviewed-by on v1 1/4
#16 lore raw
In reply to Heiko Stuebner

Hi Heiko,

Please use a cover-letter for a patch series. They allow the series to be threaded better and people can reply to the cover-letter with series-wide comments. For example, I'd like to reply to a cover-letter now with

For the series

but now it looks like I need to go back and reply to each patch separately.

Thanks,
drew

Quoted 43 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -8
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-	switch (stage) {
-	case RISCV_ALTERNATIVES_EARLY_BOOT:
+	if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
 		return false;
-	default:
-		return riscv_isa_extension_available(NULL, SVPBMT);
-	}
-#endif
 
-	return false;
+	if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+		return false;
+
+	return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
Signature · 7 lines
2.35.1


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

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

#17 lore raw

Am Freitag, 2. September 2022, 11:49:39 CEST schrieb Andrew Jones:

Quoted 6 lines

Hi Heiko,

Please use a cover-letter for a patch series. They allow the series to be threaded better and people can reply to the cover-letter with series-wide comments. For example, I'd like to reply to a cover-letter now with

Quoted 6 lines

For the series

but now it looks like I need to go back and reply to each patch separately.

I'm not sure if tooling like b4 can handle Reviewed-by's in cover-letters. At least some time back it couldn't, so am not sure if that was added meanwhile. So tags added to cover-letters might even get lost.

But I'll add a cover-letter nevertheless - need a place for the v2 changelog anyway :-)

Heiko

Quoted 32 lines

Thanks,
drew

Quoted 27 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +1 -7
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-	switch (stage) {
-	case RISCV_ALTERNATIVES_EARLY_BOOT:
+	if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
 		return false;
-	default:
-		return riscv_isa_extension_available(NULL, SVPBMT);
-	}
-#endif
 
Quoted 9 lines

arch/riscv/kernel/cpufeature.c void __init riscv_fill_hwcap(void) · line 265

Quoted 8 lines
arch/riscv/kernel/cpufeature.c +4 -1
-	return false;
+	if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+		return false;
+
+	return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)

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

#18 lore raw
Quoted 9 lines · Heiko Stübner

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Am Freitag, 2. September 2022, 11:49:39 CEST schrieb Andrew Jones:

Quoted 6 lines

Hi Heiko,

Please use a cover-letter for a patch series. They allow the series to be threaded better and people can reply to the cover-letter with series-wide comments. For example, I'd like to reply to a cover-letter now with

Quoted 8 lines
Quoted 6 lines

For the series

but now it looks like I need to go back and reply to each patch separately.

I'm not sure if tooling like b4 can handle Reviewed-by's in cover-letters.

Yup, it can! At least b4 {am,shazam} -t will.
I am not sure if the new b4 trailers does.

Quoted 54 lines

At least some time back it couldn't, so am not sure if that was added meanwhile. So tags added to cover-letters might even get lost.

But I'll add a cover-letter nevertheless - need a place for the v2 changelog anyway :-)

Heiko

Quoted 41 lines

Thanks,
drew

Quoted 35 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -8
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-   switch (stage) {
-   case RISCV_ALTERNATIVES_EARLY_BOOT:
+   if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
            return false;
-   default:
-           return riscv_isa_extension_available(NULL, SVPBMT);
-   }
-#endif
 
-   return false;
+   if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+           return false;
+
+   return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)

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

#19 lore raw

Am Freitag, 2. September 2022, 17:26:21 CEST schrieb [email protected]:

Quoted 14 lines · Heiko Stübner
Quoted 13 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Am Freitag, 2. September 2022, 11:49:39 CEST schrieb Andrew Jones:

Quoted 10 lines

Hi Heiko,

Please use a cover-letter for a patch series. They allow the series to be threaded better and people can reply to the cover-letter with series-wide comments. For example, I'd like to reply to a cover-letter now with

For the series

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

but now it looks like I need to go back and reply to each patch separately.

I'm not sure if tooling like b4 can handle Reviewed-by's in cover-letters.

Yup, it can! At least b4 {am,shazam} -t will.
I am not sure if the new b4 trailers does.

That is great to know ... gotta love b4 :-)

Quoted 49 lines
Quoted 49 lines

At least some time back it couldn't, so am not sure if that was added meanwhile. So tags added to cover-letters might even get lost.

But I'll add a cover-letter nevertheless - need a place for the v2 changelog anyway :-)

Heiko

Quoted 39 lines

Thanks,
drew

Quoted 34 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -8
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-   switch (stage) {
-   case RISCV_ALTERNATIVES_EARLY_BOOT:
+   if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
            return false;
-   default:
-           return riscv_isa_extension_available(NULL, SVPBMT);
-   }
-#endif
 
-   return false;
+   if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+           return false;
+
+   return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

arch/riscv/kernel/cpufeature.c void __init riscv_fill_hwcap(void) · line 265

Quoted 1 line
arch/riscv/kernel/cpufeature.c +0 -0
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)

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

#20 lore raw
In reply to [email protected]
Quoted 9 lines · On Fri, Sep 02, 2022 at 03:26:21PM +0000, [email protected] wrote:
Quoted 6 lines
Quoted 4 lines

but now it looks like I need to go back and reply to each patch separately.

I'm not sure if tooling like b4 can handle Reviewed-by's in cover-letters.

Yup, it can! At least b4 {am,shazam} -t will.
I am not sure if the new b4 trailers does.

Yes, it's the default behaviour for "b4 trailers". It'll probably become the default for "b4 am/shazam" at some point, too.

-K

Reviewed-by on v1 1/4
#21 lore raw
In reply to Heiko Stuebner
Quoted 38 lines · Heiko Stuebner

This can also do without the ifdef and use IS_ENABLED instead and for better readability, getting rid of that switch also seems waranted.

---
 arch/riscv/kernel/cpufeature.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/riscv/kernel/cpufeature.c +5 -8
index 553d755483ed..764ea220161f 100644
@@ -253,16 +253,13 @@ void __init riscv_fill_hwcap(void)
 #ifdef CONFIG_RISCV_ALTERNATIVE
 static bool __init_or_module cpufeature_probe_svpbmt(unsigned int stage)
 {
-#ifdef CONFIG_RISCV_ISA_SVPBMT
-	switch (stage) {
-	case RISCV_ALTERNATIVES_EARLY_BOOT:
+	if (!IS_ENABLED(CONFIG_RISCV_ISA_SVPBMT))
 		return false;
-	default:
-		return riscv_isa_extension_available(NULL, SVPBMT);
-	}
-#endif
 
-	return false;
+	if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+		return false;
+
+	return riscv_isa_extension_available(NULL, SVPBMT);
 }
 
 static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage)
Signature · 1 line
2.35.1

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