[PATCH RFC v2 03/17] RISC-V: Add support for srmcfg CSR from Ssqosid ext

Drew Fustini fustini at kernel.org
Tue Feb 3 11:43:58 PST 2026


On Mon, Feb 02, 2026 at 12:27:59PM +0800, yunhui cui wrote:
> Hi Drew,
> 
> On Thu, Jan 29, 2026 at 4:28 AM Drew Fustini <fustini at kernel.org> wrote:
> >
> > Add support for the srmcfg CSR defined in the Ssqosid ISA extension
> > (Supervisor-mode Quality of Service ID). The CSR contains two fields:
> >
> >   - Resource Control ID (RCID) used determine resource allocation
> >   - Monitoring Counter ID (MCID) used to track resource usage
> >
> > Requests from a hart to shared resources like cache will be tagged with
> > these IDs. This allows the usage of shared resources to be associated
> > with the task currently running on the hart.
> >
> > A srmcfg field is added to thread_struct and has the same format as the
> > srmcfg CSR. This allows the scheduler to set the hart's srmcfg CSR to
> > contain the RCID and MCID for the task that is being scheduled in. The
> > srmcfg CSR is only written to if the thread_struct.srmcfg is different
> > than the current value of the CSR.
> >
> > A per-cpu variable cpu_srmcfg is used to mirror that state of the CSR.
> > This is because access to L1D hot memory should be several times faster
> > than a CSR read. Also, in the case of virtualization, accesses to this
> > CSR are trapped in the hypervisor.
> >
> > Link: https://github.com/riscv/riscv-ssqosid/releases/tag/v1.0
> > Co-developed-by: Kornel Dulęba <mindal at semihalf.com>
> > Signed-off-by: Kornel Dulęba <mindal at semihalf.com>
> > [fustini: rename csr, refactor switch_to, rebase on upstream]
> > Signed-off-by: Drew Fustini <fustini at kernel.org>
> > ---
> >  MAINTAINERS                        |  7 +++++++
> >  arch/riscv/Kconfig                 | 17 ++++++++++++++++
> >  arch/riscv/include/asm/csr.h       |  8 ++++++++
> >  arch/riscv/include/asm/processor.h |  3 +++
> >  arch/riscv/include/asm/qos.h       | 41 ++++++++++++++++++++++++++++++++++++++
> >  arch/riscv/include/asm/switch_to.h |  3 +++
> >  arch/riscv/kernel/Makefile         |  2 ++
> >  arch/riscv/kernel/qos/Makefile     |  2 ++
> >  arch/riscv/kernel/qos/qos.c        |  5 +++++
> >  9 files changed, 88 insertions(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 765ad2daa218..e98d553bd0ca 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -22505,6 +22505,13 @@ F:     drivers/perf/riscv_pmu.c
> >  F:     drivers/perf/riscv_pmu_legacy.c
> >  F:     drivers/perf/riscv_pmu_sbi.c
> >
> > +RISC-V QOS RESCTRL SUPPORT
> > +M:     Drew Fustini <fustini at kernel.org>
> 
> If you don’t mind, to help support RISC-V QoS resctrl development and
> ensure interface stability, could you please add an 'R:' entry with my
> email address?

Sure, I will add in next revision.

Thanks,
Drew



More information about the linux-riscv mailing list