diff options
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/hypervisor.c | 11 | ||||
-rw-r--r-- | include/linux/hypervisor.h | 17 | ||||
-rw-r--r-- | kernel/smp.c | 1 | ||||
-rw-r--r-- | kernel/up.c | 1 |
6 files changed, 35 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index db814a89599c..95151aab3445 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -8845,6 +8845,7 @@ S: Supported | |||
8845 | F: Documentation/virtual/paravirt_ops.txt | 8845 | F: Documentation/virtual/paravirt_ops.txt |
8846 | F: arch/*/kernel/paravirt* | 8846 | F: arch/*/kernel/paravirt* |
8847 | F: arch/*/include/asm/paravirt.h | 8847 | F: arch/*/include/asm/paravirt.h |
8848 | F: include/linux/hypervisor.h | ||
8848 | 8849 | ||
8849 | PARIDE DRIVERS FOR PARALLEL PORT IDE DEVICES | 8850 | PARIDE DRIVERS FOR PARALLEL PORT IDE DEVICES |
8850 | M: Tim Waugh <tim@cyberelk.net> | 8851 | M: Tim Waugh <tim@cyberelk.net> |
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 055ea9941dd5..67942b6ad4b7 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -43,6 +43,9 @@ struct hypervisor_x86 { | |||
43 | 43 | ||
44 | /* X2APIC detection (run once per boot) */ | 44 | /* X2APIC detection (run once per boot) */ |
45 | bool (*x2apic_available)(void); | 45 | bool (*x2apic_available)(void); |
46 | |||
47 | /* pin current vcpu to specified physical cpu (run rarely) */ | ||
48 | void (*pin_vcpu)(int); | ||
46 | }; | 49 | }; |
47 | 50 | ||
48 | extern const struct hypervisor_x86 *x86_hyper; | 51 | extern const struct hypervisor_x86 *x86_hyper; |
@@ -56,6 +59,7 @@ extern const struct hypervisor_x86 x86_hyper_kvm; | |||
56 | extern void init_hypervisor(struct cpuinfo_x86 *c); | 59 | extern void init_hypervisor(struct cpuinfo_x86 *c); |
57 | extern void init_hypervisor_platform(void); | 60 | extern void init_hypervisor_platform(void); |
58 | extern bool hypervisor_x2apic_available(void); | 61 | extern bool hypervisor_x2apic_available(void); |
62 | extern void hypervisor_pin_vcpu(int cpu); | ||
59 | #else | 63 | #else |
60 | static inline void init_hypervisor(struct cpuinfo_x86 *c) { } | 64 | static inline void init_hypervisor(struct cpuinfo_x86 *c) { } |
61 | static inline void init_hypervisor_platform(void) { } | 65 | static inline void init_hypervisor_platform(void) { } |
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c index 27e46658ebe3..35691a6b0d32 100644 --- a/arch/x86/kernel/cpu/hypervisor.c +++ b/arch/x86/kernel/cpu/hypervisor.c | |||
@@ -86,3 +86,14 @@ bool __init hypervisor_x2apic_available(void) | |||
86 | x86_hyper->x2apic_available && | 86 | x86_hyper->x2apic_available && |
87 | x86_hyper->x2apic_available(); | 87 | x86_hyper->x2apic_available(); |
88 | } | 88 | } |
89 | |||
90 | void hypervisor_pin_vcpu(int cpu) | ||
91 | { | ||
92 | if (!x86_hyper) | ||
93 | return; | ||
94 | |||
95 | if (x86_hyper->pin_vcpu) | ||
96 | x86_hyper->pin_vcpu(cpu); | ||
97 | else | ||
98 | WARN_ONCE(1, "vcpu pinning requested but not supported!\n"); | ||
99 | } | ||
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h new file mode 100644 index 000000000000..3fa5ef2b3759 --- /dev/null +++ b/include/linux/hypervisor.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __LINUX_HYPEVISOR_H | ||
2 | #define __LINUX_HYPEVISOR_H | ||
3 | |||
4 | /* | ||
5 | * Generic Hypervisor support | ||
6 | * Juergen Gross <jgross@suse.com> | ||
7 | */ | ||
8 | |||
9 | #ifdef CONFIG_HYPERVISOR_GUEST | ||
10 | #include <asm/hypervisor.h> | ||
11 | #else | ||
12 | static inline void hypervisor_pin_vcpu(int cpu) | ||
13 | { | ||
14 | } | ||
15 | #endif | ||
16 | |||
17 | #endif /* __LINUX_HYPEVISOR_H */ | ||
diff --git a/kernel/smp.c b/kernel/smp.c index 3aa642d39c03..4274ca5f3bbc 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
15 | #include <linux/cpu.h> | 15 | #include <linux/cpu.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/hypervisor.h> | ||
17 | 18 | ||
18 | #include "smpboot.h" | 19 | #include "smpboot.h" |
19 | 20 | ||
diff --git a/kernel/up.c b/kernel/up.c index 1760bf3d1463..3ccee2bd13ba 100644 --- a/kernel/up.c +++ b/kernel/up.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/export.h> | 7 | #include <linux/export.h> |
8 | #include <linux/smp.h> | 8 | #include <linux/smp.h> |
9 | #include <linux/hypervisor.h> | ||
9 | 10 | ||
10 | int smp_call_function_single(int cpu, void (*func) (void *info), void *info, | 11 | int smp_call_function_single(int cpu, void (*func) (void *info), void *info, |
11 | int wait) | 12 | int wait) |