Re: [PATCH v1 24/29] cxl/region: Use endpoint's SPA range to check a region

From: Robert Richter
Date: Fri Feb 14 2025 - 08:12:05 EST


On 13.01.25 09:38:04, Alison Schofield wrote:
> On Tue, Jan 07, 2025 at 03:10:10PM +0100, Robert Richter wrote:

> > @@ -2051,13 +2055,12 @@ static int cxl_region_attach(struct cxl_region *cxlr,
> > return -ENXIO;
> > }
> >
> > - if (resource_size(cxled->dpa_res) * p->interleave_ways !=
> > - resource_size(p->res)) {
> > + if (range_len(&cxled->spa_range) != resource_size(p->res)) {
> > dev_dbg(&cxlr->dev,
> > - "%s:%s: decoder-size-%#llx * ways-%d != region-size-%#llx\n",
> > + "%s:%s: SPA size mismatch: %#llx-%#llx:%#llx-%#llx\n",
>
> The cxled->spa_range is only set in the auto region path, yet this
> path is taken by both auto and user created regions. User created regions
> die here.

The original check at this point should still work and .spa_range will
not be needed then. Fixed in next version.

-Robert