* [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
@ 2017-06-04 20:20 ` Christoffer Dall
0 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2017-06-04 20:20 UTC (permalink / raw)
To: kvmarm, linux-arm-kernel; +Cc: kvm, Marc Zyngier, Christoffer Dall
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
@ 2017-06-04 20:20 ` Christoffer Dall
0 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2017-06-04 20:20 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
2017-06-04 20:20 ` Christoffer Dall
@ 2017-06-05 13:17 ` Marc Zyngier
-1 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2017-06-05 13:17 UTC (permalink / raw)
To: Christoffer Dall, kvmarm, linux-arm-kernel; +Cc: kvm
On 04/06/17 21:20, Christoffer Dall wrote:
> 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>
> ---
> 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)
> {
>
Oops... I wonder why that didn't result in any other issues in my
code... :-(.
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
@ 2017-06-05 13:17 ` Marc Zyngier
0 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2017-06-05 13:17 UTC (permalink / raw)
To: linux-arm-kernel
On 04/06/17 21:20, Christoffer Dall wrote:
> 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>
> ---
> 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)
> {
>
Oops... I wonder why that didn't result in any other issues in my
code... :-(.
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-05 13:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-04 20:20 [PATCH] KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction Christoffer Dall
2017-06-04 20:20 ` Christoffer Dall
2017-06-05 13:17 ` Marc Zyngier
2017-06-05 13:17 ` Marc Zyngier
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.