From: Ashok Raj <ashok.raj@intel.com>
To: Andi Kleen <ak@muc.de>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, discuss@x86-64.org,
Len Brown <len.brown@intel.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
Ashok Raj <ashok.raj@intel.com>
Subject: [patch 3/5] Support physical cpu hotplug for x86_64.
Date: Tue, 28 Feb 2006 16:16:00 -0800 [thread overview]
Message-ID: <20060301001722.845609000@araj-sfield> (raw)
In-Reply-To: <20060301001557.318047000@araj-sfield>
[-- Attachment #1: x86_64-physical-cpu-hotplug.patch --]
[-- Type: text/plain, Size: 2661 bytes --]
This patch enables ACPI based physical CPU hotplug support for x86_64.
Implements acpi_map_lsapic() and acpi_unmap_lsapic() to support
physical cpu hotplug.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
------------------------------------------------------------------
arch/i386/kernel/acpi/boot.c | 69 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 65 insertions(+), 4 deletions(-)
Index: linux-2.6.16-rc4-mm1/arch/i386/kernel/acpi/boot.c
===================================================================
--- linux-2.6.16-rc4-mm1.orig/arch/i386/kernel/acpi/boot.c
+++ linux-2.6.16-rc4-mm1/arch/i386/kernel/acpi/boot.c
@@ -25,6 +25,7 @@
#include <linux/init.h>
#include <linux/config.h>
+#include <linux/cpumask.h>
#include <linux/acpi.h>
#include <linux/efi.h>
#include <linux/module.h>
@@ -505,16 +506,76 @@ EXPORT_SYMBOL(acpi_register_gsi);
#ifdef CONFIG_ACPI_HOTPLUG_CPU
int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{
- /* TBD */
- return -EINVAL;
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
+ struct acpi_table_lapic *lapic;
+ cpumask_t tmp_map, new_map;
+ u8 physid;
+ int cpu;
+
+ if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
+ return -EINVAL;
+
+ if (!buffer.length || !buffer.pointer)
+ return -EINVAL;
+
+ obj = buffer.pointer;
+ if (obj->type != ACPI_TYPE_BUFFER ||
+ obj->buffer.length < sizeof(*lapic)) {
+ acpi_os_free(buffer.pointer);
+ return -EINVAL;
+ }
+
+ lapic = (struct acpi_table_lapic *)obj->buffer.pointer;
+
+ if ((lapic->header.type != ACPI_MADT_LAPIC) ||
+ (!lapic->flags.enabled)) {
+ acpi_os_free(buffer.pointer);
+ return -EINVAL;
+ }
+
+ physid = lapic->id;
+
+ acpi_os_free(buffer.pointer);
+ buffer.length = ACPI_ALLOCATE_BUFFER;
+ buffer.pointer = NULL;
+
+ tmp_map = cpu_present_map;
+ mp_register_lapic(physid, lapic->flags.enabled);
+
+ /*
+ * If mp_register_lapic successfully generates a new logical cpu
+ * number, then the following will get us exactly what was mapped
+ */
+ cpus_andnot(new_map, cpu_present_map, tmp_map);
+ if (cpus_empty(new_map)) {
+ printk ("Unable to map lapic to logical cpu number\n");
+ return -EINVAL;
+ }
+
+ cpu = first_cpu(new_map);
+
+ *pcpu = cpu;
+ return 0;
}
EXPORT_SYMBOL(acpi_map_lsapic);
int acpi_unmap_lsapic(int cpu)
{
- /* TBD */
- return -EINVAL;
+ int i;
+
+ for_each_cpu(i) {
+ if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) {
+ x86_acpiid_to_apicid[i] = -1;
+ break;
+ }
+ }
+ x86_cpu_to_apicid[cpu] = -1;
+ cpu_clear(cpu, cpu_present_map);
+ num_processors--;
+
+ return (0);
}
EXPORT_SYMBOL(acpi_unmap_lsapic);
--
next prev parent reply other threads:[~2006-02-28 23:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-01 0:15 [patch 0/5] ACPI based physical CPU hotplug support " Ashok Raj
2006-03-01 0:15 ` [patch 1/5] Remove entries in /sys/firmware/acpi for processor also Ashok Raj
2006-03-01 0:15 ` [patch 2/5] Remove unnecessary lapic definition from acpidef.h Ashok Raj
2006-03-01 12:54 ` Andi Kleen
2006-03-01 0:16 ` Ashok Raj [this message]
2006-03-01 0:16 ` [patch 4/5] Patch to limit present cpus to fake cpu hot-add testing Ashok Raj
2006-03-01 0:16 ` [patch 5/5] Enable SCI_EMULATE to manually simulate physical hotplug testing Ashok Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060301001722.845609000@araj-sfield \
--to=ashok.raj@intel.com \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=discuss@x86-64.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®