diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0458bd516185..dbcff38dfcc3 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -237,7 +237,7 @@ out: | |||
237 | return changed; | 237 | return changed; |
238 | } | 238 | } |
239 | 239 | ||
240 | void set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | 240 | void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) |
241 | { | 241 | { |
242 | if (cr0 & CR0_RESERVED_BITS) { | 242 | if (cr0 & CR0_RESERVED_BITS) { |
243 | printk(KERN_DEBUG "set_cr0: 0x%lx #GP, reserved bits 0x%lx\n", | 243 | printk(KERN_DEBUG "set_cr0: 0x%lx #GP, reserved bits 0x%lx\n", |
@@ -295,15 +295,15 @@ void set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
295 | kvm_mmu_reset_context(vcpu); | 295 | kvm_mmu_reset_context(vcpu); |
296 | return; | 296 | return; |
297 | } | 297 | } |
298 | EXPORT_SYMBOL_GPL(set_cr0); | 298 | EXPORT_SYMBOL_GPL(kvm_set_cr0); |
299 | 299 | ||
300 | void lmsw(struct kvm_vcpu *vcpu, unsigned long msw) | 300 | void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw) |
301 | { | 301 | { |
302 | set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0ful) | (msw & 0x0f)); | 302 | kvm_set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0ful) | (msw & 0x0f)); |
303 | } | 303 | } |
304 | EXPORT_SYMBOL_GPL(lmsw); | 304 | EXPORT_SYMBOL_GPL(kvm_lmsw); |
305 | 305 | ||
306 | void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 306 | void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
307 | { | 307 | { |
308 | if (cr4 & CR4_RESERVED_BITS) { | 308 | if (cr4 & CR4_RESERVED_BITS) { |
309 | printk(KERN_DEBUG "set_cr4: #GP, reserved bits\n"); | 309 | printk(KERN_DEBUG "set_cr4: #GP, reserved bits\n"); |
@@ -334,9 +334,9 @@ void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
334 | vcpu->arch.cr4 = cr4; | 334 | vcpu->arch.cr4 = cr4; |
335 | kvm_mmu_reset_context(vcpu); | 335 | kvm_mmu_reset_context(vcpu); |
336 | } | 336 | } |
337 | EXPORT_SYMBOL_GPL(set_cr4); | 337 | EXPORT_SYMBOL_GPL(kvm_set_cr4); |
338 | 338 | ||
339 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | 339 | void kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) |
340 | { | 340 | { |
341 | if (cr3 == vcpu->arch.cr3 && !pdptrs_changed(vcpu)) { | 341 | if (cr3 == vcpu->arch.cr3 && !pdptrs_changed(vcpu)) { |
342 | kvm_mmu_flush_tlb(vcpu); | 342 | kvm_mmu_flush_tlb(vcpu); |
@@ -388,9 +388,9 @@ void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | |||
388 | } | 388 | } |
389 | up_read(&vcpu->kvm->slots_lock); | 389 | up_read(&vcpu->kvm->slots_lock); |
390 | } | 390 | } |
391 | EXPORT_SYMBOL_GPL(set_cr3); | 391 | EXPORT_SYMBOL_GPL(kvm_set_cr3); |
392 | 392 | ||
393 | void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) | 393 | void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) |
394 | { | 394 | { |
395 | if (cr8 & CR8_RESERVED_BITS) { | 395 | if (cr8 & CR8_RESERVED_BITS) { |
396 | printk(KERN_DEBUG "set_cr8: #GP, reserved bits 0x%lx\n", cr8); | 396 | printk(KERN_DEBUG "set_cr8: #GP, reserved bits 0x%lx\n", cr8); |
@@ -402,16 +402,16 @@ void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) | |||
402 | else | 402 | else |
403 | vcpu->arch.cr8 = cr8; | 403 | vcpu->arch.cr8 = cr8; |
404 | } | 404 | } |
405 | EXPORT_SYMBOL_GPL(set_cr8); | 405 | EXPORT_SYMBOL_GPL(kvm_set_cr8); |
406 | 406 | ||
407 | unsigned long get_cr8(struct kvm_vcpu *vcpu) | 407 | unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu) |
408 | { | 408 | { |
409 | if (irqchip_in_kernel(vcpu->kvm)) | 409 | if (irqchip_in_kernel(vcpu->kvm)) |
410 | return kvm_lapic_get_cr8(vcpu); | 410 | return kvm_lapic_get_cr8(vcpu); |
411 | else | 411 | else |
412 | return vcpu->arch.cr8; | 412 | return vcpu->arch.cr8; |
413 | } | 413 | } |
414 | EXPORT_SYMBOL_GPL(get_cr8); | 414 | EXPORT_SYMBOL_GPL(kvm_get_cr8); |
415 | 415 | ||
416 | /* | 416 | /* |
417 | * List of msr numbers which we expose to userspace through KVM_GET_MSRS | 417 | * List of msr numbers which we expose to userspace through KVM_GET_MSRS |
@@ -2462,7 +2462,7 @@ void realmode_lidt(struct kvm_vcpu *vcpu, u16 limit, unsigned long base) | |||
2462 | void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, | 2462 | void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, |
2463 | unsigned long *rflags) | 2463 | unsigned long *rflags) |
2464 | { | 2464 | { |
2465 | lmsw(vcpu, msw); | 2465 | kvm_lmsw(vcpu, msw); |
2466 | *rflags = kvm_x86_ops->get_rflags(vcpu); | 2466 | *rflags = kvm_x86_ops->get_rflags(vcpu); |
2467 | } | 2467 | } |
2468 | 2468 | ||
@@ -2479,7 +2479,7 @@ unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr) | |||
2479 | case 4: | 2479 | case 4: |
2480 | return vcpu->arch.cr4; | 2480 | return vcpu->arch.cr4; |
2481 | case 8: | 2481 | case 8: |
2482 | return get_cr8(vcpu); | 2482 | return kvm_get_cr8(vcpu); |
2483 | default: | 2483 | default: |
2484 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); | 2484 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); |
2485 | return 0; | 2485 | return 0; |
@@ -2491,20 +2491,20 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val, | |||
2491 | { | 2491 | { |
2492 | switch (cr) { | 2492 | switch (cr) { |
2493 | case 0: | 2493 | case 0: |
2494 | set_cr0(vcpu, mk_cr_64(vcpu->arch.cr0, val)); | 2494 | kvm_set_cr0(vcpu, mk_cr_64(vcpu->arch.cr0, val)); |
2495 | *rflags = kvm_x86_ops->get_rflags(vcpu); | 2495 | *rflags = kvm_x86_ops->get_rflags(vcpu); |
2496 | break; | 2496 | break; |
2497 | case 2: | 2497 | case 2: |
2498 | vcpu->arch.cr2 = val; | 2498 | vcpu->arch.cr2 = val; |
2499 | break; | 2499 | break; |
2500 | case 3: | 2500 | case 3: |
2501 | set_cr3(vcpu, val); | 2501 | kvm_set_cr3(vcpu, val); |
2502 | break; | 2502 | break; |
2503 | case 4: | 2503 | case 4: |
2504 | set_cr4(vcpu, mk_cr_64(vcpu->arch.cr4, val)); | 2504 | kvm_set_cr4(vcpu, mk_cr_64(vcpu->arch.cr4, val)); |
2505 | break; | 2505 | break; |
2506 | case 8: | 2506 | case 8: |
2507 | set_cr8(vcpu, val & 0xfUL); | 2507 | kvm_set_cr8(vcpu, val & 0xfUL); |
2508 | break; | 2508 | break; |
2509 | default: | 2509 | default: |
2510 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); | 2510 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); |
@@ -2602,7 +2602,7 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu, | |||
2602 | struct kvm_run *kvm_run) | 2602 | struct kvm_run *kvm_run) |
2603 | { | 2603 | { |
2604 | kvm_run->if_flag = (kvm_x86_ops->get_rflags(vcpu) & X86_EFLAGS_IF) != 0; | 2604 | kvm_run->if_flag = (kvm_x86_ops->get_rflags(vcpu) & X86_EFLAGS_IF) != 0; |
2605 | kvm_run->cr8 = get_cr8(vcpu); | 2605 | kvm_run->cr8 = kvm_get_cr8(vcpu); |
2606 | kvm_run->apic_base = kvm_get_apic_base(vcpu); | 2606 | kvm_run->apic_base = kvm_get_apic_base(vcpu); |
2607 | if (irqchip_in_kernel(vcpu->kvm)) | 2607 | if (irqchip_in_kernel(vcpu->kvm)) |
2608 | kvm_run->ready_for_interrupt_injection = 1; | 2608 | kvm_run->ready_for_interrupt_injection = 1; |
@@ -2803,7 +2803,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2803 | 2803 | ||
2804 | /* re-sync apic's tpr */ | 2804 | /* re-sync apic's tpr */ |
2805 | if (!irqchip_in_kernel(vcpu->kvm)) | 2805 | if (!irqchip_in_kernel(vcpu->kvm)) |
2806 | set_cr8(vcpu, kvm_run->cr8); | 2806 | kvm_set_cr8(vcpu, kvm_run->cr8); |
2807 | 2807 | ||
2808 | if (vcpu->arch.pio.cur_count) { | 2808 | if (vcpu->arch.pio.cur_count) { |
2809 | r = complete_pio(vcpu); | 2809 | r = complete_pio(vcpu); |
@@ -2961,7 +2961,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
2961 | sregs->cr2 = vcpu->arch.cr2; | 2961 | sregs->cr2 = vcpu->arch.cr2; |
2962 | sregs->cr3 = vcpu->arch.cr3; | 2962 | sregs->cr3 = vcpu->arch.cr3; |
2963 | sregs->cr4 = vcpu->arch.cr4; | 2963 | sregs->cr4 = vcpu->arch.cr4; |
2964 | sregs->cr8 = get_cr8(vcpu); | 2964 | sregs->cr8 = kvm_get_cr8(vcpu); |
2965 | sregs->efer = vcpu->arch.shadow_efer; | 2965 | sregs->efer = vcpu->arch.shadow_efer; |
2966 | sregs->apic_base = kvm_get_apic_base(vcpu); | 2966 | sregs->apic_base = kvm_get_apic_base(vcpu); |
2967 | 2967 | ||
@@ -3007,7 +3007,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
3007 | mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3; | 3007 | mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3; |
3008 | vcpu->arch.cr3 = sregs->cr3; | 3008 | vcpu->arch.cr3 = sregs->cr3; |
3009 | 3009 | ||
3010 | set_cr8(vcpu, sregs->cr8); | 3010 | kvm_set_cr8(vcpu, sregs->cr8); |
3011 | 3011 | ||
3012 | mmu_reset_needed |= vcpu->arch.shadow_efer != sregs->efer; | 3012 | mmu_reset_needed |= vcpu->arch.shadow_efer != sregs->efer; |
3013 | kvm_x86_ops->set_efer(vcpu, sregs->efer); | 3013 | kvm_x86_ops->set_efer(vcpu, sregs->efer); |