Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Ricardo Koller <ricarkol@google.com>
To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com
Cc: maz@kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	oupton@google.com, reijiw@google.com,
	Ricardo Koller <ricarkol@google.com>
Subject: [PATCH v2 1/5] kvm: selftests: aarch64: fix assert in gicv3_access_reg
Date: Wed, 26 Jan 2022 19:08:54 -0800	[thread overview]
Message-ID: <20220127030858.3269036-2-ricarkol@google.com> (raw)
In-Reply-To: <20220127030858.3269036-1-ricarkol@google.com>

The val argument in gicv3_access_reg can have any value when used for a
read, not necessarily 0.  Fix the assert by checking val only for
writes.

Signed-off-by: Ricardo Koller <ricarkol@google.com>
Reported-by: Reiji Watanabe <reijiw@google.com>
Cc: Andrew Jones <drjones@redhat.com>
---
 tools/testing/selftests/kvm/lib/aarch64/gic_v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/lib/aarch64/gic_v3.c b/tools/testing/selftests/kvm/lib/aarch64/gic_v3.c
index 00f613c0583c..e4945fe66620 100644
--- a/tools/testing/selftests/kvm/lib/aarch64/gic_v3.c
+++ b/tools/testing/selftests/kvm/lib/aarch64/gic_v3.c
@@ -159,7 +159,7 @@ static void gicv3_access_reg(uint32_t intid, uint64_t offset,
 	uint32_t cpu_or_dist;
 
 	GUEST_ASSERT(bits_per_field <= reg_bits);
-	GUEST_ASSERT(*val < (1U << bits_per_field));
+	GUEST_ASSERT(!write || *val < (1U << bits_per_field));
 	/* Some registers like IROUTER are 64 bit long. Those are currently not
 	 * supported by readl nor writel, so just asserting here until then.
 	 */
-- 
2.35.0.rc0.227.g00780c9af4-goog


  reply	other threads:[~2022-01-27  3:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  3:08 [PATCH v2 0/5] kvm: selftests: aarch64: some fixes for vgic_irq Ricardo Koller
2022-01-27  3:08 ` Ricardo Koller [this message]
2022-01-27  7:34   ` [PATCH v2 1/5] kvm: selftests: aarch64: fix assert in gicv3_access_reg Andrew Jones
2022-01-27  3:08 ` [PATCH v2 2/5] kvm: selftests: aarch64: pass vgic_irq guest args as a pointer Ricardo Koller
2022-01-27  7:46   ` Andrew Jones
2022-01-27  3:08 ` [PATCH v2 3/5] kvm: selftests: aarch64: fix the failure check in kvm_set_gsi_routing_irqchip_check Ricardo Koller
2022-01-27  3:08 ` [PATCH v2 4/5] kvm: selftests: aarch64: fix some vgic related comments Ricardo Koller
2022-01-27  7:49   ` Andrew Jones
2022-01-27 15:06     ` Ricardo Koller
2022-01-27  3:08 ` [PATCH v2 5/5] kvm: selftests: aarch64: use a tighter assert in vgic_poke_irq() Ricardo Koller
2022-01-27  7:51   ` Andrew Jones
2022-02-08 17:37 ` [PATCH v2 0/5] kvm: selftests: aarch64: some fixes for vgic_irq Marc Zyngier

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=20220127030858.3269036-2-ricarkol@google.com \
    --to=ricarkol@google.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=reijiw@google.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