mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 17:42:03 +02:00
platform/x86/amd/hsmp: Enable protocol version 7 metric tables on the ACPI driver
The ACPI driver currently prepares the per-socket metric table only on HSMP_PROTO_VER6. With protocol version 7 in use on Family 1Ah Model 50h-5Fh, userspace cannot reach the larger ~13 KB table: hsmp_get_tbl_dram_base() is skipped, sock->metric_tbl_addr stays NULL, and the ioctl added earlier in this series has nothing to read. Widen the proto_ver gate in init_acpi() from '== HSMP_PROTO_VER6' to '>= HSMP_PROTO_VER6' so the DRAM region is mapped and sock->metric_tbl_size is populated on protocol version 7 (and any future compatible version), making the ioctl path functional. hsmp_metric_tbl_acpi_read() now returns -EOPNOTSUPP whenever the running protocol version is not VER6, because the sysfs binary attribute cannot carry a table larger than PAGE_SIZE. Version 7 userspace gets a clear, actionable error and a documented pointer to HSMP_IOCTL_GET_TELEMETRY_DATA; version 6 userspace sees no change. The non-ACPI plat.c path is intentionally left untouched: it covers Family 1Ah Model 0h-Fh hardware fixed at protocol version 6, where the existing metrics_bin remains the supported interface. Co-developed-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com> Signed-off-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com> Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com> Link: https://patch.msgid.link/20260727141542.3370108-6-muralidhara.mk@amd.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
5273183b63
commit
aca39607c1
|
|
@ -277,13 +277,31 @@ static ssize_t hsmp_metric_tbl_acpi_read(struct file *filp, struct kobject *kobj
|
|||
struct device *dev = container_of(kobj, struct device, kobj);
|
||||
struct hsmp_socket *sock = dev_get_drvdata(dev);
|
||||
|
||||
/*
|
||||
* metrics_bin is a sysfs binary attribute and is capped at PAGE_SIZE.
|
||||
* It can therefore only carry the protocol version 6 metric table
|
||||
* (struct hsmp_metric_table). The larger tables defined from protocol
|
||||
* version 7 onwards do not fit; userspace on those systems must read
|
||||
* the snapshot through HSMP_IOCTL_GET_TELEMETRY_DATA on /dev/hsmp.
|
||||
* Surface the unsupported case here as -EOPNOTSUPP rather than
|
||||
* silently truncating the snapshot.
|
||||
*/
|
||||
if (hsmp_pdev->proto_ver != HSMP_PROTO_VER6)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return hsmp_metric_tbl_read(sock, buf, count);
|
||||
}
|
||||
|
||||
static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
|
||||
const struct bin_attribute *battr, int id)
|
||||
{
|
||||
if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6)
|
||||
/*
|
||||
* Keep metrics_bin visible on protocol version 7 and later as well,
|
||||
* so that userspace which expects the file to exist gets a clear
|
||||
* -EOPNOTSUPP from the read handler instead of -ENOENT, and is
|
||||
* pointed at HSMP_IOCTL_GET_TELEMETRY_DATA as the supported path.
|
||||
*/
|
||||
if (hsmp_pdev->proto_ver >= HSMP_PROTO_VER6)
|
||||
return battr->attr.mode;
|
||||
|
||||
return 0;
|
||||
|
|
@ -539,7 +557,7 @@ static int init_acpi(struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6) {
|
||||
if (hsmp_pdev->proto_ver >= HSMP_PROTO_VER6) {
|
||||
ret = hsmp_get_tbl_dram_base(sock_ind);
|
||||
if (ret)
|
||||
dev_info(dev, "Failed to init metric table\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user