aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-02-19 07:37:47 -0500
committerAvi Kivity <avi@qumranet.com>2007-03-04 04:12:40 -0500
commit102d8325a1d2f266d3d0a03fdde948544e72c12d (patch)
tree21024c8b9b2b702c79200343e26f14f075da0479 /drivers/kvm/svm.c
parent5972e9535e94bf875eb8eab8a667ba04c7583874 (diff)
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)
1669 return 0; 1669 return 0;
1670} 1670}
1671 1671
1672static void
1673svm_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
1674{
1675 /*
1676 * Patch in the VMMCALL instruction:
1677 */
1678 hypercall[0] = 0x0f;
1679 hypercall[1] = 0x01;
1680 hypercall[2] = 0xd9;
1681 hypercall[3] = 0xc3;
1682}
1683
1672static struct kvm_arch_ops svm_arch_ops = { 1684static struct kvm_arch_ops svm_arch_ops = {
1673 .cpu_has_kvm_support = has_svm, 1685 .cpu_has_kvm_support = has_svm,
1674 .disabled_by_bios = is_disabled, 1686 .disabled_by_bios = is_disabled,
@@ -1717,6 +1729,7 @@ static struct kvm_arch_ops svm_arch_ops = {
1717 .run = svm_vcpu_run, 1729 .run = svm_vcpu_run,
1718 .skip_emulated_instruction = skip_emulated_instruction, 1730 .skip_emulated_instruction = skip_emulated_instruction,
1719 .vcpu_setup = svm_vcpu_setup, 1731 .vcpu_setup = svm_vcpu_setup,
1732 .patch_hypercall = svm_patch_hypercall,
1720}; 1733};
1721 1734
1722static int __init svm_init(void) 1735static int __init svm_init(void)