mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
cxl/acpi: Convert QTG _DSM latencies to picoseconds
The QTG _DSM expects read and write latencies in picoseconds, as specified in CXL 3.0, Table 9-30. The code base originally kept the latencies passed to the QTG _DSM in picoseconds in effect. Commit51293c565c("cxl: Fix incorrect region perf data calculation") normalized CDAT and host bridge latencies to nanoseconds, but did not add a conversion back to picoseconds when constructing the _DSM input. Firmware can therefore select QTG IDs using understated latencies. Convert the latencies to picoseconds when constructing the _DSM input package. Multiply in 64 bits and reject latencies that cannot fit in the DWORD inputs defined by the specification. Fixes:51293c565c("cxl: Fix incorrect region perf data calculation") Cc: stable@vger.kernel.org Signed-off-by: Koichiro Den <den@valinux.co.jp> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://patch.msgid.link/20261009045452.1107921-4-den@valinux.co.jp Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
db4503d457
commit
2658c66a5e
|
|
@ -231,9 +231,10 @@ cxl_acpi_evaluate_qtg_dsm(acpi_handle handle, struct access_coordinate *coord,
|
|||
int entries, int *qos_class)
|
||||
{
|
||||
union acpi_object *out_obj, *out_buf, *obj;
|
||||
/* QTG _DSM expects latencies in picoseconds. */
|
||||
union acpi_object in_array[4] = {
|
||||
[0].integer = { ACPI_TYPE_INTEGER, coord->read_latency },
|
||||
[1].integer = { ACPI_TYPE_INTEGER, coord->write_latency },
|
||||
[0].integer = { ACPI_TYPE_INTEGER, coord->read_latency * 1000ULL },
|
||||
[1].integer = { ACPI_TYPE_INTEGER, coord->write_latency * 1000ULL },
|
||||
[2].integer = { ACPI_TYPE_INTEGER, coord->read_bandwidth },
|
||||
[3].integer = { ACPI_TYPE_INTEGER, coord->write_bandwidth },
|
||||
};
|
||||
|
|
@ -251,6 +252,11 @@ cxl_acpi_evaluate_qtg_dsm(acpi_handle handle, struct access_coordinate *coord,
|
|||
if (!entries)
|
||||
return -EINVAL;
|
||||
|
||||
/* Latency inputs must fit in the DWORD fields defined by the spec. */
|
||||
if (coord->read_latency > U32_MAX / 1000 ||
|
||||
coord->write_latency > U32_MAX / 1000)
|
||||
return -ERANGE;
|
||||
|
||||
out_obj = acpi_evaluate_dsm(handle, &acpi_cxl_qtg_id_guid, 1, 1, &in_obj);
|
||||
if (!out_obj)
|
||||
return -ENXIO;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user