Skip to content

Commit bd98cbb

Browse files
davejiangdjbw
authored andcommitted
ACPI: HMAT / cxl: Add retrieval of generic port coordinates for both access classes
Update acpi_get_genport_coordinates() to allow retrieval of both access classes of the 'struct access_coordinate' for a generic target. The update will allow CXL code to compute access coordinates for both access class. Cc: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20240308220055.2172956-5-dave.jiang@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 1745a7b commit bd98cbb

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

drivers/acpi/numa/hmat.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ static struct memory_target *acpi_find_genport_target(u32 uid)
126126
/**
127127
* acpi_get_genport_coordinates - Retrieve the access coordinates for a generic port
128128
* @uid: ACPI unique id
129-
* @coord: The access coordinates written back out for the generic port
129+
* @coord: The access coordinates written back out for the generic port.
130+
* Expect 2 levels array.
130131
*
131132
* Return: 0 on success. Errno on failure.
132133
*
@@ -142,7 +143,10 @@ int acpi_get_genport_coordinates(u32 uid,
142143
if (!target)
143144
return -ENOENT;
144145

145-
*coord = target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_LOCAL];
146+
coord[ACCESS_COORDINATE_LOCAL] =
147+
target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_LOCAL];
148+
coord[ACCESS_COORDINATE_CPU] =
149+
target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_CPU];
146150

147151
return 0;
148152
}

drivers/cxl/acpi.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,15 @@ static int get_genport_coordinates(struct device *dev, struct cxl_dport *dport)
530530
if (kstrtou32(acpi_device_uid(hb), 0, &uid))
531531
return -EINVAL;
532532

533-
rc = acpi_get_genport_coordinates(uid, &dport->hb_coord);
533+
rc = acpi_get_genport_coordinates(uid, dport->hb_coord);
534534
if (rc < 0)
535535
return rc;
536536

537537
/* Adjust back to picoseconds from nanoseconds */
538-
dport->hb_coord.read_latency *= 1000;
539-
dport->hb_coord.write_latency *= 1000;
538+
for (int i = 0; i < ACCESS_COORDINATE_MAX; i++) {
539+
dport->hb_coord[i].read_latency *= 1000;
540+
dport->hb_coord[i].write_latency *= 1000;
541+
}
540542

541543
return 0;
542544
}

drivers/cxl/core/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,
21522152
}
21532153

21542154
/* Augment with the generic port (host bridge) perf data */
2155-
combine_coordinates(&c, &dport->hb_coord);
2155+
combine_coordinates(&c, &dport->hb_coord[ACCESS_COORDINATE_LOCAL]);
21562156

21572157
/* Get the calculated PCI paths bandwidth */
21582158
pdev = to_pci_dev(port->uport_dev->parent);

drivers/cxl/cxl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ struct cxl_dport {
671671
struct cxl_port *port;
672672
struct cxl_regs regs;
673673
struct access_coordinate sw_coord;
674-
struct access_coordinate hb_coord;
674+
struct access_coordinate hb_coord[ACCESS_COORDINATE_MAX];
675675
long link_latency;
676676
};
677677

0 commit comments

Comments
 (0)