[PATCH v4 3/3] RISC-V: Add support for srmcfg CSR from Ssqosid ext

Radim Krčmář rkrcmar at ventanamicro.com
Wed Oct 8 23:47:27 PDT 2025


2025-10-07T23:21:12-07:00, Drew Fustini <fustini at kernel.org>:
> diff --git a/arch/riscv/include/asm/qos.h b/arch/riscv/include/asm/qos.h
> +static inline void __switch_to_srmcfg(struct task_struct *next)
> +{
> +	u32 *cpu_srmcfg_ptr = this_cpu_ptr(&cpu_srmcfg);
> +	u32 thread_srmcfg;
> +
> +	thread_srmcfg = READ_ONCE(next->thread.srmcfg);
> +
> +	if (thread_srmcfg != *cpu_srmcfg_ptr) {

Wouldn't prev->thread.srmcfg have the value of CSR_SRMCFG when executing
switch_to?

Thanks.

> +		*cpu_srmcfg_ptr = thread_srmcfg;
> +		csr_write(CSR_SRMCFG, thread_srmcfg);
> +	}
> +}



More information about the linux-riscv mailing list