forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: kernel: introduce cpu_init_idle CPU operation
The CPUidle subsystem on ARM64 machines requires the idle states implementation back-end to initialize idle states parameter upon boot. This patch adds a hook in the CPU operations structure that should be initialized by the CPU operations back-end in order to provide a function that initializes cpu idle states. This patch also adds the infrastructure to arm64 kernel required to export the CPU operations based initialization interface, so that drivers (ie CPUidle) can use it when they are initialized at probe time. Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __ASM_CPUIDLE_H | ||
#define __ASM_CPUIDLE_H | ||
|
||
#ifdef CONFIG_CPU_IDLE | ||
extern int cpu_init_idle(unsigned int cpu); | ||
#else | ||
static inline int cpu_init_idle(unsigned int cpu) | ||
{ | ||
return -EOPNOTSUPP; | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* ARM64 CPU idle arch support | ||
* | ||
* Copyright (C) 2014 ARM Ltd. | ||
* Author: Lorenzo Pieralisi <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/of.h> | ||
#include <linux/of_device.h> | ||
|
||
#include <asm/cpuidle.h> | ||
#include <asm/cpu_ops.h> | ||
|
||
int cpu_init_idle(unsigned int cpu) | ||
{ | ||
int ret = -EOPNOTSUPP; | ||
struct device_node *cpu_node = of_cpu_device_node_get(cpu); | ||
|
||
if (!cpu_node) | ||
return -ENODEV; | ||
|
||
if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle) | ||
ret = cpu_ops[cpu]->cpu_init_idle(cpu_node, cpu); | ||
|
||
of_node_put(cpu_node); | ||
return ret; | ||
} |