From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
hbathini@linux.ibm.com
Cc: atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com,
disgoel@linux.vnet.ibm.com
Subject: [PATCH V2 1/5] tools/testing/selftests/powerpc: Enable pmu selftests for power11
Date: Mon, 13 Jan 2025 13:28:54 +0530 [thread overview]
Message-ID: <20250113075858.45137-1-atrajeev@linux.vnet.ibm.com> (raw)
Add check for power11 pvr in the selftest utility
functions. Selftests uses pvr value to check for platform
support inorder to run the tests. pvr is also used to
send the extended mask value to capture sampling registers.
Update some of the utility functions to use hwcap2 inorder
to return platform specific bits from sampling registers.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Changelog:
v1 -> v2
No code changes. Rebased to latest upstream
.../selftests/powerpc/pmu/sampling_tests/misc.c | 11 ++++++++++-
.../selftests/powerpc/pmu/sampling_tests/misc.h | 10 ++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c b/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
index eac6420abdf1..c52d8bc2a5dc 100644
--- a/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
+++ b/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
@@ -59,6 +59,7 @@ static void init_ev_encodes(void)
ev_shift_thd_stop = 32;
switch (pvr) {
+ case POWER11:
case POWER10:
ev_mask_thd_cmp = 0x3ffff;
ev_shift_thd_cmp = 0;
@@ -129,8 +130,14 @@ int platform_check_for_tests(void)
* Check for supported platforms
* for sampling test
*/
- if ((pvr != POWER10) && (pvr != POWER9))
+ switch (pvr) {
+ case POWER11:
+ case POWER10:
+ case POWER9:
+ break;
+ default:
goto out;
+ }
/*
* Check PMU driver registered by looking for
@@ -499,6 +506,8 @@ static bool auxv_generic_compat_pmu(void)
base_pvr = POWER9;
else if (!strcmp(auxv_base_platform(), "power10"))
base_pvr = POWER10;
+ else if (!strcmp(auxv_base_platform(), "power11"))
+ base_pvr = POWER11;
return (!base_pvr);
}
diff --git a/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h b/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
index 64e25cce1435..09c5abe237af 100644
--- a/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
+++ b/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
@@ -8,10 +8,12 @@
#include <sys/stat.h>
#include "../event.h"
+#define POWER11 0x82
#define POWER10 0x80
#define POWER9 0x4e
#define PERF_POWER9_MASK 0x7f8ffffffffffff
#define PERF_POWER10_MASK 0x7ffffffffffffff
+#define PERF_POWER11_MASK PERF_POWER10_MASK
#define MMCR0_FC56 0x00000010UL /* freeze counters 5 and 6 */
#define MMCR0_PMCCEXT 0x00000200UL /* PMCCEXT control */
@@ -165,21 +167,21 @@ static inline int get_mmcr2_fcta(u64 mmcr2, int pmc)
static inline int get_mmcr2_l2l3(u64 mmcr2, int pmc)
{
- if (pvr == POWER10)
+ if (have_hwcap2(PPC_FEATURE2_ARCH_3_1))
return ((mmcr2 & 0xf8) >> 3);
return 0;
}
static inline int get_mmcr3_src(u64 mmcr3, int pmc)
{
- if (pvr != POWER10)
+ if (!have_hwcap2(PPC_FEATURE2_ARCH_3_1))
return 0;
return ((mmcr3 >> ((49 - (15 * ((pmc) - 1))))) & 0x7fff);
}
static inline int get_mmcra_thd_cmp(u64 mmcra, int pmc)
{
- if (pvr == POWER10)
+ if (have_hwcap2(PPC_FEATURE2_ARCH_3_1))
return ((mmcra >> 45) & 0x7ff);
return ((mmcra >> 45) & 0x3ff);
}
@@ -191,7 +193,7 @@ static inline int get_mmcra_sm(u64 mmcra, int pmc)
static inline u64 get_mmcra_bhrb_disable(u64 mmcra, int pmc)
{
- if (pvr == POWER10)
+ if (have_hwcap2(PPC_FEATURE2_ARCH_3_1))
return mmcra & BHRB_DISABLE;
return 0;
}
--
2.43.5
next reply other threads:[~2025-01-13 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 7:58 Athira Rajeev [this message]
2025-01-13 7:58 ` [PATCH V2 2/5] tools/testing/selftests/powerpc: Add check for power11 pvr for pmu selfests Athira Rajeev
2025-01-15 16:14 ` Disha Goel
2025-01-13 7:58 ` [PATCH V2 3/5] tools/testing/selftests/powerpc/pmu: Update comment description to mention ISA v3.1 for power10 and above Athira Rajeev
2025-01-13 7:58 ` [PATCH V2 4/5] selftests/powerpc/pmu: Add interface test for extended reg support Athira Rajeev
2025-01-13 7:58 ` [PATCH V2 5/5] selftests/powerpc/pmu: Update comment with details to understand auxv_generic_compat_pmu() utility function Athira Rajeev
2025-02-17 7:28 ` [PATCH V2 1/5] tools/testing/selftests/powerpc: Enable pmu selftests for power11 Madhavan Srinivasan
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=20250113075858.45137-1-atrajeev@linux.vnet.ibm.com \
--to=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=kjain@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).