[PATCH v9 5/5] riscv_cbqri: Add CBQRI capacity allocation platform driver
Drew Fustini
fustini at kernel.org
Sat Oct 17 23:24:19 PDT 2026
On Mon, Oct 12, 2026 at 10:33:21PM +0530, Sunil V L wrote:
> On Sat, Oct 3, 2026 at 12:45 PM Drew Fustini <fustini at kernel.org> wrote:
> >
> > Add a platform driver for CBQRI capacity controllers described in
> > device tree with the riscv,cbqri-capacity-controller compatible.
> >
> > The controller node points at the cache it governs with a
> > riscv,cbqri-cache phandle. The driver looks that cache up in cacheinfo
> > and uses its cache id as the resctrl domain id, so the binding does not
> > need to carry a CPU mask. The controller is then handed to the CBQRI
> > core, which probes its capabilities and decides whether to expose it
> > through resctrl.
> >
> > Nothing is vendor-specific and reg is the CBQRI register block itself,
> > so any SoC that describes a CBQRI capacity controller in device tree can
> > use the driver unchanged.
> >
> > Assisted-by: LLM
> > Tested-by: Chen Pei <cp0613 at linux.alibaba.com>
> > Signed-off-by: Drew Fustini <fustini at kernel.org>
> > ---
> > MAINTAINERS | 1 +
> > drivers/resctrl/Kconfig | 15 +++++
> > drivers/resctrl/Makefile | 1 +
> > drivers/resctrl/cbqri_capacity.c | 127 +++++++++++++++++++++++++++++++++++++++
> > 4 files changed, 144 insertions(+)
[..]
> > diff --git a/drivers/resctrl/cbqri_capacity.c b/drivers/resctrl/cbqri_capacity.c
> > new file mode 100644
> > index 000000000000..0670a676bdb1
> > --- /dev/null
> > +++ b/drivers/resctrl/cbqri_capacity.c
[..]
> > +static int cbqri_capacity_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct cbqri_controller_info info = {};
> > + struct device_node *cache_np;
> > + struct resource *res;
> > + u32 rcid_count, cache_level;
> > + int cache_id, cpu, ret;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res)
> > + return -EINVAL;
> > +
> Unless I am missing something, I think you can simplify the code by
> using devm_platform_ioremap_resource().
Yes, I'll switch to devm_platform_get_and_ioremap_resource().
[..]
> > +
> > + info.type = CBQRI_CONTROLLER_TYPE_CAPACITY;
> > + info.addr = res->start;
> > + info.size = resource_size(res);
> > + info.rcid_count = rcid_count;
> > + info.cache_id = cache_id;
> > +
> > + ret = riscv_cbqri_register_cc_dt(&info, cache_level);
> >
> As I mentioned in the comment for another patch, this function doesn't
> need to have "_dt" in its name.
Good point, I'll drop it.
Thanks,
Drew
More information about the linux-riscv
mailing list