mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
Merge branch 'for-7.3/cxl-type2-test' into cxl-for-next
cxl_test support for type2 cxl/test: Rework cxl_type2_mem_init() to use cxl_mock_platform_device_add() cxl/test: Add cxl_test accelerator driver cxl/test: Fixup hdm init for auto region to support type2 cxl/test: Propagate -ENOMEM on platform_device_alloc() failures cxl/test: Add hierarchy enumeration support for type2 device cxl/test: Refactor platform device enumerations cxl/test: Add type2 support for mock CFMWS0 cxl/test: Add test for module parameters
This commit is contained in:
commit
884d6a4fad
|
|
@ -5,10 +5,12 @@ obj-m += cxl_test.o
|
|||
obj-m += cxl_mock.o
|
||||
obj-m += cxl_mock_mem.o
|
||||
obj-m += cxl_translate.o
|
||||
obj-m += cxl_mock_accel.o
|
||||
|
||||
cxl_test-y := cxl.o
|
||||
cxl_test-y += hmem_test.o
|
||||
cxl_mock-y := mock.o
|
||||
cxl_mock_mem-y := mem.o
|
||||
cxl_mock_accel-y := accel.o
|
||||
|
||||
KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
|
||||
|
|
|
|||
66
tools/testing/cxl/test/accel.c
Normal file
66
tools/testing/cxl/test/accel.c
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
// Copyright(c) 2026 Intel Corporation. All rights reserved.
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <cxl/mailbox.h>
|
||||
#include <cxlmem.h>
|
||||
|
||||
struct mock_cxl_accel {
|
||||
struct cxl_dev_state cxlds;
|
||||
struct cxl_memdev *cxlmd;
|
||||
};
|
||||
|
||||
static int cxl_mock_accel_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct mock_cxl_accel *cxl_accel;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct cxl_dev_state *cxlds;
|
||||
struct cxl_memdev *cxlmd;
|
||||
struct range mock_range;
|
||||
int rc;
|
||||
|
||||
cxl_accel = devm_cxl_dev_state_create(&pdev->dev, CXL_DEVTYPE_DEVMEM,
|
||||
pdev->id + 1, 0,
|
||||
struct mock_cxl_accel, cxlds,
|
||||
false);
|
||||
if (!cxl_accel)
|
||||
return -ENOMEM;
|
||||
|
||||
cxlds = &cxl_accel->cxlds;
|
||||
cxlds->media_ready = true;
|
||||
rc = cxl_set_capacity(cxlds, SZ_512M);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
cxlmd = devm_cxl_probe_mem(cxlds, &mock_range);
|
||||
if (IS_ERR(cxlmd))
|
||||
return PTR_ERR(cxlmd);
|
||||
cxl_accel->cxlmd = cxlmd;
|
||||
|
||||
dev_dbg(dev, "Probed mock accelerator with range %pra\n", &mock_range);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct platform_device_id cxl_mock_accel_ids[] = {
|
||||
{ .name = "cxl_type2_accel" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, cxl_mock_accel_ids);
|
||||
|
||||
static struct platform_driver cxl_mock_accel_driver = {
|
||||
.probe = cxl_mock_accel_probe,
|
||||
.id_table = cxl_mock_accel_ids,
|
||||
.driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(cxl_mock_accel_driver);
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("cxl_test: accelerator device mock module");
|
||||
MODULE_IMPORT_NS("CXL");
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,8 +3,9 @@
|
|||
#include <linux/moduleparam.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include "../../../drivers/dax/bus.h"
|
||||
#include "mock.h"
|
||||
|
||||
static bool hmem_test;
|
||||
bool hmem_test;
|
||||
|
||||
static void hmem_test_work(struct work_struct *work)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <linux/dax.h>
|
||||
#include <cxl.h>
|
||||
|
||||
extern bool hmem_test;
|
||||
|
||||
struct cxl_mock_ops {
|
||||
struct list_head list;
|
||||
bool (*is_mock_adev)(struct acpi_device *dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user