2020-10-28 18:55:34 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _INTEL_PMT_CLASS_H
|
|
|
|
#define _INTEL_PMT_CLASS_H
|
|
|
|
|
2024-07-25 08:23:40 -04:00
|
|
|
#include <linux/intel_vsec.h>
|
2020-10-28 18:55:34 -07:00
|
|
|
#include <linux/xarray.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/bits.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
2023-11-29 14:21:22 -08:00
|
|
|
#include "telemetry.h"
|
2021-12-07 17:50:12 -08:00
|
|
|
|
2020-10-28 18:55:34 -07:00
|
|
|
/* PMT access types */
|
|
|
|
#define ACCESS_BARID 2
|
|
|
|
#define ACCESS_LOCAL 3
|
|
|
|
|
|
|
|
/* PMT discovery base address/offset register layout */
|
|
|
|
#define GET_BIR(v) ((v) & GENMASK(2, 0))
|
|
|
|
#define GET_ADDRESS(v) ((v) & GENMASK(31, 3))
|
|
|
|
|
2023-11-29 14:21:22 -08:00
|
|
|
struct pci_dev;
|
platform/x86/intel/pmt: Add PMT Discovery driver
This patch introduces a new driver to enumerate and expose Intel Platform
Monitoring Technology (PMT) capabilities via a simple discovery mechanism.
The PMT Discovery driver parses hardware-provided discovery tables from
Intel Out of Band Management Services Modules (OOBMSM) and extracts feature
information for various providers (such as TPMI, Telemetry, Crash Log,
etc). This unified interface simplifies the process of determining which
manageability and telemetry features are supported by a given platform.
This new feature is described in the Intel Platform Monitoring Technology
3.0 specification, section 6.6 Capability.
Key changes and additions:
New file drivers/platform/x86/intel/pmt/discovery.c:
– Implements the discovery logic to map the discovery resource, read
the feature discovery table, and validate feature parameters.
New file drivers/platform/x86/intel/pmt/features.c:
– Defines feature names, layouts, and associated capability masks.
– Provides a mapping between raw hardware attributes and sysfs
representations for easier integration with user-space tools.
New header include/linux/intel_pmt_features.h:
– Declares constants, masks, and feature identifiers used across the
PMT framework.
Sysfs integration:
– Feature attributes are exposed under /sys/class/intel_pmt.
– Each device is represented by a subfolder within the intel_pmt class,
named using its DBDF (Domain:Bus:Device.Function), e.g.:
features-0000:00:03.1
– Example directory layout for a device:
/sys/class/intel_pmt/features-0000:00:03.1/
├── accelerator_telemetry
├── crash_log
├── per_core_environment_telemetry
├── per_core_performance_telemetry
├── per_rmid_energy_telemetry
├── per_rmid_perf_telemetry
├── tpmi_control
├── tracing
└── uncore_telemetry
By exposing PMT feature details through sysfs and integrating with the
existing PMT class, this driver paves the way for more streamlined
integration of PMT-based manageability and telemetry tools.
Link: https://www.intel.com/content/www/us/en/content-details/710389/intel-platform-monitoring-technology-intel-pmt-external-specification.html
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20250703022832.1302928-9-david.e.box@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-07-02 19:28:23 -07:00
|
|
|
extern struct class intel_pmt_class;
|
2023-11-29 14:21:22 -08:00
|
|
|
|
|
|
|
struct telem_endpoint {
|
|
|
|
struct pci_dev *pcidev;
|
|
|
|
struct telem_header header;
|
2024-07-25 08:23:42 -04:00
|
|
|
struct pmt_callbacks *cb;
|
2023-11-29 14:21:22 -08:00
|
|
|
void __iomem *base;
|
|
|
|
bool present;
|
|
|
|
struct kref kref;
|
|
|
|
};
|
|
|
|
|
2023-11-29 14:21:21 -08:00
|
|
|
struct intel_pmt_header {
|
|
|
|
u32 base_offset;
|
|
|
|
u32 size;
|
|
|
|
u32 guid;
|
|
|
|
u8 access_type;
|
|
|
|
};
|
|
|
|
|
2020-10-28 18:55:34 -07:00
|
|
|
struct intel_pmt_entry {
|
2023-11-29 14:21:22 -08:00
|
|
|
struct telem_endpoint *ep;
|
2025-07-13 13:29:31 -04:00
|
|
|
struct pci_dev *pcidev;
|
2023-11-29 14:21:21 -08:00
|
|
|
struct intel_pmt_header header;
|
2020-10-28 18:55:34 -07:00
|
|
|
struct bin_attribute pmt_bin_attr;
|
2025-07-13 13:29:39 -04:00
|
|
|
const struct attribute_group *attr_grp;
|
2020-10-28 18:55:34 -07:00
|
|
|
struct kobject *kobj;
|
|
|
|
void __iomem *disc_table;
|
|
|
|
void __iomem *base;
|
2024-07-25 08:23:42 -04:00
|
|
|
struct pmt_callbacks *cb;
|
2020-10-28 18:55:34 -07:00
|
|
|
unsigned long base_addr;
|
|
|
|
size_t size;
|
2025-07-02 19:28:28 -07:00
|
|
|
u64 feature_flags;
|
2020-10-28 18:55:34 -07:00
|
|
|
u32 guid;
|
platform/x86/intel/pmt: Add PMT Discovery driver
This patch introduces a new driver to enumerate and expose Intel Platform
Monitoring Technology (PMT) capabilities via a simple discovery mechanism.
The PMT Discovery driver parses hardware-provided discovery tables from
Intel Out of Band Management Services Modules (OOBMSM) and extracts feature
information for various providers (such as TPMI, Telemetry, Crash Log,
etc). This unified interface simplifies the process of determining which
manageability and telemetry features are supported by a given platform.
This new feature is described in the Intel Platform Monitoring Technology
3.0 specification, section 6.6 Capability.
Key changes and additions:
New file drivers/platform/x86/intel/pmt/discovery.c:
– Implements the discovery logic to map the discovery resource, read
the feature discovery table, and validate feature parameters.
New file drivers/platform/x86/intel/pmt/features.c:
– Defines feature names, layouts, and associated capability masks.
– Provides a mapping between raw hardware attributes and sysfs
representations for easier integration with user-space tools.
New header include/linux/intel_pmt_features.h:
– Declares constants, masks, and feature identifiers used across the
PMT framework.
Sysfs integration:
– Feature attributes are exposed under /sys/class/intel_pmt.
– Each device is represented by a subfolder within the intel_pmt class,
named using its DBDF (Domain:Bus:Device.Function), e.g.:
features-0000:00:03.1
– Example directory layout for a device:
/sys/class/intel_pmt/features-0000:00:03.1/
├── accelerator_telemetry
├── crash_log
├── per_core_environment_telemetry
├── per_core_performance_telemetry
├── per_rmid_energy_telemetry
├── per_rmid_perf_telemetry
├── tpmi_control
├── tracing
└── uncore_telemetry
By exposing PMT feature details through sysfs and integrating with the
existing PMT class, this driver paves the way for more streamlined
integration of PMT-based manageability and telemetry tools.
Link: https://www.intel.com/content/www/us/en/content-details/710389/intel-platform-monitoring-technology-intel-pmt-external-specification.html
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20250703022832.1302928-9-david.e.box@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-07-02 19:28:23 -07:00
|
|
|
u32 num_rmids; /* Number of Resource Monitoring IDs */
|
2020-10-28 18:55:34 -07:00
|
|
|
int devid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct intel_pmt_namespace {
|
|
|
|
const char *name;
|
|
|
|
struct xarray *xa;
|
|
|
|
int (*pmt_header_decode)(struct intel_pmt_entry *entry,
|
|
|
|
struct device *dev);
|
2024-07-25 08:23:42 -04:00
|
|
|
int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev,
|
|
|
|
struct intel_pmt_entry *entry);
|
2020-10-28 18:55:34 -07:00
|
|
|
};
|
|
|
|
|
2024-07-25 08:23:42 -04:00
|
|
|
int pmt_telem_read_mmio(struct pci_dev *pdev, struct pmt_callbacks *cb, u32 guid, void *buf,
|
2024-11-14 08:03:57 -05:00
|
|
|
void __iomem *addr, loff_t off, u32 count);
|
2021-02-24 12:10:05 -08:00
|
|
|
bool intel_pmt_is_early_client_hw(struct device *dev);
|
2020-10-28 18:55:34 -07:00
|
|
|
int intel_pmt_dev_create(struct intel_pmt_entry *entry,
|
|
|
|
struct intel_pmt_namespace *ns,
|
2021-12-07 17:50:12 -08:00
|
|
|
struct intel_vsec_device *dev, int idx);
|
2020-10-28 18:55:34 -07:00
|
|
|
void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
|
|
|
|
struct intel_pmt_namespace *ns);
|
2025-07-02 19:28:28 -07:00
|
|
|
#if IS_ENABLED(CONFIG_INTEL_PMT_DISCOVERY)
|
|
|
|
void intel_pmt_get_features(struct intel_pmt_entry *entry);
|
|
|
|
#else
|
|
|
|
static inline void intel_pmt_get_features(struct intel_pmt_entry *entry) {}
|
|
|
|
#endif
|
|
|
|
|
2020-10-28 18:55:34 -07:00
|
|
|
#endif
|