diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-02-22 12:21:37 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:00:27 -0400 |
commit | 2f333bcb4edd8daef99dabe4e7df8277af73cff1 (patch) | |
tree | c984466e7756e0910bf470a094558b52bd10df33 /include/asm-x86 | |
parent | 9f81128591ca1e9907f2e7a7b195e33232167d60 (diff) |
KVM: MMU: hypercall based pte updates and TLB flushes
Hypercall based pte updates are faster than faults, and also allow use
of the lazy MMU mode to batch operations.
Don't report the feature if two dimensional paging is enabled.
[avi:
- one mmu_op hypercall instead of one per op
- allow 64-bit gpa on hypercall
- don't pass host errors (-ENOMEM) to guest]
[akpm: warning fix on i386]
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/kvm_host.h | 4 | ||||
-rw-r--r-- | include/asm-x86/kvm_para.h | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 99d31f5ed9ff..772ba95f0a0e 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h | |||
@@ -434,6 +434,10 @@ int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); | |||
434 | 434 | ||
435 | int __emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | 435 | int __emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, |
436 | const void *val, int bytes); | 436 | const void *val, int bytes); |
437 | int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes, | ||
438 | gpa_t addr, unsigned long *ret); | ||
439 | |||
440 | extern bool tdp_enabled; | ||
437 | 441 | ||
438 | enum emulation_result { | 442 | enum emulation_result { |
439 | EMULATE_DONE, /* no further processing */ | 443 | EMULATE_DONE, /* no further processing */ |
diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h index ed5df3a54aab..509845942070 100644 --- a/include/asm-x86/kvm_para.h +++ b/include/asm-x86/kvm_para.h | |||
@@ -12,10 +12,39 @@ | |||
12 | #define KVM_CPUID_FEATURES 0x40000001 | 12 | #define KVM_CPUID_FEATURES 0x40000001 |
13 | #define KVM_FEATURE_CLOCKSOURCE 0 | 13 | #define KVM_FEATURE_CLOCKSOURCE 0 |
14 | #define KVM_FEATURE_NOP_IO_DELAY 1 | 14 | #define KVM_FEATURE_NOP_IO_DELAY 1 |
15 | #define KVM_FEATURE_MMU_OP 2 | ||
15 | 16 | ||
16 | #define MSR_KVM_WALL_CLOCK 0x11 | 17 | #define MSR_KVM_WALL_CLOCK 0x11 |
17 | #define MSR_KVM_SYSTEM_TIME 0x12 | 18 | #define MSR_KVM_SYSTEM_TIME 0x12 |
18 | 19 | ||
20 | #define KVM_MAX_MMU_OP_BATCH 32 | ||
21 | |||
22 | /* Operations for KVM_HC_MMU_OP */ | ||
23 | #define KVM_MMU_OP_WRITE_PTE 1 | ||
24 | #define KVM_MMU_OP_FLUSH_TLB 2 | ||
25 | #define KVM_MMU_OP_RELEASE_PT 3 | ||
26 | |||
27 | /* Payload for KVM_HC_MMU_OP */ | ||
28 | struct kvm_mmu_op_header { | ||
29 | __u32 op; | ||
30 | __u32 pad; | ||
31 | }; | ||
32 | |||
33 | struct kvm_mmu_op_write_pte { | ||
34 | struct kvm_mmu_op_header header; | ||
35 | __u64 pte_phys; | ||
36 | __u64 pte_val; | ||
37 | }; | ||
38 | |||
39 | struct kvm_mmu_op_flush_tlb { | ||
40 | struct kvm_mmu_op_header header; | ||
41 | }; | ||
42 | |||
43 | struct kvm_mmu_op_release_pt { | ||
44 | struct kvm_mmu_op_header header; | ||
45 | __u64 pt_phys; | ||
46 | }; | ||
47 | |||
19 | #ifdef __KERNEL__ | 48 | #ifdef __KERNEL__ |
20 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
21 | 50 | ||