]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxl: Fix match_region_by_range() to use region_res_match_cxl_range()
authorDave Jiang <dave.jiang@intel.com>
Tue, 21 Oct 2025 14:52:11 +0000 (10:52 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2025 14:24:40 +0000 (16:24 +0200)
[ 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: 0ec9849b6333 ("acpi/hmat / cxl: Add extended linear cache support for CXL")
Cc: stable@vger.kernel.org
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ constify struct range ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cxl/core/region.c

index 71cc42d052481ad5d57ca1c870dfb1da96726fc1..be4521184328275a71fa6d5c19ac2472b167cf32 100644 (file)
@@ -831,7 +831,7 @@ static int match_free_decoder(struct device *dev, const void *data)
 }
 
 static bool region_res_match_cxl_range(const struct cxl_region_params *p,
-                                      struct range *range)
+                                      const struct range *range)
 {
        if (!p->res)
                return false;
@@ -3287,10 +3287,7 @@ static int match_region_by_range(struct device *dev, const void *data)
        p = &cxlr->params;
 
        guard(rwsem_read)(&cxl_rwsem.region);
-       if (p->res && p->res->start == r->start && p->res->end == r->end)
-               return 1;
-
-       return 0;
+       return region_res_match_cxl_range(p, r);
 }
 
 static int cxl_extended_linear_cache_resize(struct cxl_region *cxlr,