Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81497953 authored by Russell King's avatar Russell King
Browse files

Merge branch 'psci/for-rmk' of...

Merge branch 'psci/for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux into devel-stable
parents fa8ad788 be120397
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -8066,6 +8066,15 @@ S: Maintained
F:	include/linux/power_supply.h
F:	drivers/power/

POWER STATE COORDINATION INTERFACE (PSCI)
M:	Mark Rutland <mark.rutland@arm.com>
M:	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
L:	linux-arm-kernel@lists.infradead.org
S:	Maintained
F:	drivers/firmware/psci.c
F:	include/linux/psci.h
F:	include/uapi/linux/psci.h

PNP SUPPORT
M:	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
S:	Maintained
+1 −0
Original line number Diff line number Diff line
@@ -1496,6 +1496,7 @@ config HOTPLUG_CPU
config ARM_PSCI
	bool "Support for the ARM Power State Coordination Interface (PSCI)"
	depends on CPU_V7
	select ARM_PSCI_FW
	help
	  Say Y here if you want Linux to communicate with system firmware
	  implementing the PSCI specification for CPU-centric power
+0 −23
Original line number Diff line number Diff line
@@ -14,34 +14,11 @@
#ifndef __ASM_ARM_PSCI_H
#define __ASM_ARM_PSCI_H

#define PSCI_POWER_STATE_TYPE_STANDBY		0
#define PSCI_POWER_STATE_TYPE_POWER_DOWN	1

struct psci_power_state {
	u16	id;
	u8	type;
	u8	affinity_level;
};

struct psci_operations {
	int (*cpu_suspend)(struct psci_power_state state,
			   unsigned long entry_point);
	int (*cpu_off)(struct psci_power_state state);
	int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
	int (*migrate)(unsigned long cpuid);
	int (*affinity_info)(unsigned long target_affinity,
			unsigned long lowest_affinity_level);
	int (*migrate_info_type)(void);
};

extern struct psci_operations psci_ops;
extern struct smp_operations psci_smp_ops;

#ifdef CONFIG_ARM_PSCI
int psci_init(void);
bool psci_smp_available(void);
#else
static inline int psci_init(void) { return 0; }
static inline bool psci_smp_available(void) { return false; }
#endif

+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o

obj-$(CONFIG_ARM_VIRT_EXT)	+= hyp-stub.o
ifeq ($(CONFIG_ARM_PSCI),y)
obj-y				+= psci.o psci-call.o
obj-y				+= psci-call.o
obj-$(CONFIG_SMP)		+= psci_smp.o
endif

+23 −8
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include <linux/smp.h>
#include <linux/of.h>
#include <linux/delay.h>
#include <linux/psci.h>

#include <uapi/linux/psci.h>

#include <asm/psci.h>
@@ -51,19 +53,31 @@ static int psci_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
	if (psci_ops.cpu_on)
		return psci_ops.cpu_on(cpu_logical_map(cpu),
				       __pa(secondary_startup));
					virt_to_idmap(&secondary_startup));
	return -ENODEV;
}

#ifdef CONFIG_HOTPLUG_CPU
int psci_cpu_disable(unsigned int cpu)
{
	/* Fail early if we don't have CPU_OFF support */
	if (!psci_ops.cpu_off)
		return -EOPNOTSUPP;

	/* Trusted OS will deny CPU_OFF */
	if (psci_tos_resident_on(cpu))
		return -EPERM;

	return 0;
}

void __ref psci_cpu_die(unsigned int cpu)
{
       const struct psci_power_state ps = {
               .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
       };
	u32 state = PSCI_POWER_STATE_TYPE_POWER_DOWN <<
		    PSCI_0_2_POWER_STATE_TYPE_SHIFT;

	if (psci_ops.cpu_off)
               psci_ops.cpu_off(ps);
		psci_ops.cpu_off(state);

	/* We should never return */
	panic("psci: cpu %d failed to shutdown\n", cpu);
@@ -109,6 +123,7 @@ bool __init psci_smp_available(void)
struct smp_operations __initdata psci_smp_ops = {
	.smp_boot_secondary	= psci_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
	.cpu_disable		= psci_cpu_disable,
	.cpu_die		= psci_cpu_die,
	.cpu_kill		= psci_cpu_kill,
#endif
Loading