Re: [External] Re: [PATCH v12 1/5] riscv_cbqri: Add capacity controller core

From: Drew Fustini

Date: Thu Nov 19 2026 - 19:39:35 EST


On Thu, Nov 19, 2026 at 07:00:21PM +0800, yunhui cui wrote:
> Hi Drew,
>
> On Thu, Nov 19, 2026 at 8:09 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> >
> > On Sat, 14 Nov 2026 14:06:21 -0800
> > Drew Fustini <fustini@xxxxxxxxxx> wrote:
> >
> > > Add the core for RISC-V CBQRI capacity controllers: the register
> > > layout, the capability probe, and the allocation operations that
> > > program a capacity block mask for an RCID and read it back.
> > >
> > > A discovery layer maps the register block and describes the controller
> > > in a cbqri_controller_info descriptor. riscv_cbqri_register_cc() probes
> > > the controller from that descriptor and adds it to the controller list,
> > > which stays private to the core. The core owns the controller state
> > > after registration, so nothing in it depends on how the controller was
> > > discovered. The caller keeps the register mapping alive.
> > >
> > > Tested-by: Zeng Heng <zengheng@xxxxxxxxxxxxx>
> > > Reviewed-by: Zeng Heng <zengheng@xxxxxxxxxxxxx>
> > > Co-developed-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > > Signed-off-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > > Signed-off-by: Drew Fustini <fustini@xxxxxxxxxx>
[..]
> > > + /* The resctrl glue keys its domains on cache_id, one controller each. */
> > > + list_for_each_entry(other, &cbqri_controllers, list) {
> > > + if (other->cache.cache_level == info->cache_level &&
> > > + other->cache.cache_id == info->cache_id) {
> > > + pr_warn("CC at %pa duplicates the L%u cache id %u controller at %pa, skipping\n",
> > > + &ctrl->addr, info->cache_level, info->cache_id,
> > > + &other->addr);
> > > + return -EEXIST;
>
> A controller with the same cache level and Cache ID is not necessarily
> a duplicate. A distributed LLC may have multiple physical controllers
> managing the same logical L3 resource.
>
> Matching controllers should instead be grouped into a logical component
> keyed by (cache_level, cache_id), with the physical controllers kept in
> a linked list. User space would see one logical controller as a single
> resctrl L3 domain, while the update path would iterate the list and
> program every physical controller.

Good point that it is not a duplicate. However, I would like to keep the
scope of this series from expanding, so I would prefer for that scenario
to be handled in a future series. The domain id is the cache id in both
cases, so it won't be a problem to add later.

Do you have a platform with such an L3 that it could be tested on?

For v13, I could change the comment and the warning so that they say a
second controller for a cache is not supported, instead of calling it a
duplicate. The alternative could be to skip the whole group if it is
a problem to just leave the first of the group enabled.

Thanks,
Drew