[PATCH RFC v2 07/17] RISC-V: QoS: define prototypes for resctrl interface
Reinette Chatre
reinette.chatre at intel.com
Fri Feb 13 15:21:37 PST 2026
Hi Drew,
On 1/28/26 12:27 PM, Drew Fustini wrote:
> Define the prototypes for the resctrl interface functions that are
> implemented on RISC-V.
>
> Co-developed-by: Adrien Ricciardi <aricciardi at baylibre.com>
> Signed-off-by: Adrien Ricciardi <aricciardi at baylibre.com>
> [fustini: rebased on current upstream]
> Signed-off-by: Drew Fustini <fustini at kernel.org>
> ---
> include/linux/riscv_qos.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/include/linux/riscv_qos.h b/include/linux/riscv_qos.h
> index 51c3a96bbcd0..0c551ed85fe1 100644
> --- a/include/linux/riscv_qos.h
> +++ b/include/linux/riscv_qos.h
> @@ -3,6 +3,7 @@
> #ifndef __LINUX_RISCV_QOS_H
> #define __LINUX_RISCV_QOS_H
>
> +#include <linux/resctrl_types.h>
> #include <linux/iommu.h>
> #include <linux/types.h>
>
> @@ -31,4 +32,47 @@ struct cbqri_controller_info {
>
> extern struct list_head cbqri_controllers;
>
> +bool resctrl_arch_alloc_capable(void);
> +bool resctrl_arch_mon_capable(void);
> +bool resctrl_arch_is_llc_occupancy_enabled(void);
> +bool resctrl_arch_is_mbm_local_enabled(void);
> +bool resctrl_arch_is_mbm_total_enabled(void);
These individual event checks are no longer needed. Please refer to commit
d257cc2e5c8b ("x86,fs/resctrl: Replace architecture event enabled checks")
that can be found in your base commit.
> +
> +struct rdt_resource;
> +/*
> + * Note about terminology between x86 (Intel RDT/AMD QoS) and RISC-V:
> + * CLOSID on x86 is RCID on RISC-V
> + * RMID on x86 is MCID on RISC-V
> + * CDP on x86 is AT (access type) on RISC-V
> + */
> +u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid);
> +void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid);
> +void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 pmg);
nit: the x86 and RISC-V terms are already plenty. It should not be necessary to add
MPAM terms (pmg) to the mix?
> +void resctrl_arch_sched_in(struct task_struct *tsk);
> +void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
> +bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid);
> +bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
> +void resctrl_arch_reset_resources(void);
hmmm ... the baseline of this work is v6.19-rc4 that contains the resctrl fs/arch
split. resctrl_arch_reset_resources() seems to be based on some earlier version of
the split work that did not make it upstream.
> +void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, enum resctrl_event_id evtid);
> +void resctrl_arch_mon_ctx_free(struct rdt_resource *r, enum resctrl_event_id evtid,
> + void *arch_mon_ctx);
> +struct rdt_domain_hdr *resctrl_arch_find_domain(struct list_head *domain_list, int id);
resctrl_arch_find_domain() does not exist in resctrl. Would resctrl's resctrl_find_domain()
suffice?
> +
> +static inline bool resctrl_arch_event_is_free_running(enum resctrl_event_id evt)
resctrl_arch_event_is_free_running() also does not exist in resctrl.
> +{
> + /* must be true for resctrl L3 monitoring files to be created */
> + return true;
> +}
> +
> +static inline unsigned int resctrl_arch_round_mon_val(unsigned int val)
> +{
> + return val;
> +}
> +
> +/* Not needed for RISC-V */
> +static inline void resctrl_arch_enable_mon(void) { }
> +static inline void resctrl_arch_disable_mon(void) { }
> +static inline void resctrl_arch_enable_alloc(void) { }
> +static inline void resctrl_arch_disable_alloc(void) { }
> +
> #endif /* __LINUX_RISCV_QOS_H */
>
Reinette
More information about the linux-riscv
mailing list