Skip to content

Commit 84c3b52

Browse files
davejianggregkh
authored andcommitted
cxl: Fix match_region_by_range() to use region_res_match_cxl_range()
[ Upstream commit f4d027921c811ff7fc16e4d03c6bbbf4347cf37a ] match_region_by_range() is not using the helper function that also takes extended linear cache size into account when comparing regions. This causes a x2 region to show up as 2 partial incomplete regions rather than a single CXL region with extended linear cache support. Replace the open coded compare logic with the proper helper function for comparison. User visible impact is that when 'cxl list' is issued, no activa CXL region(s) are shown. There may be multiple idle regions present. No actual active CXL region is present in the kernel. [dj: Fix stable address] Fixes: 0ec9849 ("acpi/hmat / cxl: Add extended linear cache support for CXL") Cc: [email protected] Reviewed-by: Gregory Price <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Reviewed-by: Dan Williams <[email protected]> Signed-off-by: Dave Jiang <[email protected]> [ constify struct range ] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c42f651 commit 84c3b52

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/cxl/core/region.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int match_free_decoder(struct device *dev, const void *data)
831831
}
832832

833833
static bool region_res_match_cxl_range(const struct cxl_region_params *p,
834-
struct range *range)
834+
const struct range *range)
835835
{
836836
if (!p->res)
837837
return false;
@@ -3287,10 +3287,7 @@ static int match_region_by_range(struct device *dev, const void *data)
32873287
p = &cxlr->params;
32883288

32893289
guard(rwsem_read)(&cxl_rwsem.region);
3290-
if (p->res && p->res->start == r->start && p->res->end == r->end)
3291-
return 1;
3292-
3293-
return 0;
3290+
return region_res_match_cxl_range(p, r);
32943291
}
32953292

32963293
static int cxl_extended_linear_cache_resize(struct cxl_region *cxlr,

0 commit comments

Comments
 (0)