diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-12-04 10:02:24 -0500 |
|---|---|---|
| committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-12-13 08:15:52 -0500 |
| commit | 6d3cfbe21bef5b66530b50ad16c88fdc71a04c35 (patch) | |
| tree | b5f375258f0273acdab23d900ac9b06c642a8e5f /include/kvm | |
| parent | 957db105c99792ae8ef61ffc9ae77d910f6471da (diff) | |
arm/arm64: KVM: vgic: move reset initialization into vgic_init_maps()
VGIC initialization currently happens in three phases:
(1) kvm_vgic_create() (triggered by userspace GIC creation)
(2) vgic_init_maps() (triggered by userspace GIC register read/write
requests, or from kvm_vgic_init() if not already run)
(3) kvm_vgic_init() (triggered by first VM run)
We were doing initialization of some state to correspond with the
state of a freshly-reset GIC in kvm_vgic_init(); this is too late,
since it will overwrite changes made by userspace using the
register access APIs before the VM is run. Move this initialization
earlier, into the vgic_init_maps() phase.
This fixes a bug where QEMU could successfully restore a saved
VM state snapshot into a VM that had already been run, but could
not restore it "from cold" using the -loadvm command line option
(the symptoms being that the restored VM would run but interrupts
were ignored).
Finally rename vgic_init_maps to vgic_init and renamed kvm_vgic_init to
kvm_vgic_map_resources.
[ This patch is originally written by Peter Maydell, but I have
modified it somewhat heavily, renaming various bits and moving code
around. If something is broken, I am to be blamed. - Christoffer ]
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'include/kvm')
| -rw-r--r-- | include/kvm/arm_vgic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 206dcc3b3f7a..fe9783ba924c 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
| @@ -274,7 +274,7 @@ struct kvm_exit_mmio; | |||
| 274 | #ifdef CONFIG_KVM_ARM_VGIC | 274 | #ifdef CONFIG_KVM_ARM_VGIC |
| 275 | int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write); | 275 | int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write); |
| 276 | int kvm_vgic_hyp_init(void); | 276 | int kvm_vgic_hyp_init(void); |
| 277 | int kvm_vgic_init(struct kvm *kvm); | 277 | int kvm_vgic_map_resources(struct kvm *kvm); |
| 278 | int kvm_vgic_create(struct kvm *kvm); | 278 | int kvm_vgic_create(struct kvm *kvm); |
| 279 | void kvm_vgic_destroy(struct kvm *kvm); | 279 | void kvm_vgic_destroy(struct kvm *kvm); |
| 280 | void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu); | 280 | void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu); |
| @@ -321,7 +321,7 @@ static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, | |||
| 321 | return -ENXIO; | 321 | return -ENXIO; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static inline int kvm_vgic_init(struct kvm *kvm) | 324 | static inline int kvm_vgic_map_resources(struct kvm *kvm) |
| 325 | { | 325 | { |
| 326 | return 0; | 326 | return 0; |
| 327 | } | 327 | } |
