]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxl/acpi: Fix setup of memory resource in cxl_acpi_set_cache_size()
authorDave Jiang <dave.jiang@intel.com>
Fri, 10 Oct 2025 20:57:53 +0000 (13:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2025 14:24:24 +0000 (16:24 +0200)
commit 2e41e5a91a37202ff6743c3ae5329e106aeb1c6c upstream.

In order to compare the resource against the HMAT memory target,
the resource needs to be memory type. Change the DEFINE_RES()
macro to DEFINE_RES_MEM() in order to set the correct resource type.
hmat_get_extended_linear_cache_size() uses resource_contains()
internally. This causes a regression for platforms with the
extended linear cache enabled as the comparison always fails and the
cache size is not set. User visible impact is that when 'cxl list' is
issued, a CXL region with extended linear cache support will only
report half the size of the actual size. And this also breaks MCE
reporting of the memory region due to incorrect offset calculation
for the memory.

[dj: Fixup commit log suggested by djbw]
[dj: Fixup stable address for cc]

Fixes: 12b3d697c812 ("cxl: Remove core/acpi.c and cxl core dependency on ACPI")
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cxl/acpi.c

index 712624cba2b6e020f38b924681c77e2d1472a96c..87f0ed3f3f51fa6bd62aa5bc121da1245d3810f5 100644 (file)
@@ -345,7 +345,7 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
        struct resource res;
        int nid, rc;
 
-       res = DEFINE_RES(start, size, 0);
+       res = DEFINE_RES_MEM(start, size);
        nid = phys_to_target_node(start);
 
        rc = hmat_get_extended_linear_cache_size(&res, nid, &cache_size);