mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 09:26:42 +07:00
eb50439b92
It turns out that the logical CPU mapping is useful even when !CONFIG_SMP for manipulation of devices like interrupt and power controllers when running a UP kernel on a CPU other than 0. This can happen when kexecing a UP image from an SMP kernel. In the future, multi-cluster systems running AMP configurations will require something similar for mapping cluster IDs, so it makes sense to decouple this logic in preparation for this support. Acked-by: Yang Bai <hamo.by@gmail.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Reported-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
93 lines
1.9 KiB
C
93 lines
1.9 KiB
C
/*
|
|
* Copyright (C) 2002 ARM Ltd.
|
|
* All Rights Reserved
|
|
*
|
|
* 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/kernel.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/smp.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/smp_plat.h>
|
|
|
|
extern volatile int pen_release;
|
|
|
|
static inline void cpu_enter_lowpower(void)
|
|
{
|
|
/* Just flush the cache. Changing the coherency is not yet
|
|
* available on msm. */
|
|
flush_cache_all();
|
|
}
|
|
|
|
static inline void cpu_leave_lowpower(void)
|
|
{
|
|
}
|
|
|
|
static inline void platform_do_lowpower(unsigned int cpu)
|
|
{
|
|
/* Just enter wfi for now. TODO: Properly shut off the cpu. */
|
|
for (;;) {
|
|
/*
|
|
* here's the WFI
|
|
*/
|
|
asm("wfi"
|
|
:
|
|
:
|
|
: "memory", "cc");
|
|
|
|
if (pen_release == cpu_logical_map(cpu)) {
|
|
/*
|
|
* OK, proper wakeup, we're done
|
|
*/
|
|
break;
|
|
}
|
|
|
|
/*
|
|
* getting here, means that we have come out of WFI without
|
|
* having been woken up - this shouldn't happen
|
|
*
|
|
* The trouble is, letting people know about this is not really
|
|
* possible, since we are currently running incoherently, and
|
|
* therefore cannot safely call printk() or anything else
|
|
*/
|
|
pr_debug("CPU%u: spurious wakeup call\n", cpu);
|
|
}
|
|
}
|
|
|
|
int platform_cpu_kill(unsigned int cpu)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* platform-specific code to shutdown a CPU
|
|
*
|
|
* Called with IRQs disabled
|
|
*/
|
|
void platform_cpu_die(unsigned int cpu)
|
|
{
|
|
/*
|
|
* we're ready for shutdown now, so do it
|
|
*/
|
|
cpu_enter_lowpower();
|
|
platform_do_lowpower(cpu);
|
|
|
|
/*
|
|
* bring this CPU back into the world of cache
|
|
* coherency, and then restore interrupts
|
|
*/
|
|
cpu_leave_lowpower();
|
|
}
|
|
|
|
int platform_cpu_disable(unsigned int cpu)
|
|
{
|
|
/*
|
|
* we don't allow CPU 0 to be shutdown (it is still too special
|
|
* e.g. clock tick interrupts)
|
|
*/
|
|
return cpu == 0 ? -EPERM : 0;
|
|
}
|