Skip to content

Commit d64035a

Browse files
committed
cxl: Change sslbis handler to only handle single dport
While cxl_switch_parse_cdat() is harmless to be run multiple times, it is not efficient in the current scheme where one dport is being updated at a time by the memdev probe path. Change the input parameter to the specific dport being updated to pick up the SSLBIS information for just that dport. Reviewed-by: Gregory Price <gourry@gourry.net> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Li Ming <ming.li@zohomail.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Robert Richter <rrichter@amd.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 87439b5 commit d64035a

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

drivers/cxl/core/cdat.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ static int cdat_sslbis_handler(union acpi_subtable_headers *header, void *arg,
440440
} *tbl = (struct acpi_cdat_sslbis_table *)header;
441441
int size = sizeof(header->cdat) + sizeof(tbl->sslbis_header);
442442
struct acpi_cdat_sslbis *sslbis;
443-
struct cxl_port *port = arg;
444-
struct device *dev = &port->dev;
443+
struct cxl_dport *dport = arg;
444+
struct device *dev = &dport->port->dev;
445445
int remain, entries, i;
446446
u16 len;
447447

@@ -467,8 +467,6 @@ static int cdat_sslbis_handler(union acpi_subtable_headers *header, void *arg,
467467
u16 y = le16_to_cpu((__force __le16)tbl->entries[i].porty_id);
468468
__le64 le_base;
469469
__le16 le_val;
470-
struct cxl_dport *dport;
471-
unsigned long index;
472470
u16 dsp_id;
473471
u64 val;
474472

@@ -499,28 +497,27 @@ static int cdat_sslbis_handler(union acpi_subtable_headers *header, void *arg,
499497
val = cdat_normalize(le16_to_cpu(le_val), le64_to_cpu(le_base),
500498
sslbis->data_type);
501499

502-
xa_for_each(&port->dports, index, dport) {
503-
if (dsp_id == ACPI_CDAT_SSLBIS_ANY_PORT ||
504-
dsp_id == dport->port_id) {
505-
cxl_access_coordinate_set(dport->coord,
506-
sslbis->data_type,
507-
val);
508-
}
500+
if (dsp_id == ACPI_CDAT_SSLBIS_ANY_PORT ||
501+
dsp_id == dport->port_id) {
502+
cxl_access_coordinate_set(dport->coord,
503+
sslbis->data_type, val);
504+
return 0;
509505
}
510506
}
511507

512508
return 0;
513509
}
514510

515-
void cxl_switch_parse_cdat(struct cxl_port *port)
511+
void cxl_switch_parse_cdat(struct cxl_dport *dport)
516512
{
513+
struct cxl_port *port = dport->port;
517514
int rc;
518515

519516
if (!port->cdat.table)
520517
return;
521518

522519
rc = cdat_table_parse(ACPI_CDAT_TYPE_SSLBIS, cdat_sslbis_handler,
523-
port, port->cdat.table, port->cdat.length);
520+
dport, port->cdat.table, port->cdat.length);
524521
rc = cdat_table_parse_output(rc);
525522
if (rc)
526523
dev_dbg(&port->dev, "Failed to parse SSLBIS: %d\n", rc);

drivers/cxl/core/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ static struct cxl_dport *cxl_port_add_dport(struct cxl_port *port,
16071607
if (IS_ERR(new_dport))
16081608
return new_dport;
16091609

1610-
cxl_switch_parse_cdat(port);
1610+
cxl_switch_parse_cdat(new_dport);
16111611

16121612
if (ida_is_empty(&port->decoder_ida)) {
16131613
rc = devm_cxl_switch_port_decoders_setup(port);

drivers/cxl/cxl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
892892
#endif
893893

894894
void cxl_endpoint_parse_cdat(struct cxl_port *port);
895-
void cxl_switch_parse_cdat(struct cxl_port *port);
895+
void cxl_switch_parse_cdat(struct cxl_dport *dport);
896896

897897
int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,
898898
struct access_coordinate *coord);

0 commit comments

Comments
 (0)