public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] RISC-V: Enable cbo.clean/flush in usermode
@ 2025-01-13  8:36 Yunhui Cui
  2025-01-13  8:36 ` [PATCH v3 2/3] RISC-V: hwprobe: Expose Zicbom extension and its block size Yunhui Cui
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Yunhui Cui @ 2025-01-13  8:36 UTC (permalink / raw)
  To: ajones, alexghiti, andybnac, aou, charlie, cleger, conor.dooley,
	conor, corbet, cuiyunhui, evan, jesse, linux-doc, linux-kernel,
	linux-kselftest, linux-riscv, palmer, paul.walmsley,
	samuel.holland, shuah

Enabling cbo.clean and cbo.flush in user mode makes it more
convenient to manage the cache state and achieve better performance.

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/riscv/kernel/cpufeature.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index c0916ed318c2..60d180b98f52 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -30,6 +30,7 @@
 #define NUM_ALPHA_EXTS ('z' - 'a' + 1)
 
 static bool any_cpu_has_zicboz;
+static bool any_cpu_has_zicbom;
 
 unsigned long elf_hwcap __read_mostly;
 
@@ -87,6 +88,8 @@ static int riscv_ext_zicbom_validate(const struct riscv_isa_ext_data *data,
 		pr_err("Zicbom disabled as cbom-block-size present, but is not a power-of-2\n");
 		return -EINVAL;
 	}
+
+	any_cpu_has_zicbom = true;
 	return 0;
 }
 
@@ -944,6 +947,11 @@ void __init riscv_user_isa_enable(void)
 		current->thread.envcfg |= ENVCFG_CBZE;
 	else if (any_cpu_has_zicboz)
 		pr_warn("Zicboz disabled as it is unavailable on some harts\n");
+
+	if (riscv_has_extension_unlikely(RISCV_ISA_EXT_ZICBOM))
+		current->thread.envcfg |= ENVCFG_CBCFE;
+	else if (any_cpu_has_zicbom)
+		pr_warn("Zicbom disabled as it is unavailable on some harts\n");
 }
 
 #ifdef CONFIG_RISCV_ALTERNATIVE
-- 
2.39.2


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

end of thread, other threads:[~2025-01-13 12:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13  8:36 [PATCH v3 1/3] RISC-V: Enable cbo.clean/flush in usermode Yunhui Cui
2025-01-13  8:36 ` [PATCH v3 2/3] RISC-V: hwprobe: Expose Zicbom extension and its block size Yunhui Cui
2025-01-13  9:07   ` Andrew Jones
2025-01-13 11:29     ` [External] " yunhui cui
2025-01-13 12:41       ` Andrew Jones
2025-01-13  8:36 ` [PATCH v3 3/3] RISC-V: selftests: Add TEST_ZICBOM into CBO tests Yunhui Cui
2025-01-13  9:18   ` Andrew Jones
2025-01-13 11:49     ` [External] " yunhui cui
2025-01-13 12:42       ` Andrew Jones
2025-01-13  8:53 ` [PATCH v3 1/3] RISC-V: Enable cbo.clean/flush in usermode Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox