Received: by 10.223.164.202 with SMTP id h10csp1661648wrb; Thu, 23 Nov 2017 22:57:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMb3COKxyAsr4mZf4EkrIHzLbT+i1Vs96k9QU6sbyJBB+E7iR2+zYeC/Ti02nJx3m+m+VKUR X-Received: by 10.99.127.88 with SMTP id p24mr26338427pgn.377.1511506673022; Thu, 23 Nov 2017 22:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511506673; cv=none; d=google.com; s=arc-20160816; b=WyYvw1j800lGyt6ysVe968ziY5zhVZH1j1R/nhhNdk6qQBpkIL/bn4fTw5fvDrnMxz qsMoYz3GMuPyZxHsEWXn5sfo2VoKBldZsbHOPXc65ch2Noxk5nX7hX2wwoRBfFgiVbL1 i63YcNs+iXExsoxivR0Yl4F6qd/z7jlLxQhKV4msU/kZvlPP9/lyUuV0GCJKMKHDbo7J njFmrdE24qNpoRhvjgUSqKlPpHRZz6dr7U9EasBDIw3zdvmkuZ7+paLPkP23Hrhlgfk0 DgntDfp0Q2djXQgnvN9wCLdL2iM7dnzkV5F5akNjxfWdQi/YTPnrjkGWNhIgplLRY0D/ ktow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=AKCkwbYOD4/uQws2ONVIU/zjT7/t46WzLXTs9cm4HkA=; b=ZT6/Z/ZnTuhyLVCg01JGx7Y97PmcJdaVqw+Pj8cDna6tz0BrwmQphutQxMpLB/hzPF kNuhLPJWeWQ010nfcITg4EAot13Ruhxjj2JV6yY501QJPe6TnD7vcz+Z0Iw8ChODtZO9 2gzq55Dv0H+G3b9MCRiN4oGlGGN9GGyE6YeTskYFne6owwJEKYcdMHTcOLP/X6+/WnKt s5bd8yB4EPY08pCu2re57D4MfwvLXOmoLdj9907vJriVTn8tK6QEWm4zQD3HQIXw6tld azIlYnd+lIhPRQL0/WDJ7YVwNdmwUFNbOA7CJEXp1jgKOJ4qb2rDusfNpOy/B25slD+p kZLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L9I0vIEg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si17751985pla.622.2017.11.23.22.57.42; Thu, 23 Nov 2017 22:57:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L9I0vIEg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753382AbdKXG4t (ORCPT + 76 others); Fri, 24 Nov 2017 01:56:49 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34246 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753325AbdKXG4q (ORCPT ); Fri, 24 Nov 2017 01:56:46 -0500 Received: by mail-wm0-f67.google.com with SMTP id y82so19276661wmg.1 for ; Thu, 23 Nov 2017 22:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AKCkwbYOD4/uQws2ONVIU/zjT7/t46WzLXTs9cm4HkA=; b=L9I0vIEgQTeHvwtntzOIpdOlMYp7/EpMGRaagLbrJkw2fTl/4SH7ca8PDGQA/7sOss tKYwMwhP1ygo1/x1Z+STFhgfzTZIKMZ+Q0d/0LmMsLO3yEn5UoAln+ArV/I9wAgov20H osk1BXv1G3qeeIOb4lyIYdLBeJkwrE2dlmkIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AKCkwbYOD4/uQws2ONVIU/zjT7/t46WzLXTs9cm4HkA=; b=GY7YP/VfnB+CIYB/sHWLCmMGDoUb8wsvwBirRpEe2VNS7UpPQ27L1YtvgJ9/pkF2W+ lh2RGpuO+PvA7fDvU721iNzpb06htXHFBSGligpE93dzTOF6nawewYkaURzVlT+7zE58 /4JZRI/NMnQL+LsjsGSu0HE4942uLPJXmOdV8DvO5W/aFX/SvzQQuUYl/jPn/lU60xGC sEaSqi8VDWGDgdXXC9aW5WYhWpfmbYQ5Aw4LuI3mDtASt2LlroZ6g0MwXWE4cixtsr5J rp/pyt2PfHZL6BefeaFRQr0N52erySUXYlIK6hTNWnoxjcviTqrOrv9CHLh9uO5JK23V l3mA== X-Gm-Message-State: AJaThX44cTgFRE1+J6Om6fL/ttDO1urGWyrDtT4ueXQg52iqO+XWC/Wz /eR9iuKv3pZqGH3oGsHTntuz5w== X-Received: by 10.80.245.102 with SMTP id w35mr38093815edm.179.1511506604471; Thu, 23 Nov 2017 22:56:44 -0800 (PST) Received: from leoy-linaro (li1530-42.members.linode.com. [139.162.245.42]) by smtp.gmail.com with ESMTPSA id f36sm5755344edd.82.2017.11.23.22.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 22:56:42 -0800 (PST) Date: Fri, 24 Nov 2017 14:56:23 +0800 From: Leo Yan To: Sudeep Holla Cc: Wei Xu , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, Daniel Lezcano , Vincent Guittot Subject: Re: [PATCH] arm64: dts: Hi3660: Fix state id for 'CPU_NAP' state Message-ID: <20171124065623.GD13184@leoy-linaro> References: <1511415614-9859-1-git-send-email-leo.yan@linaro.org> <17639ecc-8ff8-e118-f6e1-51e2cfe4342b@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17639ecc-8ff8-e118-f6e1-51e2cfe4342b@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sudeep, On Thu, Nov 23, 2017 at 02:03:51PM +0000, Sudeep Holla wrote: > Hi Daniel, > > Thanks a lot for pointing me to this and having some useful discussion > in private. That helped to dig a bit further on this. > > On 23/11/17 05:40, Leo Yan wrote: > > Thanks a lot for Vincent Guittot careful work to find bug for 'CPU_NAP' > > idle state. From ftrace log we can observe CA73 CPUs can be easily waken > > up from 'CPU_NAP' state but the 'waken up' CPUs doesn't handle anything > > and sleep again; so there have tons of trace events for CA73 CPUs > > entering and exiting idle state. > > > > On Hi3660 CA73 has retention state 'CPU_NAP' for CPU idle, this state we > > set its psci parameter as '0x0000001' and from this parameter it can > > calculate state id is 1. Unfortunately ARM trusted firmware (ARM-TF) > > takes 1 as a invalid value for state id, so the CPU cannot enter idle > > state and directly bail out to kernel. > > > > This commit changes psci parameter to '0x00000000' for state id = 0; > > this id is accepted by ARM trusted firmware and finally CPU can stay > > properly in 'CPU_NAP' state. > > > > I would like to conditionally NACK this patch. If we can't update the > ARM TF at all then, I will agree with this change reluctantly. Thanks for reviewing. Just like Daniel said, we need to figure out the right method for this. So suggestions are very welcome! > This looks like an artifact of copy paste in ARM TF port for this > platform. If you look as PSCI specification, CPU suspend parameter has > some recommendations and it's good to follow then unless you have strong > reasons not to. > > As Daniel pointed to me, this patch is required to satisfy TF > particularly [1]. Now that looks like copy pasted from Juno or FVP port > and if you look deeper, it's clearly under !ARM_RECOM_STATE_ID_ENC [2] > which was not copied IIUC :). Thanks for sharing pointers. It's shame that the copying is not correct for Hikey960 :) Come back to recommended state id, I reviewed Juno board defintion and I found it's not align with PSCI spec defintion, in ARM-TF Juno code defines state as below [1]: #define ARM_LOCAL_STATE_RUN 0 #define ARM_LOCAL_STATE_RET 1 #define ARM_LOCAL_STATE_OFF 2 In PSCI spec chapter "6.5 Recommended StateID Encoding" recommends power state id as below: 0: Run 1: Standby 2: Retention 3: Powerdown So could you confirm on Hikey960 we should follow PSCI definition for state id definition? > Juno's implementation is legacy as these recommendations were added > later in the specification while Juno is 3 year old platform now. > > Though strictly speaking it's not violation of the PSCI specification, > but I would rather get this fixed not before it's too late and copied to > the next generation of platforms. Since the firmware can be easily > upgraded that shouldn't be that difficult. If completely compliant with PSCI recommended state id, we need change both for ARM-TF and kernel for this. In ARM-TF, I have sent PR [2]. For the kernel patch, we should change state id as below. Please let me know if you have suggestion for this. diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi index 12544c3..812437a 100644 --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi @@ -179,7 +179,7 @@ CPU_NAP: cpu-nap { compatible = "arm,idle-state"; - arm,psci-suspend-param = <0x0000001>; + arm,psci-suspend-param = <0x0000002>; entry-latency-us = <7>; exit-latency-us = <2>; min-residency-us = <15>; @@ -188,7 +188,7 @@ CPU_SLEEP: cpu-sleep { compatible = "arm,idle-state"; local-timer-stop; - arm,psci-suspend-param = <0x0010000>; + arm,psci-suspend-param = <0x0010003>; entry-latency-us = <40>; exit-latency-us = <70>; min-residency-us = <3000>; @@ -197,7 +197,7 @@ CLUSTER_SLEEP_0: cluster-sleep-0 { compatible = "arm,idle-state"; local-timer-stop; - arm,psci-suspend-param = <0x1010000>; + arm,psci-suspend-param = <0x1010033>; entry-latency-us = <500>; exit-latency-us = <5000>; min-residency-us = <20000>; @@ -206,7 +206,7 @@ CLUSTER_SLEEP_1: cluster-sleep-1 { compatible = "arm,idle-state"; local-timer-stop; - arm,psci-suspend-param = <0x1010000>; + arm,psci-suspend-param = <0x1010033>; entry-latency-us = <1000>; exit-latency-us = <5000>; min-residency-us = <20000>; [1] https://github.com/ARM-software/arm-trusted-firmware/blob/master/include/plat/arm/common/arm_def.h#L43 [2] https://github.com/ARM-software/arm-trusted-firmware/pull/1171/commits/13d30c1c33609eb6cffadd50954e4301d2cab909 Thanks, Leo Yan From 1584865930298257105@xxx Thu Nov 23 14:05:32 +0000 2017 X-GM-THRID: 1584834217582212283 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread