Commit 528ada28 authored by Marc Zyngier's avatar Marc Zyngier
Browse files

KVM: arm64: Fix hypercall bitmap writeback when vcpus have already run



We generally want to disallow hypercall bitmaps being changed
once vcpus have already run. But we must allow the write if
the written value is unchanged so that userspace can rewrite
the register file on reboot, for example.

Without this, a QEMU-based VM will fail to reboot correctly.

The original code was correct, and it is me that introduced
the regression.

Fixes: 05714cab ("KVM: arm64: Setup a framework for hypercall bitmap firmware registers")
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 2cde51f1
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -379,7 +379,8 @@ static int kvm_arm_set_fw_reg_bmap(struct kvm_vcpu *vcpu, u64 reg_id, u64 val)


	mutex_lock(&kvm->lock);
	mutex_lock(&kvm->lock);


	if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags)) {
	if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags) &&
	    val != *fw_reg_bmap) {
		ret = -EBUSY;
		ret = -EBUSY;
		goto out;
		goto out;
	}
	}