aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/pcpu.c
diff options
context:
space:
mode:
authorLiu Jinsong <jinsong.liu@intel.com>2013-01-25 02:43:34 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-02-19 22:02:29 -0500
commit39adc483d378f79711f291539f20e3797337892d (patch)
tree7f045e2f284864f5f16cb3b072d2cb25e6e16801 /drivers/xen/pcpu.c
parent40a58637a4fa10a2faea71f0f30ff0b3d74c6e00 (diff)
xen/acpi: ACPI cpu hotplug
This patch implement real Xen ACPI cpu hotplug driver as module. When loaded, it replaces Xen stub driver. For booting existed cpus, the driver enumerates them. For hotadded cpus, which added at runtime and notify OS via device or container event, the driver is invoked to add them, parsing cpu information, hypercalling to Xen hypervisor to add them, and finally setting up new /sys interface for them. Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/pcpu.c')
-rw-r--r--drivers/xen/pcpu.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/xen/pcpu.c b/drivers/xen/pcpu.c
index 067fcfa1723e..0836a18675b1 100644
--- a/drivers/xen/pcpu.c
+++ b/drivers/xen/pcpu.c
@@ -333,6 +333,41 @@ static irqreturn_t xen_pcpu_interrupt(int irq, void *dev_id)
333 return IRQ_HANDLED; 333 return IRQ_HANDLED;
334} 334}
335 335
336/* Sync with Xen hypervisor after cpu hotadded */
337void xen_pcpu_hotplug_sync(void)
338{
339 schedule_work(&xen_pcpu_work);
340}
341EXPORT_SYMBOL_GPL(xen_pcpu_hotplug_sync);
342
343/*
344 * For hypervisor presented cpu, return logic cpu id;
345 * For hypervisor non-presented cpu, return -ENODEV.
346 */
347int xen_pcpu_id(uint32_t acpi_id)
348{
349 int cpu_id = 0, max_id = 0;
350 struct xen_platform_op op;
351
352 op.cmd = XENPF_get_cpuinfo;
353 while (cpu_id <= max_id) {
354 op.u.pcpu_info.xen_cpuid = cpu_id;
355 if (HYPERVISOR_dom0_op(&op)) {
356 cpu_id++;
357 continue;
358 }
359
360 if (acpi_id == op.u.pcpu_info.acpi_id)
361 return cpu_id;
362 if (op.u.pcpu_info.max_present > max_id)
363 max_id = op.u.pcpu_info.max_present;
364 cpu_id++;
365 }
366
367 return -ENODEV;
368}
369EXPORT_SYMBOL_GPL(xen_pcpu_id);
370
336static int __init xen_pcpu_init(void) 371static int __init xen_pcpu_init(void)
337{ 372{
338 int irq, ret; 373 int irq, ret;