Re: [PATCH RFC v2 08/17] RISC-V: QoS: add resctrl interface for CBQRI controllers

From: Drew Fustini

Date: Wed Apr 01 2026 - 22:47:40 EST


On Tue, Mar 31, 2026 at 07:48:27PM +0200, Radim Krčmář wrote:
> 2026-01-28T12:27:29-08:00, Drew Fustini <fustini@xxxxxxxxxx>:
> > Add interface for CBQRI controller drivers to make use of the resctrl
> > filesystem.
> >
> > Co-developed-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > Signed-off-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > Signed-off-by: Drew Fustini <fustini@xxxxxxxxxx>
> > ---
>
> Hi Drew, I have just a few minor comments as I noticed that you plan to
> send a new version soon, so I'll try for a review then...

Thanks for reviewing.

> > diff --git a/arch/riscv/kernel/qos/qos_resctrl.c b/arch/riscv/kernel/qos/qos_resctrl.c
> > +static int cbqri_probe_controller(struct cbqri_controller_info *ctrl_info,
> > + struct cbqri_controller *ctrl)
> > +{
> > + int err = 0, status;
> > + u64 reg;
> [...]
> > + ctrl->base = ioremap(ctrl_info->addr, ctrl_info->size);
> > + if (!ctrl->base) {
> > + pr_warn("%s(): goto err_release_mem_region", __func__);
>
> Missing "err = -E...".

Good point, I will fix.

>
> > + goto err_release_mem_region;
> > + }
> [...]
> > + ctrl->ver_minor = reg & CBQRI_CC_CAPABILITIES_VER_MINOR_MASK;
> > + ctrl->ver_major = reg & CBQRI_CC_CAPABILITIES_VER_MAJOR_MASK;
>
> Major version is shifted.

Thanks, I will fix.

>
> > +
> > + ctrl->cc.supports_alloc_op_flush_rcid = (reg >> CBQRI_CC_CAPABILITIES_FRCID_SHIFT)
> > + & CBQRI_CC_CAPABILITIES_FRCID_MASK;
>
> FIELD_GET() could be used to make the mask+shift pattern nicer when
> defined by GENMASK().

Good point, I will switch to GENMASK and FIELD_GET.

Thanks,
Drew