Re: [PATCH v1 16/29] cxl/region: Use translated HPA ranges to calculate the endpoint position

From: Gregory Price
Date: Tue Jan 07 2025 - 17:01:35 EST


On Tue, Jan 07, 2025 at 03:10:02PM +0100, Robert Richter wrote:
> To enable address translation, the calculation of the endpoint
> position must use translated HPA ranges. The function
> cxl_endpoint_initialize() already uses translation which could be
> reused to calculate the endpoint position.
>
> Use translated HPA address ranges for the calculation of endpoint
> position by moving it to cxl_endpoint_initialize(). Create a function
> cxl_port_calc_pos() for use in the iterator there, but keep a
> simplified version of cxl_calc_interleave_pos() for the
> non-auto-discovery code path without address translation since it is
> not support there.
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> ---

just one inline question

> +static int cxl_calc_interleave_pos(struct cxl_endpoint_decoder *cxled)
> +{
> + struct cxl_port *iter, *port = cxled_to_port(cxled);
> + struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> + struct range *range = &cxled->cxld.hpa_range;
> + int pos = 0;
> +
> + /*
> + * Address translation is only supported for auto-discovery of
> + * decoders. There is no need to support address translation
> + * here.
> + */

Just clarifying - it's only supported for discovery of already
programmed decoders (programmed in BIOS)? i.e. driver-programmed
decoders shouldn't need this translation / won't support this type of
interleaving?

Comment here begs some questions but not necessarily a review blocker.

~Gregory