[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <859b1f9ec108ba897de2d5fd0c9c24a1aa32a8ef.1690273969.git.haibo1.xu@intel.com>
Date: Tue, 25 Jul 2023 16:41:36 +0800
From: Haibo Xu <haibo1.xu@...el.com>
To: unlisted-recipients:; (no To-header on input)
Cc: xiaobo55x@...il.com, haibo1.xu@...el.com, ajones@...tanamicro.com,
maz@...nel.org, oliver.upton@...ux.dev, seanjc@...gle.com,
Paolo Bonzini <pbonzini@...hat.com>,
Jonathan Corbet <corbet@....net>,
Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Shuah Khan <shuah@...nel.org>,
James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Ricardo Koller <ricarkol@...gle.com>,
Vishal Annapurve <vannapurve@...gle.com>,
Peter Xu <peterx@...hat.com>,
Vipin Sharma <vipinsh@...gle.com>,
David Matlack <dmatlack@...gle.com>,
Colton Lewis <coltonlewis@...gle.com>, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org,
linux-kselftest@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev
Subject: [PATCH v6 10/13] KVM: selftests: Only do get/set tests on present blessed list
Only do the get/set tests on present and blessed registers
since we don't know the capabilities of any new ones.
Suggested-by: Andrew Jones <ajones@...tanamicro.com>
Signed-off-by: Haibo Xu <haibo1.xu@...el.com>
Reviewed-by: Andrew Jones <ajones@...tanamicro.com>
---
tools/testing/selftests/kvm/get-reg-list.c | 29 ++++++++++++++--------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c
index 43a919f2208f..2232620fb797 100644
--- a/tools/testing/selftests/kvm/get-reg-list.c
+++ b/tools/testing/selftests/kvm/get-reg-list.c
@@ -50,6 +50,10 @@ extern int vcpu_configs_n;
for_each_reg_filtered(i) \
if (!find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
+#define for_each_present_blessed_reg(i) \
+ for_each_reg(i) \
+ if (find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
+
static const char *config_name(struct vcpu_reg_list *c)
{
struct vcpu_reg_sublist *s;
@@ -183,6 +187,16 @@ static void run_test(struct vcpu_reg_list *c)
return;
}
+ for_each_sublist(c, s)
+ blessed_n += s->regs_n;
+ blessed_reg = calloc(blessed_n, sizeof(__u64));
+
+ n = 0;
+ for_each_sublist(c, s) {
+ for (i = 0; i < s->regs_n; ++i)
+ blessed_reg[n++] = s->regs[i];
+ }
+
/*
* We only test that we can get the register and then write back the
* same value. Some registers may allow other values to be written
@@ -192,8 +206,11 @@ static void run_test(struct vcpu_reg_list *c)
* be written need to have the other values tested, then we should
* create a new set of tests for those in a new independent test
* executable.
+ *
+ * Only do the get/set tests on present, blessed list registers,
+ * since we don't know the capabilities of any new registers.
*/
- for_each_reg(i) {
+ for_each_present_blessed_reg(i) {
uint8_t addr[2048 / 8];
struct kvm_one_reg reg = {
.id = reg_list->reg[i],
@@ -236,16 +253,6 @@ static void run_test(struct vcpu_reg_list *c)
}
}
- for_each_sublist(c, s)
- blessed_n += s->regs_n;
- blessed_reg = calloc(blessed_n, sizeof(__u64));
-
- n = 0;
- for_each_sublist(c, s) {
- for (i = 0; i < s->regs_n; ++i)
- blessed_reg[n++] = s->regs[i];
- }
-
for_each_new_reg(i)
++new_regs;
--
2.34.1
Powered by blists - more mailing lists