From 0dad15c02d033d6be7e9447fbe5f645d97badc24 Mon Sep 17 00:00:00 2001
From: Liu Jinsong <jinsong.liu@intel.com>
Date: Tue, 13 Dec 2011 21:14:45 +0800
Subject: [PATCH 07/10] xen/acpi: Prepare for cpu hotplug
This patch rebased from Jeremy''s pvops commit
68320323a51c2378aca433c76157d9e66104ff1e
It does some prepare work for cpu hotplug
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
drivers/acpi/processor_xen.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/drivers/acpi/processor_xen.c b/drivers/acpi/processor_xen.c
index 029e10c..38a1c05 100644
--- a/drivers/acpi/processor_xen.c
+++ b/drivers/acpi/processor_xen.c
@@ -19,6 +19,7 @@
#include <acpi/acpi_drivers.h>
#include <acpi/processor.h>
#include <xen/acpi.h>
+#include <xen/pcpu.h>
#define PREFIX "ACPI: "
@@ -54,6 +55,42 @@ struct acpi_driver xen_acpi_processor_driver = {
},
};
+static int is_processor_present(acpi_handle handle)
+{
+ acpi_status status;
+ unsigned long long sta = 0;
+
+
+ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+
+ if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT))
+ return 1;
+
+ /*
+ * _STA is mandatory for a processor that supports hot plug
+ */
+ if (status == AE_NOT_FOUND)
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Processor does not support hot plug\n"));
+ else
+ ACPI_EXCEPTION((AE_INFO, status,
+ "Processor Device is not present"));
+ return 0;
+}
+
+static acpi_status
+xen_acpi_processor_hotadd_init(struct acpi_processor *pr, int *p_cpu)
+{
+ if (!is_processor_present(pr->handle))
+ return AE_ERROR;
+
+ if (processor_cntl_xen_notify(pr,
+ PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD))
+ return AE_ERROR;
+
+ return AE_OK;
+}
+
#ifdef CONFIG_CPU_FREQ
/*
* Existing ACPI module does parse performance states at some point,
--
1.6.5.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel