-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/testing/cxl: Introduce a mock memory device + driver
Introduce an emulated device-set plus driver to register CXL memory devices, 'struct cxl_memdev' instances, in the mock cxl_test topology. This enables the development of HDM Decoder (Host-managed Device Memory Decoder) programming flow (region provisioning) in an environment that can be updated alongside the kernel as it gains more functionality. Whereas the cxl_pci module looks for CXL memory expanders on the 'pci' bus, the cxl_mock_mem module attaches to CXL expanders on the platform bus emitted by cxl_test. Acked-by: Ben Widawsky <ben.widawsky@intel.com> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/163116440099.2460985.10692549614409346604.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
- Loading branch information
Dan Williams
committed
Sep 21, 2021
1 parent
49be6dd
commit 7d3eb23
Showing
8 changed files
with
359 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* Copyright(c) 2021 Intel Corporation. All rights reserved. */ | ||
#include <cxl.h> | ||
#include "test/mock.h" | ||
#include <core/core.h> | ||
|
||
int match_nvdimm_bridge(struct device *dev, const void *data) | ||
{ | ||
int index, rc = 0; | ||
struct cxl_mock_ops *ops = get_cxl_mock_ops(&index); | ||
const struct cxl_nvdimm *cxl_nvd = data; | ||
|
||
if (ops) { | ||
if (dev->type == &cxl_nvdimm_bridge_type && | ||
(ops->is_mock_dev(dev->parent->parent) == | ||
ops->is_mock_dev(cxl_nvd->dev.parent->parent))) | ||
rc = 1; | ||
} else | ||
rc = dev->type == &cxl_nvdimm_bridge_type; | ||
|
||
put_cxl_mock_ops(index); | ||
|
||
return rc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
ccflags-y := -I$(srctree)/drivers/cxl/ | ||
|
||
obj-m += cxl_test.o | ||
obj-m += cxl_mock.o | ||
obj-m += cxl_mock_mem.o | ||
|
||
cxl_test-y := cxl.o | ||
cxl_mock-y := mock.o | ||
cxl_mock_mem-y := mem.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.