Commit | Line | Data |
---|---|---|
0cf1bfd2 MT |
1 | /* |
2 | * KVM paravirt_ops implementation | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | * | |
18 | * Copyright (C) 2007, Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | |
19 | * Copyright IBM Corporation, 2007 | |
20 | * Authors: Anthony Liguori <aliguori@us.ibm.com> | |
21 | */ | |
22 | ||
23 | #include <linux/module.h> | |
24 | #include <linux/kernel.h> | |
25 | #include <linux/kvm_para.h> | |
26 | #include <linux/cpu.h> | |
27 | #include <linux/mm.h> | |
28 | ||
29 | /* | |
30 | * No need for any "IO delay" on KVM | |
31 | */ | |
32 | static void kvm_io_delay(void) | |
33 | { | |
34 | } | |
35 | ||
36 | static void paravirt_ops_setup(void) | |
37 | { | |
38 | pv_info.name = "KVM"; | |
39 | pv_info.paravirt_enabled = 1; | |
40 | ||
41 | if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY)) | |
42 | pv_cpu_ops.io_delay = kvm_io_delay; | |
43 | ||
44 | } | |
45 | ||
46 | void __init kvm_guest_init(void) | |
47 | { | |
48 | if (!kvm_para_available()) | |
49 | return; | |
50 | ||
51 | paravirt_ops_setup(); | |
52 | } |