mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Turner <mattst88@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	 Helge Deller <deller@gmx.de>,
	Peter Zijlstra <peterz@infradead.org>,
	 Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	 Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	 Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	 Adrian Hunter <adrian.hunter@intel.com>,
	 James Clark <james.clark@linaro.org>
Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-perf-users@vger.kernel.org,
	Matt Turner <mattst88@gmail.com>
Subject: [PATCH 2/7] parisc: perf: add an RDR table for PCX-W2 (PA-8700)
Date: Fri, 27 Nov 2026 00:02:55 -0500	[thread overview]
Message-ID: <20261127-parisc-perf-pa8800-v1-2-4f3f077010ce@gmail.com> (raw)
In-Reply-To: <20261127-parisc-perf-pa8800-v1-0-4f3f077010ce@gmail.com>

PCX-W2 uses the PCX-W RDR table, but several of its RDRs have different
widths. The C3650/C3700/C3750/J6700/J6750 PDC firmware (from HP-UX
11.11 patch PHSS_29342) describes RDR11, RDR27 and RDR30 as 32 bits,
RDR12 and RDR13 as 704 bits, and RDR22 and RDR23 as 210 bits.

The RDR22 and RDR23 widths matter: perf_write_image() writes both, and
perf_rdr_read_ubuf() realigns what it shifts out by the RDR width, so
with 194 bits the data comes back misaligned. perf_bitmasks_piranha
already describes RDR22 and RDR23 as 210 bits.

Add perf_rdr_tbl_piranha with the firmware's widths and use it on
PCX-W2.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
 arch/parisc/kernel/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index 8f9ae67270bd..2494f16bb8fd 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -139,6 +139,45 @@ static const struct rdr_tbl_ent perf_rdr_tbl_W[] = {
 	{ 16,	1,	0 },              /* RDR 31 */
 };
 
+/*
+ * RDR register descriptions for PCX-W2 (PA-8700). RDR11, RDR12, RDR13,
+ * RDR22, RDR23, RDR27 and RDR30 differ from PCX-W.
+ */
+static const struct rdr_tbl_ent perf_rdr_tbl_piranha[] = {
+	{ 19,	1,	8 },              /* RDR 0 */
+	{ 32,	1,	16 },             /* RDR 1 */
+	{ 20,	1,	0 },              /* RDR 2 */
+	{ 0,	0,	0 },              /* RDR 3 */
+	{ 344,	6,	0 },              /* RDR 4 */
+	{ 176,	3,	0 },              /* RDR 5 */
+	{ 336,	6,	0 },              /* RDR 6 */
+	{ 0,	0,	0 },              /* RDR 7 */
+	{ 0,	0,	0 },              /* RDR 8 */
+	{ 0,	0,	0 },              /* RDR 9 */
+	{ 28,	1,	0 },              /* RDR 10 */
+	{ 32,	1,	0 },              /* RDR 11 */
+	{ 704,	11,	0 },              /* RDR 12 */
+	{ 704,	11,	0 },              /* RDR 13 */
+	{ 32,	1,	0 },              /* RDR 14 */
+	{ 128,	2,	0 },              /* RDR 15 */
+	{ 1494,	24,	0 },              /* RDR 16 */
+	{ 18,	1,	0 },              /* RDR 17 */
+	{ 4,	1,	0 },              /* RDR 18 */
+	{ 0,	0,	0 },              /* RDR 19 */
+	{ 158,	3,	24 },             /* RDR 20 */
+	{ 158,	3,	24 },             /* RDR 21 */
+	{ 210,	4,	48 },             /* RDR 22 */
+	{ 210,	4,	48 },             /* RDR 23 */
+	{ 71,	2,	0 },              /* RDR 24 */
+	{ 71,	2,	0 },              /* RDR 25 */
+	{ 28,	1,	0 },              /* RDR 26 */
+	{ 32,	1,	0 },              /* RDR 27 */
+	{ 88,	2,	0 },              /* RDR 28 */
+	{ 32,	1,	0 },              /* RDR 29 */
+	{ 32,	1,	0 },              /* RDR 30 */
+	{ 16,	1,	0 },              /* RDR 31 */
+};
+
 /*
  * A non-zero write_control in the above tables is a byte offset into
  * this array.
@@ -174,6 +213,7 @@ static const uint64_t perf_bitmasks_piranha[] = {
 };
 
 static const uint64_t *bitmask_array;   /* array of bitmasks to use */
+static const struct rdr_tbl_ent *perf_rdr_tbl_cuda __ro_after_init;
 
 /******************************************************************************
  * Function Prototypes
@@ -499,6 +539,9 @@ static int __init perf_init(void)
 		 boot_cpu_data.cpu_type == mako ||
 		 boot_cpu_data.cpu_type == mako2) {
 		perf_processor_interface = CUDA_INTF;
+		perf_rdr_tbl_cuda = perf_rdr_tbl_W;
+		if (boot_cpu_data.cpu_type == pcxw2)
+			perf_rdr_tbl_cuda = perf_rdr_tbl_piranha;
 		if (boot_cpu_data.cpu_type == pcxw2 ||
 		    boot_cpu_data.cpu_type == mako ||
 		    boot_cpu_data.cpu_type == mako2)
@@ -643,7 +686,7 @@ static const struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num)
 	if (perf_processor_interface == ONYX_INTF) {
 		return &perf_rdr_tbl_U[rdr_num];
 	} else {
-		return &perf_rdr_tbl_W[rdr_num];
+		return &perf_rdr_tbl_cuda[rdr_num];
 	}
 }
 

-- 
2.56.1


  parent reply	other threads:[~2026-11-27  5:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  5:02 [PATCH 0/7] parisc: perf: fix the RDR tables and add PA-8800/PA-8900 counters Matt Turner
2026-11-27  5:02 ` [PATCH 1/7] parisc: perf: swap the PCX-U and PCX-W RDR tables Matt Turner
2026-11-27  5:02 ` Matt Turner [this message]
2026-11-27  5:02 ` [PATCH 3/7] parisc: perf: add PA-8800/PA-8900 RDR and DR2 access Matt Turner
2026-11-27  5:02 ` [PATCH 4/7] parisc: perf: program the PA-8800/PA-8900 counters Matt Turner
2026-11-27  5:02 ` [PATCH 5/7] parisc: perf: add a perf events PMU for PA-8800/PA-8900 Matt Turner
2026-11-27  5:02 ` [PATCH 6/7] parisc: perf: add PA-8800/PA-8900 event sets and an instruction filter Matt Turner
2026-11-27  5:03 ` [PATCH 7/7] parisc: perf: add PA-8800/PA-8900 memory and branch events Matt Turner

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=20261127-parisc-perf-pa8800-v1-2-4f3f077010ce@gmail.com \
    --to=mattst88@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=deller@gmx.de \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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®