Skip to content

Commit 4b1c046

Browse files
committed
cxl/test: Add cxl_test CFMWS support for extended linear cache
Add a module parameter to allow activation of extended linear cache on the auto region for cxl_test. The current platform implementation for extended linear cache is 1:1 of DRAM and CXL memory. A CFMWS is created with the size of both memory together where DRAM takes the first part of the memory range and CXL covers the second part. The current CXL auto region on cxl_test consists of 2 256M devices that creates a 512M region. The new extended linear cache setup will have 512M DRAM and 512M CXL memory for a total of 1G CFMWS. The hardware decoders must have their starting offset moved to after the DRAM region to handle the CXL regions. [ dj: Fixup commenting style. (Jonathan) ] Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com> Link: https://patch.msgid.link/20251117144611.903692-3-dave.jiang@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent fa59c35 commit 4b1c046

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • tools/testing/cxl/test

tools/testing/cxl/test/cxl.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "mock.h"
1616

1717
static int interleave_arithmetic;
18+
static bool extended_linear_cache;
1819

1920
#define FAKE_QTG_ID 42
2021

@@ -429,6 +430,22 @@ static struct cxl_mock_res *alloc_mock_res(resource_size_t size, int align)
429430
return res;
430431
}
431432

433+
/* Only update CFMWS0 as this is used by the auto region. */
434+
static void cfmws_elc_update(struct acpi_cedt_cfmws *window, int index)
435+
{
436+
if (!extended_linear_cache)
437+
return;
438+
439+
if (index != 0)
440+
return;
441+
442+
/*
443+
* The window size should be 2x of the CXL region size where half is
444+
* DRAM and half is CXL
445+
*/
446+
window->window_size = mock_auto_region_size * 2;
447+
}
448+
432449
static int populate_cedt(void)
433450
{
434451
struct cxl_mock_res *res;
@@ -453,6 +470,7 @@ static int populate_cedt(void)
453470
for (i = cfmws_start; i <= cfmws_end; i++) {
454471
struct acpi_cedt_cfmws *window = mock_cfmws[i];
455472

473+
cfmws_elc_update(window, i);
456474
res = alloc_mock_res(window->window_size, SZ_256M);
457475
if (!res)
458476
return -ENOMEM;
@@ -783,6 +801,8 @@ static void mock_init_hdm_decoder(struct cxl_decoder *cxld)
783801
}
784802

785803
base = window->base_hpa;
804+
if (extended_linear_cache)
805+
base += mock_auto_region_size;
786806
cxld->hpa_range = (struct range) {
787807
.start = base,
788808
.end = base + mock_auto_region_size - 1,
@@ -1609,6 +1629,8 @@ static __exit void cxl_test_exit(void)
16091629

16101630
module_param(interleave_arithmetic, int, 0444);
16111631
MODULE_PARM_DESC(interleave_arithmetic, "Modulo:0, XOR:1");
1632+
module_param(extended_linear_cache, bool, 0444);
1633+
MODULE_PARM_DESC(extended_linear_cache, "Enable extended linear cache support");
16121634
module_init(cxl_test_init);
16131635
module_exit(cxl_test_exit);
16141636
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)