aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/time.c
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2016-06-30 11:56:38 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2016-07-25 08:32:34 -0400
commitad5475f9faf5186b7f59de2c6481ee3e211f1ed7 (patch)
treedc9c373319bc1f1927ce10d8937292c17af217ed /arch/x86/xen/time.c
parent88e957d6e47f1232ad15b21e54a44f1147ea8c1b (diff)
x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op
HYPERVISOR_vcpu_op() passes Linux's idea of vCPU id as a parameter while Xen's idea is expected. In some cases these ideas diverge so we need to do remapping. Convert all callers of HYPERVISOR_vcpu_op() to use xen_vcpu_nr(). Leave xen_fill_possible_map() and xen_filter_cpu_maps() intact as they're only being called by PV guests before perpu areas are initialized. While the issue could be solved by switching to early_percpu for xen_vcpu_id I think it's not worth it: PV guests will probably never get to the point where their idea of vCPU id diverges from Xen's. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'arch/x86/xen/time.c')
-rw-r--r--arch/x86/xen/time.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index c31006f0f37f..fd7cd6f29b68 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -223,8 +223,10 @@ static int xen_vcpuop_shutdown(struct clock_event_device *evt)
223{ 223{
224 int cpu = smp_processor_id(); 224 int cpu = smp_processor_id();
225 225
226 if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, cpu, NULL) || 226 if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, xen_vcpu_nr(cpu),
227 HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 227 NULL) ||
228 HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
229 NULL))
228 BUG(); 230 BUG();
229 231
230 return 0; 232 return 0;
@@ -234,7 +236,8 @@ static int xen_vcpuop_set_oneshot(struct clock_event_device *evt)
234{ 236{
235 int cpu = smp_processor_id(); 237 int cpu = smp_processor_id();
236 238
237 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 239 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
240 NULL))
238 BUG(); 241 BUG();
239 242
240 return 0; 243 return 0;
@@ -253,7 +256,8 @@ static int xen_vcpuop_set_next_event(unsigned long delta,
253 /* Get an event anyway, even if the timeout is already expired */ 256 /* Get an event anyway, even if the timeout is already expired */
254 single.flags = 0; 257 single.flags = 0;
255 258
256 ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &single); 259 ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, xen_vcpu_nr(cpu),
260 &single);
257 BUG_ON(ret != 0); 261 BUG_ON(ret != 0);
258 262
259 return ret; 263 return ret;
@@ -352,7 +356,8 @@ void xen_timer_resume(void)
352 return; 356 return;
353 357
354 for_each_online_cpu(cpu) { 358 for_each_online_cpu(cpu) {
355 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 359 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
360 xen_vcpu_nr(cpu), NULL))
356 BUG(); 361 BUG();
357 } 362 }
358} 363}
@@ -372,7 +377,8 @@ static void __init xen_time_init(void)
372 377
373 clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC); 378 clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
374 379
375 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) { 380 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
381 NULL) == 0) {
376 /* Successfully turned off 100Hz tick, so we have the 382 /* Successfully turned off 100Hz tick, so we have the
377 vcpuop-based timer interface */ 383 vcpuop-based timer interface */
378 printk(KERN_DEBUG "Xen: using vcpuop timer interface\n"); 384 printk(KERN_DEBUG "Xen: using vcpuop timer interface\n");