mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
cxl/test: Add type2 support for mock CFMWS0
Add a module parameter 'type2_test' for triggering type2 test support in cxl_test. Setup the CFMWS0 configuration to be type2 when 'type2_test' is set. Tested-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Link: https://patch.msgid.link/20260629221104.3891733-3-dave.jiang@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
afae0fa7c6
commit
fc8fc576d9
|
|
@ -17,6 +17,7 @@
|
|||
static int interleave_arithmetic;
|
||||
static bool extended_linear_cache;
|
||||
static bool fail_autoassemble;
|
||||
static bool type2_test;
|
||||
|
||||
#define FAKE_QTG_ID 42
|
||||
|
||||
|
|
@ -384,6 +385,19 @@ static struct {
|
|||
},
|
||||
};
|
||||
|
||||
static struct acpi_cedt_cfmws type2_cfmws0 = {
|
||||
.header = {
|
||||
.type = ACPI_CEDT_TYPE_CFMWS,
|
||||
.length = sizeof(mock_cedt.cfmws0),
|
||||
},
|
||||
.interleave_ways = 0,
|
||||
.granularity = 4,
|
||||
.restrictions = ACPI_CEDT_CFMWS_RESTRICT_DEVMEM |
|
||||
ACPI_CEDT_CFMWS_RESTRICT_VOLATILE,
|
||||
.qtg_id = FAKE_QTG_ID,
|
||||
.window_size = SZ_256M * 4,
|
||||
};
|
||||
|
||||
struct acpi_cedt_cfmws *mock_cfmws[] = {
|
||||
[0] = &mock_cedt.cfmws0.cfmws,
|
||||
[1] = &mock_cedt.cfmws1.cfmws,
|
||||
|
|
@ -476,6 +490,11 @@ static void cfmws_elc_update(struct acpi_cedt_cfmws *window, int index)
|
|||
window->window_size = mock_auto_region_size * 2;
|
||||
}
|
||||
|
||||
static void update_type2_cfmws(void)
|
||||
{
|
||||
memcpy(&mock_cedt.cfmws0.cfmws, &type2_cfmws0, sizeof(type2_cfmws0));
|
||||
}
|
||||
|
||||
static int populate_cedt(void)
|
||||
{
|
||||
struct cxl_mock_res *res;
|
||||
|
|
@ -497,11 +516,15 @@ static int populate_cedt(void)
|
|||
chbs->length = size;
|
||||
}
|
||||
|
||||
if (type2_test)
|
||||
update_type2_cfmws();
|
||||
|
||||
for (i = cfmws_start; i <= cfmws_end; i++) {
|
||||
struct acpi_cedt_cfmws *window = mock_cfmws[i];
|
||||
int align = SZ_256M;
|
||||
|
||||
cfmws_elc_update(window, i);
|
||||
if (i == 0 && !type2_test)
|
||||
cfmws_elc_update(window, i);
|
||||
if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
|
||||
align = max_t(int, SZ_256M, PMD_SIZE);
|
||||
res = alloc_mock_res(window->window_size, align);
|
||||
|
|
@ -1837,6 +1860,8 @@ static bool __init have_multiple_modparms(void)
|
|||
count++;
|
||||
if (hmem_test)
|
||||
count++;
|
||||
if (type2_test)
|
||||
count++;
|
||||
|
||||
return count > 1;
|
||||
}
|
||||
|
|
@ -2067,6 +2092,8 @@ module_param(extended_linear_cache, bool, 0444);
|
|||
MODULE_PARM_DESC(extended_linear_cache, "Enable extended linear cache support");
|
||||
module_param(fail_autoassemble, bool, 0444);
|
||||
MODULE_PARM_DESC(fail_autoassemble, "Simulate missing member of an auto-region");
|
||||
module_param(type2_test, bool, 0444);
|
||||
MODULE_PARM_DESC(type2_test, "Enable type 2 support testing");
|
||||
module_init(cxl_test_init);
|
||||
module_exit(cxl_test_exit);
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user