diff options
author | Xiantao Zhang <xiantao.zhang@intel.com> | 2008-11-21 07:58:11 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:54:59 -0500 |
commit | 7d637978151511148912fe2ea2bac9f9c64f5c35 (patch) | |
tree | 22e335962c537535f3afae23f5f46b76b7d6e248 /arch/ia64/kvm | |
parent | d176720d34c72f7a8474a12204add93e54fe3ef1 (diff) |
KVM: ia64: Define printk function for kvm-intel module
kvm-intel module is relocated to an isolated address space
with kernel, so it can't call host kernel's printk for debug
purpose. In the module, we implement the printk to output debug
info of vmm.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/ia64/kvm')
-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 |
4 files changed, 50 insertions, 1 deletions
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) |