Skip to contentSkip to conversation

Intel pmc_core: Enable telemetry

PATCH In review David E. Box 2 participants 14 messages Mar 15, 2023 – Mar 16, 2023

Subsystems (4)
lore
Share & tools
lore

David E. Box

author maintainer
#0 lore raw

cover Intel pmc_core: Enable telemetry

On Intel SoCs, registers for the Power Management Controller are available in the PCI BAR of the SSRAM device, 0000:14.2. On Meteor Lake, these registers are structured in Intel PMT Telemetry regions which could be handled by the pmt_telemetry driver. This series adds APIs to the intel_vsec and pmt_telemetry drivers so that pmc_core driver can both create the telemetry instance from the SSRAM device and register for a handle to read the telemetry which contains the low power mode requirements for the S0ix states supported by Meteor Lake. The series also adds some fixes.

David E. Box (6):
platform/x86/intel/vsec: Explicitly enable capabilities platform/x86/intel/vsec: Add base address field platform/x86/intel/pmt: Add INTEL_PMT module namespace platform/x86/intel/pmt: telemetry: Add telemetry read functions platform/x86/intel/pmt/telemetry: Add driver version platform/x86/intel/pmc: Add Intel PMT support for MTL PMC

Gayatri Kammela (1):
platform/x86/intel/vsec: Add intel_vsec_register

Rajvi Jingar (1):
platform/x86/intel/pmc: Alder Lake slp_s0_residency fix

Xi Pardee (3):
platform/x86:intel/pmc: Combine core_init and core_configure function platform/x86:intel/pmc: Move get_low_power_modes function platform/x86/intel/pmc/mtl: get LPM information using Intel PMT

 drivers/platform/x86/intel/pmc/Kconfig     |   1 +
 drivers/platform/x86/intel/pmc/adl.c       |  17 +-
 drivers/platform/x86/intel/pmc/cnp.c       |  17 +-
 drivers/platform/x86/intel/pmc/core.c      |  71 +++++---
 drivers/platform/x86/intel/pmc/core.h      |  24 +--
 drivers/platform/x86/intel/pmc/icl.c       |  11 +-
 drivers/platform/x86/intel/pmc/mtl.c       | 187 ++++++++++++++++++-
 drivers/platform/x86/intel/pmc/spt.c       |  11 +-
 drivers/platform/x86/intel/pmc/tgl.c       |  17 +-
 drivers/platform/x86/intel/pmt/class.c     |  48 +++--
 drivers/platform/x86/intel/pmt/class.h     |  35 ++--
 drivers/platform/x86/intel/pmt/crashlog.c  |   3 +-
 drivers/platform/x86/intel/pmt/telemetry.c | 199 ++++++++++++++++++++-
 drivers/platform/x86/intel/pmt/telemetry.h | 120 +++++++++++++
 drivers/platform/x86/intel/vsec.c          | 131 ++++++--------
 drivers/platform/x86/intel/vsec.h          |  64 ++++++-
 16 files changed, 790 insertions(+), 166 deletions(-)
 create mode 100644 drivers/platform/x86/intel/pmt/telemetry.h

base-commit: 02c464b73645404654359ad21f368a13735e2850

Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/11 platform/x86/intel/vsec: Add intel_vsec_register

From: Gayatri Kammela <[email protected]>

Intel PCIe VSEC capabilities may be emulated in the MMIO space of other Intel devices like the Power Management Controller (PMC) SSRAM device. Add and export intel_vsec_register to allow those capabilities to be registered by other drivers. Reuses the existing intel_vsec_walk_header function which already creates entries from device data in lieu of a config space (used by DG1). Add a check to ensure that the memory region is available before creating a VSEC auxiliary device.

---
 drivers/platform/x86/intel/pmt/class.c |  2 +-
 drivers/platform/x86/intel/pmt/class.h |  5 ++-
 drivers/platform/x86/intel/vsec.c      | 56 +++++++++-----------------
 drivers/platform/x86/intel/vsec.h      | 51 ++++++++++++++++++++++-
 4 files changed, 73 insertions(+), 41 deletions(-)
drivers/platform/x86/intel/pmt/class.c +1 -1
index 46598dcb634a..9f505c6ef278 100644
@@ -31,7 +31,7 @@ bool intel_pmt_is_early_client_hw(struct device *dev)
 	 * differences from the server platforms (which use the Out Of Band
 	 * Management Services Module OOBMSM).
 	 */
-	return !!(ivdev->info->quirks & VSEC_QUIRK_EARLY_HW);
+	return !!(ivdev->quirks & VSEC_QUIRK_EARLY_HW);
 }
 EXPORT_SYMBOL_GPL(intel_pmt_is_early_client_hw);
 
drivers/platform/x86/intel/pmt/class.h +3 -2
index db11d58867ce..17bc40b77efc 100644
@@ -2,11 +2,10 @@
 #ifndef _INTEL_PMT_CLASS_H
 #define _INTEL_PMT_CLASS_H
 
-#include <linux/xarray.h>
-#include <linux/types.h>
 #include <linux/bits.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/types.h>
 
 #include "../vsec.h"
 
@@ -18,6 +17,8 @@
 #define GET_BIR(v)		((v) & GENMASK(2, 0))
 #define GET_ADDRESS(v)		((v) & GENMASK(31, 3))
 
+struct xarray;
+
 struct intel_pmt_entry {
 	struct bin_attribute	pmt_bin_attr;
 	struct kobject		*kobj;
drivers/platform/x86/intel/vsec.c +20 -36

85 lines not on this page · raw message

drivers/platform/x86/intel/vsec.h +49 -2

72 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/11 platform/x86/intel/vsec: Explicitly enable capabilities

In reply to David E. Box

Any discovered Intel VSEC/DVSEC capabilities are enabled by default and only get disabled by quirk. Instead, remove such quirks and only enable support for capabilities that have been explicitly added to a new capabilities field. While here, also reorder the device info structures alphabetically.

---
 drivers/platform/x86/intel/vsec.c | 65 +++++++++++++------------------
 drivers/platform/x86/intel/vsec.h | 11 +++++-
 2 files changed, 38 insertions(+), 38 deletions(-)
drivers/platform/x86/intel/vsec.c +28 -37
index a22354ee6ce3..0d5cf250e288 100644
@@ -32,14 +32,6 @@ static DEFINE_IDA(intel_vsec_ida);
 static DEFINE_IDA(intel_vsec_sdsi_ida);
 static DEFINE_XARRAY_ALLOC(auxdev_array);
 
-static enum intel_vsec_id intel_vsec_allow_list[] = {
-	VSEC_ID_TELEMETRY,
-	VSEC_ID_WATCHER,
-	VSEC_ID_CRASHLOG,
-	VSEC_ID_SDSI,
-	VSEC_ID_TPMI,
-};
-
 static const char *intel_vsec_name(enum intel_vsec_id id)
 {
 	switch (id) {
@@ -63,26 +55,19 @@ static const char *intel_vsec_name(enum intel_vsec_id id)
 	}
 }
 
-static bool intel_vsec_allowed(u16 id)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(intel_vsec_allow_list); i++)
-		if (intel_vsec_allow_list[i] == id)
-			return true;
-
-	return false;
-}
-
-static bool intel_vsec_disabled(u16 id, unsigned long quirks)
+static bool intel_vsec_supported(u16 id, unsigned long caps)
 {
 	switch (id) {
+	case VSEC_ID_TELEMETRY:
+		return !!(caps & VSEC_CAP_TELEMETRY);
 	case VSEC_ID_WATCHER:
-		return !!(quirks & VSEC_QUIRK_NO_WATCHER);
-
+		return !!(caps & VSEC_CAP_WATCHER);
 	case VSEC_ID_CRASHLOG:
-		return !!(quirks & VSEC_QUIRK_NO_CRASHLOG);
-
+		return !!(caps & VSEC_CAP_CRASHLOG);
+	case VSEC_ID_SDSI:
+		return !!(caps & VSEC_CAP_SDSI);
+	case VSEC_ID_TPMI:
+		return !!(caps & VSEC_CAP_TPMI);
 	default:
 		return false;
 	}
@@ -170,7 +155,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 	unsigned long quirks = info->quirks;
 	int i;
 
-	if (!intel_vsec_allowed(header->id) || intel_vsec_disabled(header->id, quirks))
+	if (!intel_vsec_supported(header->id, info->caps))
 		return -EINVAL;
 
 	if (!header->num_entries) {
@@ -234,14 +219,14 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 static bool intel_vsec_walk_header(struct pci_dev *pdev,
 				   struct intel_vsec_platform_info *info)
 {
-	struct intel_vsec_header **header = info->capabilities;
+	struct intel_vsec_header **header = info->headers;
 	bool have_devices = false;
 	int ret;
 
 	for ( ; *header; header++) {
 		ret = intel_vsec_add_dev(pdev, *header, info);
 		if (ret)
-			dev_info(&pdev->dev, "Could not add device for DVSEC id %d\n",
+			dev_info(&pdev->dev, "Could not add device for VSEC id %d\n",
 				 (*header)->id);
 		else
 			have_devices = true;
@@ -386,12 +371,6 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
 	return 0;
 }
 
-/* TGL info */
-static const struct intel_vsec_platform_info tgl_info = {
-	.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG |
-		  VSEC_QUIRK_TABLE_SHIFT | VSEC_QUIRK_EARLY_HW,
-};
-
 /* DG1 info */
 static struct intel_vsec_header dg1_telemetry = {
 	.length = 0x10,
@@ -402,19 +381,31 @@ static struct intel_vsec_header dg1_telemetry = {
 	.offset = 0x466000,
 };
 
-static struct intel_vsec_header *dg1_capabilities[] = {
+static struct intel_vsec_header *dg1_headers[] = {
 	&dg1_telemetry,
 	NULL
 };
 
 static const struct intel_vsec_platform_info dg1_info = {
-	.capabilities = dg1_capabilities,
+	.caps = VSEC_CAP_TELEMETRY,
+	.headers = dg1_headers,
 	.quirks = VSEC_QUIRK_NO_DVSEC | VSEC_QUIRK_EARLY_HW,
 };
 
 /* MTL info */
 static const struct intel_vsec_platform_info mtl_info = {
-	.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG,
+	.caps = VSEC_CAP_TELEMETRY,
+};
+
+/* OOBMSM info */
+static const struct intel_vsec_platform_info oobmsm_info = {
+	.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI,
+};
+
+/* TGL info */
+static const struct intel_vsec_platform_info tgl_info = {
+	.caps = VSEC_CAP_TELEMETRY,
+	.quirks = VSEC_QUIRK_TABLE_SHIFT | VSEC_QUIRK_EARLY_HW,
 };
 
 #define PCI_DEVICE_ID_INTEL_VSEC_ADL		0x467d
@@ -429,7 +420,7 @@ static const struct pci_device_id intel_vsec_pci_ids[] = {
 	{ PCI_DEVICE_DATA(INTEL, VSEC_DG1, &dg1_info) },
 	{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) },
 	{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) },
-	{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &(struct intel_vsec_platform_info) {}) },
+	{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) },
 	{ PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) },
 	{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
 	{ }
drivers/platform/x86/intel/vsec.h +10 -1
index f600d6fe0830..54fdea93f762 100644
@@ -61,9 +61,18 @@ enum intel_vsec_quirks {
 	VSEC_QUIRK_EARLY_HW     = BIT(4),
 };
 
+enum intel_vsec_capabilities {
+	VSEC_CAP_TELEMETRY	= BIT(0),
+	VSEC_CAP_WATCHER	= BIT(1),
+	VSEC_CAP_CRASHLOG	= BIT(2),
+	VSEC_CAP_SDSI		= BIT(3),
+	VSEC_CAP_TPMI		= BIT(4),
+};
+
 /* Platform specific data */
 struct intel_vsec_platform_info {
-	struct intel_vsec_header **capabilities;
+	struct intel_vsec_header **headers;
+	unsigned long caps;
 	unsigned long quirks;
 };
 
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH 3/11 platform/x86/intel/vsec: Add base address field

In reply to David E. Box

Some Intel PCIe VSEC capabilities may be emulated in MMIO. In such cases the BAR is not readable from config space. Provide a field for drivers to indicate the base address that is to be used.

---
 drivers/platform/x86/intel/pmt/class.c | 14 +++++++++++---
 drivers/platform/x86/intel/vsec.c      | 10 ++++++++--
 drivers/platform/x86/intel/vsec.h      |  2 ++
 3 files changed, 21 insertions(+), 5 deletions(-)
drivers/platform/x86/intel/pmt/class.c +11 -3
index 9f505c6ef278..7136475d4ab5 100644
@@ -161,10 +161,11 @@ static struct class intel_pmt_class = {
 
 static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
 				    struct intel_pmt_header *header,
-				    struct device *dev,
+				    struct intel_vsec_device *ivdev,
 				    struct resource *disc_res)
 {
-	struct pci_dev *pci_dev = to_pci_dev(dev->parent);
+	struct pci_dev *pci_dev = ivdev->pcidev;
+	struct device *dev = &ivdev->auxdev.dev;
 	u8 bir;
 
 	/*
@@ -216,6 +217,13 @@ static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
 
 		break;
 	case ACCESS_BARID:
+		/* Use the provided base address if it exists */
+		if (ivdev->base_addr) {
+			entry->base_addr = ivdev->base_addr +
+				   GET_ADDRESS(header->base_offset);
+			break;
+		}
+
 		/*
 		 * If another BAR was specified then the base offset
 		 * represents the offset within that BAR. SO retrieve the
@@ -320,7 +328,7 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
 	if (ret)
 		return ret;
 
-	ret = intel_pmt_populate_entry(entry, &header, dev, disc_res);
+	ret = intel_pmt_populate_entry(entry, &header, intel_vsec_dev, disc_res);
 	if (ret)
 		return ret;
 
drivers/platform/x86/intel/vsec.c +8 -2
index 0d5cf250e288..77063f699a1d 100644
@@ -153,6 +153,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 	struct intel_vsec_device *intel_vsec_dev;
 	struct resource *res, *tmp;
 	unsigned long quirks = info->quirks;
+	u64 base_addr;
 	int i;
 
 	if (!intel_vsec_supported(header->id, info->caps))
@@ -181,14 +182,18 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 	if (quirks & VSEC_QUIRK_TABLE_SHIFT)
 		header->offset >>= TABLE_OFFSET_SHIFT;
 
+	if (info->base_addr)
+		base_addr = info->base_addr;
+	else
+		base_addr = pdev->resource[header->tbir].start;
+
 	/*
 	 * The DVSEC/VSEC contains the starting offset and count for a block of
 	 * discovery tables. Create a resource array of these tables to the
 	 * auxiliary device driver.
 	 */
 	for (i = 0, tmp = res; i < header->num_entries; i++, tmp++) {
-		tmp->start = pdev->resource[header->tbir].start +
-			     header->offset + i * (header->entry_size * sizeof(u32));
+		tmp->start = base_addr + header->offset + i * (header->entry_size * sizeof(u32));
 		tmp->end = tmp->start + (header->entry_size * sizeof(u32)) - 1;
 		tmp->flags = IORESOURCE_MEM;
 
@@ -206,6 +211,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 	intel_vsec_dev->resource = res;
 	intel_vsec_dev->num_resources = header->num_entries;
 	intel_vsec_dev->quirks = info->quirks;
+	intel_vsec_dev->base_addr = info->base_addr;
 
 	if (header->id == VSEC_ID_SDSI)
 		intel_vsec_dev->ida = &intel_vsec_sdsi_ida;
drivers/platform/x86/intel/vsec.h +2 -0
index 54fdea93f762..4157ec546cd3 100644
@@ -74,6 +74,7 @@ struct intel_vsec_platform_info {
 	struct intel_vsec_header **headers;
 	unsigned long caps;
 	unsigned long quirks;
+	u64 base_addr;
 };
 
 struct intel_vsec_device {
@@ -86,6 +87,7 @@ struct intel_vsec_device {
 	void *priv_data;
 	size_t priv_data_size;
 	unsigned long quirks;
+	u64 base_addr;
 };
 
 int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
Signature · 1 line
2.34.1
author maintainer
#4 lore raw

PATCH 4/11 platform/x86/intel/pmt: Add INTEL_PMT module namespace

In reply to David E. Box

Since the currently exported symbols in pmt_class are only used by other Intel PMT drivers, create an INTEL_PMT module namespace for them.

---
 drivers/platform/x86/intel/pmt/class.c     | 6 +++---
 drivers/platform/x86/intel/pmt/crashlog.c  | 1 +
 drivers/platform/x86/intel/pmt/telemetry.c | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/intel/pmt/class.c +3 -3
index 7136475d4ab5..acc96f0cc224 100644
@@ -33,7 +33,7 @@ bool intel_pmt_is_early_client_hw(struct device *dev)
 	 */
 	return !!(ivdev->quirks & VSEC_QUIRK_EARLY_HW);
 }
-EXPORT_SYMBOL_GPL(intel_pmt_is_early_client_hw);
+EXPORT_SYMBOL_NS_GPL(intel_pmt_is_early_client_hw, INTEL_PMT);
 
 static inline int
 pmt_memcpy64_fromio(void *to, const u64 __iomem *from, size_t count)
@@ -335,7 +335,7 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
 	return intel_pmt_dev_register(entry, ns, dev);
 
 }
-EXPORT_SYMBOL_GPL(intel_pmt_dev_create);
+EXPORT_SYMBOL_NS_GPL(intel_pmt_dev_create, INTEL_PMT);
 
 void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
 			   struct intel_pmt_namespace *ns)
@@ -351,7 +351,7 @@ void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
 	device_unregister(dev);
 	xa_erase(ns->xa, entry->devid);
 }
-EXPORT_SYMBOL_GPL(intel_pmt_dev_destroy);
+EXPORT_SYMBOL_NS_GPL(intel_pmt_dev_destroy, INTEL_PMT);
 
 static int __init pmt_class_init(void)
 {
drivers/platform/x86/intel/pmt/crashlog.c +1 -0
index ace1239bc0a0..bbb3d61d09f4 100644
@@ -328,3 +328,4 @@ module_exit(pmt_crashlog_exit);
 MODULE_AUTHOR("Alexander Duyck <[email protected]>");
 MODULE_DESCRIPTION("Intel PMT Crashlog driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(INTEL_PMT);
drivers/platform/x86/intel/pmt/telemetry.c +1 -0
index 5e4009c05ecf..71cdef42084a 100644
@@ -160,3 +160,4 @@ module_exit(pmt_telem_exit);
 MODULE_AUTHOR("David E. Box <[email protected]>");
 MODULE_DESCRIPTION("Intel PMT Telemetry driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(INTEL_PMT);
Signature · 1 line
2.34.1
author maintainer
#5 lore raw

PATCH 5/11 platform/x86/intel/pmt: telemetry: Add telemetry read functions

In reply to David E. Box

Export symbols to allow access to Intel PMT Telemetry data on available devices. Provides APIs to search, register, and read telemetry using a kref managed pointer that serves as a handle to a telemetry entry.

---
 drivers/platform/x86/intel/pmt/class.c     |  28 +--
 drivers/platform/x86/intel/pmt/class.h     |  30 +++-
 drivers/platform/x86/intel/pmt/crashlog.c  |   2 +-
 drivers/platform/x86/intel/pmt/telemetry.c | 196 ++++++++++++++++++++-
 drivers/platform/x86/intel/pmt/telemetry.h | 120 +++++++++++++
 5 files changed, 353 insertions(+), 23 deletions(-)
 create mode 100644 drivers/platform/x86/intel/pmt/telemetry.h
drivers/platform/x86/intel/pmt/class.c +18 -10
index acc96f0cc224..4fc8d48ef3be 100644
@@ -17,7 +17,7 @@
 #include "../vsec.h"
 #include "class.h"
 
-#define PMT_XA_START		0
+#define PMT_XA_START		1
 #define PMT_XA_MAX		INT_MAX
 #define PMT_XA_LIMIT		XA_LIMIT(PMT_XA_START, PMT_XA_MAX)
 #define GUID_SPR_PUNIT		0x9956f43f
@@ -160,12 +160,12 @@ static struct class intel_pmt_class = {
 };
 
 static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
-				    struct intel_pmt_header *header,
 				    struct intel_vsec_device *ivdev,
 				    struct resource *disc_res)
 {
 	struct pci_dev *pci_dev = ivdev->pcidev;
 	struct device *dev = &ivdev->auxdev.dev;
+	struct intel_pmt_header *header = &entry->header;
 	u8 bir;
 
 	/*
@@ -271,7 +271,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
 	if (ns->attr_grp) {
 		ret = sysfs_create_group(entry->kobj, ns->attr_grp);
 		if (ret)
-			goto fail_sysfs;
+			goto fail_sysfs_create_group;
 	}
 
 	/* if size is 0 assume no data buffer, so no file needed */
@@ -296,13 +296,23 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
 	entry->pmt_bin_attr.size = entry->size;
 
 	ret = sysfs_create_bin_file(&dev->kobj, &entry->pmt_bin_attr);
-	if (!ret)
-		return 0;
+	if (ret)
+		goto fail_ioremap;
 
+	if (ns->pmt_add_handle) {
+		ret = ns->pmt_add_handle(entry, parent);
+		if (ret)
+			goto fail_add_handle;
+	}
+
+	return 0;
+
+fail_add_handle:
+	sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr);
 fail_ioremap:
 	if (ns->attr_grp)
 		sysfs_remove_group(entry->kobj, ns->attr_grp);
-fail_sysfs:
+fail_sysfs_create_group:
 	device_unregister(dev);
 fail_dev_create:
 	xa_erase(ns->xa, entry->devid);
@@ -314,7 +324,6 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
 			 struct intel_vsec_device *intel_vsec_dev, int idx)
 {
 	struct device *dev = &intel_vsec_dev->auxdev.dev;
-	struct intel_pmt_header header;
 	struct resource	*disc_res;
 	int ret;
 
@@ -324,16 +333,15 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
 	if (IS_ERR(entry->disc_table))
 		return PTR_ERR(entry->disc_table);
 
-	ret = ns->pmt_header_decode(entry, &header, dev);
+	ret = ns->pmt_header_decode(entry, dev);
 	if (ret)
 		return ret;
 
-	ret = intel_pmt_populate_entry(entry, &header, intel_vsec_dev, disc_res);
+	ret = intel_pmt_populate_entry(entry, intel_vsec_dev, disc_res);
 	if (ret)
 		return ret;
 
 	return intel_pmt_dev_register(entry, ns, dev);
-
 }
 EXPORT_SYMBOL_NS_GPL(intel_pmt_dev_create, INTEL_PMT);
 
drivers/platform/x86/intel/pmt/class.h +22 -8
index 17bc40b77efc..7b730cdaed5a 100644
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 
 #include "../vsec.h"
+#include "telemetry.h"
 
 /* PMT access types */
 #define ACCESS_BARID		2
@@ -18,8 +19,27 @@
 #define GET_ADDRESS(v)		((v) & GENMASK(31, 3))
 
 struct xarray;
+struct pci_dev;
+
+struct telem_handle {
+	struct pci_dev		*parent;
+	struct telem_header	header;
+	struct device		*dev;
+	void __iomem		*base;
+	bool			present;
+	struct kref		kref;
+};
+
+struct intel_pmt_header {
+	u32	base_offset;
+	u32	size;
+	u32	guid;
+	u8	access_type;
+};
 
 struct intel_pmt_entry {
+	struct telem_handle	*handle;
+	struct intel_pmt_header	header;
 	struct bin_attribute	pmt_bin_attr;
 	struct kobject		*kobj;
 	void __iomem		*disc_table;
@@ -30,20 +50,14 @@ struct intel_pmt_entry {
 	int			devid;
 };
 
-struct intel_pmt_header {
-	u32	base_offset;
-	u32	size;
-	u32	guid;
-	u8	access_type;
-};
-
 struct intel_pmt_namespace {
 	const char *name;
 	struct xarray *xa;
 	const struct attribute_group *attr_grp;
 	int (*pmt_header_decode)(struct intel_pmt_entry *entry,
-				 struct intel_pmt_header *header,
 				 struct device *dev);
+	int (*pmt_add_handle)(struct intel_pmt_entry *entry,
+			      struct device *dev);
 };
 
 bool intel_pmt_is_early_client_hw(struct device *dev);
drivers/platform/x86/intel/pmt/crashlog.c +1 -1
index bbb3d61d09f4..4014c02cafdb 100644
@@ -223,10 +223,10 @@ static const struct attribute_group pmt_crashlog_group = {
 };
 
 static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry,
-				      struct intel_pmt_header *header,
 				      struct device *dev)
 {
 	void __iomem *disc_table = entry->disc_table;
+	struct intel_pmt_header *header = &entry->header;
 	struct crashlog_entry *crashlog;
 
 	if (!pmt_crashlog_supported(entry))
drivers/platform/x86/intel/pmt/telemetry.c +192 -4

236 lines not on this page · raw message

drivers/platform/x86/intel/pmt/telemetry.h new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#6 lore raw

PATCH 6/11 platform/x86/intel/pmt/telemetry: Add driver version

In reply to David E. Box

Add a driver version number to make it easier to track changes in backported kernels.

---
 drivers/platform/x86/intel/pmt/telemetry.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/platform/x86/intel/pmt/telemetry.c +2 -0
index 39ec8d9fb5b1..7593726e814d 100644
@@ -19,6 +19,7 @@
 #include "../vsec.h"
 #include "class.h"
 
+#define DRIVER_VERSION		"1.0"
 #define TELEM_SIZE_OFFSET	0x0
 #define TELEM_GUID_OFFSET	0x4
 #define TELEM_BASE_OFFSET	0x8
@@ -348,4 +349,5 @@ module_exit(pmt_telem_exit);
 MODULE_AUTHOR("David E. Box <[email protected]>");
 MODULE_DESCRIPTION("Intel PMT Telemetry driver");
 MODULE_LICENSE("GPL v2");
+MODULE_VERSION(DRIVER_VERSION);
 MODULE_IMPORT_NS(INTEL_PMT);
Signature · 1 line
2.34.1
author maintainer
#7 lore raw

PATCH 7/11 platform/x86/intel/pmc: Alder Lake slp_s0_residency fix

In reply to David E. Box

From: Rajvi Jingar <[email protected]>

For platforms with Alder Lake PCH (Alder Lake S and Raptor Lake S) the slp_s0_residency attribute has been reporting the wrong value. Unlike other platforms, ADL PCH does not have a counter for the time that the SLP_S0 signal was asserted. Instead, firmware uses the aggregate of the Low Power Mode (LPM) substate counters as the S0ix value. Since the LPM counters run at a different frequency, this lead to misreporting of the S0ix time.

Add a check for Alder Lake PCH and adjust the frequency accordingly when display slp_s0_residency.

Fixes bbab31101f44 ("platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver")
---
 drivers/platform/x86/intel/pmc/core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmc/core.c +12 -1
index e489d2175e42..61ca7c37fb02 100644
@@ -66,7 +66,18 @@ static inline void pmc_core_reg_write(struct pmc_dev *pmcdev, int reg_offset,
 
 static inline u64 pmc_core_adjust_slp_s0_step(struct pmc_dev *pmcdev, u32 value)
 {
-	return (u64)value * pmcdev->map->slp_s0_res_counter_step;
+	/*
+	 * ADL PCH does not have the SLP_S0 counter and LPM Residency counters are
+	 * used as a workaround which uses 30.5 usec tick. All other client
+	 * programs have the legacy SLP_S0 residency counter that is using the 122
+	 * usec tick.
+	 */
+	const int lpm_adj_x2 = pmcdev->map->lpm_res_counter_step_x2;
+
+	if (pmcdev->map == &adl_reg_map)
+		return (u64)value * GET_X2_COUNTER((u64)lpm_adj_x2);
+	else
+		return (u64)value * pmcdev->map->slp_s0_res_counter_step;
 }
 
 static int set_etr3(struct pmc_dev *pmcdev)
Signature · 1 line
2.34.1
author maintainer
#8 lore raw

PATCH 8/11 platform/x86:intel/pmc: Combine core_init and core_configure function

In reply to David E. Box

From: Xi Pardee <[email protected]>

core_init and core_configure functions can be combined to have a cleaner setup for platforms.

---
 drivers/platform/x86/intel/pmc/adl.c  | 15 +++++----
 drivers/platform/x86/intel/pmc/cnp.c  | 15 ++++++++-
 drivers/platform/x86/intel/pmc/core.c | 48 +++++++++++++++------------
 drivers/platform/x86/intel/pmc/core.h | 20 +++++------
 drivers/platform/x86/intel/pmc/icl.c  |  3 +-
 drivers/platform/x86/intel/pmc/mtl.c  | 15 +++++----
 drivers/platform/x86/intel/pmc/spt.c  |  3 +-
 drivers/platform/x86/intel/pmc/tgl.c  | 15 +++++----
 8 files changed, 80 insertions(+), 54 deletions(-)
drivers/platform/x86/intel/pmc/adl.c +9 -6
index 5cbd40979f2a..a6ceaf520fd5 100644
@@ -309,17 +309,20 @@ const struct pmc_reg_map adl_reg_map = {
 	.lpm_live_status_offset = ADL_LPM_LIVE_STATUS_OFFSET,
 };
 
-void adl_core_configure(struct pmc_dev *pmcdev)
+int adl_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
+	pmcdev->map = &adl_reg_map;
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
 	dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
 	pmc_core_send_ltr_ignore(pmcdev, 3);
-}
 
-void adl_core_init(struct pmc_dev *pmcdev)
-{
-	pmcdev->map = &adl_reg_map;
-	pmcdev->core_configure = adl_core_configure;
+	return ret;
 }
drivers/platform/x86/intel/pmc/cnp.c +14 -1
index 7fb38815c4eb..fcd07a61f88d 100644
@@ -204,7 +204,20 @@ const struct pmc_reg_map cnp_reg_map = {
 	.etr3_offset = ETR3_OFFSET,
 };
 
-void cnp_core_init(struct pmc_dev *pmcdev)
+int cnp_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
 	pmcdev->map = &cnp_reg_map;
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
+	/* Due to a hardware limitation, the GBE LTR blocks PC10
+	 * when a cable is attached. Tell the PMC to ignore it.
+	 */
+	dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
+	pmc_core_send_ltr_ignore(pmcdev, 3);
+
+	return ret;
 }
drivers/platform/x86/intel/pmc/core.c +27 -21

74 lines not on this page · raw message

drivers/platform/x86/intel/pmc/core.h +8 -12
index 810204d758ab..3ce83c837fdc 100644
@@ -325,7 +325,6 @@ struct pmc_reg_map {
  * @num_lpm_modes:	Count of enabled modes
  * @lpm_en_modes:	Array of enabled modes from lowest to highest priority
  * @lpm_req_regs:	List of substate requirements
- * @core_configure:	Function pointer to configure the platform
  *
  * pmc_dev contains info about power management controller device.
  */
@@ -344,7 +343,6 @@ struct pmc_dev {
 	int num_lpm_modes;
 	int lpm_en_modes[LPM_MAX_NUM_MODES];
 	u32 *lpm_req_regs;
-	void (*core_configure)(struct pmc_dev *pmcdev);
 };
 
 extern const struct pmc_bit_map msr_map[];
@@ -397,16 +395,14 @@ extern const struct pmc_reg_map mtl_reg_map;
 
 extern void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev);
 extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value);
-
-void spt_core_init(struct pmc_dev *pmcdev);
-void cnp_core_init(struct pmc_dev *pmcdev);
-void icl_core_init(struct pmc_dev *pmcdev);
-void tgl_core_init(struct pmc_dev *pmcdev);
-void adl_core_init(struct pmc_dev *pmcdev);
-void mtl_core_init(struct pmc_dev *pmcdev);
-void tgl_core_configure(struct pmc_dev *pmcdev);
-void adl_core_configure(struct pmc_dev *pmcdev);
-void mtl_core_configure(struct pmc_dev *pmcdev);
+extern int get_primary_reg_base(struct pmc_dev *pmcdev);
+
+int spt_core_init(struct pmc_dev *pmcdev);
+int cnp_core_init(struct pmc_dev *pmcdev);
+int icl_core_init(struct pmc_dev *pmcdev);
+int tgl_core_init(struct pmc_dev *pmcdev);
+int adl_core_init(struct pmc_dev *pmcdev);
+int mtl_core_init(struct pmc_dev *pmcdev);
 
 #define pmc_for_each_mode(i, mode, pmcdev)		\
 	for (i = 0, mode = pmcdev->lpm_en_modes[i];	\
drivers/platform/x86/intel/pmc/icl.c +2 -1
index 2f11b1a6daeb..a671d7e86431 100644
@@ -50,7 +50,8 @@ const struct pmc_reg_map icl_reg_map = {
 	.etr3_offset = ETR3_OFFSET,
 };
 
-void icl_core_init(struct pmc_dev *pmcdev)
+int icl_core_init(struct pmc_dev *pmcdev)
 {
 	pmcdev->map = &icl_reg_map;
+	return get_primary_reg_base(pmcdev);
 }
drivers/platform/x86/intel/pmc/mtl.c +9 -6
index eeb3bd8c2502..96106ffbd367 100644
@@ -36,17 +36,20 @@ const struct pmc_reg_map mtl_reg_map = {
 	.lpm_live_status_offset = MTL_LPM_LIVE_STATUS_OFFSET,
 };
 
-void mtl_core_configure(struct pmc_dev *pmcdev)
+int mtl_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
+	pmcdev->map = &mtl_reg_map;
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
 	dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
 	pmc_core_send_ltr_ignore(pmcdev, 3);
-}
 
-void mtl_core_init(struct pmc_dev *pmcdev)
-{
-	pmcdev->map = &mtl_reg_map;
-	pmcdev->core_configure = mtl_core_configure;
+	return ret;
 }
drivers/platform/x86/intel/pmc/spt.c +2 -1
index e16982236778..f34015692bb8 100644
@@ -134,7 +134,8 @@ const struct pmc_reg_map spt_reg_map = {
 	.pm_vric1_offset = SPT_PMC_VRIC1_OFFSET,
 };
 
-void spt_core_init(struct pmc_dev *pmcdev)
+int spt_core_init(struct pmc_dev *pmcdev)
 {
 	pmcdev->map = &spt_reg_map;
+	return get_primary_reg_base(pmcdev);
 }
drivers/platform/x86/intel/pmc/tgl.c +9 -6
index c245ada849d0..c69f2672fb92 100644
@@ -252,18 +252,21 @@ void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev)
 	ACPI_FREE(out_obj);
 }
 
-void tgl_core_configure(struct pmc_dev *pmcdev)
+int tgl_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
+	pmcdev->map = &tgl_reg_map;
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
 	pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
 	dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
 	pmc_core_send_ltr_ignore(pmcdev, 3);
-}
 
-void tgl_core_init(struct pmc_dev *pmcdev)
-{
-	pmcdev->map = &tgl_reg_map;
-	pmcdev->core_configure = tgl_core_configure;
+	return ret;
 }
Signature · 1 line
2.34.1
author maintainer
#9 lore raw

PATCH 9/11 platform/x86/intel/pmc: Add Intel PMT support for MTL PMC

In reply to David E. Box

The PMC SSRAM device contains PMC metrics that are structured in Intel Platform Monitoring Technology (PMT) telemetry regions. Register these telemetry regions from the driver so that they may be read using the Intel PMT API.

---
 drivers/platform/x86/intel/pmc/Kconfig |   1 +
 drivers/platform/x86/intel/pmc/core.c  |   6 ++
 drivers/platform/x86/intel/pmc/core.h  |   2 +
 drivers/platform/x86/intel/pmc/mtl.c   | 106 +++++++++++++++++++++++++
 4 files changed, 115 insertions(+)
drivers/platform/x86/intel/pmc/Kconfig +1 -0
index b526597e4deb..d2f651fbec2c 100644
@@ -7,6 +7,7 @@ config INTEL_PMC_CORE
 	tristate "Intel PMC Core driver"
 	depends on PCI
 	depends on ACPI
+	depends on INTEL_PMT_TELEMETRY
 	help
 	  The Intel Platform Controller Hub for Intel Core SoCs provides access
 	  to Power Management Controller registers via various interfaces. This
drivers/platform/x86/intel/pmc/core.c +6 -0
index 4769ce0b0fbe..8f3a5a6fc874 100644
@@ -1174,6 +1174,11 @@ static void pmc_core_remove(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 	mutex_destroy(&pmcdev->lock);
 	iounmap(pmcdev->regbase);
+
+	if (pmcdev->ssram_pcidev) {
+		pci_dev_put(pmcdev->ssram_pcidev);
+		pci_disable_device(pmcdev->ssram_pcidev);
+	}
 }
 
 static bool warn_on_s0ix_failures;
@@ -1287,3 +1292,4 @@ module_platform_driver(pmc_core_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel PMC Core Driver");
+MODULE_IMPORT_NS(INTEL_VSEC);
drivers/platform/x86/intel/pmc/core.h +2 -0
index 3ce83c837fdc..ba30db31f439 100644
@@ -315,6 +315,7 @@ struct pmc_reg_map {
  * @map:		pointer to pmc_reg_map struct that contains platform
  *			specific attributes
  * @pdev:		pointer to platform_device struct
+ * @ssram_pcidev:	pointer to pci device struct for the PMC SSRAM
  * @dbgfs_dir:		path to debugfs interface
  * @pmc_xram_read_bit:	flag to indicate whether PMC XRAM shadow registers
  *			used to read MPHY PG and PLL status are available
@@ -334,6 +335,7 @@ struct pmc_dev {
 	const struct pmc_reg_map *map;
 	struct dentry *dbgfs_dir;
 	struct platform_device *pdev;
+	struct pci_dev *ssram_pcidev;
 	int pmc_xram_read_bit;
 	struct mutex lock; /* generic mutex lock for PMC Core */
 
drivers/platform/x86/intel/pmc/mtl.c +106 -0

125 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#10 lore raw

PATCH 10/11 platform/x86:intel/pmc: Move get_low_power_modes function

In reply to David E. Box

From: Xi Pardee <[email protected]>

Move the pmc_core_get_low_power_modes function call from probe to init function. This is the preparation work for retrieving LPM information using Intel PMT API patch as available low power modes need to be known.

---
 drivers/platform/x86/intel/pmc/adl.c  |  2 ++
 drivers/platform/x86/intel/pmc/cnp.c  |  2 ++
 drivers/platform/x86/intel/pmc/core.c |  3 +--
 drivers/platform/x86/intel/pmc/core.h |  1 +
 drivers/platform/x86/intel/pmc/icl.c  | 10 +++++++++-
 drivers/platform/x86/intel/pmc/mtl.c  |  2 ++
 drivers/platform/x86/intel/pmc/spt.c  | 10 +++++++++-
 drivers/platform/x86/intel/pmc/tgl.c  |  2 ++
 8 files changed, 28 insertions(+), 4 deletions(-)
drivers/platform/x86/intel/pmc/adl.c +2 -0
index a6ceaf520fd5..6101c9c2aa9c 100644
@@ -318,6 +318,8 @@ int adl_core_init(struct pmc_dev *pmcdev)
 	if (ret)
 		return ret;
 
+	pmc_core_get_low_power_modes(pmcdev->pdev);
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
drivers/platform/x86/intel/pmc/cnp.c +2 -0
index fcd07a61f88d..68e7ac7f7a11 100644
@@ -213,6 +213,8 @@ int cnp_core_init(struct pmc_dev *pmcdev)
 	if (ret)
 		return ret;
 
+	pmc_core_get_low_power_modes(pmcdev->pdev);
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
drivers/platform/x86/intel/pmc/core.c +1 -2
index 8f3a5a6fc874..3833ea4a758e 100644
@@ -898,7 +898,7 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order)
 	return true;
 }
 
-static void pmc_core_get_low_power_modes(struct platform_device *pdev)
+void pmc_core_get_low_power_modes(struct platform_device *pdev)
 {
 	struct pmc_dev *pmcdev = platform_get_drvdata(pdev);
 	u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI;
@@ -1155,7 +1155,6 @@ static int pmc_core_probe(struct platform_device *pdev)
 	}
 
 	pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(pmcdev);
-	pmc_core_get_low_power_modes(pdev);
 	pmc_core_do_dmi_quirks(pmcdev);
 
 	pmc_core_dbgfs_register(pmcdev);
drivers/platform/x86/intel/pmc/core.h +1 -0
index ba30db31f439..f4b69861c17b 100644
@@ -398,6 +398,7 @@ extern const struct pmc_reg_map mtl_reg_map;
 extern void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev);
 extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value);
 extern int get_primary_reg_base(struct pmc_dev *pmcdev);
+extern void pmc_core_get_low_power_modes(struct platform_device *pdev);
 
 int spt_core_init(struct pmc_dev *pmcdev);
 int cnp_core_init(struct pmc_dev *pmcdev);
drivers/platform/x86/intel/pmc/icl.c +9 -1
index a671d7e86431..8315e6c90efa 100644
@@ -52,6 +52,14 @@ const struct pmc_reg_map icl_reg_map = {
 
 int icl_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
 	pmcdev->map = &icl_reg_map;
-	return get_primary_reg_base(pmcdev);
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
+	pmc_core_get_low_power_modes(pmcdev->pdev);
+
+	return ret;
 }
drivers/platform/x86/intel/pmc/mtl.c +2 -0
index 48c7ec094af8..74f1f4c44812 100644
@@ -151,6 +151,8 @@ int mtl_core_init(struct pmc_dev *pmcdev)
 
 	mtl_pmc_ssram_init(pmcdev);
 
+	pmc_core_get_low_power_modes(pmcdev->pdev);
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
drivers/platform/x86/intel/pmc/spt.c +9 -1
index f34015692bb8..1f6bcd40ba76 100644
@@ -136,6 +136,14 @@ const struct pmc_reg_map spt_reg_map = {
 
 int spt_core_init(struct pmc_dev *pmcdev)
 {
+	int ret;
+
 	pmcdev->map = &spt_reg_map;
-	return get_primary_reg_base(pmcdev);
+	ret = get_primary_reg_base(pmcdev);
+	if (ret)
+		return ret;
+
+	pmc_core_get_low_power_modes(pmcdev->pdev);
+
+	return ret;
 }
drivers/platform/x86/intel/pmc/tgl.c +2 -0
index c69f2672fb92..05b7cc6f59a0 100644
@@ -261,7 +261,9 @@ int tgl_core_init(struct pmc_dev *pmcdev)
 	if (ret)
 		return ret;
 
+	pmc_core_get_low_power_modes(pmcdev->pdev);
 	pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
+
 	/* Due to a hardware limitation, the GBE LTR blocks PC10
 	 * when a cable is attached. Tell the PMC to ignore it.
 	 */
Signature · 1 line
2.34.1
author maintainer
#11 lore raw

PATCH 11/11 platform/x86/intel/pmc/mtl: get LPM information using Intel PMT

In reply to David E. Box

From: Xi Pardee <[email protected]>

For Meteor Lake, retrieve the PMC Lower Power Mode (LPM) information using Intel PMT Telemetry API.

---
 drivers/platform/x86/intel/pmc/core.c |  1 +
 drivers/platform/x86/intel/pmc/core.h |  1 +
 drivers/platform/x86/intel/pmc/mtl.c  | 64 +++++++++++++++++++++++++++
 3 files changed, 66 insertions(+)
drivers/platform/x86/intel/pmc/core.c +1 -0
index 3833ea4a758e..2e4a9ca1be62 100644
@@ -1291,4 +1291,5 @@ module_platform_driver(pmc_core_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel PMC Core Driver");
+MODULE_IMPORT_NS(INTEL_PMT);
 MODULE_IMPORT_NS(INTEL_VSEC);
drivers/platform/x86/intel/pmc/core.h +1 -0
index f4b69861c17b..e5d33999c865 100644
@@ -306,6 +306,7 @@ struct pmc_reg_map {
 	const u32 lpm_status_offset;
 	const u32 lpm_live_status_offset;
 	const u32 etr3_offset;
+	const u8  *lpm_reg_index;
 };
 
 /**
drivers/platform/x86/intel/pmc/mtl.c +64 -0

84 lines not on this page · raw message

Signature · 1 line
2.34.1
#12 lore raw
In reply to David E. Box

Hi David,

Quoted 9 lines · David E. Box

On Intel SoCs, registers for the Power Management Controller are available in the PCI BAR of the SSRAM device, 0000:14.2. On Meteor Lake, these registers are structured in Intel PMT Telemetry regions which could be handled by the pmt_telemetry driver. This series adds APIs to the intel_vsec and pmt_telemetry drivers so that pmc_core driver can both create the telemetry instance from the SSRAM device and register for a handle to read the telemetry which contains the low power mode requirements for the S0ix states supported by Meteor Lake. The series also adds some fixes.

Thank you for the series. I notice that none of these patches have a Reviewed-by nor a Tested-by from some other Intel developers.

It really helps if you can get someone other Intel kernel people to review and test your patches and then add their tags before posting a large(ish) series like this upstream.

Regards,

Hans

Quoted 41 lines

David E. Box (6):
platform/x86/intel/vsec: Explicitly enable capabilities platform/x86/intel/vsec: Add base address field platform/x86/intel/pmt: Add INTEL_PMT module namespace platform/x86/intel/pmt: telemetry: Add telemetry read functions platform/x86/intel/pmt/telemetry: Add driver version platform/x86/intel/pmc: Add Intel PMT support for MTL PMC

Gayatri Kammela (1):
platform/x86/intel/vsec: Add intel_vsec_register

Rajvi Jingar (1):
platform/x86/intel/pmc: Alder Lake slp_s0_residency fix

Xi Pardee (3):
platform/x86:intel/pmc: Combine core_init and core_configure function platform/x86:intel/pmc: Move get_low_power_modes function platform/x86/intel/pmc/mtl: get LPM information using Intel PMT

 drivers/platform/x86/intel/pmc/Kconfig     |   1 +
 drivers/platform/x86/intel/pmc/adl.c       |  17 +-
 drivers/platform/x86/intel/pmc/cnp.c       |  17 +-
 drivers/platform/x86/intel/pmc/core.c      |  71 +++++---
 drivers/platform/x86/intel/pmc/core.h      |  24 +--
 drivers/platform/x86/intel/pmc/icl.c       |  11 +-
 drivers/platform/x86/intel/pmc/mtl.c       | 187 ++++++++++++++++++-
 drivers/platform/x86/intel/pmc/spt.c       |  11 +-
 drivers/platform/x86/intel/pmc/tgl.c       |  17 +-
 drivers/platform/x86/intel/pmt/class.c     |  48 +++--
 drivers/platform/x86/intel/pmt/class.h     |  35 ++--
 drivers/platform/x86/intel/pmt/crashlog.c  |   3 +-
 drivers/platform/x86/intel/pmt/telemetry.c | 199 ++++++++++++++++++++-
 drivers/platform/x86/intel/pmt/telemetry.h | 120 +++++++++++++
 drivers/platform/x86/intel/vsec.c          | 131 ++++++--------
 drivers/platform/x86/intel/vsec.h          |  64 ++++++-
 16 files changed, 790 insertions(+), 166 deletions(-)
 create mode 100644 drivers/platform/x86/intel/pmt/telemetry.h

base-commit: 02c464b73645404654359ad21f368a13735e2850

author maintainer
#13 lore raw

Hi Hans,

Quoted 13 lines · Hans de Goede

Hi David,

Quoted 9 lines · David E. Box

On Intel SoCs, registers for the Power Management Controller are available in the PCI BAR of the SSRAM device, 0000:14.2. On Meteor Lake, these registers are structured in Intel PMT Telemetry regions which could be handled by the pmt_telemetry driver. This series adds APIs to the intel_vsec and pmt_telemetry drivers so that pmc_core driver can both create the telemetry instance from the SSRAM device and register for a handle to read the telemetry which contains the low power mode requirements for the S0ix states supported by Meteor Lake. The series also adds some fixes.

Quoted 6 lines

Thank you for the series. I notice that none of these patches have a Reviewed- by nor a Tested-by from some other Intel developers.

It really helps if you can get someone other Intel kernel people to review and test your patches and then add their tags before posting a large(ish) series like this upstream.

Sure. About 5 of these, though related, are small and can be sent separately. I'll send those first and get Intel review for the others. Since this smaller batch won't be enabling telemetry, as in the cover letter title, I'll send as a new series.

David

Quoted 51 lines

Regards,

Hans

Quoted 41 lines

David E. Box (6):
  platform/x86/intel/vsec: Explicitly enable capabilities platform/x86/intel/vsec: Add base address field platform/x86/intel/pmt: Add INTEL_PMT module namespace platform/x86/intel/pmt: telemetry: Add telemetry read functions platform/x86/intel/pmt/telemetry: Add driver version platform/x86/intel/pmc: Add Intel PMT support for MTL PMC

Gayatri Kammela (1):
  platform/x86/intel/vsec: Add intel_vsec_register

Rajvi Jingar (1):
  platform/x86/intel/pmc: Alder Lake slp_s0_residency fix

Xi Pardee (3):
  platform/x86:intel/pmc: Combine core_init and core_configure function platform/x86:intel/pmc: Move get_low_power_modes function platform/x86/intel/pmc/mtl: get LPM information using Intel PMT

 drivers/platform/x86/intel/pmc/Kconfig     |   1 + drivers/platform/x86/intel/pmc/adl.c       |  17 +- drivers/platform/x86/intel/pmc/cnp.c       |  17 +- drivers/platform/x86/intel/pmc/core.c      |  71 +++++--- drivers/platform/x86/intel/pmc/core.h      |  24 +--

 drivers/platform/x86/intel/pmc/icl.c       |  11 +-
 drivers/platform/x86/intel/pmc/mtl.c       | 187 ++++++++++++++++++-
 drivers/platform/x86/intel/pmc/spt.c       |  11 +-
 drivers/platform/x86/intel/pmc/tgl.c       |  17 +-

 drivers/platform/x86/intel/pmt/class.c     |  48 +++-- drivers/platform/x86/intel/pmt/class.h     |  35 ++-- drivers/platform/x86/intel/pmt/crashlog.c  |   3 +- drivers/platform/x86/intel/pmt/telemetry.c | 199 ++++++++++++++++++++- drivers/platform/x86/intel/pmt/telemetry.h | 120 +++++++++++++ drivers/platform/x86/intel/vsec.c          | 131 ++++++-------- drivers/platform/x86/intel/vsec.h          |  64 ++++++-

 16 files changed, 790 insertions(+), 166 deletions(-)

 create mode 100644 drivers/platform/x86/intel/pmt/telemetry.h

base-commit: 02c464b73645404654359ad21f368a13735e2850