lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180511033530.7931-5-yinbo.zhu@nxp.com>
Date:   Fri, 11 May 2018 11:35:26 +0800
From:   Yinbo Zhu <yinbo.zhu@....com>
To:     <yinbo.zhu@....com>, Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "Catalin Marinas )" <catalin.marinas@....com>,
        "Will Deacon )" <will.deacon@....com>,
        "Lorenzo Pieralisi )" <lorenzo.pieralisi@....com>,
        Li Yang <leoyang.li@....com>
CC:     <xiaobo.xie@....com>, <ran.wang_1@....com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Shawn Guo <shawnguo@...nel.org>,
        Madalin Bucur <madalin.bucur@....com>,
        Hou Zhiqiang <Zhiqiang.Hou@....com>,
        Changming Huang <jerry.huang@....com>,
        Minghuan Lian <Minghuan.Lian@....com>,
        Zhao Qiang <qiang.zhao@....com>,
        Fabio Estevam <fabio.estevam@....com>,
        "jiaheng . fan" <jiaheng.fan@....com>, Po Liu <po.liu@....com>,
        Nipun Gupta <nipun.gupta@....com>,
        Horia Geantă <horia.geanta@....com>,
        Priyanka Jain <priyanka.jain@....com>,
        Sumit Garg <sumit.garg@....com>,
        costi <constantin.tudor@...escale.com>,
        Bogdan Purcareata <bogdan.purcareata@....com>,
        Meng Yi <meng.yi@....com>,
        Wang Dongsheng <dongsheng.wang@....com>,
        "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" 
        <linux-kernel@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        "open list:FREESCALE SOC DRIVERS" <linuxppc-dev@...ts.ozlabs.org>,
        Tang Yuantian <Yuantian.Tang@....com>,
        <ying.zhang22455@....com>, Yuantian Tang <andy.tang@....com>
Subject: [PATCH 5/9] drivers: firmware: psci: use psci v0.2 to implement sleep

From: Yuantian Tang <andy.tang@....com>

Technically psci v0.2 can not support system sleep. Unfortunately
our PPA only supports psci v0.2. So workaround this by changing
psci v1.0 to v0.2 call to implement system sleep.

Signed-off-by: Tang Yuantian <andy.tang@....com>
Signed-off-by: Yinbo Zhu <yinbo.zhu@....com>
---
 drivers/firmware/psci.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index c80ec1d..0bd795f 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -437,8 +437,18 @@ int psci_cpu_suspend_enter(unsigned long index)
 
 static int psci_system_suspend(unsigned long unused)
 {
-	return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
-			      __pa_symbol(cpu_resume), 0, 0);
+	u32 state;
+	u32 ver = psci_get_version();
+
+	if (PSCI_VERSION_MAJOR(ver) >= 1) {
+		return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
+				virt_to_phys(cpu_resume), 0, 0);
+	} else {
+		state = (2 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) |
+			(1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT);
+
+		return psci_cpu_suspend(state, virt_to_phys(cpu_resume));
+	}
 }
 
 static int psci_system_suspend_enter(suspend_state_t state)
@@ -562,6 +572,8 @@ static void __init psci_0_2_set_functions(void)
 	arm_pm_restart = psci_sys_reset;
 
 	pm_power_off = psci_sys_poweroff;
+
+	suspend_set_ops(&psci_suspend_ops);
 }
 
 /*
-- 
1.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ