2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2007-10-13 09:10:53 +08:00
|
|
|
* Populate sysfs with topology information
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Written by: Matthew Dobson, IBM Corporation
|
|
|
|
* Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002, IBM Corp.
|
|
|
|
*
|
2006-02-25 05:04:27 +08:00
|
|
|
* All rights reserved.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
|
|
* NON INFRINGEMENT. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* Send feedback to <colpatch@us.ibm.com>
|
|
|
|
*/
|
2020-12-11 03:25:37 +08:00
|
|
|
#include <linux/interrupt.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/nodemask.h>
|
2011-05-27 00:22:53 +08:00
|
|
|
#include <linux/export.h>
|
2006-09-26 16:52:35 +08:00
|
|
|
#include <linux/mmzone.h>
|
2009-03-21 19:25:24 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/smp.h>
|
2012-11-14 03:32:40 +08:00
|
|
|
#include <linux/irq.h>
|
2020-08-06 20:34:32 +08:00
|
|
|
#include <asm/io_apic.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/cpu.h>
|
|
|
|
|
2008-01-30 20:33:11 +08:00
|
|
|
static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-01-30 20:33:37 +08:00
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
2023-05-13 05:07:04 +08:00
|
|
|
int arch_register_cpu(int cpu)
|
2012-11-14 03:32:51 +08:00
|
|
|
{
|
2023-05-13 05:07:04 +08:00
|
|
|
struct x86_cpu *xc = per_cpu_ptr(&cpu_devices, cpu);
|
2012-11-14 03:32:51 +08:00
|
|
|
|
2023-05-13 05:07:04 +08:00
|
|
|
xc->cpu.hotpluggable = cpu > 0;
|
|
|
|
return register_cpu(&xc->cpu, cpu);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-01-30 20:33:37 +08:00
|
|
|
EXPORT_SYMBOL(arch_register_cpu);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-12-05 00:19:07 +08:00
|
|
|
void arch_unregister_cpu(int num)
|
|
|
|
{
|
2008-02-10 06:24:08 +08:00
|
|
|
unregister_cpu(&per_cpu(cpu_devices, num).cpu);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(arch_unregister_cpu);
|
2009-03-21 19:25:24 +08:00
|
|
|
#else /* CONFIG_HOTPLUG_CPU */
|
|
|
|
|
2008-02-02 00:49:43 +08:00
|
|
|
static int __init arch_register_cpu(int num)
|
2008-01-30 20:33:37 +08:00
|
|
|
{
|
|
|
|
return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
|
|
|
|
}
|
2009-03-21 19:25:24 +08:00
|
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static int __init topology_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2005-09-07 06:16:19 +08:00
|
|
|
for_each_present_cpu(i)
|
2005-06-26 05:55:00 +08:00
|
|
|
arch_register_cpu(i);
|
2009-03-21 19:25:24 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
subsys_initcall(topology_init);
|