All of lore.kernel.org
 help / color / mirror / Atom feed
From: Disha Goel <disgoel@linux.ibm.com>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	hbathini@linux.ibm.com
Cc: kjain@linux.ibm.com, disgoel@linux.vnet.ibm.com
Subject: Re: [PATCH V2 2/5] tools/testing/selftests/powerpc: Add check for power11 pvr for pmu selfests
Date: Wed, 15 Jan 2025 21:44:04 +0530	[thread overview]
Message-ID: <98cca4da-22dc-4f8a-8fad-e71b50a7b916@linux.ibm.com> (raw)
In-Reply-To: <20250113075858.45137-2-atrajeev@linux.vnet.ibm.com>

On 13/01/25 1:28 pm, Athira Rajeev wrote:

Some of the tests depends on pvr value to choose
the event. Example:
- event_alternatives_tests_p10: alternative event depends
   on registered PMU driver which is based on pvr
- generic_events_valid_test varies based on platform
- bhrb_filter_map_test: again its dependent on pmu to
   decide which bhrb filter to use
- reserved_bits_mmcra_sample_elig_mode: randome sampling
   mode reserved bits is also varies based on platform

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>

I have tested the patches on PowerPC by compiling and running pmu selftest.

For the series:
Tested-by: Disha Goel<disgoel@linux.ibm.com>

---
Changelog:
  v1 -> v2
  No code changes. Rebased to latest upstream

  .../pmu/event_code_tests/event_alternatives_tests_p10.c    | 3 ++-
  .../pmu/event_code_tests/generic_events_valid_test.c       | 3 ++-
  .../reserved_bits_mmcra_sample_elig_mode_test.c            | 3 ++-
  .../powerpc/pmu/sampling_tests/bhrb_filter_map_test.c      | 7 +++++--
  4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c b/tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
index 8be7aada6523..355f8bbe06c3 100644
--- a/tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
+++ b/tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
@@ -26,6 +26,7 @@ static int event_alternatives_tests_p10(void)
  {
  	struct event *e, events[5];
  	int i;
+	int pvr = PVR_VER(mfspr(SPRN_PVR));

  	/* Check for platform support for the test */
  	SKIP_IF(platform_check_for_tests());
@@ -36,7 +37,7 @@ static int event_alternatives_tests_p10(void)
  	 * code and using PVR will work correctly for all cases
  	 * including generic compat mode.
  	 */
-	SKIP_IF(PVR_VER(mfspr(SPRN_PVR)) != POWER10);
+	SKIP_IF((pvr != POWER10) && (pvr != POWER11));

  	SKIP_IF(check_for_generic_compat_pmu());

diff --git a/tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c b/tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c
index 0d237c15d3f2..a378fa9a5a7b 100644
--- a/tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c
+++ b/tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c
@@ -17,6 +17,7 @@
  static int generic_events_valid_test(void)
  {
  	struct event event;
+	int pvr = mfspr(SPRN_PVR);

  	/* Check for platform support for the test */
  	SKIP_IF(platform_check_for_tests());
@@ -31,7 +32,7 @@ static int generic_events_valid_test(void)
  	 * - PERF_COUNT_HW_STALLED_CYCLES_BACKEND
  	 * - PERF_COUNT_HW_REF_CPU_CYCLES
  	 */
-	if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
+	if ((pvr == POWER10) || (pvr == POWER11)) {
  		event_init_opts(&event, PERF_COUNT_HW_CPU_CYCLES, PERF_TYPE_HARDWARE, "event");
  		FAIL_IF(event_open(&event));
  		event_close(&event);
diff --git a/tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c b/tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c
index 4c119c821b99..7bb26a232fbe 100644
--- a/tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c
+++ b/tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c
@@ -21,6 +21,7 @@
  static int reserved_bits_mmcra_sample_elig_mode(void)
  {
  	struct event event;
+	int pvr = PVR_VER(mfspr(SPRN_PVR));

  	/* Check for platform support for the test */
  	SKIP_IF(platform_check_for_tests());
@@ -59,7 +60,7 @@ static int reserved_bits_mmcra_sample_elig_mode(void)
  	 * is reserved in power10 and 0xC is reserved in
  	 * power9.
  	 */
-	if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
+	if ((pvr == POWER10) || (pvr == POWER11)) {
  		event_init(&event, 0x100401e0);
  		FAIL_IF(!event_open(&event));
  	} else if (PVR_VER(mfspr(SPRN_PVR)) == POWER9) {
diff --git a/tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c b/tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c
index 3f43c315c666..64ab9784f9b1 100644
--- a/tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c
+++ b/tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c
@@ -83,13 +83,16 @@ static int bhrb_filter_map_test(void)
  	 * using PVR will work correctly for all cases including generic
  	 * compat mode.
  	 */
-	if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
+	switch (PVR_VER(mfspr(SPRN_PVR))) {
+	case POWER11:
+	case POWER10:
  		for (i = 0; i < ARRAY_SIZE(bhrb_filter_map_valid_p10); i++) {
  			event.attr.branch_sample_type = bhrb_filter_map_valid_p10[i];
  			FAIL_IF(event_open(&event));
  			event_close(&event);
  		}
-	} else {
+		break;
+	default:
  		for (i = 0; i < ARRAY_SIZE(bhrb_filter_map_valid_p10); i++) {
  			event.attr.branch_sample_type = bhrb_filter_map_valid_p10[i];
  			FAIL_IF(!event_open(&event));



  reply	other threads:[~2025-01-15 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  7:58 [PATCH V2 1/5] tools/testing/selftests/powerpc: Enable pmu selftests for power11 Athira Rajeev
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 [this message]
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=98cca4da-22dc-4f8a-8fad-e71b50a7b916@linux.ibm.com \
    --to=disgoel@linux.ibm.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.