Commit d12aca5c authored by Linus Torvalds's avatar Linus Torvalds

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
parents 95232dd9 711442e2
...@@ -131,7 +131,7 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count) ...@@ -131,7 +131,7 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
struct cxl_port *iter = cxled_to_port(cxled); struct cxl_port *iter = cxled_to_port(cxled);
struct cxl_ep *ep; struct cxl_ep *ep;
int rc; int rc = 0;
while (!is_cxl_root(to_cxl_port(iter->dev.parent))) while (!is_cxl_root(to_cxl_port(iter->dev.parent)))
iter = to_cxl_port(iter->dev.parent); iter = to_cxl_port(iter->dev.parent);
...@@ -143,7 +143,8 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count) ...@@ -143,7 +143,8 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
cxl_rr = cxl_rr_load(iter, cxlr); cxl_rr = cxl_rr_load(iter, cxlr);
cxld = cxl_rr->decoder; cxld = cxl_rr->decoder;
rc = cxld->reset(cxld); if (cxld->reset)
rc = cxld->reset(cxld);
if (rc) if (rc)
return rc; return rc;
} }
...@@ -186,7 +187,8 @@ static int cxl_region_decode_commit(struct cxl_region *cxlr) ...@@ -186,7 +187,8 @@ static int cxl_region_decode_commit(struct cxl_region *cxlr)
iter = ep->next, ep = cxl_ep_load(iter, cxlmd)) { iter = ep->next, ep = cxl_ep_load(iter, cxlmd)) {
cxl_rr = cxl_rr_load(iter, cxlr); cxl_rr = cxl_rr_load(iter, cxlr);
cxld = cxl_rr->decoder; cxld = cxl_rr->decoder;
cxld->reset(cxld); if (cxld->reset)
cxld->reset(cxld);
} }
cxled->cxld.reset(&cxled->cxld); cxled->cxld.reset(&cxled->cxld);
...@@ -991,10 +993,10 @@ static int cxl_port_setup_targets(struct cxl_port *port, ...@@ -991,10 +993,10 @@ static int cxl_port_setup_targets(struct cxl_port *port,
int i, distance; int i, distance;
/* /*
* Passthrough ports impose no distance requirements between * Passthrough decoders impose no distance requirements between
* peers * peers
*/ */
if (port->nr_dports == 1) if (cxl_rr->nr_targets == 1)
distance = 0; distance = 0;
else else
distance = p->nr_targets / cxl_rr->nr_targets; distance = p->nr_targets / cxl_rr->nr_targets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment