linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cdall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PULL v2 2/6] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
Date: Wed,  7 Jun 2017 19:11:48 +0200	[thread overview]
Message-ID: <20170607171152.21874-3-cdall@linaro.org> (raw)
In-Reply-To: <20170607171152.21874-1-cdall@linaro.org>

We used to extract PRIbits from the ICH_VT_EL2 which was the upper field
in the register word, so a mask wasn't necessary, but as we switched to
looking at PREbits, which is bits 26 through 28 with the PRIbits field
being potentially non-zero, we really need to mask off the field value,
otherwise fun things may happen.

Signed-off-by: Christoffer Dall <cdall@linaro.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
---
 virt/kvm/arm/hyp/vgic-v3-sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c
index 32c3295..8794036 100644
--- a/virt/kvm/arm/hyp/vgic-v3-sr.c
+++ b/virt/kvm/arm/hyp/vgic-v3-sr.c
@@ -22,7 +22,7 @@
 #include <asm/kvm_hyp.h>
 
 #define vtr_to_max_lr_idx(v)		((v) & 0xf)
-#define vtr_to_nr_pre_bits(v)		(((u32)(v) >> 26) + 1)
+#define vtr_to_nr_pre_bits(v)		((((u32)(v) >> 26) & 7) + 1)
 
 static u64 __hyp_text __gic_v3_get_lr(unsigned int lr)
 {
-- 
2.9.0

  parent reply	other threads:[~2017-06-07 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 17:11 [PULL v2 0/6] KVM/ARM Fixes for v4.12-rc5 - Take 2 Christoffer Dall
2017-06-07 17:11 ` [PULL v2 1/6] KVM: arm/arm64: Fix isues with GICv2 on GICv3 migration Christoffer Dall
2017-06-07 17:11 ` Christoffer Dall [this message]
2017-06-07 17:11 ` [PULL v2 3/6] KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages Christoffer Dall
2017-06-07 17:11 ` [PULL v2 4/6] arm64: KVM: Preserve RES1 bits in SCTLR_EL2 Christoffer Dall
2017-06-07 17:11 ` [PULL v2 5/6] arm64: KVM: Allow unaligned accesses at EL2 Christoffer Dall
2017-06-07 17:11 ` [PULL v2 6/6] arm: KVM: Allow unaligned accesses at HYP Christoffer Dall
2017-06-08 13:04 ` [PULL v2 0/6] KVM/ARM Fixes for v4.12-rc5 - Take 2 Paolo Bonzini

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=20170607171152.21874-3-cdall@linaro.org \
    --to=cdall@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).