diff options
Diffstat (limited to 'drivers/xen/pcpu.c')
-rw-r--r-- | drivers/xen/pcpu.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/xen/pcpu.c b/drivers/xen/pcpu.c index 5a27a4599a4a..6536d5ab1697 100644 --- a/drivers/xen/pcpu.c +++ b/drivers/xen/pcpu.c | |||
@@ -332,6 +332,41 @@ static irqreturn_t xen_pcpu_interrupt(int irq, void *dev_id) | |||
332 | return IRQ_HANDLED; | 332 | return IRQ_HANDLED; |
333 | } | 333 | } |
334 | 334 | ||
335 | /* Sync with Xen hypervisor after cpu hotadded */ | ||
336 | void xen_pcpu_hotplug_sync(void) | ||
337 | { | ||
338 | schedule_work(&xen_pcpu_work); | ||
339 | } | ||
340 | EXPORT_SYMBOL_GPL(xen_pcpu_hotplug_sync); | ||
341 | |||
342 | /* | ||
343 | * For hypervisor presented cpu, return logic cpu id; | ||
344 | * For hypervisor non-presented cpu, return -ENODEV. | ||
345 | */ | ||
346 | int xen_pcpu_id(uint32_t acpi_id) | ||
347 | { | ||
348 | int cpu_id = 0, max_id = 0; | ||
349 | struct xen_platform_op op; | ||
350 | |||
351 | op.cmd = XENPF_get_cpuinfo; | ||
352 | while (cpu_id <= max_id) { | ||
353 | op.u.pcpu_info.xen_cpuid = cpu_id; | ||
354 | if (HYPERVISOR_dom0_op(&op)) { | ||
355 | cpu_id++; | ||
356 | continue; | ||
357 | } | ||
358 | |||
359 | if (acpi_id == op.u.pcpu_info.acpi_id) | ||
360 | return cpu_id; | ||
361 | if (op.u.pcpu_info.max_present > max_id) | ||
362 | max_id = op.u.pcpu_info.max_present; | ||
363 | cpu_id++; | ||
364 | } | ||
365 | |||
366 | return -ENODEV; | ||
367 | } | ||
368 | EXPORT_SYMBOL_GPL(xen_pcpu_id); | ||
369 | |||
335 | static int __init xen_pcpu_init(void) | 370 | static int __init xen_pcpu_init(void) |
336 | { | 371 | { |
337 | int irq, ret; | 372 | int irq, ret; |