Skip to content

Commit

Permalink
kvm: arm/arm64: vgic-v3: Tighten synchronization for guests using v2 …
Browse files Browse the repository at this point in the history
…on v3

On guest exit, and when using GICv2 on GICv3, we use a dsb(st) to
force synchronization between the memory-mapped guest view and
the system-register view that the hypervisor uses.

This is incorrect, as the spec calls out the need for "a DSB whose
required access type is both loads and stores with any Shareability
attribute", while we're only synchronizing stores.

We also lack an isb after the dsb to ensure that the latter has
actually been executed before we start reading stuff from the sysregs.

The fix is pretty easy: turn dsb(st) into dsb(sy), and slap an isb()
just after.

Cc: [email protected]
Fixes: f68d2b1 ("arm64: KVM: Implement vgic-v3 save/restore")
Acked-by: Christoffer Dall <[email protected]>
Reviewed-by: Andre Przywara <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Marc Zyngier committed Mar 14, 2018
1 parent 16ca6a6 commit 27e91ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion virt/kvm/arm/hyp/vgic-v3-sr.c
Original file line number Diff line number Diff line change
@@ -215,7 +215,8 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu)
* are now visible to the system register interface.
*/
if (!cpu_if->vgic_sre) {
dsb(st);
dsb(sy);
isb();
cpu_if->vgic_vmcr = read_gicreg(ICH_VMCR_EL2);
}

0 comments on commit 27e91ad

Please sign in to comment.