]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cxl/region: Quiet some dev_warn()s in extended linear cache setup
authorAlison Schofield <alison.schofield@intel.com>
Thu, 6 Mar 2025 21:36:51 +0000 (13:36 -0800)
committerDave Jiang <dave.jiang@intel.com>
Fri, 14 Mar 2025 23:28:15 +0000 (16:28 -0700)
Extended Linear Cache (ELC) setup code emits a dev_warn(), "Extended
linear cache calculation failed." for issues found while setting up
the ELC.

For platforms without CONFIG_ACPI_HMAT, every auto region setup will
emit the warning because the default !ACPI_HMAT return value is
EOPNOTSUPP. Suppress it by skipping the warn for EOPNOTSUPP. Change
the EOPNOTSUPP in the actual ELC failure path to ENXIO.

Remove the check and enusing dev_warn() when region resource size is
NULL. The endpoint decoders hpa_range used to create the resource is
checked in init_hdm_decoder(), so it cannot be NULL here.

For good measure, add the rc value to the dev_warn(). It will either
be the -ENOENT returned by HMAT if the mem target is not found, or
the -ENXIO from the region driver calculation.

Reviewed-by: Li Ming <ming.li@zohomail.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20250306213700.2606304-1-alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c

index a09ae21a26c6e3eb8b263788e3bf30691520ab82..6d8bdb53f258c96ea12fd4a0d2ad67f46d719f09 100644 (file)
@@ -3235,13 +3235,10 @@ static int cxl_extended_linear_cache_resize(struct cxl_region *cxlr,
        struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(cxlr->dev.parent);
        struct cxl_region_params *p = &cxlr->params;
        int nid = phys_to_target_node(res->start);
-       resource_size_t size, cache_size, start;
+       resource_size_t size = resource_size(res);
+       resource_size_t cache_size, start;
        int rc;
 
-       size = resource_size(res);
-       if (!size)
-               return -EINVAL;
-
        rc = cxl_acpi_get_extended_linear_cache_size(res, nid, &cache_size);
        if (rc)
                return rc;
@@ -3253,7 +3250,7 @@ static int cxl_extended_linear_cache_resize(struct cxl_region *cxlr,
                dev_warn(&cxlr->dev,
                         "Extended Linear Cache size %pa != CXL size %pa. No Support!",
                         &cache_size, &size);
-               return -EOPNOTSUPP;
+               return -ENXIO;
        }
 
        /*
@@ -3305,14 +3302,14 @@ static int __construct_region(struct cxl_region *cxlr,
                                    dev_name(&cxlr->dev));
 
        rc = cxl_extended_linear_cache_resize(cxlr, res);
-       if (rc) {
+       if (rc && rc != -EOPNOTSUPP) {
                /*
                 * Failing to support extended linear cache region resize does not
                 * prevent the region from functioning. Only causes cxl list showing
                 * incorrect region size.
                 */
                dev_warn(cxlmd->dev.parent,
-                        "Extended linear cache calculation failed.\n");
+                        "Extended linear cache calculation failed rc:%d\n", rc);
        }
 
        rc = insert_resource(cxlrd->res, res);