mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
When platform firmware is committed to publishing EFI_CONVENTIONAL_MEMORY in the memory map, but CXL fails to assemble the region, dax_hmem can attempt to attach a dax device to the memory range. Take advantage of the new ability to support multiple "hmem_platform" devices, and to enable regression testing of several scenarios: * CXL correctly assembles a region, check dax_hmem fails to attach dax * CXL fails to assemble a region, check dax_hmem successfully attaches dax * Check that loading the dax_cxl driver loads the dax_hmem driver * Attempt to race cxl_mock_mem async probe vs dax_hmem probe flushing. Check that both positive and negative cases. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Tested-by: Alison Schofield <alison.schofield@intel.com> Link: https://patch.msgid.link/20260327052821.440749-10-dan.j.williams@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
48 lines
1003 B
C
48 lines
1003 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright (C) 2026 Intel Corporation */
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/workqueue.h>
|
|
#include "../../../drivers/dax/bus.h"
|
|
|
|
static bool hmem_test;
|
|
|
|
static void hmem_test_work(struct work_struct *work)
|
|
{
|
|
}
|
|
|
|
static void hmem_test_release(struct device *dev)
|
|
{
|
|
struct hmem_platform_device *hpdev =
|
|
container_of(dev, typeof(*hpdev), pdev.dev);
|
|
|
|
memset(hpdev, 0, sizeof(*hpdev));
|
|
}
|
|
|
|
static struct hmem_platform_device hmem_test_device = {
|
|
.pdev = {
|
|
.name = "hmem_platform",
|
|
.id = 1,
|
|
.dev = {
|
|
.release = hmem_test_release,
|
|
},
|
|
},
|
|
.work = __WORK_INITIALIZER(hmem_test_device.work, hmem_test_work),
|
|
};
|
|
|
|
int hmem_test_init(void)
|
|
{
|
|
if (!hmem_test)
|
|
return 0;
|
|
|
|
return platform_device_register(&hmem_test_device.pdev);
|
|
}
|
|
|
|
void hmem_test_exit(void)
|
|
{
|
|
if (hmem_test)
|
|
platform_device_unregister(&hmem_test_device.pdev);
|
|
}
|
|
|
|
module_param(hmem_test, bool, 0444);
|
|
MODULE_PARM_DESC(hmem_test, "Enable/disable the dax_hmem test platform device");
|