Created
February 2, 2016 23:47
-
-
Save apritzel/761af7ca3445ec3fbdcb to your computer and use it in GitHub Desktop.
Patch to let the arch timer flush exit early if no VGIC has been instantiated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c | |
index 69bca18..ea60646 100644 | |
--- a/virt/kvm/arm/arch_timer.c | |
+++ b/virt/kvm/arm/arch_timer.c | |
@@ -143,7 +143,7 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level) | |
* Check if there was a change in the timer state (should we raise or lower | |
* the line level to the GIC). | |
*/ | |
-static void kvm_timer_update_state(struct kvm_vcpu *vcpu) | |
+static int kvm_timer_update_state(struct kvm_vcpu *vcpu) | |
{ | |
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; | |
@@ -154,10 +154,12 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu) | |
* until we call this function from kvm_timer_flush_hwstate. | |
*/ | |
if (!vgic_initialized(vcpu->kvm)) | |
- return; | |
+ return -ENODEV; | |
if (kvm_timer_should_fire(vcpu) != timer->irq.level) | |
kvm_timer_update_irq(vcpu, !timer->irq.level); | |
+ | |
+ return 0; | |
} | |
/* | |
@@ -218,7 +220,8 @@ void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) | |
bool phys_active; | |
int ret; | |
- kvm_timer_update_state(vcpu); | |
+ if (kvm_timer_update_state(vcpu)) | |
+ return; | |
/* | |
* If we enter the guest with the virtual input level to the VGIC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment