···11+* Power State Coordination Interface (PSCI)22+33+Firmware implementing the PSCI functions described in ARM document number44+ARM DEN 0022A ("Power State Coordination Interface System Software on ARM55+processors") can be used by Linux to initiate various CPU-centric power66+operations.77+88+Issue A of the specification describes functions for CPU suspend, hotplug99+and migration of secure software.1010+1111+Functions are invoked by trapping to the privilege level of the PSCI1212+firmware (specified as part of the binding below) and passing arguments1313+in a manner similar to that specified by AAPCS:1414+1515+ r0 => 32-bit Function ID / return value1616+ {r1 - r3} => Parameters1717+1818+Note that the immediate field of the trapping instruction must be set1919+to #0.2020+2121+2222+Main node required properties:2323+2424+ - compatible : Must be "arm,psci"2525+2626+ - method : The method of calling the PSCI firmware. Permitted2727+ values are:2828+2929+ "smc" : SMC #0, with the register assignments specified3030+ in this binding.3131+3232+ "hvc" : HVC #0, with the register assignments specified3333+ in this binding.3434+3535+Main node optional properties:3636+3737+ - cpu_suspend : Function ID for CPU_SUSPEND operation3838+3939+ - cpu_off : Function ID for CPU_OFF operation4040+4141+ - cpu_on : Function ID for CPU_ON operation4242+4343+ - migrate : Function ID for MIGRATE operation4444+4545+4646+Example:4747+4848+ psci {4949+ compatible = "arm,psci";5050+ method = "smc";5151+ cpu_suspend = <0x95c10000>;5252+ cpu_off = <0x95c10001>;5353+ cpu_on = <0x95c10002>;5454+ migrate = <0x95c10003>;5555+ };
+10
arch/arm/Kconfig
···16221622 Say Y here to experiment with turning CPUs off and on. CPUs16231623 can be controlled through /sys/devices/system/cpu.1624162416251625+config ARM_PSCI16261626+ bool "Support for the ARM Power State Coordination Interface (PSCI)"16271627+ depends on CPU_V716281628+ help16291629+ Say Y here if you want Linux to communicate with system firmware16301630+ implementing the PSCI specification for CPU-centric power16311631+ management operations described in ARM document number ARM DEN16321632+ 0022A ("Power State Coordination Interface System Software on16331633+ ARM processors").16341634+16251635config LOCAL_TIMERS16261636 bool "Use local timer interrupts"16271637 depends on SMP
+24
arch/arm/include/asm/opcodes-sec.h
···11+/*22+ * This program is free software; you can redistribute it and/or modify33+ * it under the terms of the GNU General Public License version 2 as44+ * published by the Free Software Foundation.55+ *66+ * This program is distributed in the hope that it will be useful,77+ * but WITHOUT ANY WARRANTY; without even the implied warranty of88+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the99+ * GNU General Public License for more details.1010+ *1111+ * Copyright (C) 2012 ARM Limited1212+ */1313+1414+#ifndef __ASM_ARM_OPCODES_SEC_H1515+#define __ASM_ARM_OPCODES_SEC_H1616+1717+#include <asm/opcodes.h>1818+1919+#define __SMC(imm4) __inst_arm_thumb32( \2020+ 0xE1600070 | (((imm4) & 0xF) << 0), \2121+ 0xF7F08000 | (((imm4) & 0xF) << 16) \2222+)2323+2424+#endif /* __ASM_ARM_OPCODES_SEC_H */
···11+/*22+ * This program is free software; you can redistribute it and/or modify33+ * it under the terms of the GNU General Public License version 2 as44+ * published by the Free Software Foundation.55+ *66+ * This program is distributed in the hope that it will be useful,77+ * but WITHOUT ANY WARRANTY; without even the implied warranty of88+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the99+ * GNU General Public License for more details.1010+ *1111+ * Copyright (C) 2012 ARM Limited1212+ */1313+1414+#ifndef __ASM_ARM_PSCI_H1515+#define __ASM_ARM_PSCI_H1616+1717+#define PSCI_POWER_STATE_TYPE_STANDBY 01818+#define PSCI_POWER_STATE_TYPE_POWER_DOWN 11919+2020+struct psci_power_state {2121+ u16 id;2222+ u8 type;2323+ u8 affinity_level;2424+};2525+2626+struct psci_operations {2727+ int (*cpu_suspend)(struct psci_power_state state,2828+ unsigned long entry_point);2929+ int (*cpu_off)(struct psci_power_state state);3030+ int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);3131+ int (*migrate)(unsigned long cpuid);3232+};3333+3434+extern struct psci_operations psci_ops;3535+3636+#endif /* __ASM_ARM_PSCI_H */