diff options
author | Avi Kivity <avi@qumranet.com> | 2007-02-19 07:37:46 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-03-04 04:12:39 -0500 |
commit | d27d4aca184ac0ca6b7e32caf79e1c2b91959be9 (patch) | |
tree | 048e9ea24b55ac63783cc6cc3495d0feb5de57d0 /drivers/kvm | |
parent | 43934a38d7cb39ff33baedc7f2c40a2a891116fa (diff) |
KVM: Cosmetics
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/kvm_main.c | 21 | ||||
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 3 | ||||
-rw-r--r-- | drivers/kvm/svm.c | 10 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 4 |
4 files changed, 15 insertions, 23 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 0a96c2c7e191..13a99cac3679 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -126,10 +126,8 @@ static inline int valid_vcpu(int n) | |||
126 | return likely(n >= 0 && n < KVM_MAX_VCPUS); | 126 | return likely(n >= 0 && n < KVM_MAX_VCPUS); |
127 | } | 127 | } |
128 | 128 | ||
129 | int kvm_read_guest(struct kvm_vcpu *vcpu, | 129 | int kvm_read_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size, |
130 | gva_t addr, | 130 | void *dest) |
131 | unsigned long size, | ||
132 | void *dest) | ||
133 | { | 131 | { |
134 | unsigned char *host_buf = dest; | 132 | unsigned char *host_buf = dest; |
135 | unsigned long req_size = size; | 133 | unsigned long req_size = size; |
@@ -161,10 +159,8 @@ int kvm_read_guest(struct kvm_vcpu *vcpu, | |||
161 | } | 159 | } |
162 | EXPORT_SYMBOL_GPL(kvm_read_guest); | 160 | EXPORT_SYMBOL_GPL(kvm_read_guest); |
163 | 161 | ||
164 | int kvm_write_guest(struct kvm_vcpu *vcpu, | 162 | int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size, |
165 | gva_t addr, | 163 | void *data) |
166 | unsigned long size, | ||
167 | void *data) | ||
168 | { | 164 | { |
169 | unsigned char *host_buf = data; | 165 | unsigned char *host_buf = data; |
170 | unsigned long req_size = size; | 166 | unsigned long req_size = size; |
@@ -457,7 +453,7 @@ EXPORT_SYMBOL_GPL(set_cr4); | |||
457 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | 453 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) |
458 | { | 454 | { |
459 | if (is_long_mode(vcpu)) { | 455 | if (is_long_mode(vcpu)) { |
460 | if ( cr3 & CR3_L_MODE_RESEVED_BITS) { | 456 | if (cr3 & CR3_L_MODE_RESEVED_BITS) { |
461 | printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); | 457 | printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); |
462 | inject_gp(vcpu); | 458 | inject_gp(vcpu); |
463 | return; | 459 | return; |
@@ -774,7 +770,6 @@ static int kvm_dev_ioctl_get_dirty_log(struct kvm *kvm, | |||
774 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) | 770 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) |
775 | goto out; | 771 | goto out; |
776 | 772 | ||
777 | |||
778 | if (any) { | 773 | if (any) { |
779 | cleared = 0; | 774 | cleared = 0; |
780 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 775 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
@@ -903,8 +898,9 @@ static int emulator_read_emulated(unsigned long addr, | |||
903 | return X86EMUL_CONTINUE; | 898 | return X86EMUL_CONTINUE; |
904 | else { | 899 | else { |
905 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); | 900 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); |
901 | |||
906 | if (gpa == UNMAPPED_GVA) | 902 | if (gpa == UNMAPPED_GVA) |
907 | return vcpu_printf(vcpu, "not present\n"), X86EMUL_PROPAGATE_FAULT; | 903 | return X86EMUL_PROPAGATE_FAULT; |
908 | vcpu->mmio_needed = 1; | 904 | vcpu->mmio_needed = 1; |
909 | vcpu->mmio_phys_addr = gpa; | 905 | vcpu->mmio_phys_addr = gpa; |
910 | vcpu->mmio_size = bytes; | 906 | vcpu->mmio_size = bytes; |
@@ -1801,12 +1797,11 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1801 | case KVM_GET_API_VERSION: | 1797 | case KVM_GET_API_VERSION: |
1802 | r = KVM_API_VERSION; | 1798 | r = KVM_API_VERSION; |
1803 | break; | 1799 | break; |
1804 | case KVM_CREATE_VCPU: { | 1800 | case KVM_CREATE_VCPU: |
1805 | r = kvm_dev_ioctl_create_vcpu(kvm, arg); | 1801 | r = kvm_dev_ioctl_create_vcpu(kvm, arg); |
1806 | if (r) | 1802 | if (r) |
1807 | goto out; | 1803 | goto out; |
1808 | break; | 1804 | break; |
1809 | } | ||
1810 | case KVM_RUN: { | 1805 | case KVM_RUN: { |
1811 | struct kvm_run kvm_run; | 1806 | struct kvm_run kvm_run; |
1812 | 1807 | ||
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 6507ccb1ea2a..f3bcee904651 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -441,9 +441,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
441 | /* | 441 | /* |
442 | * mmio: emulate if accessible, otherwise its a guest fault. | 442 | * mmio: emulate if accessible, otherwise its a guest fault. |
443 | */ | 443 | */ |
444 | if (is_io_pte(*shadow_pte)) { | 444 | if (is_io_pte(*shadow_pte)) |
445 | return 1; | 445 | return 1; |
446 | } | ||
447 | 446 | ||
448 | ++kvm_stat.pf_fixed; | 447 | ++kvm_stat.pf_fixed; |
449 | kvm_mmu_audit(vcpu, "post page fault (fixed)"); | 448 | kvm_mmu_audit(vcpu, "post page fault (fixed)"); |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 83da4ea150a3..31836444bc62 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1042,22 +1042,22 @@ static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1042 | 1042 | ||
1043 | addr_mask = io_adress(vcpu, _in, &kvm_run->io.address); | 1043 | addr_mask = io_adress(vcpu, _in, &kvm_run->io.address); |
1044 | if (!addr_mask) { | 1044 | if (!addr_mask) { |
1045 | printk(KERN_DEBUG "%s: get io address failed\n", __FUNCTION__); | 1045 | printk(KERN_DEBUG "%s: get io address failed\n", |
1046 | __FUNCTION__); | ||
1046 | return 1; | 1047 | return 1; |
1047 | } | 1048 | } |
1048 | 1049 | ||
1049 | if (kvm_run->io.rep) { | 1050 | if (kvm_run->io.rep) { |
1050 | kvm_run->io.count = vcpu->regs[VCPU_REGS_RCX] & addr_mask; | 1051 | kvm_run->io.count |
1052 | = vcpu->regs[VCPU_REGS_RCX] & addr_mask; | ||
1051 | kvm_run->io.string_down = (vcpu->svm->vmcb->save.rflags | 1053 | kvm_run->io.string_down = (vcpu->svm->vmcb->save.rflags |
1052 | & X86_EFLAGS_DF) != 0; | 1054 | & X86_EFLAGS_DF) != 0; |
1053 | } | 1055 | } |
1054 | } else { | 1056 | } else |
1055 | kvm_run->io.value = vcpu->svm->vmcb->save.rax; | 1057 | kvm_run->io.value = vcpu->svm->vmcb->save.rax; |
1056 | } | ||
1057 | return 0; | 1058 | return 0; |
1058 | } | 1059 | } |
1059 | 1060 | ||
1060 | |||
1061 | static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1061 | static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1062 | { | 1062 | { |
1063 | return 1; | 1063 | return 1; |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index fd4e91734388..ff3bfc5c390a 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include "segment_descriptor.h" | 28 | #include "segment_descriptor.h" |
29 | 29 | ||
30 | |||
31 | MODULE_AUTHOR("Qumranet"); | 30 | MODULE_AUTHOR("Qumranet"); |
32 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
33 | 32 | ||
@@ -418,10 +417,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
418 | case MSR_IA32_SYSENTER_ESP: | 417 | case MSR_IA32_SYSENTER_ESP: |
419 | vmcs_write32(GUEST_SYSENTER_ESP, data); | 418 | vmcs_write32(GUEST_SYSENTER_ESP, data); |
420 | break; | 419 | break; |
421 | case MSR_IA32_TIME_STAMP_COUNTER: { | 420 | case MSR_IA32_TIME_STAMP_COUNTER: |
422 | guest_write_tsc(data); | 421 | guest_write_tsc(data); |
423 | break; | 422 | break; |
424 | } | ||
425 | default: | 423 | default: |
426 | msr = find_msr_entry(vcpu, msr_index); | 424 | msr = find_msr_entry(vcpu, msr_index); |
427 | if (msr) { | 425 | if (msr) { |