[RFC PATCH 3/3] kvm: add pv_cpu_ops.hypercall support to the guest

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

 



Signed-off-by: Gregory Haskins <ghaskins@xxxxxxxxxx>
---

 arch/x86/kernel/kvm.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 33019dd..d299ed5 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -50,6 +50,26 @@ static void kvm_io_delay(void)
 {
 }
 
+static long _kvm_hypercall(unsigned long nr,
+			   unsigned long *args,
+			   size_t count)
+{
+	switch (count) {
+	case 0:
+		return kvm_hypercall0(nr);
+	case 1:
+		return kvm_hypercall1(nr, args[0]);
+	case 2:
+		return kvm_hypercall2(nr, args[0], args[1]);
+	case 3:
+		return kvm_hypercall3(nr, args[0], args[1], args[2]);
+	case 4:
+		return kvm_hypercall4(nr, args[0], args[1], args[2], args[3]);
+	default:
+		return -EINVAL;
+	}
+}
+
 static void kvm_mmu_op(void *buffer, unsigned len)
 {
 	int r;
@@ -207,6 +227,8 @@ static void paravirt_ops_setup(void)
 	if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
 		pv_cpu_ops.io_delay = kvm_io_delay;
 
+	pv_cpu_ops.hypercall = _kvm_hypercall;
+
 	if (kvm_para_has_feature(KVM_FEATURE_MMU_OP)) {
 		pv_mmu_ops.set_pte = kvm_set_pte;
 		pv_mmu_ops.set_pte_at = kvm_set_pte_at;

--
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