[PATCH 05/10] ARM: KVM: vgic: fix distributor irq_cfg register accessors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The irq_cfg accessors are not properly masking top bits when
compressing/expanding the value.

Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
---
 arch/arm/kvm/vgic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
index d89607a..e1d25b4 100644
--- a/arch/arm/kvm/vgic.c
+++ b/arch/arm/kvm/vgic.c
@@ -368,7 +368,7 @@ static u32 vgic_cfg_expand(u16 val)
 	int i;
 
 	for (i = 0; i < 16; i++)
-		res |= (val >> i) << (2 * i + 1);
+		res |= ((val >> i) & 1) << (2 * i + 1);
 
 	return res;
 }
@@ -379,7 +379,7 @@ static u16 vgic_cfg_compress(u32 val)
 	int i;
 
 	for (i = 0; i < 16; i++)
-		res |= (val >> (i * 2 + 1)) << i;
+		res |= ((val >> (i * 2 + 1)) & 1) << i;
 
 	return res;
 }
-- 
1.7.12



_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux