[PATCH 4/5] KVM: register rtc eoi notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yang Zhang <yang.z.zhang@xxxxxxxxx>

when virtual interrupt delivery avaliable, register a rtc eoi notifier
to force vmexit when writing eoi for rtc interupt

Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx>
---
 virt/kvm/ioapic.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index ed6f111..2c6235c 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -87,6 +87,30 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
 	return result;
 }
 
+#ifdef CONFIG_X86
+static void kvm_rtc_ack_irq(struct kvm_irq_ack_notifier *kian)
+{
+	return;
+}
+
+static void rtc_register_notifier(struct kvm_ioapic *ioapic)
+{
+	if (!kvm_apic_vid_enabled(ioapic->kvm))
+		return;
+
+	ioapic->rtc_status.irq_ack_notifier.gsi = 8;
+	ioapic->rtc_status.irq_ack_notifier.irq_acked = kvm_rtc_ack_irq;
+	kvm_register_irq_ack_notifier(ioapic->kvm,
+				&ioapic->rtc_status.irq_ack_notifier);
+}
+#else
+
+static void rtc_register_notifier(struct kvm_ioapic *ioapic)
+{
+	return;
+}
+#endif
+
 static int ioapic_service(struct kvm_ioapic *ioapic, unsigned int idx)
 {
 	union kvm_ioapic_redirect_entry *pent;
@@ -458,6 +482,8 @@ int kvm_ioapic_init(struct kvm *kvm)
 		kfree(ioapic);
 	}
 
+	rtc_register_notifier(ioapic);
+
 	return ret;
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux