Changes in 4.19.160
ah6: fix error return code in ah6_input()
atm: nicstar: Unmap DMA on send error
bnxt_en: read EEPROM A2h address using page 0
devlink: Add missing genlmsg_cancel() in devlink_nl_sb_port_pool_fill()
inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill()
lan743x: fix issue causing intermittent kernel log warnings
lan743x: prevent entire kernel HANG on open, for some platforms
mlxsw: core: Use variable timeout for EMAD retries
net: b44: fix error return code in b44_init_one()
net: bridge: add missing counters to ndo_get_stats64 callback
net: dsa: mv88e6xxx: Avoid VTU corruption on 6097
net: Have netpoll bring-up DSA management interface
netlabel: fix our progress tracking in netlbl_unlabel_staticlist()
netlabel: fix an uninitialized warning in netlbl_unlabel_staticlist()
net/mlx4_core: Fix init_hca fields offset
net: qualcomm: rmnet: Fix incorrect receive packet handling during cleanup
net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request
page_frag: Recover from memory pressure
qed: fix error return code in qed_iwarp_ll2_start()
qlcnic: fix error return code in qlcnic_83xx_restart_hw()
sctp: change to hold/put transport for proto_unreach_timer
tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate
net/mlx5: Disable QoS when min_rates on all VFs are zero
net: usb: qmi_wwan: Set DTR quirk for MR400
net/ncsi: Fix netlink registration
net: ftgmac100: Fix crash when removing driver
pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq
scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold()
selftests: kvm: Fix the segment descriptor layout to match the actual layout
ACPI: button: Add DMI quirk for Medion Akoya E2228T
arm64: psci: Avoid printing in cpu_psci_cpu_die()
vfs: remove lockdep bogosity in __sb_start_write
arm64: dts: allwinner: a64: Pine64 Plus: Fix ethernet node
arm64: dts: allwinner: h5: OrangePi PC2: Fix ethernet node
ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix ethernet node
Revert "arm: sun8i: orangepi-pc-plus: Set EMAC activity LEDs to active high"
ARM: dts: sun8i: h3: orangepi-plus2e: Enable RGMII RX/TX delay on Ethernet PHY
ARM: dts: sun8i: a83t: Enable both RGMII RX/TX delay on Ethernet PHY
arm64: dts: allwinner: a64: bananapi-m64: Enable RGMII RX/TX delay on PHY
Input: adxl34x - clean up a data type in adxl34x_probe()
MIPS: export has_transparent_hugepage() for modules
arm64: dts: allwinner: h5: OrangePi Prime: Fix ethernet node
arm: dts: imx6qdl-udoo: fix rgmii phy-mode for ksz9031 phy
ARM: dts: imx50-evk: Fix the chip select 1 IOMUX
Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER
perf lock: Don't free "lock_seq_stat" if read_count isn't zero
ip_tunnels: Set tunnel option flag when tunnel metadata is present
can: af_can: prevent potential access of uninitialized member in can_rcv()
can: af_can: prevent potential access of uninitialized member in canfd_rcv()
can: dev: can_restart(): post buffer from the right context
can: ti_hecc: Fix memleak in ti_hecc_probe
can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb()
can: peak_usb: fix potential integer overflow on shift of a int
can: m_can: m_can_handle_state_change(): fix state change
ASoC: qcom: lpass-platform: Fix memory leak
MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu
drm/sun4i: dw-hdmi: fix error return code in sun8i_dw_hdmi_bind()
can: kvaser_usb: kvaser_usb_hydra: Fix KCAN bittiming limits
xfs: fix the minrecs logic when dealing with inode root child blocks
xfs: strengthen rmap record flags checking
regulator: ti-abb: Fix array out of bound read access on the first transition
fail_function: Remove a redundant mutex unlock
xfs: revert "xfs: fix rmap key and record comparison functions"
efi/x86: Free efi_pgd with free_pages()
libfs: fix error cast of negative value in simple_attr_write()
speakup: Do not let the line discipline be used several times
ALSA: firewire: Clean up a locking issue in copy_resp_to_buf()
ALSA: usb-audio: Add delay quirk for all Logitech USB devices
ALSA: ctl: fix error path at adding user-defined element set
ALSA: mixart: Fix mutex deadlock
ALSA: hda/realtek: Add some Clove SSID in the ALC293(ALC1220)
tty: serial: imx: keep console clocks always on
efivarfs: fix memory leak in efivarfs_create()
staging: rtl8723bs: Add 024c:0627 to the list of SDIO device-ids
ext4: fix bogus warning in ext4_update_dx_flag()
iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum
iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting tablet-mode
regulator: pfuze100: limit pfuze-support-disable-sw to pfuze{100,200}
regulator: fix memory leak with repeated set_machine_constraints()
regulator: avoid resolve_supply() infinite recursion
regulator: workaround self-referent regulators
xtensa: disable preemption around cache alias management calls
mac80211: minstrel: remove deferred sampling code
mac80211: minstrel: fix tx status processing corner case
mac80211: free sta in sta_info_insert_finish() on errors
s390/cpum_sf.c: fix file permission for cpum_sfb_size
s390/dasd: fix null pointer dereference for ERP requests
ptrace: Set PF_SUPERPRIV when checking capability
seccomp: Set PF_SUPERPRIV when checking capability
x86/microcode/intel: Check patch signature before saving microcode for early loading
mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault()
Linux 4.19.160
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3a7304be6687f4ffe96f0e765da0c0ec7dcb971d
131 lines
3.0 KiB
C
131 lines
3.0 KiB
C
/*
|
|
* 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.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* Copyright (C) 2013 ARM Limited
|
|
*
|
|
* Author: Will Deacon <will.deacon@arm.com>
|
|
*/
|
|
|
|
#define pr_fmt(fmt) "psci: " fmt
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/of.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/psci.h>
|
|
#include <linux/mm.h>
|
|
|
|
#include <uapi/linux/psci.h>
|
|
|
|
#include <asm/compiler.h>
|
|
#include <asm/cpu_ops.h>
|
|
#include <asm/errno.h>
|
|
#include <asm/smp_plat.h>
|
|
|
|
static int __init cpu_psci_cpu_init(unsigned int cpu)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static int __init cpu_psci_cpu_prepare(unsigned int cpu)
|
|
{
|
|
if (!psci_ops.cpu_on) {
|
|
pr_err("no cpu_on method, not booting CPU%d\n", cpu);
|
|
return -ENODEV;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int cpu_psci_cpu_boot(unsigned int cpu)
|
|
{
|
|
int err = psci_ops.cpu_on(cpu_logical_map(cpu),
|
|
__pa_function(secondary_entry));
|
|
if (err)
|
|
pr_err("failed to boot CPU%d (%d)\n", cpu, err);
|
|
|
|
return err;
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static int cpu_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;
|
|
}
|
|
|
|
static void cpu_psci_cpu_die(unsigned int cpu)
|
|
{
|
|
/*
|
|
* There are no known implementations of PSCI actually using the
|
|
* power state field, pass a sensible default for now.
|
|
*/
|
|
u32 state = PSCI_POWER_STATE_TYPE_POWER_DOWN <<
|
|
PSCI_0_2_POWER_STATE_TYPE_SHIFT;
|
|
|
|
psci_ops.cpu_off(state);
|
|
}
|
|
|
|
static int cpu_psci_cpu_kill(unsigned int cpu)
|
|
{
|
|
int err;
|
|
unsigned long start, end;
|
|
|
|
if (!psci_ops.affinity_info)
|
|
return 0;
|
|
/*
|
|
* cpu_kill could race with cpu_die and we can
|
|
* potentially end up declaring this cpu undead
|
|
* while it is dying. So, try again a few times.
|
|
*/
|
|
|
|
start = jiffies;
|
|
end = start + msecs_to_jiffies(100);
|
|
do {
|
|
err = psci_ops.affinity_info(cpu_logical_map(cpu), 0);
|
|
if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) {
|
|
pr_info("CPU%d killed (polled %d ms)\n", cpu,
|
|
jiffies_to_msecs(jiffies - start));
|
|
return 0;
|
|
}
|
|
|
|
usleep_range(100, 1000);
|
|
} while (time_before(jiffies, end));
|
|
|
|
pr_warn("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n",
|
|
cpu, err);
|
|
return -ETIMEDOUT;
|
|
}
|
|
#endif
|
|
|
|
const struct cpu_operations cpu_psci_ops = {
|
|
.name = "psci",
|
|
#ifdef CONFIG_CPU_IDLE
|
|
.cpu_init_idle = psci_cpu_init_idle,
|
|
.cpu_suspend = psci_cpu_suspend_enter,
|
|
#endif
|
|
.cpu_init = cpu_psci_cpu_init,
|
|
.cpu_prepare = cpu_psci_cpu_prepare,
|
|
.cpu_boot = cpu_psci_cpu_boot,
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
.cpu_disable = cpu_psci_cpu_disable,
|
|
.cpu_die = cpu_psci_cpu_die,
|
|
.cpu_kill = cpu_psci_cpu_kill,
|
|
#endif
|
|
};
|
|
|