Intel Platform Monitoring Technology
Subsystems (4)
David E. Box
maintainercover Intel Platform Monitoring Technology
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintanence to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can see which devices support a PMT feature by perusing each device file underneath the class in sysfs. It can additionally see if a particluar device supports a PMT feature by seeing if that device contains a pointer to a PMT class in its device folder.
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Patch 1 - adds the Designated Vendor PCI Extended Capability. The PMT
feature is discoverable as an Intel DVSEC capabilitity.
Patch 2 - an MFD driver that creates cells for each PMT capability found on
a PCI device. This supports SoC platforms that expose PMT capabilities under a PMT dedicated PCI device id.
Patch 3 - adds support for the PMT Telemetry feature.
To: [email protected],
[email protected],
[email protected]
Cc: [email protected],
[email protected]
*** BLURB HERE ***
David E. Box (3):
pci: Add Designated Vendor Specific Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver
.../ABI/testing/sysfs-class-intel_pmt_telem | 46 +++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 174 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telem.c | 356 ++++++++++++++++++ drivers/platform/x86/intel_pmt_telem.h | 20 + include/linux/intel-dvsec.h | 44 +++ include/uapi/linux/pci_regs.h | 5 + 11 files changed, 673 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-intel_pmt_telem create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telem.c create mode 100644 drivers/platform/x86/intel_pmt_telem.h create mode 100644 include/linux/intel-dvsec.h
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH 1/3 pci: Add Designated Vendor Specific Capability
Add pcie dvsec extended capability id along with helper macros to retrieve information from the headers.
https://members.pcisig.com/wg/PCI-SIG/document/12335
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/pci_regs.h +5 -0
@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Desinated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */
Signature · 1 line
2.20.1
Re: [PATCH 1/3] pci: Add Designated Vendor Specific Capability
Quoted 2 lines · David E. Box
Add pcie dvsec extended capability id along with helper macros to
pcie -> PCIe
dvsec -> DVSEC (but here I'm not sure, what's official abbreviation for this?)
Quoted 5 lines
retrieve information from the headers.
Perhaps
DocLink: ...
(as a tag)
Quoted 32 lines
Signed-off-by David E. Box <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +5
-1@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Desinated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */ --2.20.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerRe: [PATCH 1/3] pci: Add Designated Vendor Specific Capability
Quoted 8 lines · Andy Shevchenko
Quoted 1 line · David E. Box
Add pcie dvsec extended capability id along with helper macros to
pcie -> PCIe
dvsec -> DVSEC (but here I'm not sure, what's official abbreviation for this?)
Okay. DVSEC is used in the ECN. I'll spell it here out as well.
Quoted 11 lines
Quoted 5 lines
retrieve information from the headers.
Perhaps
DocLink: ...
(as a tag)
Yes. Forgot to add this.
Re: [PATCH 1/3] pci: Add Designated Vendor Specific Capability
In reply to David E. Box$ git log --oneline include/uapi/linux/pci_regs.h 202853595e53 PCI: pciehp: Disable in-band presence detect when possible ed22aaaede44 PCI: dwc: intel: PCIe RC controller driver bbdb2f5ecdf1 PCI: Add #defines for Enter Compliance, Transmit Margin c9c13ba428ef PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 106feb2fdced PCI: pciehp: Remove pciehp_set_attention_status() 448d5a55759a PCI: Add #defines for some of PCIe spec r4.0 features de76cda215d5 PCI: Decode PCIe 32 GT/s link speed
Yours could be:
PCI: Add #defines for Designated Vendor-Specific Capability
Quoted 2 lines · David E. Box
Add pcie dvsec extended capability id along with helper macros to retrieve information from the headers.
s/pcie/PCIe/
s/dvsec/DVSEC/
s/id/ID/
I don't see any helper macros in the patch. Well, OK, I guess the header offsets could be considered macros.
Quoted 1 line
This URL is for an ECN. DVSEC is included in PCIe r5.0, sec 7.9.6, so please cite that instead so the citation remains useful after the URL becomes stale and for people who have the spec but not access to the PCI-SIG website.
Quoted 1 line
Signed-off-by David E. Box <[email protected]>
include/uapi/linux/pci_regs.h line 723
Quoted 13 lines
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +1
-0@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Desinated Vendor-Specific */
s/Desinated/Designated/
Quoted 17 lines
include/uapi/linux/pci_regs.h +4
-0#define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */ Signature · 1 line
2.20.1
David E. Box
maintainerPATCH 2/3 mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. Capabilities are discovered using PCIe DVSEC with the Intel VID. Each capability is discovered as a separate DVSEC instance in a device's config space. This driver uses MFD to manage the creation of platform devices for each type so that they may be controlled by their own drivers (to be introduced). Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added. Tiger Lake however will not support Watcher and Crashlog even though the capabilities appear on the device. So add a quirk facility and use it to disable them.
--- MAINTAINERS | 5 ++ drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 174 ++++++++++++++++++++++++++++++++++++ include/linux/intel-dvsec.h | 44 +++++++++ 5 files changed, 234 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 include/linux/intel-dvsec.h
MAINTAINERS +5 -0
@@ -8783,6 +8783,11 @@ S: Maintained F: arch/x86/include/asm/intel_telemetry.h F: drivers/platform/x86/intel_telemetry* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL UNCORE FREQUENCY CONTROL M: Srinivas Pandruvada <[email protected]> L: [email protected]
drivers/mfd/Kconfig +10 -0
@@ -632,6 +632,16 @@ config MFD_INTEL_MSIC Passage) chip. This chip embeds audio, battery, GPIO, etc. devices used in Intel Medfield platforms. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PTM capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +1 -0
@@ -212,6 +212,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/intel_pmt.c new file +174 -0
174 lines not on this page · raw message
include/linux/intel-dvsec.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH 3/3 platform/x86: Intel PMT Telemetry capability driver
PMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
This module manages access to all PMT Telemetry endpoints on a system, regardless of the device exporting them. It creates an intel_pmt_telem class to manage the list. For each endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry comes from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
--- .../ABI/testing/sysfs-class-intel_pmt_telem | 46 +++ MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telem.c | 356 ++++++++++++++++++ drivers/platform/x86/intel_pmt_telem.h | 20 + 6 files changed, 434 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-intel_pmt_telem create mode 100644 drivers/platform/x86/intel_pmt_telem.c create mode 100644 drivers/platform/x86/intel_pmt_telem.h
Documentation/ABI/testing/sysfs-class-intel_pmt_telem new file +46 -0
@@ -0,0 +1,46 @@ +What: /sys/class/intel_pmt_telem/ +Date: April 2020 +KernelVersion: 5.8 +Contact: David Box <[email protected]> +Description: + The intel_pmt_telem/ class directory contains information for + devices that expose hardware telemetry using Intel Platform + Monitoring Technology (PMT) + +What: /sys/class/intel_pmt_telem/telemX +Date: April 2020 +KernelVersion: 5.8 +Contact: David Box <[email protected]> +Description: + The telemX directory contains files describing an instance of a + PMT telemetry device that exposes hardware telemetry. Each + telemX device has an associated /dev/telemX node. This node can + be opened and mapped to access the telemetry space of the + device. The register layout of the telemetry space is + determined from an XML file of specific guid for the corresponding + parent device. + +What: /sys/class/intel_pmt_telem/telemX/guid +Date: April 2020 +KernelVersion: 5.8 +Contact: David Box <[email protected]> +Description: + (RO) The guid for this telemetry device. The guid identifies + the version of the XML file for the parent device that should + be used to determine the register layout. + +What: /sys/class/intel_pmt_telem/telemX/size +Date: April 2020 +KernelVersion: 5.8 +Contact: David Box <[email protected]> +Description: + (RO) The size of telemetry region in bytes that corresponds to + the mapping size for the /dev/telemX device node. + +What: /sys/class/intel_pmt_telem/telemX/offset +Date: April 2020 +KernelVersion: 5.8 +Contact: David Box <[email protected]> +Description: + (RO) The offset of telemetry region in bytes that corresponds to + the mapping for the /dev/telemX device node.
MAINTAINERS +1 -0
@@ -8787,6 +8787,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL UNCORE FREQUENCY CONTROL M: Srinivas Pandruvada <[email protected]>
drivers/platform/x86/Kconfig +10 -0
@@ -1368,6 +1368,16 @@ config INTEL_TELEMETRY directly via debugfs files. Various tools may use this interface for SoC state monitoring. +config INTEL_PMT_TELEM + tristate "Intel PMT telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -146,3 +146,4 @@ obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \ intel_telemetry_pltdrv.o \ intel_telemetry_debugfs.o obj-$(CONFIG_PMC_ATOM) += pmc_atom.o +obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.o
drivers/platform/x86/intel_pmt_telem.c new file +356 -0
356 lines not on this page · raw message
drivers/platform/x86/intel_pmt_telem.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _INTEL_PMT_TELEM_H +#define _INTEL_PMT_TELEM_H + +#include <linux/intel-dvsec.h> + +/* Telemetry types */ +#define PMT_TELEM_TELEMETRY 0 +#define PMT_TELEM_CRASHLOG 1 + +struct telem_header { +u8 access_type; +u8 telem_type; +u16 size; +u32 guid; +u32 base_offset; +u8 tbir; +}; + +#endif
Signature · 1 line
2.20.1
Re: [PATCH 3/3] platform/x86: Intel PMT Telemetry capability driver
On Tue, May 5, 2020 at 5:32 AM David E. Box <[email protected]> wrote:
...
Quoted 8 lines
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
Is old hardware going to support this in the future? (I have in mind Apollo Lake / Broxton)
Quoted 2 lines
This module manages access to all PMT Telemetry endpoints on a system, regardless of the device exporting them. It creates an
intel_pmt_telem
Name is not the best we can come up with. Would anyone else use PMT? Would it be vendor-agnostic ABI?
(For example, I know that MIPI standardizes tracing protocols, like STM, do we have any plans to standardize this one?)
telem -> telemetry.
Quoted 7 lines
class to manage the list. For each endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry comes from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
...
Quoted 1 line
+ tristate "Intel PMT telemetry driver"
I think user should understand what is it from the title (hint: spell PMT fully).
...
Quoted 2 lines
obj-$(CONFIG_PMC_ATOM) += pmc_atom.o
+obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.o
Keep this and Kconfig section in order with the other stuff.
...
bits.h?
Quoted 10 lines
drivers/platform/x86/intel_pmt_telem.c new file +10
-0+#include <linux/cdev.h> +#include <linux/intel-dvsec.h> +#include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/uaccess.h> +#include <linux/xarray.h>
...
drivers/platform/x86/intel_pmt_telem.c line 25
Quoted 2 lines
drivers/platform/x86/intel_pmt_telem.c new file +2
-0+/* platform device name to bind to driver */ +#define TELEM_DRV_NAME "pmt_telemetry"
Shouldn't be part of MFD header?
...
Quoted 1 line
+#define
TELEM_TBIR_MASK0x7
GENMASK() ?
Quoted 10 lines
drivers/platform/x86/intel_pmt_telem.c new file +10
-0+struct pmt_telem_priv { +struct device *dev; +struct intel_dvsec_header *dvsec; +struct telem_header header; +unsigned long base_addr; +void __iomem *disc_table; +struct cdev cdev; +dev_t devt; +int devid; +};
...
Quoted 9 lines
drivers/platform/x86/intel_pmt_telem.c new file +9
-0+unsigned long phys = priv->base_addr; +unsigned long pfn =PFN_DOWN (phys); +unsigned long psize; + + psize = (PFN_UP (priv->base_addr + priv->header.size) - pfn) *PAGE_SIZE ; +if (vsize > psize) { +dev_err (priv->dev,"Requested mmap size is too large\n" ); +return -EINVAL ; + }
...
drivers/platform/x86/intel_pmt_telem.c line 141
Quoted 7 lines
drivers/platform/x86/intel_pmt_telem.c new file +7
-0+static ssize_t guid_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct pmt_telem_priv *priv =dev_get_drvdata (dev); + +return sprintf (buf,"0x%x\n" , priv->header.guid); +}
So, it's not a GUID but rather some custom number? Can we actually do a real GUID / UUID here?
Because of TODO below I suppose it's not carved in stone (yet) and basically a protocol defined by firmware (which can be amended).
...
Quoted 1 line
+ /* TODO: replace with device properties??? */
So, please, fulfill. swnode I guess is what you are looking for.
Quoted 5 lines
drivers/platform/x86/intel_pmt_telem.c new file +5
-0+ priv->dvsec =dev_get_platdata (&pdev->dev); +if (!priv->dvsec) { +dev_err (&pdev->dev,"Platform data not found\n" ); +return -ENODEV ; + }
...
drivers/platform/x86/intel_pmt_telem.c line 259
Quoted 11 lines
drivers/platform/x86/intel_pmt_telem.c new file +10
-0+/* Local access and BARID only for now */ +switch (priv->header.access_type) { +case TELEM_ACCESS_LOCAL : +if (priv->header.tbir) { +dev_err (&pdev->dev, +"Unsupported BAR index %d for access type %d\n" , + priv->header.tbir, priv->header.access_type); +return -EINVAL ; + } + fallthrough;
What's the point?
drivers/platform/x86/intel_pmt_telem.c line 272
Quoted 10 lines
drivers/platform/x86/intel_pmt_telem.c new file +9
-0+ +case TELEM_ACCESS_BARID : +break ; +default : +dev_err (&pdev->dev,"Unsupported access type %d\n" , + priv->header.access_type); +return -EINVAL ; + } + err =alloc_chrdev_region (&priv->devt,0 ,1 ,TELEM_DRV_NAME );
err or ret? Be consistent in the module.
Quoted 1 line
+ if (err < 0) {
' < 0' Do we need it?
Quoted 4 lines
drivers/platform/x86/intel_pmt_telem.c new file +4
-0+dev_err (&pdev->dev, +"PMT telemetry chrdev_region err: %d\n" , err); +return err; + }
...
drivers/platform/x86/intel_pmt_telem.c line 285
Quoted 2 lines
drivers/platform/x86/intel_pmt_telem.c new file +2
-0+ err =pmt_telem_create_dev (priv); +if (err <0 )
' < 0' Do we need it?
Quoted 5 lines
drivers/platform/x86/intel_pmt_telem.c new file +4
-0+ goto fail_create_dev; + +return 0 ; +}
...
drivers/platform/x86/intel_pmt_telem.c line 316
Quoted 6 lines
drivers/platform/x86/intel_pmt_telem.c new file +6
-0+static const struct platform_device_id pmt_telem_table[] = { + { + .name ="pmt_telemetry" , + }, { +/* sentinel */ + }
{ .name = ... },
{}
is enough.
Quoted 1 line
+};
...
drivers/platform/x86/intel_pmt_telem.c line 333
Quoted 6 lines
drivers/platform/x86/intel_pmt_telem.c new file +5
-0+static int __init pmt_telem_init (void ) +{ +int ret =class_register (&pmt_telem_class); + +if (ret)
int ret;
ret = ...
if (ret)
Quoted 8 lines
drivers/platform/x86/intel_pmt_telem.c new file +8
-0+return ret; + + ret =platform_driver_register (&pmt_telem_driver); +if (ret) +class_unregister (&pmt_telem_class); + +return ret; +}
...
drivers/platform/x86/intel_pmt_telem.c line 83
Quoted 5 lines
drivers/platform/x86/intel_pmt_telem.c new file +3
-0+{ +} +
Extra blank line.
drivers/platform/x86/intel_pmt_telem.c line 351
Quoted 2 lines
drivers/platform/x86/intel_pmt_telem.c new file +2
-0+module_init (pmt_telem_init); +module_exit (pmt_telem_exit);
Better to attach to the respective functions.
...
Quoted 1 line
+#include <
linux/intel-dvsec.h>
There is no user of this below, but types.h has users here.
drivers/platform/x86/intel_pmt_telem.h line 12
Quoted 7 lines
drivers/platform/x86/intel_pmt_telem.h new file +6
-0+/* Telemetry types */ +#define PMT_TELEM_TELEMETRY 0 +#define PMT_TELEM_CRASHLOG 1 + +struct telem_header { +u8 access_type;
If it's part of hardware communication, shouldn't be rather __uXX types to show that this is part of protocol between software and hardware?
Quoted 6 lines
drivers/platform/x86/intel_pmt_telem.h new file +6
-0+u8 telem_type; +u16 size; +u32 guid; +u32 base_offset; +u8 tbir; +};
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerRe: [PATCH 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 21 lines · Andy Shevchenko
On Tue, May 5, 2020 at 5:32 AM David E. Box <
[email protected]> wrote:...
Quoted 7 lines
Register mappings are not provided by the driver. Instead, a GUID is read
from a header for each endpoint. The GUID identifies the device and is to
be used with an XML, provided by the vendor, to discover the available set
of metrics and their register mapping. This allows firmwareQuoted 8 lines
updates to
modify the register space without needing to update the driver every time
with new mappings. Firmware writes a new GUID in this case to specify the
new mapping. Software tools with access to the associated XML file can
then interpret the changes.
Quoted 2 lines
Is old hardware going to support this in the future? (I have in mind Apollo Lake / Broxton)
I don't know of any plans for this.
Quoted 10 lines
Quoted 5 lines
This module manages access to all PMT Telemetry endpoints on a system,
regardless of the device exporting them. It creates anintel_pmt_telemName is not the best we can come up with. Would anyone else use PMT? Would it be vendor-agnostic ABI?
(For example, I know that MIPI standardizes tracing protocols, like STM, do we have any plans to standardize this one?)
Not at this time. The technology may be used as a feature on non-Intel devices, but it is Intel owned. Hence the use of DVSEC which allows hardware to enumerate and get driver support for IP from other vendors.
Quoted 48 lines
telem -> telemetry.
Quoted 13 lines
class to manage the list. For each endpoint, sysfs files provide GUID and
size information as well as a pointer to the parent device the telemetry
comes from. Software may discover the association between endpoints and
devices by iterating through the list in sysfs, or by looking for the
existence of the class folder under the device of interest. A device node
of the same name allows software to then map the telemetry space for direct
access....
Quoted 1 line
+ tristate "Intel PMT telemetry driver"
I think user should understand what is it from the title (hint: spell PMT fully).
...
Quoted 2 lines
obj-$(CONFIG_PMC_ATOM) += pmc_atom.o
+obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.oKeep this and
Kconfigsection in order with the other stuff....
bits.h?Quoted 10 lines
drivers/platform/x86/intel_pmt_telem.c new file +10
-0+#include <linux/cdev.h> +#include <linux/intel-dvsec.h> +#include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/uaccess.h> +#include <linux/xarray.h> ...
Quoted 4 lines
drivers/platform/x86/intel_pmt_telem.c line 25
Quoted 2 lines
drivers/platform/x86/intel_pmt_telem.c new file +2
-0+/* platform device name to bind to driver */ +#define TELEM_DRV_NAME "pmt_telemetry"Shouldn't be part of MFD header?
Can place in the dvsec header shared by MFD and drivers.
Quoted 35 lines
...
Quoted 1 line
+#define
TELEM_TBIR_MASK0x7
GENMASK()?Quoted 10 lines
drivers/platform/x86/intel_pmt_telem.c new file +10
-0+struct pmt_telem_priv { +struct device *dev; +struct intel_dvsec_header *dvsec; +struct telem_header header; +unsigned long base_addr; +void __iomem *disc_table; +struct cdev cdev; +dev_t devt; +int devid; +};...
Quoted 11 lines
drivers/platform/x86/intel_pmt_telem.c new file +5
-0+unsigned long phys = priv->base_addr; +unsigned long pfn =PFN_DOWN (phys); +unsigned long psize; + + psize = (PFN_UP (priv->base_addr + priv->header.size) - pfn)*
PAGE_SIZE;(quoted diff) +2
-0+ if (vsize > psize) { + dev_err(priv->dev, "Requested mmap size is toolarge\n");
(quoted diff) +2
-0+ return -EINVAL; + }...
Quoted 11 lines
drivers/platform/x86/intel_pmt_telem.c line 141
Quoted 8 lines
+static
ssize_tguid_show(struct device *dev, structdevice_attribute*attr,drivers/platform/x86/intel_pmt_telem.c new file +6
-0+ char *buf) +{ +struct pmt_telem_priv *priv =dev_get_drvdata (dev); + +return sprintf (buf,"0x%x\n" , priv->header.guid); +}So, it's not a GUID but rather some custom number? Can we actually do a real GUID / UUID here?
I wish but this is the name it was called. We should have pushed back more on this. My concern now in calling the attribute something different is that it will not align with public documentation.
...
Quoted 9 lines
Quoted 9 lines
drivers/platform/x86/intel_pmt_telem.c new file +6
-0+/* Local access and BARID only for now */ +switch (priv->header.access_type) { +case TELEM_ACCESS_LOCAL : +if (priv->header.tbir) { + dev_err(&pdev->dev, + "Unsupported BAR index %d foraccess type %d\n",
+priv->header.tbir, priv-
Quoted 6 lines
drivers/platform/x86/intel_pmt_telem.c line 259
Quoted 4 lines
Quoted 1 line
header.access_type);
drivers/platform/x86/intel_pmt_telem.c new file +3
-0+return -EINVAL ; + } + fallthrough;What's the point?
The next case has the break. That case is only there to validate that it's not the default which would be an error. Will switch this to break though to make it explicit.
Ack on everything else. Thanks.
David E. Box
maintainerRe: [PATCH 3/3] platform/x86: Intel PMT Telemetry capability driver
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
...
Quoted 1 line
+ /* TODO: replace with device properties??? */
So, please, fulfill. swnode I guess is what you are looking for.
I kept the platform data in v2 because swnode properties doesn't look like a good fit. We are only passing information that was read from the pci device. It is not hard coded, platform specific data.
David
Re: [PATCH 2/3] mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxQuoted 6 lines · David E. Box
drivers/mfd/Kconfig +0
-0@@ -632,6 +632,16 @@ config MFD_INTEL_MSIC Passage) chip. This chip embeds audio, battery, GPIO, etc.
drivers/mfd/Kconfig config MFD_INTEL_MSIC · line 642
Quoted 10 lines
drivers/mfd/Kconfig +8
-0devices used in Intel Medfield platforms. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PTM capabilities/devices for
What is PTM?
Quoted 5 lines
drivers/mfd/Kconfig +2
-0+ platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
Signature · 1 line
~Randy
David E. Box
maintainerRe: [PATCH 2/3] mfd: Intel Platform Monitoring Technology support
Quoted 9 lines · Randy Dunlap
Quoted 8 lines · David E. Box
drivers/mfd/Kconfig +0
-0@@ -632,6 +632,16 @@ config MFD_INTEL_MSIC Passage) chip. This chip embeds audio, battery, GPIO, etc. devices used in Intel Medfield platforms.
Quoted 12 lines
drivers/mfd/Kconfig config MFD_INTEL_MSIC · line 642
Quoted 10 lines
drivers/mfd/Kconfig +6
-0+config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is aninterface that
drivers/mfd/Kconfig +1
-0+ provides access to hardware monitor registers. This driversupports
drivers/mfd/Kconfig +1
-0+ Telemetry, Watcher, and Crashlog PTM capabilities/devices forWhat is PTM?
s/PTM/PMT
I have the fortune of working on another project involving PCI Precision Time Management.
Re: [PATCH 2/3] mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxQuoted 13 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. Capabilities are discovered using PCIe DVSEC with the Intel VID. Each capability is discovered as a separate DVSEC instance in a device's config space. This driver uses MFD to manage the creation of platform devices for each type so that they may be controlled by their own drivers (to be introduced). Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added. Tiger Lake however will not support Watcher and Crashlog even though the capabilities appear on the device. So add a quirk facility and use it to disable them.
...
Quoted 1 line
include/linux/intel-dvsec.h | 44 +++++++++
I guess it's no go for a such header, since we may end up with tons of a such. Perhaps simple pcie-dvsec.h ?
...
MAINTAINERS S: Maintained · line 8789
Quoted 10 lines
MAINTAINERS +4
-0@@ -8783,6 +8783,11 @@ S: Maintained F: arch/x86/include/asm/intel_telemetry.h F: drivers/platform/x86/intel_telemetry* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c
I believe you forgot to run parse-maintainers.pl --order --input=MAINTAINERS --output=MAINTAINERS
...
MAINTAINERS S: Maintained · line 8793
Quoted 4 lines
MAINTAINERS +3
-0+ info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info), + GFP_KERNEL); +
Extra blank line.
MAINTAINERS S: Maintained
Quoted 7 lines
MAINTAINERS +7
-0+ if (!info) + return -ENOMEM; + + while ((pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC))) { + pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER1, &vid); + if (vid != PCI_VENDOR_ID_INTEL) + continue;
Perhaps a candidate for for_each_vendor_cap() macro in pcie-dvsec.h. Or how is it done for the rest of capabilities?
Quoted 1 line
+ }
...
MAINTAINERS
Quoted 4 lines
MAINTAINERS +3
-0+static const struct pci_device_id pmt_pci_ids[] = { + /* TGL */ + { PCI_VDEVICE(INTEL, 0x9a0d), (kernel_ulong_t)&tgl_info },
PCI_DEVICE_DATA()?
Quoted 2 lines
MAINTAINERS +2
-0+ { } +};
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerRe: [PATCH 2/3] mfd: Intel Platform Monitoring Technology support
Quoted 25 lines · Andy Shevchenko
Quoted 14 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports
multiple types of monitoring capabilities. Capabilities are discovered
using PCIe DVSEC with the Intel VID. Each capability is discovered as a
separate DVSEC instance in a device's config space. This driver uses MFD to
manage the creation of platform devices for each type so that they may be
controlled by their own drivers (to be introduced). Support is included
for the 3 current capability types, Telemetry, Watcher, andQuoted 8 lines
Crashlog. The
features are available on new Intel platforms starting from Tiger Lake for
which support is added. Tiger Lake however will not support Watcher and
Crashlog even though the capabilities appear on the device. So add a quirk
facility and use it to disable them.
Quoted 7 lines
...
Quoted 1 line
include/linux/intel-dvsec.h | 44 +++++++++I guess it's no go for a such header, since we may end up with tons of
a such. Perhaps simplepcie-dvsec.h?
Too general. Nothing in here applies to all PCIE DVSEC capabilities. The file describes only the vendor defined space in a DVSEC region.
Quoted 41 lines
...
MAINTAINERS S: Maintained · line 8789
Quoted 10 lines
MAINTAINERS +4
-0@@ -8783,6 +8783,11 @@ S: Maintained F: arch/x86/include/asm/intel_telemetry.h F: drivers/platform/x86/intel_telemetry* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.cI believe you forgot to run parse-maintainers.pl --order --input=MAINTAINERS --output=MAINTAINERS
...
MAINTAINERS S: Maintained · line 8793
Quoted 4 lines
MAINTAINERS +3
-0+ info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info), + GFP_KERNEL); +Extra blank line.
MAINTAINERS
Quoted 9 lines
MAINTAINERS +4
-0+ if (!info) + return -ENOMEM; + + while ((pos = pci_find_next_ext_capability(pdev, pos,
PCI_EXT_CAP_ID_DVSEC))) {
+ pci_read_config_word(pdev, pos +PCI_DVSEC_HEADER1,
&vid);MAINTAINERS +2
-0+ if (vid != PCI_VENDOR_ID_INTEL) + continue;Perhaps a candidate for
for_each_vendor_cap()macro inpcie-dvsec.h. Or how is it done for the rest of capabilities?Quoted 1 line
+ }
Quoted 7 lines
...
MAINTAINERS
Quoted 3 lines
MAINTAINERS +3
-0+static const struct pci_device_id pmt_pci_ids[] = { + /* TGL */ + { PCI_VDEVICE(INTEL, 0x9a0d), (kernel_ulong_t)&tgl_info },
PCI_DEVICE_DATA()?
Ack on the rest of the changes.
David E. Box
maintainerPATCH v2 1/3 PCI: Add defines for Designated Vendor-Specific Capability
In reply to David E. BoxAdd PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/pci_regs.h +5 -0
@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v2 2/3 mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added. Tiger Lake however will not support Watcher and Crashlog even though the capabilities appear on the device. So add a quirk facility and use it to disable them.
--- MAINTAINERS | 5 ++ drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 170 ++++++++++++++++++++++++++++++++++++ include/linux/intel-dvsec.h | 48 ++++++++++ 5 files changed, 234 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 include/linux/intel-dvsec.h
MAINTAINERS +5 -0
@@ -8733,6 +8733,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]> L: [email protected]
drivers/mfd/Kconfig +10 -0
@@ -632,6 +632,16 @@ config MFD_INTEL_MSIC Passage) chip. This chip embeds audio, battery, GPIO, etc. devices used in Intel Medfield platforms. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +1 -0
@@ -212,6 +212,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/intel_pmt.c new file +170 -0
170 lines not on this page · raw message
include/linux/intel-dvsec.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v2 2/3] mfd: Intel Platform Monitoring Technology support
Quoted 11 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added. Tiger Lake however will not support Watcher and Crashlog even though the capabilities appear on the device. So add a quirk facility and use it to disable them.
Thank you for an update.
Some nitpicks below.
...
Quoted 1 line
+ case
DVSEC_INTEL_ID_TELEM:
Is this from the spec? Or can we also spell TELEMETRY ?
Quoted 1 line
+ name =
TELEM_DEV_NAME;
Ditto for all occurrences.
Quoted 1 line
+ break;
...
drivers/mfd/intel_pmt.c line 55
Quoted 2 lines
drivers/mfd/intel_pmt.c new file +2
-0+ cell =devm_kcalloc (&pdev->dev, header->num_entries, +sizeof (*cell),GFP_KERNEL );
I think if you use temporary
struct device *dev = &pdev->dev;
you may squeeze this to one line and make others smaller as well.
Quoted 2 lines
(quoted diff) +2
-0+ if (!cell) + return -ENOMEM;
...
drivers/mfd/intel_pmt.c line 71
Quoted 3 lines
drivers/mfd/intel_pmt.c new file +3
-0+ res->start = pdev->resource[header->tbir].start + + header->offset + + (i * (INTEL_DVSEC_ENTRY_SIZE <<2 ));
Outer parentheses are redundant. And perhaps last two lines can be one.
...
drivers/mfd/intel_pmt.c line 91
Quoted 7 lines
drivers/mfd/intel_pmt.c new file +6
-0+static int +pmt_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ +u16 vid; +u32 table; +int ret, pos =0 , last_pos =0 ;
Redundant assignment of pos.
drivers/mfd/intel_pmt.c line 131
Quoted 7 lines
drivers/mfd/intel_pmt.c new file +6
-0+while ((pos =pci_find_next_ext_capability (pdev, pos,PCI_EXT_CAP_ID_DVSEC ))) { +pci_read_config_word (pdev, pos +PCI_DVSEC_HEADER1 , &vid); +if (vid !=PCI_VENDOR_ID_INTEL ) +continue ; + + last_pos = pos;
Can we simple use a boolean flag?
Quoted 8 lines
drivers/mfd/intel_pmt.c new file +7
-0+ } + +if (!last_pos) { +dev_err (&pdev->dev,"No supported PMT capabilities found.\n" ); +return -ENODEV ; + } +}
...
drivers/mfd/intel_pmt.c line 23
Quoted 3 lines
drivers/mfd/intel_pmt.c new file +2
-0+}; +
Extra blank line.
Quoted 1 line
+module_pci_driver(pmt_pci_driver);
...
+ bits.h since GENMASK() is in use.
Quoted 1 line
+#include <
linux/types.h>
...
include/linux/intel-dvsec.h line 37
Quoted 3 lines
include/linux/intel-dvsec.h new file +3
-0+enum pmt_quirks { +/* Watcher capability not supported */ +PMT_QUIRK_NO_WATCHER = (1 <<0 ),
BIT() ?
include/linux/intel-dvsec.h line 40
Quoted 3 lines
include/linux/intel-dvsec.h new file +3
-0+ +/* Crashlog capability not supported */ + PMT_QUIRK_NO_CRASHLOG = (1 << 1),
BIT() ?
Quoted 1 line
+};
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerv2 cover Intel Platform Monitoring Technology
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Changes from V1:
- In the telemetry driver, set the device in device_create() to the parent pci device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the pci parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class to pmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixes
David E. Box (3):
PCI: Add #defines for Designated Vendor-Specific Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver
MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 170 ++++++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telem.c | 362 +++++++++++++++++++++++++ include/linux/intel-dvsec.h | 48 ++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 613 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telem.c create mode 100644 include/linux/intel-dvsec.h
Signature · 1 line
2.20.1
Quoted 49 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
Quoted 3 lines
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Some nitpicks per individual patches, also you forgot to send the series to PDx86 mailing list and its maintainers (only me included).
Quoted 36 lines
Changes from V1:
- In the telemetry driver, set the device in
device_create()to the parent pci device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the pci parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class topmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixesDavid E. Box (3):
PCI: Add #defines for Designated Vendor-Specific Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driverMAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 170 ++++++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telem.c | 362 +++++++++++++++++++++++++ include/linux/intel-dvsec.h | 48 ++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 613 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telem.c create mode 100644 include/linux/intel-dvsec.h--
2.20.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerPATCH v3 1/3 PCI: Add defines for Designated Vendor-Specific Capability
In reply to David E. BoxAdd PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/pci_regs.h +5 -0
@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */
Signature · 1 line
2.20.1
Re: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
Quoted 4 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
Quoted 32 lines
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +5
-1@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */ --2.20.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
In reply to David E. BoxQuoted 16 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +1
-0@@ -720,6 +720,7 @@ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */
include/uapi/linux/pci_regs.h line 1065
Quoted 3 lines
include/uapi/linux/pci_regs.h +3
-0@@ -1062,6 +1063,10 @@ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */
Just a little comment: It would make more sense to me to s/DVSEC/DVSPEC/g.
But then I don't have the PCIe documentation.
Signature · 1 line
~Randy
Re: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
Quoted 10 lines · Randy Dunlap
Quoted 9 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 13 lines
include/uapi/linux/pci_regs.h line 1065
Quoted 10 lines
include/uapi/linux/pci_regs.h +4
-0@@ -720,6 +720,7 @@ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ @@ -1062,6 +1063,10 @@ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ Just a little comment: It would make more sense to me to s/DVSEC/DVSPEC/g.
Yeah, that is confusing, but "DVSEC" is the term used in the spec. I think it stands for "Designated Vendor-Specific Extended Capability".
Re: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
Quoted 25 lines · Bjorn Helgaas
Quoted 10 lines · Randy Dunlap
Quoted 9 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)Quoted 13 lines
include/uapi/linux/pci_regs.h line 1065
Quoted 10 lines
include/uapi/linux/pci_regs.h +4
-0@@ -720,6 +720,7 @@ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ @@ -1062,6 +1063,10 @@ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ Just a little comment: It would make more sense to me to s/DVSEC/DVSPEC/g.
Quoted 2 lines
Yeah, that is confusing, but "DVSEC" is the term used in the spec. I think it stands for "Designated Vendor-Specific Extended Capability".
Right. I noticed that after I sent the email.
thanks.
Signature · 1 line
~Randy
Re: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
In reply to Randy DunlapQuoted 24 lines · Randy Dunlap
Quoted 16 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +1
-0@@ -720,6 +720,7 @@ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ include/uapi/linux/pci_regs.h line 1065
Quoted 3 lines
include/uapi/linux/pci_regs.h +3
-0@@ -1062,6 +1063,10 @@ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Vendor-Specific Header2 */ Just a little comment: It would make more sense to me to s/DVSEC/DVSPEC/g.
Quoted 1 line
But then I don't have the PCIe documentation.
Arguably some of the confusion might be from the patch title. DVSEC is acronym for Designated Vendor-Specific Extended Capability if I recall correctly. It would probably be best to call that out since the extended implies it lives in the config space accessible via the memory mapped config.
David E. Box
maintainerRe: [PATCH V3 1/3] PCI: Add defines for Designated Vendor-Specific Capability
Quoted 13 lines · Alexander Duyck
Quoted 11 lines · Randy Dunlap
Quoted 10 lines · David E. Box
Add PCIe DVSEC extended capability ID and defines for the header offsets.
Defined in PCIe r5.0, sec 7.9.6.Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/pci_regs.h +0
-0@@ -720,6 +720,7 @@Quoted 8 lines
Quoted 8 lines
include/uapi/linux/pci_regs.h +1
-0+#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor- Specific */
include/uapi/linux/pci_regs.h +2
-0@@ -1062,6 +1063,10 @@ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Vendor-Specific Header1 */
+#definePCI_DVSEC_HEADER20x8/* Vendor-Specific
Header2 */
These comments I'll fix to say "Designated Vendor-Specific"
Quoted 6 lines
Quoted 5 lines
Just a little comment: It would make more sense to me to s/DVSEC/DVSPEC/g.
But then I don't have the PCIe documentation.
Quoted 9 lines
Arguably some of the confusion might be from the patch title. DVSEC is
acronym for Designated Vendor-Specific Extended Capability if I recall
correctly. It would probably be best to call that out since the extended
implies it lives in the config space accessible via the memory mapped
config.
I'll change the patch title as well, but agree DVSEC is better as it's consistent with the spec.
Thanks
David
David E. Box
maintainerv3 cover Intel Platform Monitoring Technology
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Changes from V2:
Please excuse this delayed V3 as we dealt with last minute hardware changes.
- In order to handle certain HW bugs from the telemetry capability driver, create a single platform device per capability instead of a device per entry. Add the entry data as device resources and let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug in intel_pmt.c
- Handle overlapping regions in intel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the PMT capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to the intel_pmt.c, the only place where it's needed.
- Remove now unused platform data.
- Add missing header files types.h, bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.
Changes from V1:
- In the telemetry driver, set the device in device_create() to the parent pci device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the pci parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class to pmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixes
David E. Box (3):
PCI: Add defines for Designated Vendor-Specific Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver
.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 218 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 454 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 751 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v4 1/3 PCI: Add defines for Designated Vendor-Specific Extended Capability
Add PCIe Designated Vendor-Specific Extended Capability (DVSEC) and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/pci_regs.h +5 -0
@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Designated Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Designated Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */
Signature · 1 line
2.20.1
Re: [PATCH V4 1/3] PCI: Add defines for Designated Vendor-Specific Extended Capability
Quoted 4 lines · David E. Box
Add PCIe Designated Vendor-Specific Extended Capability (DVSEC) and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
FWIW,
Quoted 32 lines
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)include/uapi/linux/pci_regs.h +5
-1@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Designated Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Designated Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */ --2.20.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerv4 cover Intel Platform Monitoring Technology
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Changes from V3:
- Write out full acronym for DVSEC in PCI patch commit message and add 'Designated' to comments
- remove unused variable caught by kernel test robot <[email protected]>
- Add required Co-developed-by signoffs, noted by Andy
- Allow access using new CAP_PERFMON capability as suggested by Alexey Bundankov
- Fix spacing in Kconfig, noted by Randy
- Other style changes and fixups suggested by Andy
Changes from V2:
- In order to handle certain HW bugs from the telemetry capability driver, create a single platform device per capability instead of a device per entry. Add the entry data as device resources and let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug in intel_pmt.c
- Handle overlapping regions in intel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the PMT capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to the intel_pmt.c, the only place where it's needed.
- Remove now unused platform data.
- Add missing header files types.h, bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.
Changes from V1:
- In the telemetry driver, set the device in device_create() to the parent PCI device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the PCI parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class to pmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixes
David E. Box (3):
PCI: Add defines for Designated Vendor-Specific Extended Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver
.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 215 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 742 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Signature · 1 line
2.20.1
Quoted 49 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
Quoted 3 lines
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
I assume this goes thru MFD tree.
Quoted 64 lines
Changes from V3:
- Write out full acronym for DVSEC in PCI patch commit message and add 'Designated' to comments
- remove unused variable caught by kernel test robot <[email protected]>
- Add required Co-developed-by signoffs, noted by Andy
- Allow access using newCAP_PERFMONcapability as suggested by Alexey Bundankov
- Fix spacing inKconfig, noted by Randy
- Other style changes and fixups suggested by AndyChanges from V2:
- In order to handle certain HW bugs from the telemetry capability driver, create a single platform device per capability instead of a device per entry. Add the entry data as device resources and let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug inintel_pmt.c
- Handle overlapping regions inintel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the PMT capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to theintel_pmt.c, the only place where it's needed.
- Remove now unused platform data.
- Add missing header filestypes.h,bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.Changes from V1:
- In the telemetry driver, set the device indevice_create()to the parent PCI device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the PCI parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class topmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixesDavid E. Box (3):
PCI: Add defines for Designated Vendor-Specific Extended Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 215 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 742 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c--
2.20.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
David E. Box
maintainerQuoted 89 lines · Andy Shevchenko
Quoted 87 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device.
With customers increasingly asking for hardware telemetry, engineers not
only have to figure out how to measure and collect data, but also how to
deliver it and make it discoverable. The latter may be through some device
specific method requiring device specific tools to collect the data. This
in turn requires customers to manage a suite of different tools in order to
collect the differing assortment of monitoring data on their systems. Even
when such information can be provided in kernel drivers, they may require
constant maintenance to update register mappings as they change with
firmware updates and new versions of hardware. PMT provides a solution for
discovering and reading telemetry from a device through a hardware agnostic
framework that allows for updates to systems without requiring patches to
the kernel or software tools.PMT defines several capabilities to support collecting monitoring data from
hardware. All are discoverable as separate instances of the PCIE Designated
Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID
field uniquely identifies the capability. Each DVSEC also provides a BAR
offset to a header that defines capability-specific attributes, including
GUID, feature type, offset and length, as well as configuration settings
where applicable. The GUID uniquely identifies the register space of any
monitor data exposed by the capability. The GUID is associated with an XML
file from the vendor that describes the mapping of the register space along
with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without
requiring any changes to drivers or software tools. The new mapping is
confirmed by an updated GUID, read from the hardware, which software uses
with a new XML.The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block
of read only data. The Watcher capability provides access to hardware
sampling and tracing features. Crashlog provides access to device crash
dumps. While there is some relationship between capabilities (Watcher can
be configured to sample from the Telemetry data set) each exists as stand
alone features with no dependency on any other. The design therefore splits
them into individual, capability specific drivers. MFD is used to create
platform devices for each capability so that they may be managed by their
own driver. The PMT architecture is (for the most part) agnostic to the
type of device it can collect from. Devices nodes are consequently generic
in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver
creates a class to manage the list of devices supporting it. Software can
determine which devices support a PMT feature by searching through each
device node entry in the sysfs class folder. It can additionally determine
if a particular device supports a PMT feature by checking for a PMT class
folder in the device folder.
Quoted 6 lines
Quoted 4 lines
This patch set provides support for the PMT framework, along with support
for Telemetry on Tiger Lake.I assume this goes thru MFD tree.
Yes, looking for pull by MFD. Thanks Andy.
David E. Box
maintainerv5 cover Intel Platform Monitoring Technology
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device. With customers increasingly asking for hardware telemetry, engineers not only have to figure out how to measure and collect data, but also how to deliver it and make it discoverable. The latter may be through some device specific method requiring device specific tools to collect the data. This in turn requires customers to manage a suite of different tools in order to collect the differing assortment of monitoring data on their systems. Even when such information can be provided in kernel drivers, they may require constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for discovering and reading telemetry from a device through a hardware agnostic framework that allows for updates to systems without requiring patches to the kernel or software tools.
PMT defines several capabilities to support collecting monitoring data from hardware. All are discoverable as separate instances of the PCIE Designated Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID field uniquely identifies the capability. Each DVSEC also provides a BAR offset to a header that defines capability-specific attributes, including GUID, feature type, offset and length, as well as configuration settings where applicable. The GUID uniquely identifies the register space of any monitor data exposed by the capability. The GUID is associated with an XML file from the vendor that describes the mapping of the register space along with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without requiring any changes to drivers or software tools. The new mapping is confirmed by an updated GUID, read from the hardware, which software uses with a new XML.
The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash dumps. While there is some relationship between capabilities (Watcher can be configured to sample from the Telemetry data set) each exists as stand alone features with no dependency on any other. The design therefore splits them into individual, capability specific drivers. MFD is used to create platform devices for each capability so that they may be managed by their own driver. The PMT architecture is (for the most part) agnostic to the type of device it can collect from. Devices nodes are consequently generic in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver creates a class to manage the list of devices supporting it. Software can determine which devices support a PMT feature by searching through each device node entry in the sysfs class folder. It can additionally determine if a particular device supports a PMT feature by checking for a PMT class folder in the device folder.
This patch set provides support for the PMT framework, along with support for Telemetry on Tiger Lake.
Changes from V4:
- Replace MFD with PMT in driver title
- Fix commit tags in chronological order
- Fix includes in alphabetical order
- Use 'raw' string instead of defines for device names
- Add an error message when returning an error code for unrecognized capability id
- Use dev_err instead of dev_warn for messages when returning an error
- Change while loop to call pci_find_next_ext_capability once
- Add missing continue in while loop
- Keep PCI platform defines using PCI_DEVICE_DATA magic tied to the pci_device_id table
- Comment and kernel message cleanup
Changes from V3:
- Write out full acronym for DVSEC in PCI patch commit message and add 'Designated' to comments
- remove unused variable caught by kernel test robot <[email protected]>
- Add required Co-developed-by signoffs, noted by Andy
- Allow access using new CAP_PERFMON capability as suggested by Alexey Bundankov
- Fix spacing in Kconfig, noted by Randy
- Other style changes and fixups suggested by Andy
Changes from V2:
- In order to handle certain HW bugs from the telemetry capability driver, create a single platform device per capability instead of a device per entry. Add the entry data as device resources and let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug in intel_pmt.c
- Handle overlapping regions in intel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the PMT capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to the intel_pmt.c, the only place where it's needed.
- Remove now unused platform data.
- Add missing header files types.h, bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.
Changes from V1:
- In the telemetry driver, set the device in device_create() to the parent PCI device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the PCI parent.
- Move telem struct into driver and delete unneeded header file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class to pmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering fixes
David E. Box (3):
PCI: Add defines for Designated Vendor-Specific Extended Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver
.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 220 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 747 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Signature · 1 line
2.20.1
David E. Box
maintainerFriendly ping.
Quoted 176 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device.
With customers increasingly asking for hardware telemetry, engineers not
only have to figure out how to measure and collect data, but also how to
deliver it and make it discoverable. The latter may be through some device
specific method requiring device specific tools to collect the data. This
in turn requires customers to manage a suite of different tools in order to
collect the differing assortment of monitoring data on their systems. Even
when such information can be provided in kernel drivers, they may require
constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for
discovering and reading telemetry from a device through a hardware agnostic
framework that allows for updates to systems without requiring patches to
the kernel or software tools.PMT defines several capabilities to support collecting monitoring data from
hardware. All are discoverable as separate instances of the PCIE Designated
Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID
field uniquely identifies the capability. Each DVSEC also provides a BAR
offset to a header that defines capability-specific attributes, including
GUID, feature type, offset and length, as well as configuration settings
where applicable. The GUID uniquely identifies the register space of any
monitor data exposed by the capability. The GUID is associated with an XML
file from the vendor that describes the mapping of the register space along
with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without
requiring any changes to drivers or software tools. The new mapping is
confirmed by an updated GUID, read from the hardware, which software uses
with a new XML.The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block
of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash
dumps. While there is some relationship between capabilities (Watcher can
be configured to sample from the Telemetry data set) each exists as stand
alone features with no dependency on any other. The design therefore splits
them into individual, capability specific drivers. MFD is used to create
platform devices for each capability so that they may be managed by their
own driver. The PMT architecture is (for the most part) agnostic to the
type of device it can collect from. Devices nodes are consequently generic
in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver
creates a class to manage the list of devices supporting it. Software can
determine which devices support a PMT feature by searching through each
device node entry in the sysfs class folder. It can additionally determine
if a particular device supports a PMT feature by checking for a PMT class
folder in the device folder.This patch set provides support for the PMT framework, along with support
for Telemetry on Tiger Lake.Changes from V4:
- Replace MFD with PMT in driver title
- Fix commit tags in chronological order
- Fix includes in alphabetical order
- Use 'raw' string instead of defines for device names
- Add an error message when returning an error code for unrecognized capability id
- Usedev_errinstead ofdev_warnfor messages when returning an error
- Change while loop to callpci_find_next_ext_capabilityonce
- Add missing continue in while loop
- Keep PCI platform defines usingPCI_DEVICE_DATAmagic tied to thepci_device_idtable
- Comment and kernel message cleanupChanges from V3:
- Write out full acronym for DVSEC in PCI patch commit message
and
add 'Designated' to comments
- remove unused variable caught by kernel test robot <
[email protected]>
- Add required Co-developed-by signoffs, noted by Andy
- Allow access using newCAP_PERFMONcapability as suggested by Alexey Bundankov
- Fix spacing inKconfig, noted by Randy
- Other style changes and fixups suggested by AndyChanges from V2:
- In order to handle certain HW bugs from the telemetry
capability
driver, create a single platform device per capability
instead of
a device per entry. Add the entry data as device resources
and
let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug inintel_pmt.c
- Handle overlapping regions inintel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the
PMT
capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to theintel_pmt.c,
the
only place where it's needed.
- Remove now unused platform data.
- Add missing header filestypes.h,bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.Changes from V1:
- In the telemetry driver, set the device indevice_create()to the parent PCI device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the PCI parent.
- Move telem struct into driver and delete unneeded header
file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class topmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering
fixesDavid E. Box (3):
PCI: Add defines for Designated Vendor-Specific Extended Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 220 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 747 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class- pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
MCTP and PLDM are the latest in Platform management Technology. Sw application and drivers can be implemented on the PCIe platform. Previously I spent some time on this.
Quoted 181 lines · David E. Box
Friendly ping.
Quoted 176 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring capabilities on a device.
With customers increasingly asking for hardware telemetry, engineers not
only have to figure out how to measure and collect data, but also how to
deliver it and make it discoverable. The latter may be through some device
specific method requiring device specific tools to collect the data. This
in turn requires customers to manage a suite of different tools in order to
collect the differing assortment of monitoring data on their systems. Even
when such information can be provided in kernel drivers, they may require
constant maintenance to update register mappings as they change with firmware updates and new versions of hardware. PMT provides a solution for
discovering and reading telemetry from a device through a hardware agnostic
framework that allows for updates to systems without requiring patches to
the kernel or software tools.PMT defines several capabilities to support collecting monitoring data from
hardware. All are discoverable as separate instances of the PCIE Designated
Vendor extended capability (DVSEC) with the Intel vendor code. The DVSEC ID
field uniquely identifies the capability. Each DVSEC also provides a BAR
offset to a header that defines capability-specific attributes, including
GUID, feature type, offset and length, as well as configuration settings
where applicable. The GUID uniquely identifies the register space of any
monitor data exposed by the capability. The GUID is associated with an XML
file from the vendor that describes the mapping of the register space along
with properties of the monitor data. This allows vendors to perform firmware updates that can change the mapping (e.g. add new metrics) without
requiring any changes to drivers or software tools. The new mapping is
confirmed by an updated GUID, read from the hardware, which software uses
with a new XML.The current capabilities defined by PMT are Telemetry, Watcher, and Crashlog. The Telemetry capability provides access to a continuous block
of read only data. The Watcher capability provides access to hardware sampling and tracing features. Crashlog provides access to device crash
dumps. While there is some relationship between capabilities (Watcher can
be configured to sample from the Telemetry data set) each exists as stand
alone features with no dependency on any other. The design therefore splits
them into individual, capability specific drivers. MFD is used to create
platform devices for each capability so that they may be managed by their
own driver. The PMT architecture is (for the most part) agnostic to the
type of device it can collect from. Devices nodes are consequently generic
in naming, e.g. /dev/telem<n> and /dev/smplr<n>. Each capability driver
creates a class to manage the list of devices supporting it. Software can
determine which devices support a PMT feature by searching through each
device node entry in the sysfs class folder. It can additionally determine
if a particular device supports a PMT feature by checking for a PMT class
folder in the device folder.This patch set provides support for the PMT framework, along with support
for Telemetry on Tiger Lake.Changes from V4:
- Replace MFD with PMT in driver title
- Fix commit tags in chronological order
- Fix includes in alphabetical order
- Use 'raw' string instead of defines for device names
- Add an error message when returning an error code for unrecognized capability id
- Usedev_errinstead ofdev_warnfor messages when returning an error
- Change while loop to callpci_find_next_ext_capabilityonce
- Add missing continue in while loop
- Keep PCI platform defines usingPCI_DEVICE_DATAmagic tied to thepci_device_idtable
- Comment and kernel message cleanupChanges from V3:
- Write out full acronym for DVSEC in PCI patch commit message
and
add 'Designated' to comments
- remove unused variable caught by kernel test robot <
[email protected]>
- Add required Co-developed-by signoffs, noted by Andy
- Allow access using newCAP_PERFMONcapability as suggested by Alexey Bundankov
- Fix spacing inKconfig, noted by Randy
- Other style changes and fixups suggested by AndyChanges from V2:
- In order to handle certain HW bugs from the telemetry
capability
driver, create a single platform device per capability
instead of
a device per entry. Add the entry data as device resources
and
let the capability driver manage them as a set allowing for cleaner HW bug resolution.
- Handle discovery table offset bug inintel_pmt.c
- Handle overlapping regions inintel_pmt_telemetry.c
- Add description of sysfs class to testing ABI.
- Don't check size and count until confirming support for the
PMT
capability to avoid bailing out when we need to skip it.
- Remove unneeded header file. Move code to theintel_pmt.c,
the
only place where it's needed.
- Remove now unused platform data.
- Add missing header filestypes.h,bits.h.
- Rename file name and build options from telem to telemetry.
- Code cleanup suggested by Andy S.
- x86 mailing list added.Changes from V1:
- In the telemetry driver, set the device indevice_create()to the parent PCI device (the monitoring device) for clear association in sysfs. Was set before to the platform device created by the PCI parent.
- Move telem struct into driver and delete unneeded header
file.
- Start telem device numbering from 0 instead of 1. 1 was used due to anticipated changes, no longer needed.
- Use helper macros suggested by Andy S.
- Rename class topmt_telemetry, spelling out full name
- Move monitor device name defines to common header
- Coding style, spelling, and Makefile/MAINTAINERS ordering
fixesDavid E. Box (3):
PCI: Add defines for Designated Vendor-Specific Extended Capability
mfd: Intel Platform Monitoring Technology support platform/x86: Intel PMT Telemetry capability driver.../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 220 +++++++++ drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 5 + 9 files changed, 747 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class- pmt_telemetry create mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Quoted 1 line · David E. Box
Friendly ping.
Don't do that. Sending contentless pings is seldom helpful.
If you think your set has been dropped please just send a [RESEND].
This is probably worth doing anyway, since you've sent v2, v3, v4 and now v5 has reply-tos of one another. The thread has become quite messy as a result.
Also please take the time to identify where we are with respect to the current release cycle. The merge-window is open presently. Meaning that most maintainers are busy, either sending out pull-requests or ramping up for the next cycle (or just taking a quick breather).
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
David E. Box
maintainerQuoted 12 lines · Lee Jones
Quoted 1 line · David E. Box
Friendly ping.
Don't do that. Sending contentless pings is seldom helpful.
If you think your set has been dropped please just send a [RESEND].
This is probably worth doing anyway, since you've sent v2, v3, v4 and now v5 has reply-tos of one another. The thread has become quite messy as a result.
Quoted 6 lines
Also please take the time to identify where we are with respect to the
current release cycle. The merge-window is open presently. Meaning that most maintainers are busy, either sending out pull-requests or ramping up for the next cycle (or just taking a quick breather).
No problem. I'll resend v5 in a new thread when rc1 is tagged. Thanks.
David E. Box
maintainerPATCH v5 1/3 PCI: Add defines for Designated Vendor-Specific Extended Capability
In reply to David E. BoxAdd PCIe Designated Vendor-Specific Extended Capability (DVSEC) and defines for the header offsets. Defined in PCIe r5.0, sec 7.9.6.
--- include/uapi/linux/pci_regs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/pci_regs.h +5 -0
@@ -720,6 +720,7 @@#define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_DVSEC 0x23/* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_DLF 0x25/* Data Link Feature */ #define PCI_EXT_CAP_ID_PL_16GT 0x26/* Physical Layer 16.0 GT/s */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -1062,6 +1063,10 @@#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000/* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c/* Control 2 Register */ +/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ +#define PCI_DVSEC_HEADER1 0x4/* Designated Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER2 0x8/* Designated Vendor-Specific Header2 */ +/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000/* Data Link Feature Exchange Enable */
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v5 2/3 mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added.
Also add a quirk mechanism for several early hardware differences and bugs. For Tiger Lake, do not support Watcher and Crashlog capabilities since they will not be compatible with future product. Also, fix use a quirk to fix the discovery table offset.
--- MAINTAINERS | 5 + drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 220 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c
MAINTAINERS +5 -0
@@ -8845,6 +8845,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]> L: [email protected]
drivers/mfd/Kconfig +10 -0
@@ -670,6 +670,16 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology (PMT) support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +1 -0
@@ -216,6 +216,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/intel_pmt.c new file +220 -0
220 lines not on this page · raw message
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v5 3/3 platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxPMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
The module manages access to all PMT Telemetry endpoints on a system, independent of the device exporting them. It creates a pmt_telemetry class to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
Also create a PCI device id list for early telemetry hardware that require workarounds for known issues.
--- .../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ 5 files changed, 506 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Documentation/ABI/testing/sysfs-class-pmt_telemetry new file +46 -0
@@ -0,0 +1,46 @@ +What: /sys/class/pmt_telemetry/ +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The pmt_telemetry/ class directory contains information for + devices that expose hardware telemetry using Intel Platform + Monitoring Technology (PMT) + +What: /sys/class/pmt_telemetry/telem<x> +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The telem<x> directory contains files describing an instance of + a PMT telemetry device that exposes hardware telemetry. Each + telem<x> directory has an associated /dev/telem<x> node. This + node may be opened and mapped to access the telemetry space of + the device. The register layout of the telemetry space is + determined from an XML file that matches the PCI device id and + GUID for the device. + +What: /sys/class/pmt_telemetry/telem<x>/guid +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The GUID for this telemetry device. The GUID identifies + the version of the XML file for the parent device that is to + be used to get the register layout. + +What: /sys/class/pmt_telemetry/telem<x>/size +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The size of telemetry region in bytes that corresponds to + the mapping size for the /dev/telem<x> device node. + +What: /sys/class/pmt_telemetry/telem<x>/offset +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The offset of telemetry region in bytes that corresponds to + the mapping for the /dev/telem<x> device node.
MAINTAINERS +1 -0
@@ -8849,6 +8849,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]>
drivers/platform/x86/Kconfig +10 -0
@@ -1339,6 +1339,16 @@ config INTEL_PMC_CORE - LTR Ignore - MPHY/PLL gating status (Sunrisepoint PCH only) +config INTEL_PMT_TELEMETRY + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + config INTEL_PUNIT_IPC tristate "Intel P-Unit IPC Driver" help
drivers/platform/x86/Makefile +1 -0
@@ -139,6 +139,7 @@ obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o +obj-$(CONFIG_INTEL_PMT_TELEMETRY) += intel_pmt_telemetry.o obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_PCI) += intel_scu_pcidrv.o
drivers/platform/x86/intel_pmt_telemetry.c new file +448 -0
448 lines not on this page · raw message
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v4 2/3 mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added.
Also add a quirk mechanism for several early hardware differences and bugs. For Tiger Lake, do not support Watcher and Crashlog capabilities since they will not be compatible with future product. Also, fix use a quirk to fix the discovery table offset.
--- MAINTAINERS | 5 + drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 215 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c
MAINTAINERS +5 -0
@@ -8845,6 +8845,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]> L: [email protected]
drivers/mfd/Kconfig +10 -0
@@ -670,6 +670,16 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +1 -0
@@ -216,6 +216,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/intel_pmt.c new file +215 -0
215 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH V4 2/3] mfd: Intel Platform Monitoring Technology support
Quoted 14 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added.
Also add a quirk mechanism for several early hardware differences and bugs. For Tiger Lake, do not support Watcher and Crashlog capabilities since they will not be compatible with future product. Also, fix use a quirk to fix the discovery table offset.
Quoted 4 lines
Reviewed-by Andy Shevchenko <[email protected]>Co-developed-by Alexander Duyck <[email protected]>Signed-off-by Alexander Duyck <[email protected]>Signed-off-by David E. Box <[email protected]>
This should be in chronological order.
Quoted 29 lines
--- MAINTAINERS | 5 + drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 215 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 drivers/mfd/intel_pmt.cMAINTAINERS +5
-0@@ -8845,6 +8845,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]> L: [email protected]drivers/mfd/Kconfig +0
-0
drivers/mfd/Kconfig config MFD_INTEL_PMC_BXT · line 674
Quoted 5 lines
drivers/mfd/Kconfig +2
-0@@ -670,6 +670,16 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support"
Nit: "Intel Platform Monitoring Technology (PMT) support"
Quoted 29 lines
drivers/mfd/Kconfig +8
-0+ depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600drivers/mfd/Makefile +1
-0@@ -216,6 +216,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.odrivers/mfd/intel_pmt.c new file +0
-0
drivers/mfd/intel_pmt.c line 3
Quoted 3 lines
drivers/mfd/intel_pmt.c new file +3
-0@@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Intel Platform Monitoring Technology MFD driver
s/MFD/(PMT)/
drivers/mfd/intel_pmt.c line 8
Quoted 4 lines
drivers/mfd/intel_pmt.c new file +4
-0+* Copyright (c) 2020, Intel Corporation. +* All Rights Reserved. +* +* Authors: David E. Box <[email protected]>
Looks odd to use a plural for a single author.
drivers/mfd/intel_pmt.c line 19
Quoted 11 lines
drivers/mfd/intel_pmt.c new file +11
-0+*/ + +#include <linux/bits.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> +#include <linux/mfd/core.h> +#include <linux/types.h>
Alphabetical please.
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +6
-0+/* Intel DVSEC capability vendor space offsets */ +#define INTEL_DVSEC_ENTRIES 0xA +#define INTEL_DVSEC_SIZE 0xB +#define INTEL_DVSEC_TABLE 0xC +#define INTEL_DVSEC_TABLE_BAR (x) ((x) & GENMASK(2, 0)) +#define INTEL_DVSEC_TABLE_OFFSET (x) ((x) & GENMASK(31, 3))
drivers/mfd/intel_pmt.c line 36
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+#define INTEL_DVSEC_ENTRY_SIZE 4 + +/* PMT capabilities */ +#define DVSEC_INTEL_ID_TELEMETRY 2 +#define DVSEC_INTEL_ID_WATCHER 3 +#define DVSEC_INTEL_ID_CRASHLOG 4 + +#define TELEMETRY_DEV_NAME "pmt_telemetry" +#define WATCHER_DEV_NAME "pmt_watcher" +#define CRASHLOG_DEV_NAME "pmt_crashlog"
Please don't define names of things. It makes grepping a pain, at the very least. Just use the 'raw' string in-place.
Quoted 22 lines
drivers/mfd/intel_pmt.c new file +22
-0+struct intel_dvsec_header { +u16 length; +u16 id; +u8 num_entries; +u8 entry_size; +u8 tbir; +u32 offset; +}; + +enum pmt_quirks { +/* Watcher capability not supported */ +PMT_QUIRK_NO_WATCHER =BIT (0 ), + +/* Crashlog capability not supported */ +PMT_QUIRK_NO_CRASHLOG =BIT (1 ), + +/* Use shift instead of mask to read discovery table offset */ +PMT_QUIRK_TABLE_SHIFT =BIT (2 ), +}; + +struct pmt_platform_info { +unsigned long quirks;
drivers/mfd/intel_pmt.c line 69
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+}; + +static const struct pmt_platform_info tgl_info = { + .quirks =PMT_QUIRK_NO_WATCHER |PMT_QUIRK_NO_CRASHLOG | +PMT_QUIRK_TABLE_SHIFT , +}; + +static int +pmt_add_dev (struct pci_dev *pdev,struct intel_dvsec_header *header, +struct pmt_platform_info *info)
My personal preference is to a) only break when you have to and b) to align with the '('. Perhaps point b) is satisfied and it's just the patch format that's shifting the tab though?
Quoted 19 lines
drivers/mfd/intel_pmt.c new file +19
-0+{ +struct device *dev = &pdev->dev; +struct resource *res, *tmp; +struct mfd_cell *cell; +const char *name; +int count = header->num_entries; +int size = header->entry_size; +int i; + +switch (header->id) { +case DVSEC_INTEL_ID_TELEMETRY : + name =TELEMETRY_DEV_NAME ; +break ; +case DVSEC_INTEL_ID_WATCHER : +if (info->quirks &PMT_QUIRK_NO_WATCHER ) { +dev_info (dev,"Watcher not supported\n" ); +return 0 ; + } + name =WATCHER_DEV_NAME ;
drivers/mfd/intel_pmt.c line 98
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+break ; +case DVSEC_INTEL_ID_CRASHLOG : +if (info->quirks &PMT_QUIRK_NO_CRASHLOG ) { +dev_info (dev,"Crashlog not supported\n" ); +return 0 ; + } + name =CRASHLOG_DEV_NAME ; +break ; +default : +return -EINVAL ;
Doesn't deserve an error message?
drivers/mfd/intel_pmt.c line 103
Quoted 5 lines
drivers/mfd/intel_pmt.c new file +5
-0+ } + +if (!header->num_entries || !header->entry_size) { +dev_warn (dev,"Invalid count or size for %s header\n" , name); +return -EINVAL ;
If you're returning an error, this should be dev_err().
Even if you only handle it as a warning at the call site.
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +6
-0+ } + + cell =devm_kzalloc (dev,sizeof (*cell),GFP_KERNEL ); +if (!cell) +return -ENOMEM ; +
drivers/mfd/intel_pmt.c line 119
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+ res =devm_kcalloc (dev, count,sizeof (*res),GFP_KERNEL ); +if (!res) +return -ENOMEM ; + +if (info->quirks &PMT_QUIRK_TABLE_SHIFT ) + header->offset >>=3 ; + +for (i =0 , tmp = res; i < count; i++, tmp++) { + tmp->start = pdev->resource[header->tbir].start + + header->offset + i * (size <<2 );
Deserves a comment I think.
Quoted 23 lines
drivers/mfd/intel_pmt.c new file +23
-0+ tmp->end = tmp->start + (size <<2 ) -1 ; + tmp->flags =IORESOURCE_MEM ; + } + + cell->resources = res; + cell->num_resources = count; + cell->name = name; + +return devm_mfd_add_devices (dev,PLATFORM_DEVID_AUTO , cell,1 ,NULL ,0 , +NULL ); +} + +static int +pmt_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ +struct intel_dvsec_header header; +struct pmt_platform_info *info; +bool found_devices = false; +int ret, pos =0 ; +u32 table; +u16 vid; + + ret =pcim_enable_device (pdev);
drivers/mfd/intel_pmt.c line 152
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+if (ret) +return ret; + + info =devm_kmemdup (&pdev->dev, (void *)id->driver_data,sizeof (*info), +GFP_KERNEL ); +if (!info) +return -ENOMEM ; + + pos =pci_find_next_ext_capability (pdev, pos,PCI_EXT_CAP_ID_DVSEC ); +while (pos) {
If you do:
do {
int pos;
pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC);
if (!pos)
break;Then you can invoke pci_find_next_ext_capability() once, no?
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+pci_read_config_word (pdev, pos +PCI_DVSEC_HEADER1 , &vid); +if (vid !=PCI_VENDOR_ID_INTEL ) +continue ; + +pci_read_config_word (pdev, pos +PCI_DVSEC_HEADER2 , + &header.id); +pci_read_config_byte (pdev, pos +INTEL_DVSEC_ENTRIES , + &header.num_entries); +pci_read_config_byte (pdev, pos +INTEL_DVSEC_SIZE , + &header.entry_size);
drivers/mfd/intel_pmt.c line 172
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+pci_read_config_dword (pdev, pos +INTEL_DVSEC_TABLE , + &table); + + header.tbir =INTEL_DVSEC_TABLE_BAR (table); + header.offset =INTEL_DVSEC_TABLE_OFFSET (table); + + ret =pmt_add_dev (pdev, &header, info); +if (ret) + dev_warn(&pdev->dev, + "Failed to add devices for DVSEC id %d\n",
"device", so not all devices, right?
drivers/mfd/intel_pmt.c line 173
Quoted 1 line
drivers/mfd/intel_pmt.c new file +1
-0+ header.id);
Don't you want to continue here?
Else you're going to set found_devices for a failed device.
Quoted 14 lines
drivers/mfd/intel_pmt.c new file +14
-0+ found_devices = true; + + pos =pci_find_next_ext_capability (pdev, pos, +PCI_EXT_CAP_ID_DVSEC ); + } + +if (!found_devices) { +dev_err (&pdev->dev,"No supported PMT capabilities found.\n" ); +return -ENODEV ; + } + +pm_runtime_put (&pdev->dev); +pm_runtime_allow (&pdev->dev); +
drivers/mfd/intel_pmt.c line 197
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+return 0 ; +} + +static void pmt_pci_remove (struct pci_dev *pdev) +{ +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_sync (&pdev->dev); +} + +#define PCI_DEVICE_ID_INTEL_PMT_TGL 0x9a0d
What's this for?
If this is PCI_DEVICE_DATA magic, it would be worth tying it to the struct i.e. remove the empty line between it and the table below.
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +6
-0+static const struct pci_device_id pmt_pci_ids[] = { + {PCI_DEVICE_DATA (INTEL ,PMT_TGL , &tgl_info) }, + { } +}; +MODULE_DEVICE_TABLE (pci, pmt_pci_ids); +
drivers/mfd/intel_pmt.c line 214
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+static struct pci_driver pmt_pci_driver = { + .name ="intel-pmt" , + .id_table = pmt_pci_ids, + .probe = pmt_pci_probe, + .remove = pmt_pci_remove, +}; +module_pci_driver (pmt_pci_driver); + +MODULE_AUTHOR ("David E. Box <[email protected]>" ); +MODULE_DESCRIPTION ("Intel Platform Monitoring Technology MFD driver" );
s/MFD/(PMT)/
Quoted 1 line
drivers/mfd/intel_pmt.c new file +1
-0+MODULE_LICENSE ("GPL v2" );
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
David E. Box
maintainerRe: [PATCH V4 2/3] mfd: Intel Platform Monitoring Technology support
Hi Lee,
Thanks for this thorough review. Ack on all the comments with particular thanks for spoting the missing continue.
David
Quoted 386 lines · Lee Jones
Quoted 23 lines · David E. Box
Intel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports
multiple types of monitoring capabilities. This driver creates platform
devices for each type so that they may be managed by capability specific
drivers (to be introduced). Capabilities are discovered using PCIe DVSEC
ids. Support is included for the 3 current capability types, Telemetry,
Watcher, and Crashlog. The features are available on new Intel platforms
starting from Tiger Lake for which support is added.Also add a quirk mechanism for several early hardware differences and bugs.
For Tiger Lake, do not support Watcher and Crashlog capabilities since they
will not be compatible with future product. Also, fix use a quirk to fix
the discovery table offset.Quoted 5 lines
Reviewed-by Andy Shevchenko <[email protected]>Co-developed-by Alexander Duyck <[email protected]Quoted 1 line
Signed-off-by Alexander Duyck <[email protected]>Signed-off-by David E. Box <[email protected]>This should be in chronological order.
Quoted 31 lines
--- MAINTAINERS | 5 + drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 215 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 drivers/mfd/intel_pmt.cMAINTAINERS +5
-0@@ -8845,6 +8845,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTIONSUPPORT
M: Stanislav Yakovlev <[email protected]>
L: [email protected]drivers/mfd/Kconfig +0
-0drivers/mfd/Kconfig config MFD_INTEL_PMC_BXT · line 674
Quoted 5 lines
drivers/mfd/Kconfig +2
-0@@ -670,6 +670,16 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support"Nit: "Intel Platform Monitoring Technology (PMT) support"
Quoted 32 lines
drivers/mfd/Kconfig +4
-0+ depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is aninterface that
drivers/mfd/Kconfig +1
-0+ provides access to hardware monitor registers. This driversupports
drivers/mfd/Kconfig +3
-0+ Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600drivers/mfd/Makefile +0
-0@@ -216,6 +216,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) +=intel-lpss-pci.o
obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o
obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o
obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.odrivers/mfd/Makefile +1
-0+obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.odrivers/mfd/intel_pmt.c new file +0
-0drivers/mfd/intel_pmt.c line 3
Quoted 3 lines
drivers/mfd/intel_pmt.c new file +3
-0@@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Intel Platform Monitoring Technology MFD driver s/MFD/(PMT)/
drivers/mfd/intel_pmt.c line 8
Quoted 4 lines
drivers/mfd/intel_pmt.c new file +4
-0+* Copyright (c) 2020, Intel Corporation. +* All Rights Reserved. +* +* Authors: David E. Box <[email protected]> Looks odd to use a plural for a single author.
drivers/mfd/intel_pmt.c line 19
Quoted 11 lines
drivers/mfd/intel_pmt.c new file +11
-0+*/ + +#include <linux/bits.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> +#include <linux/mfd/core.h> +#include <linux/types.h> Alphabetical please.
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +6
-0+/* Intel DVSEC capability vendor space offsets */ +#define INTEL_DVSEC_ENTRIES 0xA +#define INTEL_DVSEC_SIZE 0xB +#define INTEL_DVSEC_TABLE 0xC +#define INTEL_DVSEC_TABLE_BAR (x) ((x) & GENMASK(2, 0)) +#define INTEL_DVSEC_TABLE_OFFSET (x) ((x) & GENMASK(31, 3))drivers/mfd/intel_pmt.c line 36
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+#define INTEL_DVSEC_ENTRY_SIZE 4 + +/* PMT capabilities */ +#define DVSEC_INTEL_ID_TELEMETRY 2 +#define DVSEC_INTEL_ID_WATCHER 3 +#define DVSEC_INTEL_ID_CRASHLOG 4 + +#define TELEMETRY_DEV_NAME "pmt_telemetry" +#define WATCHER_DEV_NAME "pmt_watcher" +#define CRASHLOG_DEV_NAME "pmt_crashlog"Please don't define names of things. It makes grepping a pain, at the
very least. Just use the 'raw' string in-place.Quoted 32 lines
drivers/mfd/intel_pmt.c new file +31
-0+struct intel_dvsec_header { +u16 length; +u16 id; +u8 num_entries; +u8 entry_size; +u8 tbir; +u32 offset; +}; + +enum pmt_quirks { +/* Watcher capability not supported */ +PMT_QUIRK_NO_WATCHER =BIT (0 ), + +/* Crashlog capability not supported */ +PMT_QUIRK_NO_CRASHLOG =BIT (1 ), + +/* Use shift instead of mask to read discovery table offset */ +PMT_QUIRK_TABLE_SHIFT =BIT (2 ), +}; + +struct pmt_platform_info { +unsigned long quirks; +}; + +static const struct pmt_platform_info tgl_info = { + .quirks =PMT_QUIRK_NO_WATCHER |PMT_QUIRK_NO_CRASHLOG | +PMT_QUIRK_TABLE_SHIFT , +}; + +static int +pmt_add_dev(struct pci_dev *pdev, struct intel_dvsec_header*header,
drivers/mfd/intel_pmt.c line 69
Quoted 1 line
drivers/mfd/intel_pmt.c new file +1
-0+ struct pmt_platform_info *info)My personal preference is to a) only break when you have to and b) to align with the '('. Perhaps point b) is satisfied and it's just the patch format that's shifting the tab though?
Quoted 19 lines
drivers/mfd/intel_pmt.c new file +19
-0+{ +struct device *dev = &pdev->dev; +struct resource *res, *tmp; +struct mfd_cell *cell; +const char *name; +int count = header->num_entries; +int size = header->entry_size; +int i; + +switch (header->id) { +case DVSEC_INTEL_ID_TELEMETRY : + name =TELEMETRY_DEV_NAME ; +break ; +case DVSEC_INTEL_ID_WATCHER : +if (info->quirks &PMT_QUIRK_NO_WATCHER ) { +dev_info (dev,"Watcher not supported\n" ); +return 0 ; + } + name =WATCHER_DEV_NAME ;drivers/mfd/intel_pmt.c line 98
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+break ; +case DVSEC_INTEL_ID_CRASHLOG : +if (info->quirks &PMT_QUIRK_NO_CRASHLOG ) { +dev_info (dev,"Crashlog not supported\n" ); +return 0 ; + } + name =CRASHLOG_DEV_NAME ; +break ; +default : +return -EINVAL ;Doesn't deserve an error message?
drivers/mfd/intel_pmt.c
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +4
-0+ } + +if (!header->num_entries || !header->entry_size) { + dev_warn(dev, "Invalid count or size for %s header\n",name);
drivers/mfd/intel_pmt.c new file +1
-0+return -EINVAL ;If you're returning an error, this should be
dev_err().Even if you only handle it as a warning at the call site.
Quoted 6 lines
drivers/mfd/intel_pmt.c new file +6
-0+ } + + cell =devm_kzalloc (dev,sizeof (*cell),GFP_KERNEL ); +if (!cell) +return -ENOMEM ; +drivers/mfd/intel_pmt.c line 119
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+ res =devm_kcalloc (dev, count,sizeof (*res),GFP_KERNEL ); +if (!res) +return -ENOMEM ; + +if (info->quirks &PMT_QUIRK_TABLE_SHIFT ) + header->offset >>=3 ; + +for (i =0 , tmp = res; i < count; i++, tmp++) { + tmp->start = pdev->resource[header->tbir].start + + header->offset + i * (size <<2 );Deserves a comment I think.
Quoted 36 lines
drivers/mfd/intel_pmt.c new file +9
-0+ tmp->end = tmp->start + (size <<2 ) -1 ; + tmp->flags =IORESOURCE_MEM ; + } + + cell->resources = res; + cell->num_resources = count; + cell->name = name; + + return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, cell, 1,NULL, 0,
drivers/mfd/intel_pmt.c new file +5
-0+ NULL); +} + +static int +pmt_pci_probe(struct pci_dev *pdev, const struct pci_device_id*id)
drivers/mfd/intel_pmt.c new file +13
-0+{ +struct intel_dvsec_header header; +struct pmt_platform_info *info; +bool found_devices = false; +int ret, pos =0 ; +u32 table; +u16 vid; + + ret =pcim_enable_device (pdev); +if (ret) +return ret; + + info = devm_kmemdup(&pdev->dev, (void *)id->driver_data,
sizeof(*info),drivers/mfd/intel_pmt.c new file +5
-0+ GFP_KERNEL); +if (!info) +return -ENOMEM ; + + pos = pci_find_next_ext_capability(pdev, pos,
PCI_EXT_CAP_ID_DVSEC);drivers/mfd/intel_pmt.c line 152
Quoted 1 line
drivers/mfd/intel_pmt.c new file +1
-0+while (pos) {If you do:
do { int pos; pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC); if (!pos) break;Then you can invoke
pci_find_next_ext_capability()once, no?Quoted 21 lines
drivers/mfd/intel_pmt.c new file +1
-0+ pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER1,&vid);
drivers/mfd/intel_pmt.c new file +19
-0+if (vid !=PCI_VENDOR_ID_INTEL ) +continue ; + +pci_read_config_word (pdev, pos +PCI_DVSEC_HEADER2 , + &header.id); +pci_read_config_byte (pdev, pos +INTEL_DVSEC_ENTRIES , + &header.num_entries); +pci_read_config_byte (pdev, pos +INTEL_DVSEC_SIZE , + &header.entry_size); +pci_read_config_dword (pdev, pos +INTEL_DVSEC_TABLE , + &table); + + header.tbir =INTEL_DVSEC_TABLE_BAR (table); + header.offset =INTEL_DVSEC_TABLE_OFFSET (table); + + ret =pmt_add_dev (pdev, &header, info); +if (ret) + dev_warn(&pdev->dev, + "Failed to add devices for DVSEC idQuoted 1 line
%d\n",
"device", so not all devices, right?
drivers/mfd/intel_pmt.c line 173
Quoted 1 line
drivers/mfd/intel_pmt.c new file +1
-0+ header.id);Don't you want to continue here?
Else you're going to set
found_devicesfor a failed device.Quoted 16 lines
drivers/mfd/intel_pmt.c new file +4
-0+ found_devices = true; + + pos =pci_find_next_ext_capability (pdev, pos, + PCI_EXT_CAP_ID_DVSEC);
drivers/mfd/intel_pmt.c new file +4
-0+ } + +if (!found_devices) { + dev_err(&pdev->dev, "No supported PMT capabilitiesfound.\n");
drivers/mfd/intel_pmt.c new file +6
-0+return -ENODEV ; + } + +pm_runtime_put (&pdev->dev); +pm_runtime_allow (&pdev->dev); +drivers/mfd/intel_pmt.c line 197
Quoted 10 lines
drivers/mfd/intel_pmt.c new file +10
-0+return 0 ; +} + +static void pmt_pci_remove (struct pci_dev *pdev) +{ +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_sync (&pdev->dev); +} + +#define PCI_DEVICE_ID_INTEL_PMT_TGL 0x9a0dWhat's this for?
If this is
PCI_DEVICE_DATAmagic, it would be worth tying it to the struct i.e. remove the empty line between it and the table below.Quoted 16 lines
drivers/mfd/intel_pmt.c new file +16
-0+static const struct pci_device_id pmt_pci_ids[] = { + {PCI_DEVICE_DATA (INTEL ,PMT_TGL , &tgl_info) }, + { } +}; +MODULE_DEVICE_TABLE (pci, pmt_pci_ids); + +static struct pci_driver pmt_pci_driver = { + .name ="intel-pmt" , + .id_table = pmt_pci_ids, + .probe = pmt_pci_probe, + .remove = pmt_pci_remove, +}; +module_pci_driver (pmt_pci_driver); + +MODULE_AUTHOR ("David E. Box <[email protected]>" ); +MODULE_DESCRIPTION("Intel Platform Monitoring Technology MFDQuoted 1 line
driver");
s/MFD/(PMT)/
Quoted 1 line
+MODULE_LICENSE("GPL v2");
Re: [PATCH V4 2/3] mfd: Intel Platform Monitoring Technology support
In reply to Lee JonesQuoted 10 lines · Lee Jones
If you do:
do { int pos; pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC); if (!pos) break;Then you can invoke
pci_find_next_ext_capability()once, no?
Part of your suggestion here won't work, because pos needs to be initialized to 0 the first time. As such it needs to be declared and initialized outside the loop. Other than that it may be ok.
--
Mark Rustad, [email protected]
David E. Box
maintainerRe: [PATCH V4 2/3] mfd: Intel Platform Monitoring Technology support
Quoted 12 lines · Mark D Rustad
Quoted 10 lines · Lee Jones
If you do:
do { int pos; pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC); if (!pos) break;
Quoted 6 lines
Quoted 1 line
Then you can invoke
pci_find_next_ext_capability()once, no?Part of your suggestion here won't work, because pos needs to be initialized to 0 the first time. As such it needs to be declared and
initialized outside the loop. Other than that it may be ok.
Already done in V5. Thanks.
David
Re: [PATCH V4 2/3] mfd: Intel Platform Monitoring Technology support
In reply to Mark D RustadQuoted 11 lines · Mark D Rustad
Quoted 9 lines · Lee Jones
If you do:
do { int pos; pos = pci_find_next_ext_capability(pdev, pos, PCI_EXT_CAP_ID_DVSEC); if (!pos) break;
Quoted 5 lines
Quoted 1 line
Then you can invoke
pci_find_next_ext_capability()once, no?Part of your suggestion here won't work, because pos needs to be initialized to 0 the first time. As such it needs to be declared and initialized outside the loop. Other than that it may be ok.
Right. It was just an example I quickly hacked out.
Feel free to move the variable, or make it static, etc.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
David E. Box
maintainerPATCH v4 3/3 platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxPMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
The module manages access to all PMT Telemetry endpoints on a system, independent of the device exporting them. It creates a pmt_telemetry class to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
Also create a PCI device id list for early telemetry hardware that require workarounds for known issues.
--- .../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 448 ++++++++++++++++++ 5 files changed, 506 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Documentation/ABI/testing/sysfs-class-pmt_telemetry new file +46 -0
@@ -0,0 +1,46 @@ +What: /sys/class/pmt_telemetry/ +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The pmt_telemetry/ class directory contains information for + devices that expose hardware telemetry using Intel Platform + Monitoring Technology (PMT) + +What: /sys/class/pmt_telemetry/telem<x> +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The telem<x> directory contains files describing an instance of + a PMT telemetry device that exposes hardware telemetry. Each + telem<x> directory has an associated /dev/telem<x> node. This + node may be opened and mapped to access the telemetry space of + the device. The register layout of the telemetry space is + determined from an XML file that matches the PCI device id and + GUID for the device. + +What: /sys/class/pmt_telemetry/telem<x>/guid +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The GUID for this telemetry device. The GUID identifies + the version of the XML file for the parent device that is to + be used to get the register layout. + +What: /sys/class/pmt_telemetry/telem<x>/size +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The size of telemetry region in bytes that corresponds to + the mapping size for the /dev/telem<x> device node. + +What: /sys/class/pmt_telemetry/telem<x>/offset +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The offset of telemetry region in bytes that corresponds to + the mapping for the /dev/telem<x> device node.
MAINTAINERS +1 -0
@@ -8849,6 +8849,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]>
drivers/platform/x86/Kconfig +10 -0
@@ -1339,6 +1339,16 @@ config INTEL_PMC_CORE - LTR Ignore - MPHY/PLL gating status (Sunrisepoint PCH only) +config INTEL_PMT_TELEMETRY + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + config INTEL_PUNIT_IPC tristate "Intel P-Unit IPC Driver" help
drivers/platform/x86/Makefile +1 -0
@@ -139,6 +139,7 @@ obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o +obj-$(CONFIG_INTEL_PMT_TELEMETRY) += intel_pmt_telemetry.o obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_PCI) += intel_scu_pcidrv.o
drivers/platform/x86/intel_pmt_telemetry.c new file +448 -0
448 lines not on this page · raw message
Signature · 1 line
2.20.1
David E. Box
maintainerPATCH v3 2/3 mfd: Intel Platform Monitoring Technology support
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) is an architecture for enumerating and accessing hardware monitoring facilities. PMT supports multiple types of monitoring capabilities. This driver creates platform devices for each type so that they may be managed by capability specific drivers (to be introduced). Capabilities are discovered using PCIe DVSEC ids. Support is included for the 3 current capability types, Telemetry, Watcher, and Crashlog. The features are available on new Intel platforms starting from Tiger Lake for which support is added.
This patch also adds a quirk mechanism for several early hardware differences and bugs. For Tiger Lake, do not support Watcher and Crashlog capabilities since they will not be compatible with future product. Also, fix use a quirk to fix the discovery table offset.
--- MAINTAINERS | 5 + drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/intel_pmt.c | 218 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 drivers/mfd/intel_pmt.c
MAINTAINERS +5 -0
@@ -8845,6 +8845,11 @@ F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_msic.h F: include/linux/mfd/intel_soc_pmic* +INTEL PMT DRIVER +M: "David E. Box" <[email protected]> +S: Maintained +F: drivers/mfd/intel_pmt.c + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]> L: [email protected]
drivers/mfd/Kconfig +10 -0
@@ -670,6 +670,16 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. +config MFD_INTEL_PMT + tristate "Intel Platform Monitoring Technology support" + depends on PCI + select MFD_CORE + help + The Intel Platform Monitoring Technology (PMT) is an interface that + provides access to hardware monitor registers. This driver supports + Telemetry, Watcher, and Crashlog PMT capabilities/devices for + platforms starting from Tiger Lake. + config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +1 -0
@@ -216,6 +216,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o +obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/intel_pmt.c new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
2.20.1
kernel test robot
build botRe: [PATCH V3 2/3] mfd: Intel Platform Monitoring Technology support
I love your patch! Perhaps something to improve:
Hi "David,
I love your patch! Perhaps something to improve:
[auto build test WARNING on ljones-mfd/for-mfd-next]
[also build test WARNING on pci/next linus/master v5.8-rc5 next-20200714] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-E-Box/Intel-Platform-Monitoring-Technology/20200714-142630 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next config: x86_64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/mfd/intel_pmt.c:67:39: warning: unused variable 'pmt_info' [-Wunused-const-variable]
static const struct pmt_platform_info pmt_info = {
^1 warning generated.
vim +/pmt_info +67 drivers/mfd/intel_pmt.c
66
> 67 static const struct pmt_platform_info pmt_info = {
68 };
69 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
David E. Box
maintainerPATCH v3 3/3 platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxPMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
This module manages access to all PMT Telemetry endpoints on a system, independent of the device exporting them. It creates a pmt_telemetry class to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
This patch also creates an pci device id list for early telemetry hardware that requires workarounds for known issues.
--- .../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 454 ++++++++++++++++++ 5 files changed, 512 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/platform/x86/intel_pmt_telemetry.c
Documentation/ABI/testing/sysfs-class-pmt_telemetry new file +46 -0
@@ -0,0 +1,46 @@ +What: /sys/class/pmt_telemetry/ +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The pmt_telemetry/ class directory contains information for + devices that expose hardware telemetry using Intel Platform + Monitoring Technology (PMT) + +What: /sys/class/pmt_telemetry/telem<x> +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The telem<x> directory contains files describing an instance of + a PMT telemetry device that exposes hardware telemetry. Each + telem<x> directory has an associated /dev/telem<x> node. This + node may be opened and mapped to access the telemetry space of + the device. The register layout of the telemetry space is + determined from an XML file that matches the pci device id and + guid for the device. + +What: /sys/class/pmt_telemetry/telem<x>/guid +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The guid for this telemetry device. The guid identifies + the version of the XML file for the parent device that is to + be used to get the register layout. + +What: /sys/class/pmt_telemetry/telem<x>/size +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The size of telemetry region in bytes that corresponds to + the mapping size for the /dev/telem<x> device node. + +What: /sys/class/pmt_telemetry/telem<x>/offset +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The offset of telemetry region in bytes that corresponds to + the mapping for the /dev/telem<x> device node.
MAINTAINERS +1 -0
@@ -8849,6 +8849,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]>
drivers/platform/x86/Kconfig +10 -0
@@ -1396,6 +1396,16 @@ config INTEL_TELEMETRY directly via debugfs files. Various tools may use this interface for SoC state monitoring. +config INTEL_PMT_TELEMETRY + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -139,6 +139,7 @@ obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o +obj-$(CONFIG_INTEL_PMT_TELEMETRY) += intel_pmt_telemetry.o obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_PCI) += intel_scu_pcidrv.o
drivers/platform/x86/intel_pmt_telemetry.c new file +454 -0
454 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH V3 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 25 lines · David E. Box
PMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
This module manages access to all PMT Telemetry endpoints on a system, independent of the device exporting them. It creates a
pmt_telemetryclass to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
Quoted 2 lines
This patch also creates an pci device id list for early telemetry hardware that requires workarounds for known issues.
Some more style issues, after addressing feel free to add
Quoted 2 lines
Signed-off-by David E. Box <[email protected]>Signed-off-by Alexander Duyck <[email protected]>
Since you are submitting this the order of the above SoB chain is a bit strange. I think something like
SoB: Alexander
Co-developed-by: Alexander
SoB: David
is expected (same for patch 2).
...
Documentation/ABI/testing/sysfs-class-pmt_telemetry line 20
Quoted 8 lines
Documentation/ABI/testing/sysfs-class-pmt_telemetry new file +8
-0+Contact: David Box <[email protected]> +Description: + The telem<x> directory contains files describing an instance of + a PMT telemetry device that exposes hardware telemetry. Each + telem<x> directory has an associated /dev/telem<x> node. This + node may be opened and mapped to access the telemetry space of + the device. The register layout of the telemetry space is + determined from an XML file that matches the pci device id and
PCI
Quoted 1 line
+ guid for the device.
GUID
Same for all code where it appears.
...
drivers/platform/x86/intel_pmt_telemetry.c line 130
Quoted 2 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +2
-0+ psize = (PFN_UP (entry->base_addr + entry->header.size) - pfn) * +PAGE_SIZE ;
I wouldn't mind having this on one line.
...
Review
Quoted 2 lines
(quoted diff) +2
-0+static ssize_t guid_show(struct device *dev, struct device_attribute *attr, + char *buf)
Ditto.
...
drivers/platform/x86/intel_pmt_telemetry.c line 178
Quoted 2 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +2
-0+static ssize_t offset_show (struct device *dev,struct device_attribute *attr, +char *buf)
Ditto.
...
drivers/platform/x86/intel_pmt_telemetry.c line 213
Quoted 6 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +5
-0+static bool pmt_telem_is_early_client_hw (struct device *dev) +{ +struct pci_dev *parent; + + parent =to_pci_dev (dev->parent);
Can be one line.
Quoted 2 lines
(quoted diff) +2
-0+ return !!pci_match_id(pmt_telem_early_client_pci_ids, parent); +}
...
drivers/platform/x86/intel_pmt_telemetry.c line 376
Quoted 2 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +2
-0+ entry->header_res =platform_get_resource (pdev,IORESOURCE_MEM , + i);
One line, please.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH V3 3/3] platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxHi David,
Quoted 217 lines · David E. Box
PMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
This module manages access to all PMT Telemetry endpoints on a system, independent of the device exporting them. It creates a
pmt_telemetryclass to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.This patch also creates an pci device id list for early telemetry hardware that requires workarounds for known issues.
Signed-off-by David E. Box <[email protected]>Signed-off-by Alexander Duyck <[email protected]>--- .../ABI/testing/sysfs-class-pmt_telemetry | 46 ++ MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telemetry.c | 454 ++++++++++++++++++ 5 files changed, 512 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-pmt_telemetry create mode 100644 drivers/platform/x86/intel_pmt_telemetry.cDocumentation/ABI/testing/sysfs-class-pmt_telemetry new file +46
-0@@ -0,0 +1,46 @@ +What: /sys/class/pmt_telemetry/ +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The pmt_telemetry/ class directory contains information for + devices that expose hardware telemetry using Intel Platform + Monitoring Technology (PMT) + +What: /sys/class/pmt_telemetry/telem<x> +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + The telem<x> directory contains files describing an instance of + a PMT telemetry device that exposes hardware telemetry. Each + telem<x> directory has an associated /dev/telem<x> node. This + node may be opened and mapped to access the telemetry space of + the device. The register layout of the telemetry space is + determined from an XML file that matches the pci device id and + guid for the device. + +What: /sys/class/pmt_telemetry/telem<x>/guid +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The guid for this telemetry device. The guid identifies + the version of the XML file for the parent device that is to + be used to get the register layout. + +What: /sys/class/pmt_telemetry/telem<x>/size +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The size of telemetry region in bytes that corresponds to + the mapping size for the /dev/telem<x> device node. + +What: /sys/class/pmt_telemetry/telem<x>/offset +Date: July 2020 +KernelVersion: 5.9 +Contact: David Box <[email protected]> +Description: + (RO) The offset of telemetry region in bytes that corresponds to + the mapping for the /dev/telem<x> device node.MAINTAINERS +1
-0@@ -8849,6 +8849,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]>drivers/platform/x86/Kconfig +10
-0@@ -1396,6 +1396,16 @@ config INTEL_TELEMETRY directly via debugfs files. Various tools may use this interface for SoC state monitoring. +config INTEL_PMT_TELEMETRY + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + endif # X86_PLATFORM_DEVICES config PMC_ATOMdrivers/platform/x86/Makefile +1
-0@@ -139,6 +139,7 @@ obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o +obj-$(CONFIG_INTEL_PMT_TELEMETRY) += intel_pmt_telemetry.o obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_PCI) += intel_scu_pcidrv.odrivers/platform/x86/intel_pmt_telemetry.c new file +75
-0@@ -0,0 +1,454 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Intel Platform Monitory Technology Telemetry driver +* +* Copyright (c) 2020, Intel Corporation. +* All Rights Reserved. +* +* Author: "David E. Box" <[email protected]> +*/ + +#include <linux/bits.h> +#include <linux/cdev.h> +#include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/uaccess.h> +#include <linux/xarray.h> + +#define TELEM_DEV_NAME "pmt_telemetry" + +/* Telemetry access types */ +#define TELEM_ACCESS_FUTURE 1 +#define TELEM_ACCESS_BARID 2 +#define TELEM_ACCESS_LOCAL 3 + +#define TELEM_GUID_OFFSET 0x4 +#define TELEM_BASE_OFFSET 0x8 +#define TELEM_TBIR_MASK GENMASK(2, 0) +#define TELEM_ACCESS (v) ((v) & GENMASK(3, 0)) +#define TELEM_TYPE (v) (((v) & GENMASK(7, 4)) >> 4) +/* size is in bytes */ +#define TELEM_SIZE (v) (((v) & GENMASK(27, 12)) >> 10) + +#define TELEM_XA_START 0 +#define TELEM_XA_MAX INT_MAX +#define TELEM_XA_LIMIT XA_LIMIT(TELEM_XA_START, TELEM_XA_MAX) + +/* Used by client hardware to identify a fixed telemetry entry*/ +#define TELEM_CLIENT_FIXED_BLOCK_GUID 0x10000000 + +static DEFINE_XARRAY_ALLOC (telem_array); + +struct pmt_telem_priv ; + +struct telem_header { +u8 access_type; +u8 telem_type; +u16 size; +u32 guid; +u32 base_offset; +u8 tbir; +}; + +struct pmt_telem_entry { +struct pmt_telem_priv *priv; +struct telem_header header; +struct resource *header_res; +unsigned long base_addr; +void __iomem *disc_table; +struct cdev cdev; +dev_t devt; +int devid; +}; + +struct pmt_telem_priv { +struct pmt_telem_entry *entry; +int num_entries; +struct device *dev; +}; + +/*
drivers/platform/x86/intel_pmt_telemetry.c line 85
Quoted 10 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +10
-0+* devfs +*/ +static int pmt_telem_open (struct inode *inode,struct file *filp) +{ +struct pmt_telem_priv *priv; +struct pmt_telem_entry *entry; +struct pci_driver *pci_drv; +struct pci_dev *pci_dev; + +if (!capable (CAP_SYS_ADMIN ))
Thanks for supplying these patches.
Are there any reasons not to expose this feature to CAP_PERFMON privileged processes too that currently have access to performance monitoring features of the kernel without root/CAP_SYS_ADMIN credentials? This could be done by pefmon_capable() function call starting from v5.8+.
Thanks,
Alexei
Quoted 370 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +369
-0+return -EPERM ; + + entry = container_of(inode->i_cdev, struct pmt_telem_entry, cdev); + priv = entry->priv; + pci_dev =to_pci_dev (priv->dev->parent); + + pci_drv =pci_dev_driver (pci_dev); +if (!pci_drv) +return -ENODEV ; + + filp->private_data = entry; +get_device (&pci_dev->dev); + +if (!try_module_get (pci_drv->driver.owner)) { +put_device (&pci_dev->dev); +return -ENODEV ; + } + +return 0 ; +} + +static int pmt_telem_release (struct inode *inode,struct file *filp) +{ +struct pmt_telem_entry *entry = filp->private_data; +struct pci_dev *pci_dev =to_pci_dev (entry->priv->dev->parent); +struct pci_driver *pci_drv =pci_dev_driver (pci_dev); + +put_device (&pci_dev->dev); +module_put (pci_drv->driver.owner); + +return 0 ; +} + +static int pmt_telem_mmap (struct file *filp,struct vm_area_struct *vma) +{ +struct pmt_telem_entry *entry = filp->private_data; +struct pmt_telem_priv *priv; +unsigned long vsize = vma->vm_end - vma->vm_start; +unsigned long phys = entry->base_addr; +unsigned long pfn =PFN_DOWN (phys); +unsigned long psize; + + priv = entry->priv; + psize = (PFN_UP (entry->base_addr + entry->header.size) - pfn) * +PAGE_SIZE ; +if (vsize > psize) { +dev_err (priv->dev,"Requested mmap size is too large\n" ); +return -EINVAL ; + } + +if ((vma->vm_flags &VM_WRITE ) || (vma->vm_flags &VM_MAYWRITE )) +return -EPERM ; + + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); + +if (io_remap_pfn_range (vma, vma->vm_start, pfn, vsize, + vma->vm_page_prot)) +return -EINVAL ; + +return 0 ; +} + +static const struct file_operations pmt_telem_fops = { + .owner =THIS_MODULE , + .open = pmt_telem_open, + .mmap = pmt_telem_mmap, + .release = pmt_telem_release, +}; + +/* +* sysfs +*/ +static ssize_t guid_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct pmt_telem_entry *entry =dev_get_drvdata (dev); + +return sprintf (buf,"0x%x\n" , entry->header.guid); +} +static DEVICE_ATTR_RO (guid); + +static ssize_t size_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct pmt_telem_entry *entry =dev_get_drvdata (dev); + +/* Display buffer size in bytes */ +return sprintf (buf,"%u\n" , entry->header.size); +} +static DEVICE_ATTR_RO (size); + +static ssize_t offset_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct pmt_telem_entry *entry =dev_get_drvdata (dev); + +/* Display buffer offset in bytes */ +return sprintf (buf,"%lu\n" ,offset_in_page (entry->base_addr)); +} +static DEVICE_ATTR_RO (offset); + +static struct attribute *pmt_telem_attrs[] = { + &dev_attr_guid.attr, + &dev_attr_size.attr, + &dev_attr_offset.attr, +NULL +}; +ATTRIBUTE_GROUPS (pmt_telem); + +struct class pmt_telem_class = { + .owner =THIS_MODULE , + .name ="pmt_telemetry" , + .dev_groups = pmt_telem_groups, +}; + +/* +* driver initialization +*/ +static const struct pci_device_id pmt_telem_early_client_pci_ids[] = { + {PCI_VDEVICE (INTEL ,0x9a0d ) },/* TGL */ + { } +}; + +static bool pmt_telem_is_early_client_hw (struct device *dev) +{ +struct pci_dev *parent; + + parent =to_pci_dev (dev->parent); + +return !!pci_match_id (pmt_telem_early_client_pci_ids, parent); +} + +static int pmt_telem_create_dev (struct pmt_telem_priv *priv, +struct pmt_telem_entry *entry) +{ +struct pci_dev *pci_dev; +struct device *dev; +int ret; + +cdev_init (&entry->cdev, &pmt_telem_fops); + ret =cdev_add (&entry->cdev, entry->devt,1 ); +if (ret) { +dev_err (priv->dev,"Could not add char dev\n" ); +return ret; + } + + pci_dev =to_pci_dev (priv->dev->parent); + dev =device_create (&pmt_telem_class, &pci_dev->dev, entry->devt, + entry,"telem%d" , entry->devid); +if (IS_ERR (dev)) { +dev_err (priv->dev,"Could not create device node\n" ); +cdev_del (&entry->cdev); + } + +return PTR_ERR_OR_ZERO (dev); +} + +static void pmt_telem_populate_header (void __iomem *disc_offset, +struct telem_header *header) +{ + header->access_type =TELEM_ACCESS (readb (disc_offset)); + header->telem_type =TELEM_TYPE (readb (disc_offset)); + header->size =TELEM_SIZE (readl (disc_offset)); + header->guid =readl (disc_offset +TELEM_GUID_OFFSET ); + header->base_offset =readl (disc_offset +TELEM_BASE_OFFSET ); + +/* +* For non-local access types the lower 3 bits of base offset +* contains the index of the base address register where the +* telemetry can be found. +*/ + header->tbir = header->base_offset &TELEM_TBIR_MASK ; + header->base_offset ^= header->tbir; +} + +static int pmt_telem_add_entry (struct pmt_telem_priv *priv, +struct pmt_telem_entry *entry) +{ +struct resource *res = entry->header_res; +struct pci_dev *pci_dev =to_pci_dev (priv->dev->parent); +int ret; + +pmt_telem_populate_header (entry->disc_table, &entry->header); + +/* Local access and BARID only for now */ +switch (entry->header.access_type) { +case TELEM_ACCESS_LOCAL : +if (entry->header.tbir) { +dev_err (priv->dev, +"Unsupported BAR index %d for access type %d\n" , + entry->header.tbir, entry->header.access_type); +return -EINVAL ; + } + +/* +* For access_type LOCAL, the base address is as follows: +* base address = header address + header length + base offset +*/ + entry->base_addr = res->start +resource_size (res) + + entry->header.base_offset; +break ; + +case TELEM_ACCESS_BARID : + entry->base_addr = pci_dev->resource[entry->header.tbir].start + + entry->header.base_offset; +break ; + +default : +dev_err (priv->dev,"Unsupported access type %d\n" , + entry->header.access_type); +return -EINVAL ; + } + + ret =alloc_chrdev_region (&entry->devt,0 ,1 ,TELEM_DEV_NAME ); +if (ret) { +dev_err (priv->dev, +"PMT telemetry chrdev_region error: %d\n" , ret); +return ret; + } + + ret =xa_alloc (&telem_array, &entry->devid, entry,TELEM_XA_LIMIT , +GFP_KERNEL ); +if (ret) + goto fail_xa_alloc; + + ret =pmt_telem_create_dev (priv, entry); +if (ret) + goto fail_create_dev; + + entry->priv = priv; + priv->num_entries++; +return 0 ; + +fail_create_dev: +xa_erase (&telem_array, entry->devid); +fail_xa_alloc: +unregister_chrdev_region (entry->devt,1 ); + +return ret; +} + +static bool pmt_telem_region_overlaps (struct platform_device *pdev, +void __iomem *disc_table) +{ +u32 guid; + + guid =readl (disc_table +TELEM_GUID_OFFSET ); + +return guid ==TELEM_CLIENT_FIXED_BLOCK_GUID ; +} + +static void pmt_telem_remove_entries (struct pmt_telem_priv *priv) +{ +int i; + +for (i =0 ; i < priv->num_entries; i++) { +device_destroy (&pmt_telem_class, priv->entry[i].devt); +cdev_del (&priv->entry[i].cdev); +xa_erase (&telem_array, priv->entry[i].devid); +unregister_chrdev_region (priv->entry[i].devt,1 ); + } +} + +static int pmt_telem_probe (struct platform_device *pdev) +{ +struct pmt_telem_priv *priv; +struct pmt_telem_entry *entry; +bool early_hw; +int i; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +platform_set_drvdata (pdev, priv); + priv->dev = &pdev->dev; + + priv->entry =devm_kcalloc (&pdev->dev, pdev->num_resources, +sizeof (struct pmt_telem_entry ),GFP_KERNEL ); +if (!priv->entry) +return -ENOMEM ; + +if (pmt_telem_is_early_client_hw (&pdev->dev)) + early_hw = true; + +for (i =0 , entry = priv->entry; i < pdev->num_resources; + i++, entry++) { +int ret; + + entry->header_res =platform_get_resource (pdev,IORESOURCE_MEM , + i); +if (!entry->header_res) { +pmt_telem_remove_entries (priv); +return -ENODEV ; + } + + entry->disc_table =devm_platform_ioremap_resource (pdev, i); +if (IS_ERR (entry->disc_table)) { +pmt_telem_remove_entries (priv); +return PTR_ERR (entry->disc_table); + } + +if (pmt_telem_region_overlaps (pdev, entry->disc_table) && + early_hw) +continue ; + + ret =pmt_telem_add_entry (priv, entry); +if (ret) { +pmt_telem_remove_entries (priv); +return ret; + } + } + +return 0 ; +} + +static int pmt_telem_remove (struct platform_device *pdev) +{ +struct pmt_telem_priv *priv =platform_get_drvdata (pdev); + +pmt_telem_remove_entries (priv); + +return 0 ; +} + +static const struct platform_device_id pmt_telem_table[] = { + { + .name ="pmt_telemetry" , + }, + {} +}; +MODULE_DEVICE_TABLE (platform, pmt_telem_table); + +static struct platform_driver pmt_telem_driver = { + .driver = { + .name =TELEM_DEV_NAME , + }, + .probe = pmt_telem_probe, + .remove = pmt_telem_remove, + .id_table = pmt_telem_table, +}; + +static int __init pmt_telem_init (void ) +{ +int ret =class_register (&pmt_telem_class); + +if (ret) +return ret; + + ret =platform_driver_register (&pmt_telem_driver); +if (ret) +class_unregister (&pmt_telem_class); + +return ret; +} +module_init (pmt_telem_init); + +static void __exit pmt_telem_exit(void) +{ +platform_driver_unregister (&pmt_telem_driver); +class_unregister (&pmt_telem_class); +xa_destroy (&telem_array); +} +module_exit (pmt_telem_exit); + +MODULE_AUTHOR ("David E. Box <[email protected]>" ); +MODULE_DESCRIPTION ("Intel PMT Telemetry driver" ); +MODULE_ALIAS ("platform:" TELEM_DEV_NAME ); +MODULE_LICENSE ("GPL v2" );
David E. Box
maintainerRe: [PATCH V3 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 3 lines · Alexey Budankov
Hi David,
On 14.07.2020 9:23, David E. Box wrote:
...
Quoted 10 lines
drivers/platform/x86/intel_pmt_telemetry.c line 85
Quoted 9 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +8
-0+static int pmt_telem_open (struct inode *inode,struct file *filp) +{ +struct pmt_telem_priv *priv; +struct pmt_telem_entry *entry; +struct pci_driver *pci_drv; +struct pci_dev *pci_dev; + +if (!capable (CAP_SYS_ADMIN ))
Quoted 8 lines
Thanks for supplying these patches.
Are there any reasons not to expose this feature toCAP_PERFMONprivileged
processes too that currently have access to performance monitoring features
of the kernel without root/CAP_SYS_ADMIN credentials? This could be done bypefmon_capable()function call starting from v5.8+.
The new capability is well suited for this feature. I'll make the change. Thanks.
David
Re: [PATCH V3 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 26 lines · David E. Box
Quoted 3 lines · Alexey Budankov
Hi David,
On 14.07.2020 9:23, David E. Box wrote:
...
Quoted 10 lines
drivers/platform/x86/intel_pmt_telemetry.c line 85
Quoted 9 lines
drivers/platform/x86/intel_pmt_telemetry.c new file +8
-0+static int pmt_telem_open (struct inode *inode,struct file *filp) +{ +struct pmt_telem_priv *priv; +struct pmt_telem_entry *entry; +struct pci_driver *pci_drv; +struct pci_dev *pci_dev; + +if (!capable (CAP_SYS_ADMIN ))Quoted 8 lines
Thanks for supplying these patches.
Are there any reasons not to expose this feature toCAP_PERFMONprivileged
processes too that currently have access to performance monitoring features
of the kernel without root/CAP_SYS_ADMIN credentials? This could be done bypefmon_capable()function call starting from v5.8+.
Quoted 2 lines
The new capability is well suited for this feature. I'll make the change. Thanks.
I appreciate your cooperation. Thanks!
Alexei
Re: [PATCH V3 3/3] platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxQuoted 11 lines · David E. Box
drivers/platform/x86/Kconfig +3
-0@@ -1396,6 +1396,16 @@ config INTEL_TELEMETRY directly via debugfs files. Various tools may use this interface for SoC state monitoring. +config INTEL_PMT_TELEMETRY + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help
drivers/platform/x86/Kconfig config INTEL_TELEMETRY · line 1411
Quoted 10 lines
drivers/platform/x86/Kconfig +7
-0+ The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + endif # X86_PLATFORM_DEVICES config PMC_ATOM
The text under "help" should be indented with one tab + 2 spaces, as is done in patch 2/3.
Signature · 1 line
~Randy
David E. Box
maintainerPATCH v2 3/3 platform/x86: Intel PMT Telemetry capability driver
In reply to David E. BoxPMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
This module manages access to all PMT Telemetry endpoints on a system, regardless of the device exporting them. It creates a pmt_telemetry class to manage the list. For each endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry comes from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
--- MAINTAINERS | 1 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_pmt_telem.c | 362 +++++++++++++++++++++++++ 4 files changed, 374 insertions(+) create mode 100644 drivers/platform/x86/intel_pmt_telem.c
MAINTAINERS +1 -0
@@ -8737,6 +8737,7 @@ INTEL PMT DRIVER M: "David E. Box" <[email protected]> S: Maintained F: drivers/mfd/intel_pmt.c +F: drivers/platform/x86/intel_pmt_* INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev <[email protected]>
drivers/platform/x86/Kconfig +10 -0
@@ -1368,6 +1368,16 @@ config INTEL_TELEMETRY directly via debugfs files. Various tools may use this interface for SoC state monitoring. +config INTEL_PMT_TELEM + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + help + The Intel Platform Monitory Technology (PMT) Telemetry driver provides + access to hardware telemetry metrics on devices that support the + feature. + + For more information, see + <file:Documentation/ABI/testing/sysfs-class-intel_pmt_telem> + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -139,6 +139,7 @@ obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o obj-$(CONFIG_INTEL_PMC_IPC) += intel_pmc_ipc.o +obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.o obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o
drivers/platform/x86/intel_pmt_telem.c new file +362 -0
362 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v2 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 15 lines · David E. Box
PMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from continuous, memory mapped, read-only register spaces.
Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes.
Quoted 6 lines
This module manages access to all PMT Telemetry endpoints on a system, regardless of the device exporting them. It creates a
pmt_telemetryclass to manage the list. For each endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry comes from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of
ABI needs documentation.
Quoted 2 lines
the class folder under the device of interest. A device node of the same name allows software to then map the telemetry space for direct access.
...
Quoted 1 line
+config
INTEL_PMT_TELEM
TELEMETRY
...
Quoted 1 line
+obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.o
telemetry
(Inside the file it's fine to have telem)
...
drivers/platform/x86/intel_pmt_telem.c line 247
Quoted 5 lines
drivers/platform/x86/intel_pmt_telem.c new file +5
-0+ priv->dvsec =dev_get_platdata (&pdev->dev); +if (!priv->dvsec) { +dev_err (&pdev->dev,"Platform data not found\n" ); +return -ENODEV ; + }
I don't see how is it being used?
--
With Best Regards,
Andy Shevchenko
David E. Box
maintainerRe: [PATCH v2 3/3] platform/x86: Intel PMT Telemetry capability driver
Quoted 39 lines · Andy Shevchenko
Quoted 24 lines · David E. Box
PMT Telemetry is a capability of the Intel Platform Monitoring Technology.
The Telemetry capability provides access to device telemetry metrics that
provide hardware performance data to users from continuous, memory mapped,
read-only register spaces.Register mappings are not provided by the driver. Instead, a GUID is read
from a header for each endpoint. The GUID identifies the device and is to
be used with an XML, provided by the vendor, to discover the available set
of metrics and their register mapping. This allows firmware updates to
modify the register space without needing to update the driver every time
with new mappings. Firmware writes a new GUID in this case to specify the
new mapping. Software tools with access to the associated XML file can
then interpret the changes.Quoted 12 lines
This module manages access to all PMT Telemetry endpoints on a system,
regardless of the device exporting them. It creates apmt_telemetryclass
to manage the list. For each endpoint, sysfs files provide GUID and size
information as well as a pointer to the parent device the telemetry comes
from. Software may discover the association between endpoints and devices
by iterating through the list in sysfs, or by looking for the existence of
Quoted 1 line
ABI needs documentation.
We will be releasing a Linux software spec for PMT. We are waiting on public release of the PMT spec. For this patch we did document the sysfs class ABI.
Quoted 22 lines
Quoted 5 lines
the class folder under the device of interest. A device node of the same
name allows software to then map the telemetry space for direct access....
Quoted 1 line
+config
INTEL_PMT_TELEMTELEMETRY
...
Quoted 1 line
+obj-$(CONFIG_INTEL_PMT_TELEM) += intel_pmt_telem.o
telemetry
(Inside the file it's fine to have telem)
...
Quoted 7 lines
drivers/platform/x86/intel_pmt_telem.c line 247
Quoted 5 lines
drivers/platform/x86/intel_pmt_telem.c new file +5
-0+ priv->dvsec =dev_get_platdata (&pdev->dev); +if (!priv->dvsec) { +dev_err (&pdev->dev,"Platform data not found\n" ); +return -ENODEV ; + }I don't see how is it being used?
Good catch :). This was initially used to pass the DVSEC info from the pci device to the telemetry driver. But with changes all of the needed info is now read from the driver's memory resource. It was unnoticed that dvsec fields are no longer used. Will remove in next version.
Okay on other comments.
David