Skip to content

Commit

Permalink
KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoffer Dall committed Jun 6, 2017
1 parent 28232a4 commit d68356c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virt/kvm/arm/hyp/vgic-v3-sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit d68356c

Please sign in to comment.