mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-18 08:35:08 +08:00
89b3098703
Current arch_cpu_idle() is called with IRQs disabled, but will return with IRQs enabled. However, the very first thing the generic code does after calling arch_cpu_idle() is raw_local_irq_disable(). This means that architectures that can idle with IRQs disabled end up doing a pointless 'enable-disable' dance. Therefore, push this IRQ disabling into the idle function, meaning that those architectures can avoid the pointless IRQ state flipping. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Tony Lindgren <tony@atomide.com> Tested-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Acked-by: Mark Rutland <mark.rutland@arm.com> [arm64] Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Guo Ren <guoren@kernel.org> Acked-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20230112195540.618076436@infradead.org
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Gemini Device Tree boot support
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/system_misc.h>
|
|
#include <asm/proc-fns.h>
|
|
|
|
#ifdef CONFIG_DEBUG_GEMINI
|
|
/* This is needed for LL-debug/earlyprintk/debug-macro.S */
|
|
static struct map_desc gemini_io_desc[] __initdata = {
|
|
{
|
|
.virtual = CONFIG_DEBUG_UART_VIRT,
|
|
.pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
|
|
.length = SZ_4K,
|
|
.type = MT_DEVICE,
|
|
},
|
|
};
|
|
|
|
static void __init gemini_map_io(void)
|
|
{
|
|
iotable_init(gemini_io_desc, ARRAY_SIZE(gemini_io_desc));
|
|
}
|
|
#else
|
|
#define gemini_map_io NULL
|
|
#endif
|
|
|
|
static void gemini_idle(void)
|
|
{
|
|
/*
|
|
* Because of broken hardware we have to enable interrupts or the CPU
|
|
* will never wakeup... Acctualy it is not very good to enable
|
|
* interrupts first since scheduler can miss a tick, but there is
|
|
* no other way around this. Platforms that needs it for power saving
|
|
* should enable it in init code, since by default it is
|
|
* disabled.
|
|
*/
|
|
|
|
/* FIXME: Enabling interrupts here is racy! */
|
|
raw_local_irq_enable();
|
|
cpu_do_idle();
|
|
raw_local_irq_disable();
|
|
}
|
|
|
|
static void __init gemini_init_machine(void)
|
|
{
|
|
arm_pm_idle = gemini_idle;
|
|
}
|
|
|
|
static const char *gemini_board_compat[] = {
|
|
"cortina,gemini",
|
|
NULL,
|
|
};
|
|
|
|
DT_MACHINE_START(GEMINI_DT, "Gemini (Device Tree)")
|
|
.map_io = gemini_map_io,
|
|
.init_machine = gemini_init_machine,
|
|
.dt_compat = gemini_board_compat,
|
|
MACHINE_END
|