Skip to content

Commit 5e5f4ad

Browse files
committed
cxl/port: Move endpoint HDM Decoder Capability init to port driver
The responsibility for establishing HDM Decoder Capability based operation is more closely tied to port enabling than memdev enabling which is concerned with port enumeration. This later enables reusing @cxlhdm for probing / controlling "global enable" for the HDM Decoder Capability. For now, just do the nominal move. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/165291691167.1426646.7936109077255288258.stgit@dwillia2-xfh Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 92804ed commit 5e5f4ad

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

drivers/cxl/mem.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ static void enable_suspend(void *data)
5454
static int cxl_mem_probe(struct device *dev)
5555
{
5656
struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
57-
struct cxl_dev_state *cxlds = cxlmd->cxlds;
5857
struct cxl_port *parent_port;
5958
int rc;
6059

@@ -94,16 +93,6 @@ static int cxl_mem_probe(struct device *dev)
9493
if (rc)
9594
return rc;
9695

97-
rc = cxl_hdm_decode_init(cxlds);
98-
if (rc)
99-
return rc;
100-
101-
rc = cxl_await_media_ready(cxlds);
102-
if (rc) {
103-
dev_err(dev, "Media not active (%d)\n", rc);
104-
return rc;
105-
}
106-
10796
/*
10897
* The kernel may be operating out of CXL memory on this device,
10998
* there is no spec defined way to determine whether this device

drivers/cxl/port.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,22 @@ static int cxl_port_probe(struct device *dev)
3838

3939
if (is_cxl_endpoint(port)) {
4040
struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport);
41+
struct cxl_dev_state *cxlds = cxlmd->cxlds;
4142

4243
get_device(&cxlmd->dev);
4344
rc = devm_add_action_or_reset(dev, schedule_detach, cxlmd);
4445
if (rc)
4546
return rc;
47+
48+
rc = cxl_hdm_decode_init(cxlds);
49+
if (rc)
50+
return rc;
51+
52+
rc = cxl_await_media_ready(cxlds);
53+
if (rc) {
54+
dev_err(dev, "Media not active (%d)\n", rc);
55+
return rc;
56+
}
4657
} else {
4758
rc = devm_cxl_port_enumerate_dports(port);
4859
if (rc < 0)

0 commit comments

Comments
 (0)