From: Deepak Gupta <debug@rivosinc.com>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Andrew Jones <ajones@ventanamicro.com>,
Conor Dooley <conor@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] riscv: Call riscv_user_isa_enable() only on the boot hart
Date: Fri, 7 Jun 2024 14:59:51 -0700 [thread overview]
Message-ID: <ZmOC18Lj2WrMe9J/@debug.ba.rivosinc.com> (raw)
In-Reply-To: <20240605205658.184399-4-samuel.holland@sifive.com>
On Wed, Jun 05, 2024 at 01:56:47PM -0700, Samuel Holland wrote:
>Now that the [ms]envcfg CSR value is maintained per thread, not per
>hart, riscv_user_isa_enable() only needs to be called once during boot,
>to set the value for the init task. This also allows it to be marked as
>__init. riscv_isa_extension_check() sets any_cpu_has_zicboz, so it also
>needs to be marked __init; it could have had this annotation already.
>
>Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
>---
>
> arch/riscv/include/asm/cpufeature.h | 2 +-
> arch/riscv/kernel/cpufeature.c | 8 ++++----
> arch/riscv/kernel/smpboot.c | 2 --
> 3 files changed, 5 insertions(+), 7 deletions(-)
>
>diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h
>index 347805446151..4bf7b7ebf6b3 100644
>--- a/arch/riscv/include/asm/cpufeature.h
>+++ b/arch/riscv/include/asm/cpufeature.h
>@@ -31,7 +31,7 @@ DECLARE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
> /* Per-cpu ISA extensions. */
> extern struct riscv_isainfo hart_isa[NR_CPUS];
>
>-void riscv_user_isa_enable(void);
>+void __init riscv_user_isa_enable(void);
>
> #if defined(CONFIG_RISCV_MISALIGNED)
> bool check_unaligned_access_emulated_all_cpus(void);
>diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
>index 1153b96346ae..bfe8550c0aae 100644
>--- a/arch/riscv/kernel/cpufeature.c
>+++ b/arch/riscv/kernel/cpufeature.c
>@@ -27,7 +27,7 @@
>
> #define NUM_ALPHA_EXTS ('z' - 'a' + 1)
>
>-static bool any_cpu_has_zicboz;
>+static bool any_cpu_has_zicboz __initdata;
>
> unsigned long elf_hwcap __read_mostly;
>
>@@ -74,7 +74,7 @@ bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned i
> }
> EXPORT_SYMBOL_GPL(__riscv_isa_extension_available);
>
>-static bool riscv_isa_extension_check(int id)
>+static bool __init riscv_isa_extension_check(int id)
> {
> switch (id) {
> case RISCV_ISA_EXT_ZICBOM:
>@@ -725,12 +725,12 @@ unsigned long riscv_get_elf_hwcap(void)
> return hwcap;
> }
>
>-void riscv_user_isa_enable(void)
>+void __init riscv_user_isa_enable(void)
> {
> if (riscv_has_extension_unlikely(RISCV_ISA_EXT_ZICBOZ))
> current->thread.envcfg |= ENVCFG_CBZE;
> else if (any_cpu_has_zicboz)
>- pr_warn_once("Zicboz disabled as it is unavailable on some harts\n");
>+ pr_warn("Zicboz disabled as it is unavailable on some harts\n");
> }
>
> #ifdef CONFIG_RISCV_ALTERNATIVE
>diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
>index 1319b29ce3b5..3e8ece31c30d 100644
>--- a/arch/riscv/kernel/smpboot.c
>+++ b/arch/riscv/kernel/smpboot.c
>@@ -231,8 +231,6 @@ asmlinkage __visible void smp_callin(void)
> elf_hwcap &= ~COMPAT_HWCAP_ISA_V;
> }
>
>- riscv_user_isa_enable();
>-
> /*
> * Remote cache and TLB flushes are ignored while the CPU is offline,
> * so flush them both right now just in case.
Suggestion:
Squash with current patch 1 and call it patch 2.
>--
>2.44.1
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Deepak Gupta <debug@rivosinc.com>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Andrew Jones <ajones@ventanamicro.com>,
Conor Dooley <conor@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] riscv: Call riscv_user_isa_enable() only on the boot hart
Date: Fri, 7 Jun 2024 14:59:51 -0700 [thread overview]
Message-ID: <ZmOC18Lj2WrMe9J/@debug.ba.rivosinc.com> (raw)
In-Reply-To: <20240605205658.184399-4-samuel.holland@sifive.com>
On Wed, Jun 05, 2024 at 01:56:47PM -0700, Samuel Holland wrote:
>Now that the [ms]envcfg CSR value is maintained per thread, not per
>hart, riscv_user_isa_enable() only needs to be called once during boot,
>to set the value for the init task. This also allows it to be marked as
>__init. riscv_isa_extension_check() sets any_cpu_has_zicboz, so it also
>needs to be marked __init; it could have had this annotation already.
>
>Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
>---
>
> arch/riscv/include/asm/cpufeature.h | 2 +-
> arch/riscv/kernel/cpufeature.c | 8 ++++----
> arch/riscv/kernel/smpboot.c | 2 --
> 3 files changed, 5 insertions(+), 7 deletions(-)
>
>diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h
>index 347805446151..4bf7b7ebf6b3 100644
>--- a/arch/riscv/include/asm/cpufeature.h
>+++ b/arch/riscv/include/asm/cpufeature.h
>@@ -31,7 +31,7 @@ DECLARE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
> /* Per-cpu ISA extensions. */
> extern struct riscv_isainfo hart_isa[NR_CPUS];
>
>-void riscv_user_isa_enable(void);
>+void __init riscv_user_isa_enable(void);
>
> #if defined(CONFIG_RISCV_MISALIGNED)
> bool check_unaligned_access_emulated_all_cpus(void);
>diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
>index 1153b96346ae..bfe8550c0aae 100644
>--- a/arch/riscv/kernel/cpufeature.c
>+++ b/arch/riscv/kernel/cpufeature.c
>@@ -27,7 +27,7 @@
>
> #define NUM_ALPHA_EXTS ('z' - 'a' + 1)
>
>-static bool any_cpu_has_zicboz;
>+static bool any_cpu_has_zicboz __initdata;
>
> unsigned long elf_hwcap __read_mostly;
>
>@@ -74,7 +74,7 @@ bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned i
> }
> EXPORT_SYMBOL_GPL(__riscv_isa_extension_available);
>
>-static bool riscv_isa_extension_check(int id)
>+static bool __init riscv_isa_extension_check(int id)
> {
> switch (id) {
> case RISCV_ISA_EXT_ZICBOM:
>@@ -725,12 +725,12 @@ unsigned long riscv_get_elf_hwcap(void)
> return hwcap;
> }
>
>-void riscv_user_isa_enable(void)
>+void __init riscv_user_isa_enable(void)
> {
> if (riscv_has_extension_unlikely(RISCV_ISA_EXT_ZICBOZ))
> current->thread.envcfg |= ENVCFG_CBZE;
> else if (any_cpu_has_zicboz)
>- pr_warn_once("Zicboz disabled as it is unavailable on some harts\n");
>+ pr_warn("Zicboz disabled as it is unavailable on some harts\n");
> }
>
> #ifdef CONFIG_RISCV_ALTERNATIVE
>diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
>index 1319b29ce3b5..3e8ece31c30d 100644
>--- a/arch/riscv/kernel/smpboot.c
>+++ b/arch/riscv/kernel/smpboot.c
>@@ -231,8 +231,6 @@ asmlinkage __visible void smp_callin(void)
> elf_hwcap &= ~COMPAT_HWCAP_ISA_V;
> }
>
>- riscv_user_isa_enable();
>-
> /*
> * Remote cache and TLB flushes are ignored while the CPU is offline,
> * so flush them both right now just in case.
Suggestion:
Squash with current patch 1 and call it patch 2.
>--
>2.44.1
>
next prev parent reply other threads:[~2024-06-07 22:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 20:56 [PATCH 0/3] riscv: Per-thread envcfg CSR support Samuel Holland
2024-06-05 20:56 ` Samuel Holland
2024-06-05 20:56 ` [PATCH 1/3] riscv: Enable cbo.zero only when all harts support Zicboz Samuel Holland
2024-06-05 20:56 ` Samuel Holland
2024-06-07 20:35 ` Deepak Gupta
2024-06-07 20:35 ` Deepak Gupta
2024-06-07 20:39 ` Conor Dooley
2024-06-07 20:39 ` Conor Dooley
2024-06-07 21:41 ` Deepak Gupta
2024-06-07 21:41 ` Deepak Gupta
2024-06-05 20:56 ` [PATCH 2/3] riscv: Add support for per-thread envcfg CSR values Samuel Holland
2024-06-05 20:56 ` Samuel Holland
2024-06-07 21:59 ` Deepak Gupta
2024-06-07 21:59 ` Deepak Gupta
2024-06-13 16:59 ` Samuel Holland
2024-06-13 16:59 ` Samuel Holland
2024-06-05 20:56 ` [PATCH 3/3] riscv: Call riscv_user_isa_enable() only on the boot hart Samuel Holland
2024-06-05 20:56 ` Samuel Holland
2024-06-07 21:59 ` Deepak Gupta [this message]
2024-06-07 21:59 ` Deepak Gupta
2024-06-07 22:01 ` [PATCH 0/3] riscv: Per-thread envcfg CSR support Deepak Gupta
2024-06-07 22:01 ` Deepak Gupta
2024-06-13 17:01 ` Samuel Holland
2024-06-13 17:01 ` Samuel Holland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZmOC18Lj2WrMe9J/@debug.ba.rivosinc.com \
--to=debug@rivosinc.com \
--cc=ajones@ventanamicro.com \
--cc=conor@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=samuel.holland@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.