]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cxl/mem: Arrange for always-synchronous memdev attach
authorDan Williams <dan.j.williams@intel.com>
Tue, 16 Dec 2025 00:56:12 +0000 (16:56 -0800)
committerDave Jiang <dave.jiang@intel.com>
Mon, 5 Jan 2026 17:13:53 +0000 (10:13 -0700)
commit1f1cb7f0c25574cf51501f8c8cece0047d7e8848
tree2ea89acf1ed07c8364033a21536973b9c5ebe0f2
parent10016118b6fade907143a32a7aeaa777063dc79c
cxl/mem: Arrange for always-synchronous memdev attach

In preparation for CXL accelerator drivers that have a hard dependency on
CXL capability initialization, arrange for cxl_mem_probe() to always run
synchronous with the device_add() of cxl_memdev instances. I.e.
cxl_mem_driver registration is always complete before the first memdev
creation event.

At present, cxl_pci does not care about the attach state of the cxl_memdev
because all generic memory expansion functionality can be handled by the
cxl_core. For accelerators, however, that driver needs to perform driver
specific initialization if CXL is available, or execute a fallback to PCIe
only operation.

This synchronous attach guarantee is also needed for Soft Reserve Recovery,
which is an effort that needs to assert that devices have had a chance to
attach before making a go / no-go decision on proceeding with CXL subsystem
initialization.

By moving devm_cxl_add_memdev() to cxl_mem.ko it removes async module
loading as one reason that a memdev may not be attached upon return from
devm_cxl_add_memdev().

Cc: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Cc: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Tested-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Tested-by: Alejandro Lucero <alucerop@amd.com>
Link: https://patch.msgid.link/20251216005616.3090129-3-dan.j.williams@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/Kconfig
drivers/cxl/core/memdev.c
drivers/cxl/cxlmem.h
drivers/cxl/mem.c