Skip to contentSkip to conversation

riscv: some svpbmt fixes

PATCH Superseded Heiko Stuebner 2 participants 7 messages May 18, 2022 – May 26, 2022 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover riscv: some svpbmt fixes

Some additionals comments and notes from autobuilders received after the series got applied, warranted some changes.

So this is a small collection of cleanups for the svpbmt v10 series.

Heiko Stuebner (4):
riscv: drop cpufeature_apply_feature tracking variable
riscv: Improve description for RISCV_ISA_SVPBMT Kconfig symbol
riscv: make patch-function pointer more generic in
cpu_manufacturer_info struct
riscv: fix dependency for t-head errata

 arch/riscv/Kconfig              |  9 +++++++--
 arch/riscv/Kconfig.erratas      |  1 +
 arch/riscv/kernel/alternative.c | 18 +++++++++---------
 arch/riscv/kernel/cpufeature.c  |  5 +----
 4 files changed, 18 insertions(+), 15 deletions(-)
Signature · 7 lines
2.35.1


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

PATCH 1/4 riscv: drop cpufeature_apply_feature tracking variable

The variable was tracking which feature patches got applied but that information was never actually used - and thus resulted in a warning as well.

Drop the variable.

---
 arch/riscv/kernel/cpufeature.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/kernel/cpufeature.c +1 -4
index dea3ea19deee..b33564df81e1 100644
@@ -294,7 +294,6 @@ void __init_or_module riscv_cpufeature_patch_func(struct alt_entry *begin,
 						  unsigned int stage)
 {
 	u32 cpu_req_feature = cpufeature_probe(stage);
-	u32 cpu_apply_feature = 0;
 	struct alt_entry *alt;
 	u32 tmp;
 
@@ -308,10 +307,8 @@ void __init_or_module riscv_cpufeature_patch_func(struct alt_entry *begin,
 		}
 
 		tmp = (1U << alt->errata_id);
-		if (cpu_req_feature & tmp) {
+		if (cpu_req_feature & tmp)
 			patch_text_nosync(alt->old_ptr, alt->alt_ptr, alt->alt_len);
-			cpu_apply_feature |= tmp;
-		}
 	}
 }
 #endif
Signature · 7 lines
2.35.1


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

PATCH 2/4 riscv: Improve description for RISCV_ISA_SVPBMT Kconfig symbol

In reply to Heiko Stuebner

This improves the symbol's description to make it easier for people to understand what it is about.

---
 arch/riscv/Kconfig | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/riscv/Kconfig +7 -2
index 65285b980134..a4b299ad4473 100644
@@ -356,8 +356,13 @@ config RISCV_ISA_SVPBMT
 	select RISCV_ALTERNATIVE
 	default y
 	help
-	   Adds support to dynamically detect the presence of the SVPBMT extension
-	   (Supervisor-mode: page-based memory types) and enable its usage.
+	   Adds support to dynamically detect the presence of the SVPBMT
+	   ISA-extension (Supervisor-mode: page-based memory types) and
+	   enable its usage.
+
+	   The memory type for a page contains a combination of attributes
+	   that indicate the cacheability, idempotency, and ordering
+	   properties for access to that page.
 
 	   The SVPBMT extension is only available on 64Bit cpus.
 
Signature · 7 lines
2.35.1


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

PATCH 3/4 riscv: make patch-function pointer more generic in cpu_manufacturer_info struct

In reply to Heiko Stuebner

During review the naming of the function-pointer was called confusing as the vendor id is just one of three inputs for the patching and indeed it serves no real purpose, as with recent changes the function pointer is not a static global element anymore, so drop the "vendor_" prefix.

---
 arch/riscv/kernel/alternative.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/riscv/kernel/alternative.c +9 -9
index c9d0d3c53223..a7d26a00beea 100644
@@ -20,7 +20,7 @@ struct cpu_manufacturer_info_t {
 	unsigned long vendor_id;
 	unsigned long arch_id;
 	unsigned long imp_id;
-	void (*vendor_patch_func)(struct alt_entry *begin, struct alt_entry *end,
+	void (*patch_func)(struct alt_entry *begin, struct alt_entry *end,
 				  unsigned long archid, unsigned long impid,
 				  unsigned int stage);
 };
@@ -40,16 +40,16 @@ static void __init_or_module riscv_fill_cpu_mfr_info(struct cpu_manufacturer_inf
 	switch (cpu_mfr_info->vendor_id) {
 #ifdef CONFIG_ERRATA_SIFIVE
 	case SIFIVE_VENDOR_ID:
-		cpu_mfr_info->vendor_patch_func = sifive_errata_patch_func;
+		cpu_mfr_info->patch_func = sifive_errata_patch_func;
 		break;
 #endif
 #ifdef CONFIG_ERRATA_THEAD
 	case THEAD_VENDOR_ID:
-		cpu_mfr_info->vendor_patch_func = thead_errata_patch_func;
+		cpu_mfr_info->patch_func = thead_errata_patch_func;
 		break;
 #endif
 	default:
-		cpu_mfr_info->vendor_patch_func = NULL;
+		cpu_mfr_info->patch_func = NULL;
 	}
 }
 
@@ -68,13 +68,13 @@ static void __init_or_module _apply_alternatives(struct alt_entry *begin,
 
 	riscv_cpufeature_patch_func(begin, end, stage);
 
-	if (!cpu_mfr_info.vendor_patch_func)
+	if (!cpu_mfr_info.patch_func)
 		return;
 
-	cpu_mfr_info.vendor_patch_func(begin, end,
-				   cpu_mfr_info.arch_id,
-				   cpu_mfr_info.imp_id,
-				   stage);
+	cpu_mfr_info.patch_func(begin, end,
+				cpu_mfr_info.arch_id,
+				cpu_mfr_info.imp_id,
+				stage);
 }
 
 void __init apply_boot_alternatives(void)
Signature · 1 line
2.35.1
#4 lore raw

PATCH 4/4 riscv: fix dependency for t-head errata

In reply to Heiko Stuebner

alternatives only work correctly on non-xip-kernels and while the selected alternative-symbol has the correct dependency the symbol selecting it also needs that dependency.

So add the missing dependency to the T-Head errata Kconfig symbol.

---
 arch/riscv/Kconfig.erratas | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/Kconfig.erratas +1 -0
index ebfcd5cc6eaf..457ac72c9b36 100644
@@ -35,6 +35,7 @@ config ERRATA_SIFIVE_CIP_1200
 
 config ERRATA_THEAD
 	bool "T-HEAD errata"
+	depends on !XIP_KERNEL
 	select RISCV_ALTERNATIVE
 	help
 	  All T-HEAD errata Kconfig depend on this Kconfig. Disabling
Signature · 7 lines
2.35.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by on v1 4/4
#5 lore raw

Re: [PATCH 4/4] riscv: fix dependency for t-head errata

Quoted 28 lines · Heiko Stuebner

alternatives only work correctly on non-xip-kernels and while the selected alternative-symbol has the correct dependency the symbol selecting it also needs that dependency.

So add the missing dependency to the T-Head errata Kconfig symbol.

---
 arch/riscv/Kconfig.erratas | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/Kconfig.erratas +1 -1
index ebfcd5cc6eaf..457ac72c9b36 100644
@@ -35,6 +35,7 @@ config ERRATA_SIFIVE_CIP_1200
 
 config ERRATA_THEAD
        bool "T-HEAD errata"
+       depends on !XIP_KERNEL
        select RISCV_ALTERNATIVE
        help
          All T-HEAD errata Kconfig depend on this Kconfig. Disabling
--

2.35.1

Signature · 9 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#6 lore raw
In reply to Heiko Stuebner

Am Mittwoch, 18. Mai 2022, 19:02:50 CEST schrieb Heiko Stuebner:

Quoted 4 lines

Some additionals comments and notes from autobuilders received after the series got applied, warranted some changes.

So this is a small collection of cleanups for the svpbmt v10 series.

I've just sent a v2 of this which added another patch onto the series.

See https://lore.kernel.org/r/[email protected]

Heiko

Quoted 14 lines

Heiko Stuebner (4):
riscv: drop cpufeature_apply_feature tracking variable
riscv: Improve description for RISCV_ISA_SVPBMT Kconfig symbol
riscv: make patch-function pointer more generic in
cpu_manufacturer_info struct
riscv: fix dependency for t-head errata

 arch/riscv/Kconfig              |  9 +++++++--
 arch/riscv/Kconfig.erratas      |  1 +
 arch/riscv/kernel/alternative.c | 18 +++++++++---------
 arch/riscv/kernel/cpufeature.c  |  5 +----
 4 files changed, 18 insertions(+), 15 deletions(-)