From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>, Oliver Upton <oupton@kernel.org>,
Ben Horgan <ben.horgan@arm.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 2/3] KVM: selftests: arm64: Report register reset tests individually
Date: Mon, 28 Sep 2026 16:32:21 +0100 [thread overview]
Message-ID: <arqHe5v75qT2AJwd@gremlin> (raw)
In-Reply-To: <20260901-kvm-arm64-set-id-regs-aarch64-v7-2-7b065b0bda9a@kernel.org>
On Tue, Sep 01, 2026 at 07:50:02PM +0100, Mark Brown wrote:
> set_id_regs tests that registers have their values preserved over reset.
> Currently it reports all registers in a single test with an instantly fatal
> assert which isn't great for diagnostics, it's hard to tell which register
> failed or if it's just one register. Change this to report each register as
> a separate test so that it's clear from the program output which registers
> have problems.
Sounds reasonable.
>
> Reviewed-by: Ben Horgan <ben.horgan@arm.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
All LGTM so:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> tools/testing/selftests/kvm/arm64/set_id_regs.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/arm64/set_id_regs.c b/tools/testing/selftests/kvm/arm64/set_id_regs.c
> index db6414a93ad3..3aa8886e8b70 100644
> --- a/tools/testing/selftests/kvm/arm64/set_id_regs.c
> +++ b/tools/testing/selftests/kvm/arm64/set_id_regs.c
> @@ -819,13 +819,21 @@ static void test_vcpu_non_ftr_id_regs(struct kvm_vcpu *vcpu)
> static void test_assert_id_reg_unchanged(struct kvm_vcpu *vcpu, u32 encoding)
> {
> size_t idx = encoding_to_range_idx(encoding);
> - u64 observed;
> + u64 observed, expected;
> + bool pass;
>
> observed = vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(encoding));
> - TEST_ASSERT_EQ(reset_mutable_bits(encoding, test_reg_vals[idx]),
> - reset_mutable_bits(encoding, observed));
> + observed = reset_mutable_bits(encoding, observed);
> + expected = reset_mutable_bits(encoding, test_reg_vals[idx]);
> + pass = expected == observed;
> + if (!pass)
> + ksft_print_msg("%lx != %lx\n", expected, observed);
> + ksft_test_result(pass, "%s unchanged by reset\n",
> + get_reg_name(encoding));
Ah yeah -> individual tests.
> }
>
> +#define ID_REG_RESET_UNCHANGED_TEST (ARRAY_SIZE(test_regs) + NUM_EXTRA_REGS)
Yeah can see from original test_reset_preserves_id_regs() that this is correct.
> +
> static void test_reset_preserves_id_regs(struct kvm_vcpu *vcpu)
> {
> /*
> @@ -843,8 +851,6 @@ static void test_reset_preserves_id_regs(struct kvm_vcpu *vcpu)
> test_assert_id_reg_unchanged(vcpu, SYS_MIDR_EL1);
> test_assert_id_reg_unchanged(vcpu, SYS_REVIDR_EL1);
> test_assert_id_reg_unchanged(vcpu, SYS_AIDR_EL1);
> -
> - ksft_test_result_pass("%s\n", __func__);
> }
>
> int main(void)
> @@ -872,7 +878,8 @@ int main(void)
>
> ksft_print_header();
>
> - test_cnt = 3 + MPAM_IDREG_TEST + MTE_IDREG_TEST + GUEST_READ_TEST;
> + test_cnt = 2 + MPAM_IDREG_TEST + MTE_IDREG_TEST + GUEST_READ_TEST +
> + ID_REG_RESET_UNCHANGED_TEST;
> for (i = 0; i < ARRAY_SIZE(test_regs); i++)
> for (j = 0; test_regs[i].ftr_bits[j].type != FTR_END; j++)
> test_cnt++;
>
> --
> 2.47.3
>
>
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-09-28 15:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 18:50 [PATCH v7 0/3] KVM: selftests: arm64: Improve diagnostics from set_id_regs Mark Brown
2026-09-01 18:50 ` [PATCH v7 1/3] KVM: selftests: arm64: Report set_id_reg reads of test registers as tests Mark Brown
2026-09-28 15:26 ` Lorenzo Stoakes (ARM)
2026-09-28 16:29 ` Mark Brown
2026-09-01 18:50 ` [PATCH v7 2/3] KVM: selftests: arm64: Report register reset tests individually Mark Brown
2026-09-28 15:32 ` Lorenzo Stoakes (ARM) [this message]
2026-09-01 18:50 ` [PATCH v7 3/3] KVM: selftests: arm64: Make set_id_regs bitfield validatity checks non-fatal Mark Brown
2026-09-28 15:43 ` Lorenzo Stoakes (ARM)
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=arqHe5v75qT2AJwd@gremlin \
--to=ljs@kernel.org \
--cc=ben.horgan@arm.com \
--cc=broonie@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=suzuki.poulose@arm.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.