Re: [PATCH v4 05/14] cxl: Simplify cxl_root_ops allocation and handling

From: Robert Richter

Date: Fri Nov 07 2025 - 10:44:42 EST


On 04.11.25 16:02:04, Dave Jiang wrote:
>
>
> On 11/3/25 2:53 PM, Dave Jiang wrote:
> >
> >
> > On 11/3/25 11:47 AM, Robert Richter wrote:
> >> A root port's callback handlers are collected in struct cxl_root_ops.
> >> The structure is dynamically allocated, though it contains only a
> >> single pointer in it. This also requires to check two pointers to
> >> check for the existance of a callback.
> >>
> >> Simplify the allocation, release and handler check by embedding the
> >> ops statical in struct cxl_root.
> >>
> >> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> >
> > Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>
>
>

> Thought about it for a bit, should the callback be with 'cxl_rd_ops'
> and the rest of the translation functions under the root decoder
> rather than cxl_root_ops with the cxl root? That seems to be the
> better fit.

The handler for address translation is needed to determine the root
decoders. Because of that the cxl_rd_ops cannot be used to hold the
callback reference. The use of cxl_root_ops works since the pci tree
can be walked to get the cxl root without any cxl specific knowledge.
A description of that is already in the patch that adds the callback.

I haven't evaluated moving qos to cxl_rd_ops as this is not the scope
of the series.

-Robert