Your ROOT_URL in app.ini is https://gitea.jennalody.de/ but you are visiting https://gitea.jenslody.de/jenna/kernel_samsung_sm7125/blame/branch/fourteen/arch/arm64/kernel/psci.c You should set ROOT_URL correctly, otherwise the web may not work correctly.
kernel_samsung_sm7125/arch/arm64/kernel/psci.c

134 lines
3.0 KiB

/*
* 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>
ARM64: kernel: make cpu_ops hooks DT agnostic ARM64 CPU operations such as cpu_init and cpu_init_idle take a struct device_node pointer as a parameter, which corresponds to the device tree node of the logical cpu on which the operation has to be applied. With the advent of ACPI on arm64, where MADT static table entries are used to initialize cpus, the device tree node parameter in cpu_ops hooks become useless when booting with ACPI, since in that case cpu device tree nodes are not present and can not be used for cpu initialization. The current cpu_init hook requires a struct device_node pointer parameter because it is called while parsing the device tree to initialize CPUs, when the cpu_logical_map (that is used to match a cpu node reg property to a device tree node) for a given logical cpu id is not set up yet. This means that the cpu_init hook cannot rely on the of_get_cpu_node function to retrieve the device tree node corresponding to the logical cpu id passed in as parameter, so the cpu device tree node must be passed in as a parameter to fix this catch-22 dependency cycle. This patch reshuffles the cpu_logical_map initialization code so that the cpu_init cpu_ops hook can safely use the of_get_cpu_node function to retrieve the cpu device tree node, removing the need for the device tree node pointer parameter. In the process, the patch removes device tree node parameters from all cpu_ops hooks, in preparation for SMP DT/ACPI cpus initialization consolidation. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Hanjun Guo <hanjun.guo@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Mark Rutland <mark.rutland@arm.com> [DT] Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
10 years ago
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)
{
int ret;
/*
* 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;
ret = psci_ops.cpu_off(state);
pr_crit("unable to power off CPU%u (%d)\n", cpu, ret);
}
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) {
Merge android-4.14.161 (d8cb916) into msm-4.14 * refs/heads/tmp-d8cb916: Linux 4.14.161 perf probe: Fix to show function entry line as probe-able nbd: fix shutdown and recv work deadlock v2 mmc: sdhci-of-esdhc: fix P2020 errata handling mmc: sdhci: Update the tuning failed messages to pr_debug level mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support" powerpc/irq: fix stack overflow verification x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[] x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure() KVM: arm64: Ensure 'params' is initialised when looking up sys register ext4: unlock on error in ext4_expand_extra_isize() ext4: check for directory entries too close to block end ext4: fix ext4_empty_dir() for directories with holes staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes intel_th: pci: Add Elkhart Lake SOC support intel_th: pci: Add Comet Lake PCH-V support USB: EHCI: Do not return -EPIPE when hub is disconnected usbip: Fix error path of vhci_recv_ret_submit() usbip: Fix receive error in vhci-hcd when using scatter-gather btrfs: abort transaction after failed inode updates in create_subvol btrfs: return error pointer from alloc_test_extent_buffer s390/ftrace: fix endless recursion in function_graph tracer usb: xhci: Fix build warning seen with CONFIG_PM=n mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode Revert "mmc: sdhci: Fix incorrect switch to HS mode" btrfs: don't prematurely free work in scrub_missing_raid56_worker() btrfs: don't prematurely free work in reada_start_machine_worker() net: phy: initialise phydev speed and duplex sanely mips: fix build when "48 bits virtual memory" is enabled libtraceevent: Fix memory leakage in copy_filter_type crypto: vmx - Avoid weird build failures mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c crypto: sun4i-ss - Fix 64-bit size_t warnings fbtft: Make sure string is NULL terminated iwlwifi: check kasprintf() return value x86/insn: Add some Intel instructions to the opcode map spi: st-ssc4: add missed pm_runtime_disable btrfs: don't prematurely free work in run_ordered_work() btrfs: don't prematurely free work in end_workqueue_fn() mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests crypto: virtio - deal with unsupported input sizes spi: tegra20-slink: add missed clk_unprepare iwlwifi: mvm: fix unaligned read of rx_pkt_status x86/crash: Add a forward declaration of struct kimage cpufreq: Register drivers only after CPU devices have been registered parport: load lowlevel driver if ports not found s390/disassembler: don't hide instruction addresses ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile spi: pxa2xx: Add missed security checks EDAC/ghes: Fix grain calculation media: si470x-i2c: add missed operations in remove media: pvrusb2: Fix oops on tear-down when radio support is not present fsi: core: Fix small accesses and unaligned offsets via sysfs ath10k: fix get invalid tx rate for Mesh metric perf probe: Filter out instances except for inlined subroutine and subprogram perf probe: Skip end-of-sequence and non statement lines perf probe: Fix to show calling lines of inlined functions perf probe: Return a better scope DIE if there is no best scope perf probe: Skip overlapped location on searching variables perf parse: If pmu configuration fails free terms drm/amdgpu: fix potential double drop fence reference perf probe: Fix to probe a function which has no entry pc libsubcmd: Use -O0 with DEBUG=1 perf probe: Fix to show inlined function callsite without entry_pc perf probe: Fix to show ranges of variables in functions without entry_pc perf probe: Fix to probe an inline function which has no entry pc perf probe: Walk function lines in lexical blocks perf probe: Fix to list probe event with correct line number perf probe: Fix to find range-only function instance rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt() ALSA: timer: Limit max amount of slave instances spi: img-spfi: fix potential double release bnx2x: Fix PF-VF communication over multi-cos queues. rfkill: allocate static minor media: v4l2-core: fix touch support in v4l_g_fmt media: rcar_drif: fix a memory disclosure ixgbe: protect TX timestamping from API misuse pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler() Bluetooth: Fix advertising duplicated flags iio: dln2-adc: fix iio_triggered_buffer_postenable() position pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B loop: fix no-unmap write-zeroes request behavior libata: Ensure ata_port probe has completed before detach s390/mm: add mm_pxd_folded() checks to pxd_free() s390/time: ensure get_clock_monotonic() returns monotonic values phy: qcom-usb-hs: Fix extcon double register after power cycle net: dsa: LAN9303: select REGMAP when LAN9303 enable gpu: host1x: Allocate gather copy for host1x RDMA/qedr: Fix memory leak in user qp and mr net: phy: dp83867: enable robust auto-mdix arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill() x86/ioapic: Prevent inconsistent state when moving an interrupt rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot drm/gma500: fix memory disclosures due to uninitialized bytes x86/mce: Lower throttling MCE messages' priority to warning Bluetooth: hci_core: fix init for HCI_USER_CHANNEL Bluetooth: missed cpu_to_le16 conversion in hci_init4_req iio: adc: max1027: Reset the device at probe time usb: usbfs: Suppress problematic bind and unbind uevents. perf report: Add warning when libunwind not compiled in perf test: Report failure for mmap events drm/bridge: dw-hdmi: Restore audio when setting a mode x86/mm: Use the correct function type for native_set_fixmap() extcon: sm5502: Reset registers during initialization media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic media: ti-vpe: vpe: Make sure YUYV is set as default format media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format media: ti-vpe: vpe: Fix Motion Vector vpdma stride media: cx88: Fix some error handling path in 'cx8800_initdev()' mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring block: Fix writeback throttling W=1 compiler warnings samples: pktgen: fix proc_cmd command result check logic drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller media: cec-funcs.h: add status_req checks media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init() regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe() hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled usb: renesas_usbhs: add suspend event support in gadget mode selftests/bpf: Correct path to include msg + path pinctrl: devicetree: Avoid taking direct reference to device name string ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq media: venus: core: Fix msm8996 frequency table tools/power/cpupower: Fix initializer override in hsw_ext_cstates media: ov6650: Fix stored crop rectangle not in sync with hardware media: ov6650: Fix stored frame format not in sync with hardware media: i2c: ov2659: Fix missing 720p register config media: ov6650: Fix crop rectangle alignment not passed back media: i2c: ov2659: fix s_stream return value media: am437x-vpfe: Setting STD to current value is not an error IB/iser: bound protection_sg size by data_sg size libertas: fix a potential NULL pointer dereference rtlwifi: prevent memory leak in rtl_usb_probe staging: rtl8188eu: fix possible null dereference staging: rtl8192u: fix multiple memory leaks on error path spi: Add call to spi_slave_abort() function when spidev driver is released iio: light: bh1750: Resolve compiler warning and make code more readable drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings drm: mst: Fix query_payload ack reply struct ALSA: hda/ca0132 - Avoid endless loop ALSA: hda/ca0132 - Keep power on during processing DSP response ALSA: pcm: Avoid possible info leaks from PCM stream buffers Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues btrfs: handle ENOENT in btrfs_uuid_tree_iterate btrfs: do not leak reloc root if we fail to read the fs root btrfs: skip log replay on orphaned roots btrfs: do not call synchronize_srcu() in inode_tree_del btrfs: don't double lock the subvol_sem for rename exchange sctp: fully initialize v4 addr in some functions qede: Fix multicast mac configuration net: usb: lan78xx: Fix suspend/resume PHY register access error net: qlogic: Fix error paths in ql_alloc_large_buffers() net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() net: hisilicon: Fix a BUG trigered by wrong bytes_compl net: dst: Force 4-byte alignment of dst_metrics mod_devicetable: fix PHY module format fjes: fix missed check in fjes_acpi_add af_packet: set defaule value for tmo ANDROID: cuttlefish_defconfig: Disable TRANSPARENT_HUGEPAGE Conflicts: arch/arm64/kernel/psci.c Change-Id: I989024129dbc7ce44af19108621958bfdd2fe6ef Signed-off-by: Srinivasarao P <spathi@codeaurora.org> Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
5 years ago
pr_debug("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
ARM: 8511/1: ARM64: kernel: PSCI: move PSCI idle management code to drivers/firmware ARM64 PSCI kernel interfaces that initialize idle states and implement the suspend API to enter them are generic and can be shared with the ARM architecture. To achieve that goal, this patch moves ARM64 PSCI idle management code to drivers/firmware, so that the interface to initialize and enter idle states can actually be shared by ARM and ARM64 arches back-ends. The ARM generic CPUidle implementation also requires the definition of a cpuidle_ops section entry for the kernel to initialize the CPUidle operations at boot based on the enable-method (ie ARM64 has the statically initialized cpu_ops counterparts for that purpose); therefore this patch also adds the required section entry on CONFIG_ARM for PSCI so that the kernel can initialize the PSCI CPUidle back-end when PSCI is the probed enable-method. On ARM64 this patch provides no functional change. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arch/arm64] Acked-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Jisheng Zhang <jszhang@marvell.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
9 years ago
.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
};