Skip to content

Commit

Permalink
ACPI: HMAT / cxl: Add retrieval of generic port coordinates for both …
Browse files Browse the repository at this point in the history
…access classes

[ Upstream commit bd98cbb ]

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>
Stable-dep-of: 592780b ("cxl: Fix retrieving of access_coordinates in PCIe path")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
davejiang authored and gregkh committed Apr 17, 2024
1 parent ddf9cd4 commit 9d8dc8c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
8 changes: 6 additions & 2 deletions drivers/acpi/numa/hmat.c
Expand Up @@ -126,7 +126,8 @@ static struct memory_target *acpi_find_genport_target(u32 uid)
/**
* acpi_get_genport_coordinates - Retrieve the access coordinates for a generic port
* @uid: ACPI unique id
* @coord: The access coordinates written back out for the generic port
* @coord: The access coordinates written back out for the generic port.
* Expect 2 levels array.
*
* Return: 0 on success. Errno on failure.
*
Expand All @@ -142,7 +143,10 @@ int acpi_get_genport_coordinates(u32 uid,
if (!target)
return -ENOENT;

*coord = target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_LOCAL];
coord[ACCESS_COORDINATE_LOCAL] =
target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_LOCAL];
coord[ACCESS_COORDINATE_CPU] =
target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_CPU];

return 0;
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/cxl/acpi.c
Expand Up @@ -530,13 +530,15 @@ static int get_genport_coordinates(struct device *dev, struct cxl_dport *dport)
if (kstrtou32(acpi_device_uid(hb), 0, &uid))
return -EINVAL;

rc = acpi_get_genport_coordinates(uid, &dport->hb_coord);
rc = acpi_get_genport_coordinates(uid, dport->hb_coord);
if (rc < 0)
return rc;

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

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/cxl/core/port.c
Expand Up @@ -2152,7 +2152,7 @@ int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,
}

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

/* Get the calculated PCI paths bandwidth */
pdev = to_pci_dev(port->uport_dev->parent);
Expand Down
2 changes: 1 addition & 1 deletion drivers/cxl/cxl.h
Expand Up @@ -671,7 +671,7 @@ struct cxl_dport {
struct cxl_port *port;
struct cxl_regs regs;
struct access_coordinate sw_coord;
struct access_coordinate hb_coord;
struct access_coordinate hb_coord[ACCESS_COORDINATE_MAX];
long link_latency;
};

Expand Down

0 comments on commit 9d8dc8c

Please sign in to comment.