Skip to content

Commit e16bf7e

Browse files
committed
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.
2 parents 80dda9a + 5459e18 commit e16bf7e

3 files changed

Lines changed: 14 additions & 26 deletions

File tree

drivers/cxl/core/cdat.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/overflow.h>
88
#include "cxlpci.h"
99
#include "cxlmem.h"
10+
#include "core.h"
1011
#include "cxl.h"
1112

1213
struct dsmas_entry {
@@ -317,21 +318,18 @@ static int match_cxlrd_hb(struct device *dev, void *data)
317318
struct device *host_bridge = data;
318319
struct cxl_switch_decoder *cxlsd;
319320
struct cxl_root_decoder *cxlrd;
320-
unsigned int seq;
321321

322322
if (!is_root_decoder(dev))
323323
return 0;
324324

325325
cxlrd = to_cxl_root_decoder(dev);
326326
cxlsd = &cxlrd->cxlsd;
327327

328-
do {
329-
seq = read_seqbegin(&cxlsd->target_lock);
330-
for (int i = 0; i < cxlsd->nr_targets; i++) {
331-
if (host_bridge == cxlsd->target[i]->dport_dev)
332-
return 1;
333-
}
334-
} while (read_seqretry(&cxlsd->target_lock, seq));
328+
guard(rwsem_read)(&cxl_region_rwsem);
329+
for (int i = 0; i < cxlsd->nr_targets; i++) {
330+
if (host_bridge == cxlsd->target[i]->dport_dev)
331+
return 1;
332+
}
335333

336334
return 0;
337335
}

drivers/cxl/core/port.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,10 @@ static ssize_t target_list_show(struct device *dev,
173173
{
174174
struct cxl_switch_decoder *cxlsd = to_cxl_switch_decoder(dev);
175175
ssize_t offset;
176-
unsigned int seq;
177176
int rc;
178177

179-
do {
180-
seq = read_seqbegin(&cxlsd->target_lock);
181-
rc = emit_target_list(cxlsd, buf);
182-
} while (read_seqretry(&cxlsd->target_lock, seq));
183-
178+
guard(rwsem_read)(&cxl_region_rwsem);
179+
rc = emit_target_list(cxlsd, buf);
184180
if (rc < 0)
185181
return rc;
186182
offset = rc;
@@ -1678,7 +1674,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_mem_find_port, CXL);
16781674
static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd,
16791675
struct cxl_port *port, int *target_map)
16801676
{
1681-
int i, rc = 0;
1677+
int i;
16821678

16831679
if (!target_map)
16841680
return 0;
@@ -1688,19 +1684,16 @@ static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd,
16881684
if (xa_empty(&port->dports))
16891685
return -EINVAL;
16901686

1691-
write_seqlock(&cxlsd->target_lock);
1692-
for (i = 0; i < cxlsd->nr_targets; i++) {
1687+
guard(rwsem_write)(&cxl_region_rwsem);
1688+
for (i = 0; i < cxlsd->cxld.interleave_ways; i++) {
16931689
struct cxl_dport *dport = find_dport(port, target_map[i]);
16941690

1695-
if (!dport) {
1696-
rc = -ENXIO;
1697-
break;
1698-
}
1691+
if (!dport)
1692+
return -ENXIO;
16991693
cxlsd->target[i] = dport;
17001694
}
1701-
write_sequnlock(&cxlsd->target_lock);
17021695

1703-
return rc;
1696+
return 0;
17041697
}
17051698

17061699
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,
17701763
return -EINVAL;
17711764

17721765
cxlsd->nr_targets = nr_targets;
1773-
seqlock_init(&cxlsd->target_lock);
17741766
return cxl_decoder_init(port, &cxlsd->cxld);
17751767
}
17761768

drivers/cxl/cxl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ struct cxl_endpoint_decoder {
413413
/**
414414
* struct cxl_switch_decoder - Switch specific CXL HDM Decoder
415415
* @cxld: base cxl_decoder object
416-
* @target_lock: coordinate coherent reads of the target list
417416
* @nr_targets: number of elements in @target
418417
* @target: active ordered target list in current decoder configuration
419418
*
@@ -425,7 +424,6 @@ struct cxl_endpoint_decoder {
425424
*/
426425
struct cxl_switch_decoder {
427426
struct cxl_decoder cxld;
428-
seqlock_t target_lock;
429427
int nr_targets;
430428
struct cxl_dport *target[];
431429
};

0 commit comments

Comments
 (0)