Skip to content

Commit 78b8f1a

Browse files
djbwdavejiang
authored andcommitted
tools/testing/cxl: Simulate auto-assembly failure
Add a cxl_test module option to skip setting up one of the members of the default auto-assembled region. This simulates a device failing between firmware setup and OS boot, or region configuration interrupted by an event like kexec. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://patch.msgid.link/20260327052821.440749-9-dan.j.williams@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 059edcc commit 78b8f1a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • tools/testing/cxl/test

tools/testing/cxl/test/cxl.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
static int interleave_arithmetic;
1818
static bool extended_linear_cache;
19+
static bool fail_autoassemble;
1920

2021
#define FAKE_QTG_ID 42
2122

@@ -819,6 +820,12 @@ static void mock_init_hdm_decoder(struct cxl_decoder *cxld)
819820
return;
820821
}
821822

823+
/* Simulate missing cxl_mem.4 configuration */
824+
if (hb0 && pdev->id == 4 && cxld->id == 0 && fail_autoassemble) {
825+
default_mock_decoder(cxld);
826+
return;
827+
}
828+
822829
base = window->base_hpa;
823830
if (extended_linear_cache)
824831
base += mock_auto_region_size;
@@ -1620,6 +1627,8 @@ module_param(interleave_arithmetic, int, 0444);
16201627
MODULE_PARM_DESC(interleave_arithmetic, "Modulo:0, XOR:1");
16211628
module_param(extended_linear_cache, bool, 0444);
16221629
MODULE_PARM_DESC(extended_linear_cache, "Enable extended linear cache support");
1630+
module_param(fail_autoassemble, bool, 0444);
1631+
MODULE_PARM_DESC(fail_autoassemble, "Simulate missing member of an auto-region");
16231632
module_init(cxl_test_init);
16241633
module_exit(cxl_test_exit);
16251634
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)