public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@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, "Deepak Gupta" <debug@rivosinc.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Andy Chiu" <andy.chiu@sifive.com>,
	"Clément Léger" <cleger@rivosinc.com>,
	"Evan Green" <evan@rivosinc.com>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Xiao Wang" <xiao.w.wang@intel.com>,
	"Zhao Ke" <ke.zhao@shingroup.cn>
Subject: Re: [PATCH v4 3/3] riscv: Call riscv_user_isa_enable() only on the boot hart
Date: Thu, 12 Sep 2024 15:59:28 -0700	[thread overview]
Message-ID: <ZuNyUC8mUSp8UtfI@ghost> (raw)
In-Reply-To: <20240814081126.956287-4-samuel.holland@sifive.com>

On Wed, Aug 14, 2024 at 01:10:56AM -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.
> 
> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> Reviewed-by: Deepak Gupta <debug@rivosinc.com>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

> ---
> 
> Changes in v4:
>  - Rebase on riscv/for-next (v6.11-rc)
>  - Add Conor's Reviewed-by tags from v2 (missed in v3)
> 
> Changes in v3:
>  - Drop use of __initdata due to conflicts with cpufeature.c refactoring
> 
> Changes in v2:
>  - Rebase on riscv/for-next
> 
>  arch/riscv/include/asm/cpufeature.h | 2 +-
>  arch/riscv/kernel/cpufeature.c      | 4 ++--
>  arch/riscv/kernel/smpboot.c         | 2 --
>  3 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h
> index 45f9c1171a48..ce9a995730c1 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);
>  
>  #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) {	\
>  	.name = #_name,									\
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index df3e7e8d6d78..b3b9735cb19a 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -919,12 +919,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 0f8f1c95ac38..e36d20205bd7 100644
> --- a/arch/riscv/kernel/smpboot.c
> +++ b/arch/riscv/kernel/smpboot.c
> @@ -233,8 +233,6 @@ asmlinkage __visible void smp_callin(void)
>  	numa_add_cpu(curr_cpuid);
>  	set_cpu_online(curr_cpuid, true);
>  
> -	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.
> -- 
> 2.45.1
> 

  reply	other threads:[~2024-09-12 22:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14  8:10 [PATCH v4 0/3] riscv: Per-thread envcfg CSR support Samuel Holland
2024-08-14  8:10 ` [PATCH v4 1/3] riscv: Enable cbo.zero only when all harts support Zicboz Samuel Holland
2024-09-12 23:01   ` Charlie Jenkins
2024-08-14  8:10 ` [PATCH v4 2/3] riscv: Add support for per-thread envcfg CSR values Samuel Holland
2024-09-12 23:01   ` Charlie Jenkins
2024-08-14  8:10 ` [PATCH v4 3/3] riscv: Call riscv_user_isa_enable() only on the boot hart Samuel Holland
2024-09-12 22:59   ` Charlie Jenkins [this message]
2024-10-06 13:29 ` [PATCH v4 0/3] riscv: Per-thread envcfg CSR support patchwork-bot+linux-riscv

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=ZuNyUC8mUSp8UtfI@ghost \
    --to=charlie@rivosinc.com \
    --cc=ajones@ventanamicro.com \
    --cc=andy.chiu@sifive.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=cleger@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=conor@kernel.org \
    --cc=debug@rivosinc.com \
    --cc=evan@rivosinc.com \
    --cc=ke.zhao@shingroup.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=samuel.holland@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=xiao.w.wang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox