mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: "Rajneesh Bhardwaj" <irenic.rajneesh@gmail.com>,
	"Xi Pardee" <xi.pardee@linux.intel.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
	Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] platform/x86/intel/pmc: Do not decode the summary rows in ltr_show
Date: Sat, 21 Nov 2026 10:06:11 +0100	[thread overview]
Message-ID: <20261121090614.677144-1-pmenzel@molgen.mpg.de> (raw)

On an Intel Tiger Lake laptop Dell XPS 13 9310, the first read of
`/sys/kernel/debug/pmc_core/ltr_show` after loading the driver logs:

    intel_pmc_core: Invalid LTR scale factor 7 (only 0-5 are valid per PCIe spec)

The value comes from the last row, AGGREGATED_SYSTEM (CNP_PMC_LTR_CUR_ASLT,
0x1b54). In 120 reads over 30 seconds, it read 0x7fffdff, 0x7fffc1f or
0x7fffc23 (117 times), and 0x40201ff or 0x402001f (3 times); another read
gave 0x7ffffff. Decoded as an LTR message, the snoop half of the first
group has the reserved bits 14:13 set and scale 7, and the second group is
CURRENT_PLATFORM (0x40201) shifted left by eight with the low byte filled.
So these two PMC registers do not seem to hold the PCIe LTR payload the
per-IP rows carry, and decoding them only produces the warning (the decoded
value is 0 anyway).

All ltr_show maps end with CURRENT_PLATFORM and AGGREGATED_SYSTEM, which
pmc_core_send_ltr_ignore() already relies on. Print only the raw value of
these two rows, as for rows without a requirement bit set, and keep the
warning for the per-IP rows.

With the change, 200 reads with AGGREGATED_SYSTEM bit 15 set in 199 of them
log nothing, and the CNV row is still decoded (0x89fe89fe, 522240 ns).

Fixes: 8122e7cd806d ("platform/x86: intel_pmc_core: Decode Snoop / Non Snoop LTR")
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---

Notes:
    Claude Code (claude-opus-5-5) helped analyse the register values, write
    the patch, and test it on the Dell XPS 13 9310.

 drivers/platform/x86/intel/pmc/core.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 71be313bdf0e1..e3f7d6bc8ce47 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -631,6 +631,18 @@ static u32 convert_ltr_scale(u32 val)
 	return 1U << (5 * val);
 }
 
+/*
+ * Every ltr_show map ends with CURRENT_PLATFORM and AGGREGATED_SYSTEM. Unlike
+ * the per-IP rows, these PMC registers do not hold an LTR message payload as
+ * defined by PCIe; on Tiger Lake, for example, AGGREGATED_SYSTEM has the
+ * reserved bits 14:13 set and reads 0x7fffdff. Do not decode them.
+ */
+static bool pmc_core_ltr_is_summary(const struct pmc_bit_map *map,
+				    unsigned int index)
+{
+	return !map[index + 1].name || !map[index + 2].name;
+}
+
 static int pmc_core_ltr_show(struct seq_file *s, void *unused)
 {
 	struct pmc_dev *pmcdev = s->private;
@@ -654,6 +666,7 @@ static int pmc_core_ltr_show(struct seq_file *s, void *unused)
 		map = pmc->map->ltr_show_sts;
 		for (index = 0; map[index].name; index++) {
 			bool ltr_ign_data;
+			bool summary = pmc_core_ltr_is_summary(map, index);
 
 			if (index > pmc->map->ltr_ignore_max)
 				ltr_ign_data = false;
@@ -666,12 +679,12 @@ static int pmc_core_ltr_show(struct seq_file *s, void *unused)
 			snoop_ltr = ltr_raw_data & ~MTPMC_MASK;
 			nonsnoop_ltr = (ltr_raw_data >> 0x10) & ~MTPMC_MASK;
 
-			if (FIELD_GET(LTR_REQ_NONSNOOP, ltr_raw_data)) {
+			if (!summary && FIELD_GET(LTR_REQ_NONSNOOP, ltr_raw_data)) {
 				scale = FIELD_GET(LTR_DECODED_SCALE, nonsnoop_ltr);
 				val = FIELD_GET(LTR_DECODED_VAL, nonsnoop_ltr);
 				decoded_non_snoop_ltr = val * convert_ltr_scale(scale);
 			}
-			if (FIELD_GET(LTR_REQ_SNOOP, ltr_raw_data)) {
+			if (!summary && FIELD_GET(LTR_REQ_SNOOP, ltr_raw_data)) {
 				scale = FIELD_GET(LTR_DECODED_SCALE, snoop_ltr);
 				val = FIELD_GET(LTR_DECODED_VAL, snoop_ltr);
 				decoded_snoop_ltr = val * convert_ltr_scale(scale);
-- 
2.54.0


             reply	other threads:[~2026-11-21  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  9:06 Paul Menzel [this message]
2026-11-21  9:06 ` [PATCH 2/2] platform/x86/intel/pmc: Fix Tiger Lake LTR ignore maximum to 22 Paul Menzel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261121090614.677144-1-pmenzel@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=irenic.rajneesh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rajneesh.bhardwaj@linux.intel.com \
    --cc=xi.pardee@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®