public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: linux-riscv@lists.infradead.org
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, evan@rivosinc.com,
	conor.dooley@microchip.com, apatel@ventanamicro.com
Subject: [RFC PATCH 5/5] RISC-V: selftests: Apply which-cpus flag to CBO hwprobe test
Date: Thu, 21 Sep 2023 14:55:24 +0200	[thread overview]
Message-ID: <20230921125518.175428-12-ajones@ventanamicro.com> (raw)
In-Reply-To: <20230921125518.175428-7-ajones@ventanamicro.com>

Now that we can efficiently clear cpus from a cpu set that do
not meet a key-value criteria, apply it to the cpus used in
the CBO hwprobe selftest, instead of looping over hwprobe.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
 tools/testing/selftests/riscv/hwprobe/cbo.c | 26 +++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
index 50a2cc8aef38..375a343bc2c6 100644
--- a/tools/testing/selftests/riscv/hwprobe/cbo.c
+++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
@@ -135,27 +135,19 @@ static void check_no_zicboz_cpus(cpu_set_t *cpus)
 {
 	struct riscv_hwprobe pair = {
 		.key = RISCV_HWPROBE_KEY_IMA_EXT_0,
+		.value = RISCV_HWPROBE_EXT_ZICBOZ,
 	};
-	cpu_set_t one_cpu;
-	int i = 0, c = 0;
+	cpu_set_t tmp;
 	long rc;
 
-	while (i++ < CPU_COUNT(cpus)) {
-		while (!CPU_ISSET(c, cpus))
-			++c;
-
-		CPU_ZERO(&one_cpu);
-		CPU_SET(c, &one_cpu);
-
-		rc = riscv_hwprobe(&pair, 1, sizeof(cpu_set_t), (unsigned long *)&one_cpu, 0);
-		assert(rc == 0 && pair.key == RISCV_HWPROBE_KEY_IMA_EXT_0);
+	memcpy(&tmp, cpus, sizeof(cpu_set_t));
+	rc = riscv_hwprobe(&pair, 1, sizeof(cpu_set_t), (unsigned long *)&tmp, RISCV_HWPROBE_WHICH_CPUS);
+	assert(rc == 0 && pair.key == RISCV_HWPROBE_KEY_IMA_EXT_0);
 
-		if (pair.value & RISCV_HWPROBE_EXT_ZICBOZ)
-			ksft_exit_fail_msg("Zicboz is only present on a subset of harts.\n"
-					   "Use taskset to select a set of harts where Zicboz\n"
-					   "presence (present or not) is consistent for each hart\n");
-		++c;
-	}
+	if (CPU_COUNT(&tmp))
+		ksft_exit_fail_msg("Zicboz is only present on a subset of harts.\n"
+				   "Use taskset to select a set of harts where Zicboz\n"
+				   "presence (present or not) is consistent for each hart\n");
 }
 
 enum {
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2023-09-21 12:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 12:55 [RFC PATCH 0/5] RISC-V: hwprobe related stuff Andrew Jones
2023-09-21 12:55 ` [RFC PATCH 1/5] RISC-V: hwprobe: Clarify cpus size parameter Andrew Jones
2023-09-25 11:23   ` Palmer Dabbelt
2023-09-25 12:07     ` Andrew Jones
2023-09-21 12:55 ` [RFC PATCH 2/5] RISC-V: selftests: Replace cpu_count with cpusetsize Andrew Jones
2023-09-25 11:23   ` Palmer Dabbelt
2023-09-21 12:55 ` [RFC PATCH 3/5] RISC-V: hwprobe: Introduce which-cpus flag Andrew Jones
2023-09-25 11:23   ` Palmer Dabbelt
2023-09-25 12:12     ` Andrew Jones
2023-09-25 16:26     ` Evan Green
2023-09-25 11:23   ` Palmer Dabbelt
2023-09-25 12:14     ` Andrew Jones
2023-10-09 14:15     ` Andrew Jones
2023-09-25 16:16   ` Evan Green
2023-10-05 13:23     ` Andrew Jones
2023-10-05 17:12       ` Evan Green
2023-10-05 18:11         ` Andrew Jones
2023-10-09 15:39           ` Andrew Jones
2023-10-09 16:50             ` Evan Green
2023-10-10 10:44               ` Andrew Jones
2023-10-10 15:14                 ` Evan Green
2023-10-10 16:22                   ` Andrew Jones
2023-09-21 12:55 ` [RFC PATCH 4/5] RISC-V: selftests: Add which-cpus hwprobe test Andrew Jones
2023-09-25 11:23   ` Palmer Dabbelt
2023-09-21 12:55 ` Andrew Jones [this message]
2023-09-25 11:23   ` [RFC PATCH 5/5] RISC-V: selftests: Apply which-cpus flag to CBO " Palmer Dabbelt

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=20230921125518.175428-12-ajones@ventanamicro.com \
    --to=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=conor.dooley@microchip.com \
    --cc=evan@rivosinc.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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