164 lines
3.9 KiB
Diff
164 lines
3.9 KiB
Diff
From: Ben Hutchings <ben@decadent.org.uk>
|
|
Date: Tue, 10 Jan 2012 03:04:32 +0000
|
|
Subject: cpu: Register a generic CPU device on architectures that currently
|
|
do not
|
|
|
|
commit 9f13a1fd452f11c18004ba2422a6384b424ec8a9 upstream.
|
|
|
|
frv, h8300, m68k, microblaze, openrisc, score, um and xtensa currently
|
|
do not register a CPU device. Add the config option GENERIC_CPU_DEVICES
|
|
which causes a generic CPU device to be registered for each present CPU,
|
|
and make all these architectures select it.
|
|
|
|
Richard Weinberger <richard@nod.at> covered UML and suggested using
|
|
per_cpu.
|
|
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
---
|
|
arch/frv/Kconfig | 1 +
|
|
arch/h8300/Kconfig | 1 +
|
|
arch/m68k/Kconfig | 1 +
|
|
arch/microblaze/Kconfig | 1 +
|
|
arch/openrisc/Kconfig | 1 +
|
|
arch/score/Kconfig | 1 +
|
|
arch/um/Kconfig.common | 1 +
|
|
arch/xtensa/Kconfig | 1 +
|
|
drivers/base/Kconfig | 4 ++++
|
|
drivers/base/cpu.c | 19 +++++++++++++++++++
|
|
10 files changed, 31 insertions(+)
|
|
|
|
--- a/arch/frv/Kconfig
|
|
+++ b/arch/frv/Kconfig
|
|
@@ -8,6 +8,7 @@
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
select ARCH_HAVE_NMI_SAFE_CMPXCHG
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config ZONE_DMA
|
|
bool
|
|
--- a/arch/h8300/Kconfig
|
|
+++ b/arch/h8300/Kconfig
|
|
@@ -4,6 +4,7 @@
|
|
select HAVE_IDE
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config SYMBOL_PREFIX
|
|
string
|
|
--- a/arch/m68k/Kconfig
|
|
+++ b/arch/m68k/Kconfig
|
|
@@ -7,6 +7,7 @@
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config RWSEM_GENERIC_SPINLOCK
|
|
bool
|
|
--- a/arch/microblaze/Kconfig
|
|
+++ b/arch/microblaze/Kconfig
|
|
@@ -17,6 +17,7 @@
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_PROBE
|
|
select GENERIC_IRQ_SHOW
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config SWAP
|
|
def_bool n
|
|
--- a/arch/openrisc/Kconfig
|
|
+++ b/arch/openrisc/Kconfig
|
|
@@ -15,6 +15,7 @@
|
|
select GENERIC_IRQ_PROBE
|
|
select GENERIC_IRQ_SHOW
|
|
select GENERIC_IOMAP
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config MMU
|
|
def_bool y
|
|
--- a/arch/score/Kconfig
|
|
+++ b/arch/score/Kconfig
|
|
@@ -4,6 +4,7 @@
|
|
def_bool y
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
choice
|
|
prompt "System type"
|
|
--- a/arch/um/Kconfig.common
|
|
+++ b/arch/um/Kconfig.common
|
|
@@ -8,6 +8,7 @@
|
|
default y
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
+ select GENERIC_CPU_DEVICES
|
|
|
|
config MMU
|
|
bool
|
|
--- a/arch/xtensa/Kconfig
|
|
+++ b/arch/xtensa/Kconfig
|
|
@@ -9,6 +9,7 @@
|
|
select HAVE_IDE
|
|
select HAVE_GENERIC_HARDIRQS
|
|
select GENERIC_IRQ_SHOW
|
|
+ select GENERIC_CPU_DEVICES
|
|
help
|
|
Xtensa processors are 32-bit RISC machines designed by Tensilica
|
|
primarily for embedded systems. These processors are both
|
|
--- a/drivers/base/Kconfig
|
|
+++ b/drivers/base/Kconfig
|
|
@@ -172,6 +172,10 @@
|
|
bool
|
|
default n
|
|
|
|
+config GENERIC_CPU_DEVICES
|
|
+ bool
|
|
+ default n
|
|
+
|
|
source "drivers/base/regmap/Kconfig"
|
|
|
|
endmenu
|
|
--- a/drivers/base/cpu.c
|
|
+++ b/drivers/base/cpu.c
|
|
@@ -11,6 +11,7 @@
|
|
#include <linux/device.h>
|
|
#include <linux/node.h>
|
|
#include <linux/gfp.h>
|
|
+#include <linux/percpu.h>
|
|
|
|
#include "base.h"
|
|
|
|
@@ -268,11 +269,29 @@
|
|
NULL,
|
|
};
|
|
|
|
+#ifdef CONFIG_GENERIC_CPU_DEVICES
|
|
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
|
|
+#endif
|
|
+
|
|
+static void __init cpu_dev_register_generic(void)
|
|
+{
|
|
+#ifdef CONFIG_GENERIC_CPU_DEVICES
|
|
+ int i;
|
|
+
|
|
+ for_each_possible_cpu(i) {
|
|
+ if (register_cpu(&per_cpu(cpu_devices, i), i))
|
|
+ panic("Failed to register CPU device");
|
|
+ }
|
|
+#endif
|
|
+}
|
|
+
|
|
void __init cpu_dev_init(void)
|
|
{
|
|
if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
|
|
panic("Failed to register CPU subsystem");
|
|
|
|
+ cpu_dev_register_generic();
|
|
+
|
|
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
|
|
sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
|
|
#endif
|