diff options
author | Sheng Yang <sheng@linux.intel.com> | 2010-05-14 07:40:51 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-07-22 19:45:59 -0400 |
commit | 38e20b07efd541a959de367dc90a17f92ce2e8a6 (patch) | |
tree | bb087e243bf6e707dd063be2024a3b90de2f9413 /arch/x86/xen/enlighten.c | |
parent | bee6ab53e652a414af20392899879b58cd80d033 (diff) |
x86/xen: event channels delivery on HVM.
Set the callback to receive evtchns from Xen, using the
callback vector delivery mechanism.
The traditional way for receiving event channel notifications from Xen
is via the interrupts from the platform PCI device.
The callback vector is a newer alternative that allow us to receive
notifications on any vcpu and doesn't need any PCI support: we allocate
a vector exclusively to receive events, in the vector handler we don't
need to interact with the vlapic, therefore we avoid a VMEXIT.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r-- | arch/x86/xen/enlighten.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 09b36e9d507a..b211a04c4b2c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 | 11 | * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/cpu.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
@@ -38,6 +39,7 @@ | |||
38 | #include <xen/interface/memory.h> | 39 | #include <xen/interface/memory.h> |
39 | #include <xen/features.h> | 40 | #include <xen/features.h> |
40 | #include <xen/page.h> | 41 | #include <xen/page.h> |
42 | #include <xen/hvm.h> | ||
41 | #include <xen/hvc-console.h> | 43 | #include <xen/hvc-console.h> |
42 | 44 | ||
43 | #include <asm/paravirt.h> | 45 | #include <asm/paravirt.h> |
@@ -80,6 +82,8 @@ struct shared_info xen_dummy_shared_info; | |||
80 | void *xen_initial_gdt; | 82 | void *xen_initial_gdt; |
81 | 83 | ||
82 | RESERVE_BRK(shared_info_page_brk, PAGE_SIZE); | 84 | RESERVE_BRK(shared_info_page_brk, PAGE_SIZE); |
85 | __read_mostly int xen_have_vector_callback; | ||
86 | EXPORT_SYMBOL_GPL(xen_have_vector_callback); | ||
83 | 87 | ||
84 | /* | 88 | /* |
85 | * Point at some empty memory to start with. We map the real shared_info | 89 | * Point at some empty memory to start with. We map the real shared_info |
@@ -1277,6 +1281,24 @@ static void __init init_shared_info(void) | |||
1277 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | 1281 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; |
1278 | } | 1282 | } |
1279 | 1283 | ||
1284 | static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, | ||
1285 | unsigned long action, void *hcpu) | ||
1286 | { | ||
1287 | int cpu = (long)hcpu; | ||
1288 | switch (action) { | ||
1289 | case CPU_UP_PREPARE: | ||
1290 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; | ||
1291 | break; | ||
1292 | default: | ||
1293 | break; | ||
1294 | } | ||
1295 | return NOTIFY_OK; | ||
1296 | } | ||
1297 | |||
1298 | static struct notifier_block __cpuinitdata xen_hvm_cpu_notifier = { | ||
1299 | .notifier_call = xen_hvm_cpu_notify, | ||
1300 | }; | ||
1301 | |||
1280 | static void __init xen_hvm_guest_init(void) | 1302 | static void __init xen_hvm_guest_init(void) |
1281 | { | 1303 | { |
1282 | int r; | 1304 | int r; |
@@ -1287,6 +1309,12 @@ static void __init xen_hvm_guest_init(void) | |||
1287 | return; | 1309 | return; |
1288 | 1310 | ||
1289 | init_shared_info(); | 1311 | init_shared_info(); |
1312 | |||
1313 | if (xen_feature(XENFEAT_hvm_callback_vector)) | ||
1314 | xen_have_vector_callback = 1; | ||
1315 | register_cpu_notifier(&xen_hvm_cpu_notifier); | ||
1316 | have_vcpu_info_placement = 0; | ||
1317 | x86_init.irqs.intr_init = xen_init_IRQ; | ||
1290 | } | 1318 | } |
1291 | 1319 | ||
1292 | static bool __init xen_hvm_platform(void) | 1320 | static bool __init xen_hvm_platform(void) |