Skip to contentSkip to conversation

Patch "arm/arm64: KVM: Reset the HCR on each vcpu when resetting the" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Jul 1, 2015

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm/arm64: KVM: Reset the HCR on each vcpu when resetting the

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm-arm64-kvm-reset-the-hcr-on-each-vcpu-when-resetting-the.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From b856a59141b1066d3c896a0d0231f84dabd040af Mon Sep 17 00:00:00 2001

From: Christoffer Dall <[email protected]>
Date: Thu, 16 Oct 2014 17:21:16 +0200
Subject: arm/arm64: KVM: Reset the HCR on each vcpu when resetting the
vcpu

From: Christoffer Dall <[email protected]>

commit b856a59141b1066d3c896a0d0231f84dabd040af upstream.

When userspace resets the vcpu using KVM_ARM_VCPU_INIT, we should also reset the HCR, because we now modify the HCR dynamically to enable/disable trapping of guest accesses to the VM registers.

This is crucial for reboot of VMs working since otherwise we will not be doing the necessary cache maintenance operations when faulting in pages with the guest MMU off.

---
 arch/arm/include/asm/kvm_emulate.h   |    5 +++++
 arch/arm/kvm/arm.c                   |    2 ++
 arch/arm/kvm/guest.c                 |    1 -
 arch/arm64/include/asm/kvm_emulate.h |    5 +++++
 arch/arm64/kvm/guest.c               |    1 -
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/include/asm/kvm_emulate.h +5 -0
@@ -33,6 +33,11 @@ void kvm_inject_undefined(struct kvm_vcp
 void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
 void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
 
+static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
+{
+	vcpu->arch.hcr = HCR_GUEST_MASK;
+}
+
 static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
 {
 	return 1;
arch/arm/kvm/arm.c +2 -0
@@ -675,6 +675,8 @@ static int kvm_arch_vcpu_ioctl_vcpu_init
 	if (ret)
 		return ret;
 
+	vcpu_reset_hcr(vcpu);
+
 	/*
 	 * Handle the "start in power-off" case by marking the VCPU as paused.
 	 */
arch/arm/kvm/guest.c +0 -1
@@ -38,7 +38,6 @@ struct kvm_stats_debugfs_item debugfs_en
 
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
-	vcpu->arch.hcr = HCR_GUEST_MASK;
 	return 0;
 }
 
arch/arm64/include/asm/kvm_emulate.h +5 -0
@@ -38,6 +38,11 @@ void kvm_inject_undefined(struct kvm_vcp
 void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
 void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
 
+static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
+{
+	vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
+}
+
 static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu)
 {
 	return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc;
arch/arm64/kvm/guest.c +0 -1
@@ -38,7 +38,6 @@ struct kvm_stats_debugfs_item debugfs_en
 
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
-	vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
 	return 0;
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/arm-arm64-kvm-ensure-memslots-are-within-kvm_phys_size.patch queue-3.14/arm-arm64-kvm-don-t-clear-the-vcpu_power_off-flag.patch queue-3.14/arm-arm64-kvm-correct-kvm_arm_vcpu_init-power-off-option.patch queue-3.14/arm-arm64-kvm-don-t-allow-creating-vcpus-after-vgic_initialized.patch queue-3.14/arm-arm64-kvm-fix-potential-null-dereference-in.patch queue-3.14/arm64-kvm-fix-unmapping-with-48-bit-vas.patch queue-3.14/arm-arm64-kvm-fix-set_clear_sgi_pend_reg-offset.patch queue-3.14/arm-kvm-strict_mm_typechecks-fix-for-user_mem_abort.patch queue-3.14/arm-arm64-kvm-fix-use-of-wnr-bit-in-kvm_is_write_fault.patch queue-3.14/arm-kvm-fix-cpu-hotplug.patch queue-3.14/arm-arm64-kvm-fix-vttbr_baddr_mask-and-pgd-alloc.patch queue-3.14/arm-arm64-kvm-introduce-stage2_unmap_vm.patch queue-3.14/arm-arm64-kvm-vgic-fix-error-code-in-kvm_vgic_create.patch queue-3.14/kvm-arm-vgic-plug-irq-injection-race.patch queue-3.14/arm-arm64-kvm-reset-the-hcr-on-each-vcpu-when-resetting-the.patch