[PATCH 01/15] ARM: KVM: vgic: fix GICH_VMCR default value

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

 



We blindly use the GICH_VMCR value when initializing a new VCPU,
happilly reusing whatever state was left in the register. Bad.

Instead, just set it to zero. The GIC will set BPR and ABPR to
sensible reset values.

Note that this breaks SMP boot, but fixes for both QEMU and kvm-tool
are on their way.

Reported-by: Will Deacon <will.deacon@xxxxxxx>
Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
---
 arch/arm/kvm/vgic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
index f697c14..7df1edc 100644
--- a/arch/arm/kvm/vgic.c
+++ b/arch/arm/kvm/vgic.c
@@ -1091,8 +1091,12 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
 	reg = readl_relaxed(vcpu->kvm->arch.vgic.vctrl_base + GICH_VTR);
 	vgic_cpu->nr_lr = (reg & 0x1f) + 1;
 
-	reg = readl_relaxed(vcpu->kvm->arch.vgic.vctrl_base + GICH_VMCR);
-	vgic_cpu->vgic_vmcr = reg | (0x1f << 27); /* Priority */
+	/*
+	 * By forcing VMCR to zero, the GIC will restore the binary
+	 * points to their reset values. Anything else resets to zero
+	 * anyway.
+	 */
+	vgic_cpu->vgic_vmcr = 0;
 
 	vgic_cpu->vgic_hcr = VGIC_HCR_EN; /* Get the show on the road... */
 
-- 
1.8.0.1



_______________________________________________
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