Skip to content

Commit d12aca5

Browse files
committed
Merge tag 'cxl-fixes-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull cxl fixes from Dan Williams: "Two fixups for CXL (Compute Express Link) in presence of passthrough decoders. This primarily helps developers using the QEMU CXL emulation, but with the impending arrival of CXL switches these types of topologies will be of interest to end users. - Fix a crash when shutting down regions in the presence of passthrough decoders - Fix region creation to understand passthrough decoders instead of the narrower definition of passthrough ports" * tag 'cxl-fixes-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: cxl/region: Fix passthrough-decoder detection cxl/region: Fix null pointer dereference for resetting decoder
2 parents 95232dd + 711442e commit d12aca5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/cxl/core/region.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
131131
struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
132132
struct cxl_port *iter = cxled_to_port(cxled);
133133
struct cxl_ep *ep;
134-
int rc;
134+
int rc = 0;
135135

136136
while (!is_cxl_root(to_cxl_port(iter->dev.parent)))
137137
iter = to_cxl_port(iter->dev.parent);
@@ -143,7 +143,8 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
143143

144144
cxl_rr = cxl_rr_load(iter, cxlr);
145145
cxld = cxl_rr->decoder;
146-
rc = cxld->reset(cxld);
146+
if (cxld->reset)
147+
rc = cxld->reset(cxld);
147148
if (rc)
148149
return rc;
149150
}
@@ -186,7 +187,8 @@ static int cxl_region_decode_commit(struct cxl_region *cxlr)
186187
iter = ep->next, ep = cxl_ep_load(iter, cxlmd)) {
187188
cxl_rr = cxl_rr_load(iter, cxlr);
188189
cxld = cxl_rr->decoder;
189-
cxld->reset(cxld);
190+
if (cxld->reset)
191+
cxld->reset(cxld);
190192
}
191193

192194
cxled->cxld.reset(&cxled->cxld);
@@ -991,10 +993,10 @@ static int cxl_port_setup_targets(struct cxl_port *port,
991993
int i, distance;
992994

993995
/*
994-
* Passthrough ports impose no distance requirements between
996+
* Passthrough decoders impose no distance requirements between
995997
* peers
996998
*/
997-
if (port->nr_dports == 1)
999+
if (cxl_rr->nr_targets == 1)
9981000
distance = 0;
9991001
else
10001002
distance = p->nr_targets / cxl_rr->nr_targets;

0 commit comments

Comments
 (0)