diff options
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/include/asm/kvm_host.h | 4 | ||||
-rw-r--r-- | arch/ia64/kvm/Makefile | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 8 | ||||
-rw-r--r-- | arch/ia64/kvm/kvm_lib.c | 15 | ||||
-rw-r--r-- | arch/ia64/kvm/vmm.c | 26 |
5 files changed, 54 insertions, 1 deletions
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h index 678e2646a500..0560f3fae538 100644 --- a/arch/ia64/include/asm/kvm_host.h +++ b/arch/ia64/include/asm/kvm_host.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #define EXIT_REASON_EXTERNAL_INTERRUPT 6 | 39 | #define EXIT_REASON_EXTERNAL_INTERRUPT 6 |
40 | #define EXIT_REASON_IPI 7 | 40 | #define EXIT_REASON_IPI 7 |
41 | #define EXIT_REASON_PTC_G 8 | 41 | #define EXIT_REASON_PTC_G 8 |
42 | #define EXIT_REASON_DEBUG 20 | ||
42 | 43 | ||
43 | /*Define vmm address space and vm data space.*/ | 44 | /*Define vmm address space and vm data space.*/ |
44 | #define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20) | 45 | #define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20) |
@@ -126,6 +127,8 @@ | |||
126 | KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data) | 127 | KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data) |
127 | #define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT) | 128 | #define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT) |
128 | 129 | ||
130 | #define VMM_LOG_LEN 256 | ||
131 | |||
129 | #include <linux/types.h> | 132 | #include <linux/types.h> |
130 | #include <linux/mm.h> | 133 | #include <linux/mm.h> |
131 | #include <linux/kvm.h> | 134 | #include <linux/kvm.h> |
@@ -437,6 +440,7 @@ struct kvm_vcpu_arch { | |||
437 | 440 | ||
438 | unsigned long opcode; | 441 | unsigned long opcode; |
439 | unsigned long cause; | 442 | unsigned long cause; |
443 | char log_buf[VMM_LOG_LEN]; | ||
440 | union context host; | 444 | union context host; |
441 | union context guest; | 445 | union context guest; |
442 | }; | 446 | }; |
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile index 92cef66ca268..76464dc312e6 100644 --- a/arch/ia64/kvm/Makefile +++ b/arch/ia64/kvm/Makefile | |||
@@ -60,7 +60,7 @@ obj-$(CONFIG_KVM) += kvm.o | |||
60 | 60 | ||
61 | CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 | 61 | CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 |
62 | kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ | 62 | kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ |
63 | vtlb.o process.o | 63 | vtlb.o process.o kvm_lib.o |
64 | #Add link memcpy and memset to avoid possible structure assignment error | 64 | #Add link memcpy and memset to avoid possible structure assignment error |
65 | kvm-intel-objs += memcpy.o memset.o | 65 | kvm-intel-objs += memcpy.o memset.o |
66 | obj-$(CONFIG_KVM_INTEL) += kvm-intel.o | 66 | obj-$(CONFIG_KVM_INTEL) += kvm-intel.o |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 70eb829767f4..b4d24e2cce40 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -474,6 +474,13 @@ static int handle_external_interrupt(struct kvm_vcpu *vcpu, | |||
474 | return 1; | 474 | return 1; |
475 | } | 475 | } |
476 | 476 | ||
477 | static int handle_vcpu_debug(struct kvm_vcpu *vcpu, | ||
478 | struct kvm_run *kvm_run) | ||
479 | { | ||
480 | printk("VMM: %s", vcpu->arch.log_buf); | ||
481 | return 1; | ||
482 | } | ||
483 | |||
477 | static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu, | 484 | static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu, |
478 | struct kvm_run *kvm_run) = { | 485 | struct kvm_run *kvm_run) = { |
479 | [EXIT_REASON_VM_PANIC] = handle_vm_error, | 486 | [EXIT_REASON_VM_PANIC] = handle_vm_error, |
@@ -485,6 +492,7 @@ static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
485 | [EXIT_REASON_EXTERNAL_INTERRUPT] = handle_external_interrupt, | 492 | [EXIT_REASON_EXTERNAL_INTERRUPT] = handle_external_interrupt, |
486 | [EXIT_REASON_IPI] = handle_ipi, | 493 | [EXIT_REASON_IPI] = handle_ipi, |
487 | [EXIT_REASON_PTC_G] = handle_global_purge, | 494 | [EXIT_REASON_PTC_G] = handle_global_purge, |
495 | [EXIT_REASON_DEBUG] = handle_vcpu_debug, | ||
488 | 496 | ||
489 | }; | 497 | }; |
490 | 498 | ||
diff --git a/arch/ia64/kvm/kvm_lib.c b/arch/ia64/kvm/kvm_lib.c new file mode 100644 index 000000000000..a85cb611ecd7 --- /dev/null +++ b/arch/ia64/kvm/kvm_lib.c | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * kvm_lib.c: Compile some libraries for kvm-intel module. | ||
3 | * | ||
4 | * Just include kernel's library, and disable symbols export. | ||
5 | * Copyright (C) 2008, Intel Corporation. | ||
6 | * Xiantao Zhang (xiantao.zhang@intel.com) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | #undef CONFIG_MODULES | ||
14 | #include "../../../lib/vsprintf.c" | ||
15 | #include "../../../lib/ctype.c" | ||
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c index 2275bf4e681a..957779593c2f 100644 --- a/arch/ia64/kvm/vmm.c +++ b/arch/ia64/kvm/vmm.c | |||
@@ -62,5 +62,31 @@ void vmm_spin_unlock(spinlock_t *lock) | |||
62 | { | 62 | { |
63 | _vmm_raw_spin_unlock(lock); | 63 | _vmm_raw_spin_unlock(lock); |
64 | } | 64 | } |
65 | |||
66 | static void vcpu_debug_exit(struct kvm_vcpu *vcpu) | ||
67 | { | ||
68 | struct exit_ctl_data *p = &vcpu->arch.exit_data; | ||
69 | long psr; | ||
70 | |||
71 | local_irq_save(psr); | ||
72 | p->exit_reason = EXIT_REASON_DEBUG; | ||
73 | vmm_transition(vcpu); | ||
74 | local_irq_restore(psr); | ||
75 | } | ||
76 | |||
77 | asmlinkage int printk(const char *fmt, ...) | ||
78 | { | ||
79 | struct kvm_vcpu *vcpu = current_vcpu; | ||
80 | va_list args; | ||
81 | int r; | ||
82 | |||
83 | memset(vcpu->arch.log_buf, 0, VMM_LOG_LEN); | ||
84 | va_start(args, fmt); | ||
85 | r = vsnprintf(vcpu->arch.log_buf, VMM_LOG_LEN, fmt, args); | ||
86 | va_end(args); | ||
87 | vcpu_debug_exit(vcpu); | ||
88 | return r; | ||
89 | } | ||
90 | |||
65 | module_init(kvm_vmm_init) | 91 | module_init(kvm_vmm_init) |
66 | module_exit(kvm_vmm_exit) | 92 | module_exit(kvm_vmm_exit) |