blob: 957779593c2f7f5fd9fd9a833532ad70a9712897 [file] [log] [blame]
Xiantao Zhangbb46fb42008-04-01 14:49:24 +08001/*
2 * vmm.c: vmm module interface with kvm module
3 *
4 * Copyright (c) 2007, Intel Corporation.
5 *
6 * Xiantao Zhang (xiantao.zhang@intel.com)
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place - Suite 330, Boston, MA 02111-1307 USA.
20 */
21
22
23#include<linux/module.h>
24#include<asm/fpswa.h>
25
26#include "vcpu.h"
27
28MODULE_AUTHOR("Intel");
29MODULE_LICENSE("GPL");
30
31extern char kvm_ia64_ivt;
32extern fpswa_interface_t *vmm_fpswa_interface;
33
34struct kvm_vmm_info vmm_info = {
35 .module = THIS_MODULE,
36 .vmm_entry = vmm_entry,
37 .tramp_entry = vmm_trampoline,
38 .vmm_ivt = (unsigned long)&kvm_ia64_ivt,
39};
40
41static int __init kvm_vmm_init(void)
42{
43
44 vmm_fpswa_interface = fpswa_interface;
45
46 /*Register vmm data to kvm side*/
47 return kvm_init(&vmm_info, 1024, THIS_MODULE);
48}
49
50static void __exit kvm_vmm_exit(void)
51{
52 kvm_exit();
53 return ;
54}
55
56void vmm_spin_lock(spinlock_t *lock)
57{
58 _vmm_raw_spin_lock(lock);
59}
60
61void vmm_spin_unlock(spinlock_t *lock)
62{
63 _vmm_raw_spin_unlock(lock);
64}
Xiantao Zhang7d637972008-11-21 20:58:11 +080065
66static 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
77asmlinkage 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
Xiantao Zhangbb46fb42008-04-01 14:49:24 +080091module_init(kvm_vmm_init)
92module_exit(kvm_vmm_exit)