Blame view

arch/ia64/kvm/vmm.c 2.3 KB
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  /*
   * vmm.c: vmm module interface with kvm module
   *
   * Copyright (c) 2007, Intel Corporation.
   *
   *  Xiantao Zhang (xiantao.zhang@intel.com)
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms and conditions of the GNU General Public License,
   * version 2, as published by the Free Software Foundation.
   *
   * This program is distributed in the hope it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   * more details.
   *
   * You should have received a copy of the GNU General Public License along with
   * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
   * Place - Suite 330, Boston, MA 02111-1307 USA.
   */
5e2be1983   Xiantao Zhang   KVM: ia64: Add so...
21
  #include<linux/kernel.h>
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
22
23
24
25
26
27
28
29
30
  #include<linux/module.h>
  #include<asm/fpswa.h>
  
  #include "vcpu.h"
  
  MODULE_AUTHOR("Intel");
  MODULE_LICENSE("GPL");
  
  extern char kvm_ia64_ivt;
0b5d7a2cc   Jes Sorensen   KVM: ia64: Drop i...
31
32
  extern char kvm_asm_mov_from_ar;
  extern char kvm_asm_mov_from_ar_sn2;
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
33
  extern fpswa_interface_t *vmm_fpswa_interface;
9f7d5bb5e   Xiantao Zhang   KVM: ia64: Add ha...
34
  long vmm_sanity = 1;
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
35
  struct kvm_vmm_info vmm_info = {
0b5d7a2cc   Jes Sorensen   KVM: ia64: Drop i...
36
37
38
39
40
41
  	.module			= THIS_MODULE,
  	.vmm_entry		= vmm_entry,
  	.tramp_entry		= vmm_trampoline,
  	.vmm_ivt		= (unsigned long)&kvm_ia64_ivt,
  	.patch_mov_ar		= (unsigned long)&kvm_asm_mov_from_ar,
  	.patch_mov_ar_sn2	= (unsigned long)&kvm_asm_mov_from_ar_sn2,
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
42
43
44
45
46
47
48
49
  };
  
  static int __init  kvm_vmm_init(void)
  {
  
  	vmm_fpswa_interface = fpswa_interface;
  
  	/*Register vmm data to kvm side*/
0ee75bead   Avi Kivity   KVM: Let vcpu str...
50
  	return kvm_init(&vmm_info, 1024, 0, THIS_MODULE);
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
51
52
53
54
55
56
57
  }
  
  static void __exit kvm_vmm_exit(void)
  {
  	kvm_exit();
  	return ;
  }
a662b8135   Tony Luck   KVM: ia64: fix bu...
58
  void vmm_spin_lock(vmm_spinlock_t *lock)
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
59
60
61
  {
  	_vmm_raw_spin_lock(lock);
  }
a662b8135   Tony Luck   KVM: ia64: fix bu...
62
  void vmm_spin_unlock(vmm_spinlock_t *lock)
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
63
64
65
  {
  	_vmm_raw_spin_unlock(lock);
  }
7d6379781   Xiantao Zhang   KVM: ia64: Define...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  
  static void vcpu_debug_exit(struct kvm_vcpu *vcpu)
  {
  	struct exit_ctl_data *p = &vcpu->arch.exit_data;
  	long psr;
  
  	local_irq_save(psr);
  	p->exit_reason = EXIT_REASON_DEBUG;
  	vmm_transition(vcpu);
  	local_irq_restore(psr);
  }
  
  asmlinkage int printk(const char *fmt, ...)
  {
  	struct kvm_vcpu *vcpu = current_vcpu;
  	va_list args;
  	int r;
  
  	memset(vcpu->arch.log_buf, 0, VMM_LOG_LEN);
  	va_start(args, fmt);
  	r = vsnprintf(vcpu->arch.log_buf, VMM_LOG_LEN, fmt, args);
  	va_end(args);
  	vcpu_debug_exit(vcpu);
  	return r;
  }
bb46fb4af   Xiantao Zhang   KVM: ia64: VMM mo...
91
92
  module_init(kvm_vmm_init)
  module_exit(kvm_vmm_exit)