Skip to content

Commit 12bffae

Browse files
committed
Merge tag 'cxl-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL (Compute Express Link) updates from Dave Jiang: "The significant change of interest is the handling of soft reserved memory conflict between CXL and HMEM. In essence CXL will be the first to claim the soft reserved memory ranges that belongs to CXL and attempt to enumerate them with best effort. If CXL is not able to enumerate the ranges it will punt them to HMEM. There are also MAINTAINERS email changes from Dan Williams and Jonathan Cameron" * tag 'cxl-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (37 commits) MAINTAINERS: Update Jonathan Cameron's email address cxl/hdm: Add support for 32 switch decoders MAINTAINERS: Update address for Dan Williams tools/testing/cxl: Enable replay of user regions as auto regions cxl/region: Add a region sysfs interface for region lock status tools/testing/cxl: Test dax_hmem takeover of CXL regions tools/testing/cxl: Simulate auto-assembly failure dax/hmem: Parent dax_hmem devices dax/hmem: Fix singleton confusion between dax_hmem_work and hmem devices dax/hmem: Reduce visibility of dax_cxl coordination symbols cxl/region: Constify cxl_region_resource_contains() cxl/region: Limit visibility of cxl_region_contains_resource() dax/cxl: Fix HMEM dependencies cxl/region: Fix use-after-free from auto assembly failure cxl/core: Check existence of cxl_memdev_state in poison test cxl/core: use cleanup.h for devm_cxl_add_dax_region cxl/core/region: move dax region device logic into region_dax.c cxl/core/region: move pmem region driver logic into region_pmem.c dax/hmem, cxl: Defer and resolve Soft Reserved ownership cxl/region: Add helper to check Soft Reserved containment by CXL regions ...
2 parents 7d67274 + 6c724ce commit 12bffae

33 files changed

Lines changed: 1625 additions & 654 deletions

File tree

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Colin Ian King <colin.i.king@gmail.com> <colin.king@canonical.com>
208208
Corey Minyard <minyard@acm.org>
209209
Damian Hobson-Garcia <dhobsong@igel.co.jp>
210210
Dan Carpenter <error27@gmail.com> <dan.carpenter@oracle.com>
211+
Dan Williams <djbw@kernel.org> <dan.j.williams@intel.com>
211212
Daniel Borkmann <daniel@iogearbox.net> <danborkmann@googlemail.com>
212213
Daniel Borkmann <daniel@iogearbox.net> <danborkmann@iogearbox.net>
213214
Daniel Borkmann <daniel@iogearbox.net> <daniel.borkmann@tik.ee.ethz.ch>
@@ -427,6 +428,7 @@ John Stultz <johnstul@us.ibm.com>
427428
<jon.toppins+linux@gmail.com> <jtoppins@cumulusnetworks.com>
428429
<jon.toppins+linux@gmail.com> <jtoppins@redhat.com>
429430
Jonas Gorski <jonas.gorski@gmail.com> <jogo@openwrt.org>
431+
Jonathan Cameron <jic23@kernel.org> <jonathan.cameron@huawei.com>
430432
Jordan Crouse <jordan@cosmicpenguin.net> <jcrouse@codeaurora.org>
431433
<josh@joshtriplett.org> <josh@freedesktop.org>
432434
<josh@joshtriplett.org> <josh@kernel.org>

Documentation/ABI/testing/sysfs-bus-cxl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,19 @@ Description:
508508
(RO) The size of extended linear cache, if there is an extended
509509
linear cache. Otherwise the attribute will not be visible.
510510

511+
512+
What: /sys/bus/cxl/devices/regionZ/locked
513+
Date: Mar, 2026
514+
KernelVersion: v7.1
515+
Contact: linux-cxl@vger.kernel.org
516+
Description:
517+
(RO) The CXL driver has the capability to lock a region based on
518+
a BIOS or platform dependent configuration. Regions created as
519+
locked are never permitted to be destroyed. Resets to participating
520+
decoders will not result in a region destroy and will not free the
521+
decoder resources.
522+
523+
511524
What: /sys/bus/cxl/devices/regionZ/mode
512525
Date: January, 2023
513526
KernelVersion: v6.3

MAINTAINERS

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,7 +4055,7 @@ S: Maintained
40554055
F: crypto/rsa*
40564056

40574057
ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
4058-
R: Dan Williams <dan.j.williams@intel.com>
4058+
R: Dan Williams <djbw@kernel.org>
40594059
S: Odd fixes
40604060
W: http://sourceforge.net/projects/xscaleiop
40614061
F: Documentation/crypto/async-tx-api.rst
@@ -6422,12 +6422,12 @@ F: include/linux/compiler_attributes.h
64226422

64236423
COMPUTE EXPRESS LINK (CXL)
64246424
M: Davidlohr Bueso <dave@stgolabs.net>
6425-
M: Jonathan Cameron <jonathan.cameron@huawei.com>
6425+
M: Jonathan Cameron <jic23@kernel.org>
64266426
M: Dave Jiang <dave.jiang@intel.com>
64276427
M: Alison Schofield <alison.schofield@intel.com>
64286428
M: Vishal Verma <vishal.l.verma@intel.com>
64296429
M: Ira Weiny <ira.weiny@intel.com>
6430-
M: Dan Williams <dan.j.williams@intel.com>
6430+
M: Dan Williams <djbw@kernel.org>
64316431
L: linux-cxl@vger.kernel.org
64326432
S: Maintained
64336433
F: Documentation/driver-api/cxl
@@ -6438,7 +6438,7 @@ F: include/uapi/linux/cxl_mem.h
64386438
F: tools/testing/cxl/
64396439

64406440
COMPUTE EXPRESS LINK PMU (CPMU)
6441-
M: Jonathan Cameron <jonathan.cameron@huawei.com>
6441+
M: Jonathan Cameron <jic23@kernel.org>
64426442
L: linux-cxl@vger.kernel.org
64436443
S: Maintained
64446444
F: Documentation/admin-guide/perf/cxl.rst
@@ -7295,7 +7295,7 @@ S: Maintained
72957295
F: scripts/dev-needs.sh
72967296

72977297
DEVICE DIRECT ACCESS (DAX)
7298-
M: Dan Williams <dan.j.williams@intel.com>
7298+
M: Dan Williams <djbw@kernel.org>
72997299
M: Vishal Verma <vishal.l.verma@intel.com>
73007300
M: Dave Jiang <dave.jiang@intel.com>
73017301
L: nvdimm@lists.linux.dev
@@ -9852,7 +9852,7 @@ F: include/linux/fcntl.h
98529852
F: include/uapi/linux/fcntl.h
98539853

98549854
FILESYSTEM DIRECT ACCESS (DAX)
9855-
M: Dan Williams <dan.j.williams@intel.com>
9855+
M: Dan Williams <djbw@kernel.org>
98569856
R: Matthew Wilcox <willy@infradead.org>
98579857
R: Jan Kara <jack@suse.cz>
98589858
L: linux-fsdevel@vger.kernel.org
@@ -10597,7 +10597,7 @@ FWCTL SUBSYSTEM
1059710597
M: Dave Jiang <dave.jiang@intel.com>
1059810598
M: Jason Gunthorpe <jgg@nvidia.com>
1059910599
M: Saeed Mahameed <saeedm@nvidia.com>
10600-
R: Jonathan Cameron <Jonathan.Cameron@huawei.com>
10600+
R: Jonathan Cameron <jic23@kernel.org>
1060110601
S: Maintained
1060210602
F: Documentation/userspace-api/fwctl/
1060310603
F: drivers/fwctl/
@@ -12938,7 +12938,7 @@ F: drivers/platform/x86/intel/hid.c
1293812938

1293912939
INTEL I/OAT DMA DRIVER
1294012940
M: Dave Jiang <dave.jiang@intel.com>
12941-
R: Dan Williams <dan.j.williams@intel.com>
12941+
R: Dan Williams <djbw@kernel.org>
1294212942
L: dmaengine@vger.kernel.org
1294312943
S: Supported
1294412944
Q: https://patchwork.kernel.org/project/linux-dmaengine/list/
@@ -14657,7 +14657,7 @@ K: libie
1465714657

1465814658
LIBNVDIMM BTT: BLOCK TRANSLATION TABLE
1465914659
M: Vishal Verma <vishal.l.verma@intel.com>
14660-
M: Dan Williams <dan.j.williams@intel.com>
14660+
M: Dan Williams <djbw@kernel.org>
1466114661
M: Dave Jiang <dave.jiang@intel.com>
1466214662
L: nvdimm@lists.linux.dev
1466314663
S: Supported
@@ -14666,7 +14666,7 @@ P: Documentation/nvdimm/maintainer-entry-profile.rst
1466614666
F: drivers/nvdimm/btt*
1466714667

1466814668
LIBNVDIMM PMEM: PERSISTENT MEMORY DRIVER
14669-
M: Dan Williams <dan.j.williams@intel.com>
14669+
M: Dan Williams <djbw@kernel.org>
1467014670
M: Vishal Verma <vishal.l.verma@intel.com>
1467114671
M: Dave Jiang <dave.jiang@intel.com>
1467214672
L: nvdimm@lists.linux.dev
@@ -14684,7 +14684,7 @@ F: Documentation/devicetree/bindings/pmem/pmem-region.yaml
1468414684
F: drivers/nvdimm/of_pmem.c
1468514685

1468614686
LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
14687-
M: Dan Williams <dan.j.williams@intel.com>
14687+
M: Dan Williams <djbw@kernel.org>
1468814688
M: Vishal Verma <vishal.l.verma@intel.com>
1468914689
M: Dave Jiang <dave.jiang@intel.com>
1469014690
M: Ira Weiny <ira.weiny@intel.com>
@@ -25361,7 +25361,7 @@ F: drivers/staging/
2536125361

2536225362
STANDALONE CACHE CONTROLLER DRIVERS
2536325363
M: Conor Dooley <conor@kernel.org>
25364-
M: Jonathan Cameron <jonathan.cameron@huawei.com>
25364+
M: Jonathan Cameron <jic23@kernel.org>
2536525365
S: Maintained
2536625366
T: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
2536725367
F: Documentation/devicetree/bindings/cache/
@@ -27088,7 +27088,7 @@ S: Maintained
2708827088
F: Documentation/devicetree/bindings/trigger-source/*
2708927089

2709027090
TRUSTED EXECUTION ENVIRONMENT SECURITY MANAGER (TSM)
27091-
M: Dan Williams <dan.j.williams@intel.com>
27091+
M: Dan Williams <djbw@kernel.org>
2709227092
L: linux-coco@lists.linux.dev
2709327093
S: Maintained
2709427094
F: Documentation/ABI/testing/configfs-tsm-report

drivers/acpi/numa/srat.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,11 @@ int __init acpi_numa_init(void)
654654
}
655655
last_real_pxm = fake_pxm;
656656
fake_pxm++;
657-
acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws,
658-
&fake_pxm);
657+
658+
/* No need to expand numa nodes if CXL is disabled */
659+
if (IS_ENABLED(CONFIG_CXL_ACPI))
660+
acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws,
661+
&fake_pxm);
659662

660663
if (cnt < 0)
661664
return cnt;

drivers/cxl/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cxl_core-y += hdm.o
1515
cxl_core-y += pmu.o
1616
cxl_core-y += cdat.o
1717
cxl_core-$(CONFIG_TRACING) += trace.o
18-
cxl_core-$(CONFIG_CXL_REGION) += region.o
18+
cxl_core-$(CONFIG_CXL_REGION) += region.o region_pmem.o region_dax.o
1919
cxl_core-$(CONFIG_CXL_MCE) += mce.o
2020
cxl_core-$(CONFIG_CXL_FEATURES) += features.o
2121
cxl_core-$(CONFIG_CXL_EDAC_MEM_FEATURES) += edac.o

drivers/cxl/core/core.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ int cxl_get_poison_by_endpoint(struct cxl_port *port);
5050
struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa);
5151
u64 cxl_dpa_to_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
5252
u64 dpa);
53+
int devm_cxl_add_dax_region(struct cxl_region *cxlr);
54+
int devm_cxl_add_pmem_region(struct cxl_region *cxlr);
5355

5456
#else
5557
static inline u64 cxl_dpa_to_hpa(struct cxl_region *cxlr,
@@ -224,4 +226,6 @@ int cxl_set_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid,
224226
u16 *return_code);
225227
#endif
226228

229+
resource_size_t cxl_rcd_component_reg_phys(struct device *dev,
230+
struct cxl_dport *dport);
227231
#endif /* __CXL_CORE_H__ */

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
170170
}
171171

172172
parse_hdm_decoder_caps(cxlhdm);
173-
if (cxlhdm->decoder_count == 0) {
173+
if (cxlhdm->decoder_count < 0) {
174174
dev_err(dev, "Spec violation. Caps invalid\n");
175175
return ERR_PTR(-ENXIO);
176176
}

drivers/cxl/core/mbox.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ int cxl_enumerate_cmds(struct cxl_memdev_state *mds)
893893
}
894894
EXPORT_SYMBOL_NS_GPL(cxl_enumerate_cmds, "CXL");
895895

896-
void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
896+
void cxl_event_trace_record(struct cxl_memdev *cxlmd,
897897
enum cxl_event_log_type type,
898898
enum cxl_event_type event_type,
899899
const uuid_t *uuid, union cxl_event *evt)
@@ -920,6 +920,7 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
920920
* translations. Take topology mutation locks and lookup
921921
* { HPA, REGION } from { DPA, MEMDEV } in the event record.
922922
*/
923+
guard(device)(&cxlmd->dev);
923924
guard(rwsem_read)(&cxl_rwsem.region);
924925
guard(rwsem_read)(&cxl_rwsem.dpa);
925926

@@ -968,7 +969,7 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
968969
}
969970
EXPORT_SYMBOL_NS_GPL(cxl_event_trace_record, "CXL");
970971

971-
static void __cxl_event_trace_record(const struct cxl_memdev *cxlmd,
972+
static void __cxl_event_trace_record(struct cxl_memdev *cxlmd,
972973
enum cxl_event_log_type type,
973974
struct cxl_event_record_raw *record)
974975
{
@@ -1521,23 +1522,21 @@ int cxl_mailbox_init(struct cxl_mailbox *cxl_mbox, struct device *host)
15211522
}
15221523
EXPORT_SYMBOL_NS_GPL(cxl_mailbox_init, "CXL");
15231524

1524-
struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev)
1525+
struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev, u64 serial,
1526+
u16 dvsec)
15251527
{
15261528
struct cxl_memdev_state *mds;
15271529
int rc;
15281530

1529-
mds = devm_kzalloc(dev, sizeof(*mds), GFP_KERNEL);
1531+
mds = devm_cxl_dev_state_create(dev, CXL_DEVTYPE_CLASSMEM, serial,
1532+
dvsec, struct cxl_memdev_state, cxlds,
1533+
true);
15301534
if (!mds) {
15311535
dev_err(dev, "No memory available\n");
15321536
return ERR_PTR(-ENOMEM);
15331537
}
15341538

15351539
mutex_init(&mds->event.log_lock);
1536-
mds->cxlds.dev = dev;
1537-
mds->cxlds.reg_map.host = dev;
1538-
mds->cxlds.cxl_mbox.host = dev;
1539-
mds->cxlds.reg_map.resource = CXL_RESOURCE_NONE;
1540-
mds->cxlds.type = CXL_DEVTYPE_CLASSMEM;
15411540

15421541
rc = devm_cxl_register_mce_notifier(dev, &mds->mce_notifier);
15431542
if (rc == -EOPNOTSUPP)

drivers/cxl/core/memdev.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ bool cxl_memdev_has_poison_cmd(struct cxl_memdev *cxlmd,
204204
{
205205
struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds);
206206

207+
if (!mds)
208+
return 0;
209+
207210
return test_bit(cmd, mds->poison.enabled_cmds);
208211
}
209212

@@ -656,6 +659,30 @@ static void detach_memdev(struct work_struct *work)
656659

657660
static struct lock_class_key cxl_memdev_key;
658661

662+
struct cxl_dev_state *_devm_cxl_dev_state_create(struct device *dev,
663+
enum cxl_devtype type,
664+
u64 serial, u16 dvsec,
665+
size_t size, bool has_mbox)
666+
{
667+
struct cxl_dev_state *cxlds = devm_kzalloc(dev, size, GFP_KERNEL);
668+
669+
if (!cxlds)
670+
return NULL;
671+
672+
cxlds->dev = dev;
673+
cxlds->type = type;
674+
cxlds->serial = serial;
675+
cxlds->cxl_dvsec = dvsec;
676+
cxlds->reg_map.host = dev;
677+
cxlds->reg_map.resource = CXL_RESOURCE_NONE;
678+
679+
if (has_mbox)
680+
cxlds->cxl_mbox.host = dev;
681+
682+
return cxlds;
683+
}
684+
EXPORT_SYMBOL_NS_GPL(_devm_cxl_dev_state_create, "CXL");
685+
659686
static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds,
660687
const struct file_operations *fops,
661688
const struct cxl_memdev_attach *attach)

drivers/cxl/core/pci.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,63 @@ bool cxl_endpoint_decoder_reset_detected(struct cxl_port *port)
696696
}
697697
EXPORT_SYMBOL_NS_GPL(cxl_endpoint_decoder_reset_detected, "CXL");
698698

699+
static int cxl_rcrb_get_comp_regs(struct pci_dev *pdev,
700+
struct cxl_register_map *map,
701+
struct cxl_dport *dport)
702+
{
703+
resource_size_t component_reg_phys;
704+
705+
*map = (struct cxl_register_map) {
706+
.host = &pdev->dev,
707+
.resource = CXL_RESOURCE_NONE,
708+
};
709+
710+
component_reg_phys = cxl_rcd_component_reg_phys(&pdev->dev, dport);
711+
if (component_reg_phys == CXL_RESOURCE_NONE)
712+
return -ENXIO;
713+
714+
map->resource = component_reg_phys;
715+
map->reg_type = CXL_REGLOC_RBI_COMPONENT;
716+
map->max_size = CXL_COMPONENT_REG_BLOCK_SIZE;
717+
718+
return 0;
719+
}
720+
721+
int cxl_pci_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type,
722+
struct cxl_register_map *map)
723+
{
724+
int rc;
725+
726+
rc = cxl_find_regblock(pdev, type, map);
727+
728+
/*
729+
* If the Register Locator DVSEC does not exist, check if it
730+
* is an RCH and try to extract the Component Registers from
731+
* an RCRB.
732+
*/
733+
if (rc && type == CXL_REGLOC_RBI_COMPONENT && is_cxl_restricted(pdev)) {
734+
struct cxl_dport *dport;
735+
struct cxl_port *port __free(put_cxl_port) =
736+
cxl_pci_find_port(pdev, &dport);
737+
if (!port)
738+
return -EPROBE_DEFER;
739+
740+
rc = cxl_rcrb_get_comp_regs(pdev, map, dport);
741+
if (rc)
742+
return rc;
743+
744+
rc = cxl_dport_map_rcd_linkcap(pdev, dport);
745+
if (rc)
746+
return rc;
747+
748+
} else if (rc) {
749+
return rc;
750+
}
751+
752+
return cxl_setup_regs(map);
753+
}
754+
EXPORT_SYMBOL_NS_GPL(cxl_pci_setup_regs, "CXL");
755+
699756
int cxl_pci_get_bandwidth(struct pci_dev *pdev, struct access_coordinate *c)
700757
{
701758
int speed, bw;

0 commit comments

Comments
 (0)