Skip to content

Commit 99698e7

Browse files
liming011davejiang
authored andcommitted
cxl/acpi: Remove cxl_acpi_set_cache_size()
cxl_acpi_set_cache_size() returns an error only when the size of the cache range is not matched with the CXL address range. Almost all implementation of setting cache size is in cxl_acpi_set_cache_size(), cxl_setup_extended_linear_size() does nothing except printing a warning in above error case, but cxl_acpi_set_cache_size() also prints a warning at the same time. So can consolidates these two functions into one, keep the function name as cxl_setup_extended_linear_size(). Signed-off-by: Li Ming <ming.li@zohomail.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://patch.msgid.link/20260109154042.331296-1-ming.li@zohomail.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent e5b1887 commit 99698e7

1 file changed

Lines changed: 5 additions & 24 deletions

File tree

drivers/cxl/acpi.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static int add_or_reset_cxl_resource(struct resource *parent, struct resource *r
357357
return rc;
358358
}
359359

360-
static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
360+
static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd)
361361
{
362362
struct cxl_decoder *cxld = &cxlrd->cxlsd.cxld;
363363
struct range *hpa = &cxld->hpa_range;
@@ -367,12 +367,14 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
367367
struct resource res;
368368
int nid, rc;
369369

370+
/* Explicitly initialize cache size to 0 at the beginning */
371+
cxlrd->cache_size = 0;
370372
res = DEFINE_RES_MEM(start, size);
371373
nid = phys_to_target_node(start);
372374

373375
rc = hmat_get_extended_linear_cache_size(&res, nid, &cache_size);
374376
if (rc)
375-
return 0;
377+
return;
376378

377379
/*
378380
* The cache range is expected to be within the CFMWS.
@@ -384,31 +386,10 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
384386
dev_warn(&cxld->dev,
385387
"Extended Linear Cache size %pa != CXL size %pa. No Support!",
386388
&cache_size, &size);
387-
return -ENXIO;
389+
return;
388390
}
389391

390392
cxlrd->cache_size = cache_size;
391-
392-
return 0;
393-
}
394-
395-
static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd)
396-
{
397-
int rc;
398-
399-
rc = cxl_acpi_set_cache_size(cxlrd);
400-
if (rc) {
401-
/*
402-
* Failing to retrieve extended linear cache region resize does not
403-
* prevent the region from functioning. Only causes cxl list showing
404-
* incorrect region size.
405-
*/
406-
dev_warn(cxlrd->cxlsd.cxld.dev.parent,
407-
"Extended linear cache retrieval failed rc:%d\n", rc);
408-
409-
/* Ignoring return code */
410-
cxlrd->cache_size = 0;
411-
}
412393
}
413394

414395
DEFINE_FREE(put_cxlrd, struct cxl_root_decoder *,

0 commit comments

Comments
 (0)