Re: [PATCH v1 21/29] cxl/region: Lock decoders that need address translation

From: Robert Richter
Date: Thu Feb 06 2025 - 08:23:56 EST


On 07.01.25 17:35:00, Gregory Price wrote:
> On Tue, Jan 07, 2025 at 03:10:07PM +0100, Robert Richter wrote:
> > There is only support to translate from the endpoint to its parent
> > port, but not in the opposite direction from the parent to the
> > endpoint. Thus, the endpoint address range cannot be determined and
> > setup manually. If the parent implements the ->to_hpa() callback and
> > needs address translation, forbit reprogramming of the decoders and
> ^^^^^^
> forbid?
>
> > lock them.
> >
> > Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> > ---
> > drivers/cxl/core/region.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > index 8d7893878362..681c26abc26e 100644
> > --- a/drivers/cxl/core/region.c
> > +++ b/drivers/cxl/core/region.c
> > @@ -3353,6 +3353,17 @@ static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
> > if (cxl_port_calc_hpa(parent, cxld, &hpa))
> > return -ENXIO;
> >
> > + /*
> > + * There is only support to translate from the endpoint to its
> > + * parent port, but not in the opposite direction from the
> > + * parent to the endpoint. Thus, the endpoint address range
> > + * cannot be determined and setup manually. If the parent
> > + * implements the ->to_hpa() callback and needs address
> > + * translation, forbit reprogramming of the decoders and lock
> ^^^^^^
> forbid?

Updated both.

-Robert

>
> > + * them.
> > + */
> > + cxld->flags |= CXL_DECODER_F_LOCK;
> > +
> > /* Iterate from endpoint to root_port refining the position */
> > pos = cxl_port_calc_pos(iter, &hpa, pos);
> > if (pos < 0)
> > --
> > 2.39.5
> >