diff options
author | Dan Williams <dan.j.williams@intel.com> | 2024-01-05 19:24:33 -0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2024-01-05 19:24:33 -0800 |
commit | e16bf7e015d75fdd805528bedaf285fcb71dad2a (patch) | |
tree | e5ec5f22bc582951752565ddf260cd4c89b95bee /drivers/cxl/core/port.c | |
parent | 80dda9a69a487c72ded1ac69234c8a89d5922b04 (diff) | |
parent | 5459e186a5c9f412334321cff58d70dcb0e48a04 (diff) | |
download | linux-stable-e16bf7e015d75fdd805528bedaf285fcb71dad2a.tar.gz linux-stable-e16bf7e015d75fdd805528bedaf285fcb71dad2a.tar.bz2 linux-stable-e16bf7e015d75fdd805528bedaf285fcb71dad2a.zip |
Merge branch 'for-6.7/cxl' into for-6.8/cxl
Pick up a late locking change + fixup that is better as merge window
material than rc material.
Diffstat (limited to 'drivers/cxl/core/port.c')
-rw-r--r-- | drivers/cxl/core/port.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 63a4e3c2baed..e59d9d37aa65 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -173,14 +173,10 @@ static ssize_t target_list_show(struct device *dev, { struct cxl_switch_decoder *cxlsd = to_cxl_switch_decoder(dev); ssize_t offset; - unsigned int seq; int rc; - do { - seq = read_seqbegin(&cxlsd->target_lock); - rc = emit_target_list(cxlsd, buf); - } while (read_seqretry(&cxlsd->target_lock, seq)); - + guard(rwsem_read)(&cxl_region_rwsem); + rc = emit_target_list(cxlsd, buf); if (rc < 0) return rc; offset = rc; @@ -1678,7 +1674,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_mem_find_port, CXL); static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd, struct cxl_port *port, int *target_map) { - int i, rc = 0; + int i; if (!target_map) return 0; @@ -1688,19 +1684,16 @@ static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd, if (xa_empty(&port->dports)) return -EINVAL; - write_seqlock(&cxlsd->target_lock); - for (i = 0; i < cxlsd->nr_targets; i++) { + guard(rwsem_write)(&cxl_region_rwsem); + for (i = 0; i < cxlsd->cxld.interleave_ways; i++) { struct cxl_dport *dport = find_dport(port, target_map[i]); - if (!dport) { - rc = -ENXIO; - break; - } + if (!dport) + return -ENXIO; cxlsd->target[i] = dport; } - write_sequnlock(&cxlsd->target_lock); - return rc; + return 0; } struct cxl_dport *cxl_hb_modulo(struct cxl_root_decoder *cxlrd, int pos) @@ -1770,7 +1763,6 @@ static int cxl_switch_decoder_init(struct cxl_port *port, return -EINVAL; cxlsd->nr_targets = nr_targets; - seqlock_init(&cxlsd->target_lock); return cxl_decoder_init(port, &cxlsd->cxld); } |