psci.c (e71246a23acbc89e9cb4ebf1558d60e65733479f) | psci.c (c814ca029e1015bb0ecec312f4bb9751ba1a711a) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License version 2 as 4 * published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 6 unchanged lines hidden (view full) --- 15 16#define pr_fmt(fmt) "psci: " fmt 17 18#include <linux/init.h> 19#include <linux/of.h> 20#include <linux/smp.h> 21#include <linux/reboot.h> 22#include <linux/pm.h> | 1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License version 2 as 4 * published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 6 unchanged lines hidden (view full) --- 15 16#define pr_fmt(fmt) "psci: " fmt 17 18#include <linux/init.h> 19#include <linux/of.h> 20#include <linux/smp.h> 21#include <linux/reboot.h> 22#include <linux/pm.h> |
23#include <linux/delay.h> |
|
23#include <uapi/linux/psci.h> 24 25#include <asm/compiler.h> 26#include <asm/cpu_ops.h> 27#include <asm/errno.h> 28#include <asm/psci.h> 29#include <asm/smp_plat.h> 30#include <asm/system_misc.h> --- 367 unchanged lines hidden (view full) --- 398 struct psci_power_state state = { 399 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, 400 }; 401 402 ret = psci_ops.cpu_off(state); 403 404 pr_crit("unable to power off CPU%u (%d)\n", cpu, ret); 405} | 24#include <uapi/linux/psci.h> 25 26#include <asm/compiler.h> 27#include <asm/cpu_ops.h> 28#include <asm/errno.h> 29#include <asm/psci.h> 30#include <asm/smp_plat.h> 31#include <asm/system_misc.h> --- 367 unchanged lines hidden (view full) --- 399 struct psci_power_state state = { 400 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, 401 }; 402 403 ret = psci_ops.cpu_off(state); 404 405 pr_crit("unable to power off CPU%u (%d)\n", cpu, ret); 406} |
407 408static int cpu_psci_cpu_kill(unsigned int cpu) 409{ 410 int err, i; 411 412 if (!psci_ops.affinity_info) 413 return 1; 414 /* 415 * cpu_kill could race with cpu_die and we can 416 * potentially end up declaring this cpu undead 417 * while it is dying. So, try again a few times. 418 */ 419 420 for (i = 0; i < 10; i++) { 421 err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); 422 if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) { 423 pr_info("CPU%d killed.\n", cpu); 424 return 1; 425 } 426 427 msleep(10); 428 pr_info("Retrying again to check for CPU kill\n"); 429 } 430 431 pr_warn("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n", 432 cpu, err); 433 /* Make op_cpu_kill() fail. */ 434 return 0; 435} |
|
406#endif 407 408const struct cpu_operations cpu_psci_ops = { 409 .name = "psci", 410 .cpu_init = cpu_psci_cpu_init, 411 .cpu_prepare = cpu_psci_cpu_prepare, 412 .cpu_boot = cpu_psci_cpu_boot, 413#ifdef CONFIG_HOTPLUG_CPU 414 .cpu_disable = cpu_psci_cpu_disable, 415 .cpu_die = cpu_psci_cpu_die, | 436#endif 437 438const struct cpu_operations cpu_psci_ops = { 439 .name = "psci", 440 .cpu_init = cpu_psci_cpu_init, 441 .cpu_prepare = cpu_psci_cpu_prepare, 442 .cpu_boot = cpu_psci_cpu_boot, 443#ifdef CONFIG_HOTPLUG_CPU 444 .cpu_disable = cpu_psci_cpu_disable, 445 .cpu_die = cpu_psci_cpu_die, |
446 .cpu_kill = cpu_psci_cpu_kill, |
|
416#endif 417}; 418 419#endif | 447#endif 448}; 449 450#endif |