Skip to contentSkip to conversation

KVM: arm/arm64: Fix broken GICH_ELRSR big endian conversion

PATCH In review Christoffer Dall 2 participants 2 messages Dec 3, 2017 – Dec 4, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm/arm64: Fix broken GICH_ELRSR big endian conversion

From: Christoffer Dall <[email protected]>

We are incorrectly rearranging 32-bit words inside a 64-bit typed value for big endian systems, which would result in never marking a virtual interrupt as inactive on big endian systems (assuming 32 or fewer LRs on the hardware). Fix this by not doing any word order manipulation for the typed values.

---
 virt/kvm/arm/hyp/vgic-v2-sr.c | 4 ----
 1 file changed, 4 deletions(-)
virt/kvm/arm/hyp/vgic-v2-sr.c +0 -4
index a3f18d362366..d7fd46fe9efb 100644
@@ -34,11 +34,7 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base)
 	else
 		elrsr1 = 0;
 
-#ifdef CONFIG_CPU_BIG_ENDIAN
-	cpu_if->vgic_elrsr = ((u64)elrsr0 << 32) | elrsr1;
-#else
 	cpu_if->vgic_elrsr = ((u64)elrsr1 << 32) | elrsr0;
-#endif
 }
 
 static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base)
Signature · 1 line
2.14.2
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Christoffer Dall

From: Christoffer Dall <[email protected]>

We are incorrectly rearranging 32-bit words inside a 64-bit typed value for big endian systems, which would result in never marking a virtual interrupt as inactive on big endian systems (assuming 32 or fewer LRs on the hardware). Fix this by not doing any word order manipulation for the typed values.

---
 virt/kvm/arm/hyp/vgic-v2-sr.c | 4 ----
 1 file changed, 4 deletions(-)
virt/kvm/arm/hyp/vgic-v2-sr.c +0 -0
index a3f18d362366..d7fd46fe9efb 100644
@@ -34,11 +34,7 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base)
 	else

virt/kvm/arm/hyp/vgic-v2-sr.c static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base) · line 40

Quoted 10 lines
virt/kvm/arm/hyp/vgic-v2-sr.c +0 -4
 		elrsr1 = 0;
 
-#ifdef CONFIG_CPU_BIG_ENDIAN
-	cpu_if->vgic_elrsr = ((u64)elrsr0 << 32) | elrsr1;
-#else
 	cpu_if->vgic_elrsr = ((u64)elrsr1 << 32) | elrsr0;
-#endif
 }
 
 static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base)

Duh!

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...