summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorIngo Molnar2007-02-19 13:37:47 +0100
committerAvi Kivity2007-03-04 10:12:40 +0100
commit102d8325a1d2f266d3d0a03fdde948544e72c12d (patch)
tree21024c8b9b2b702c79200343e26f14f075da0479 /drivers/kvm/svm.c
parentKVM: Use page_private()/set_page_private() apis (diff)
downloadkernel-qcow2-linux-102d8325a1d2f266d3d0a03fdde948544e72c12d.tar.gz
kernel-qcow2-linux-102d8325a1d2f266d3d0a03fdde948544e72c12d.tar.xz
kernel-qcow2-linux-102d8325a1d2f266d3d0a03fdde948544e72c12d.zip
KVM: add MSR based hypercall API
This adds a special MSR based hypercall API to KVM. This is to be used by paravirtual kernels and virtual drivers. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 72cac0488b31..f6e86528f031 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1669,6 +1669,18 @@ static int is_disabled(void)
return 0;
}
+static void
+svm_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
+{
+ /*
+ * Patch in the VMMCALL instruction:
+ */
+ hypercall[0] = 0x0f;
+ hypercall[1] = 0x01;
+ hypercall[2] = 0xd9;
+ hypercall[3] = 0xc3;
+}
+
static struct kvm_arch_ops svm_arch_ops = {
.cpu_has_kvm_support = has_svm,
.disabled_by_bios = is_disabled,
@@ -1717,6 +1729,7 @@ static struct kvm_arch_ops svm_arch_ops = {
.run = svm_vcpu_run,
.skip_emulated_instruction = skip_emulated_instruction,
.vcpu_setup = svm_vcpu_setup,
+ .patch_hypercall = svm_patch_hypercall,
};
static int __init svm_init(void)