devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>
Cc: Mark Rutland <Mark.Rutland-5wv7dgnIgG8@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Jonghwa Lee
	<jonghwa3.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
	"leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Amit Daniel Kachhap
	<amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Sudeep Holla <Sudeep.Holla-5wv7dgnIgG8@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH RFC 1/2] Documentation: arm: define DT bindings for system suspend
Date: Thu, 22 Jan 2015 20:09:12 +0800	[thread overview]
Message-ID: <20150122200912.4d85434d@xhacker> (raw)
In-Reply-To: <20150122115906.GB1218@red-moon>

Dear Lorenzo,

On Thu, 22 Jan 2015 03:59:06 -0800
Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> wrote:

> On Thu, Jan 22, 2015 at 06:29:49AM +0000, Jisheng Zhang wrote:
> > Dear Lorenzo and Sudeep,
> > 
> > On Wed, 21 Jan 2015 20:33:14 -0800
> > Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> wrote:
> > 
> > > Dear Lorenzo,
> > > 
> > > On Wed, 21 Jan 2015 05:56:11 -0800
> > > Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> wrote:
> > > 
> > > > On Wed, Jan 21, 2015 at 01:35:07PM +0000, Jisheng Zhang wrote:
> > > > > Dear Sudeep,
> > > > > 
> > > > > On Wed, 21 Jan 2015 05:21:39 -0800
> > > > > Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> wrote:
> > > > > 
> > > > > > Dear Sudeep,
> > > > > > 
> > > > > > On Wed, 21 Jan 2015 03:35:54 -0800
> > > > > > Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org> wrote:
> > > > > > 
> > > > > > > ARM based platforms implement unique ways to enter system
> > > > > > > suspend (i.e. Suspend to RAM). The mechanism and the parameters
> > > > > > > defining the system state vary on a per-platform basis forcing
> > > > > > > the OS to handle it in very platform specific way.
> > > > > > > 
> > > > > > > Since ARM 32-bit systems had machine specific code, no attempts
> > > > > > > to standardize are being made as it provides easy way to
> > > > > > > implement suspend operations in a platform specific manner.
> > > > > > > However, this approach not only makes maintainance more
> > > > > > > difficult as the number of platforms supported increases but
> > > > > > > also not feasible for ARM64.
> > > > > > > 
> > > > > > > This DT binding aims at standardizing the system suspend for ARM
> > > > > > > platforms. ARM64 platforms mandates entry-method property in DT
> > > > > > > for this system suspend node.
> > > > > > > 
> > > > > > > On system implementing PSCI as an enable-method to enter system
> > > > > > > suspend, the PSCI CPU suspend method is used on versions upto
> > > > > > > v0.2 and requires the power_state parameter to be passed to the
> > > > > > > PSCI CPU suspend function.
> > > > > > > 
> > > > > > > This parameter is platform specific, therefore must be provided
> > > > > > > by firmware to the OS in order to enable proper call sequence.
> > > > > > > 
> > > > > > > This ARM system suspend DT bindings rely on a property
> > > > > > > (i.e. arm,psci-suspend-param) in the PSCI DT bindings that
> > > > > > > describes how the PSCI CPU suspend power_state parameter should
> > > > > > > be defined in DT.
> > > > > > > 
> > > > > > > Signed-off-by: Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org>
> > > > > > > ---
> > > > > > >  Documentation/devicetree/bindings/arm/psci.txt     | 11 +++
> > > > > > >  .../devicetree/bindings/arm/system-suspend.txt     | 93
> > > > > > > ++++++++++++++++++++++ 2 files changed, 104 insertions(+)
> > > > > > >  create mode 100644
> > > > > > > Documentation/devicetree/bindings/arm/system-suspend.txt
> > > > > > > 
> > > > > > > diff --git a/Documentation/devicetree/bindings/arm/psci.txt
> > > > > > > b/Documentation/devicetree/bindings/arm/psci.txt index
> > > > > > > 5aa40ede0e99..bd3977a2a333 100644 ---
> > > > > > > a/Documentation/devicetree/bindings/arm/psci.txt +++
> > > > > > > b/Documentation/devicetree/bindings/arm/psci.txt @@ -61,6
> > > > > > > +61,14 @@ Device tree nodes that require usage of PSCI
> > > > > > > CPU_SUSPEND function (ie idle Definition: power_state parameter
> > > > > > > to pass to the PSCI suspend call. 
> > > > > > > +PSCI v0.2 and earlier versions don't have explicit operation
> > > > > > > for system +suspend. However, one can implement system suspend
> > > > > > > using CPU_SUSPEND by +ensuring every other core except the one
> > > > > > > executing the CPU_SUSPEND call +has called into PSCI through a
> > > > > > > CPU_OFF call.
> > > > > > 
> > > > > > If users explicitly hot-unplug other cores when system load is
> > > > > > low to save power, then we want to suspend at some point, how
> > > > > > does the firmware know this case?
> > > > > 
> > > > > Sorry for confusion. I mean 
> > > > > 
> > > > > If users explicitly hot-unplug other cores when system load is low
> > > > > to save power, then at some point cpuidle want to suspend the
> > > > > cluster, how does the distinguish this case with suspend the system
> > > > > to ram.
> > > > 
> > > > Through the arm,psci-suspend-param DT property, ie PSCI CPU_SUSPEND
> > > > power_state parameter.
> > > > 
> > > > Did you read the patch :) ?
> > > 
> > > Yep, I do read the patch ;) To be honest, I implemented the s2ram
> > > similar as the patch does. But according to PSCI v0.2,
> > > "arm,psci-suspend-param = <0x1010000>" means suspend the cluster. I'm
> > > not sure I understand it correctly, "can implement system suspend using
> > > CPU_SUSPEND by ensuring every other core except the one executing the
> > > CPU_SUSPEND call has called into PSCI through a CPU_OFF call" intend to
> > > ask firmware to 
> > > 
> > > suspend the system if other cores has called into PSCI through a CPU_OFF
> > > 
> > > or
> > > 
> > > suspend the cpu cluster if other cores are not CPU_OFF.
> > > 
> > > 
> > > I extend the PSCI CPU_SUSPEND function's to use power_state bit[26] to
> > > tell firmware whether suspend to ram or not.
> > > 
> 
> And that's what the arm,psci-suspend-param stands for in the
> system-state node.
> 
> Since system-suspend corresponds supposedly to the highest level of
> affinity in the system, I would rather say power_state = 0x3010000
> can be used for system suspend (affinity bits[25:24] = 0x3), but we did
> not want to force it, probably that's what we should do.
> 
> Yes, there is also a platform specific component in power_state
> param and you can use that too, we wanted to leave flexibility
> to platforms.
> 
> PSCI v1.0 will introduce a different separate call for system
> suspend, this patch copes with "legacy" versions, as the patch
> logs describe.
> 
> I agree that the value 0x1010000 was a bad choice for the example, it
> is confusing, but it does not mean you _have_ to use that value, is it
> clear ?
> 
> > I read the PSCI spec again, power_state bit[0:15] is "platform specific
> > ID", Is one of these bits used for suspend system?
> 
> It is platform specific, you define that :) ! That's the reason why
> firmware has to tell the OS what parameter triggers the system-state,
> it is platform specific, and we provide a binding to define it and provide
> the OS with the correct value to use.
> 
> Lorenzo

Thank you for detailed explanations. Now I got your and the patches' points.
I were just confused by the 0x1010000.

I'll reuse this patch for arm64 suspend system.

Thanks,
Jisheng
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-01-22 12:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 11:35 [PATCH RFC 0/2] ARM: DT: add bindings for system suspend Sudeep Holla
     [not found] ` <1421840155-18990-1-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2015-01-21 11:35   ` [PATCH RFC 1/2] Documentation: arm: define DT " Sudeep Holla
     [not found]     ` <1421840155-18990-2-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2015-01-21 13:21       ` Jisheng Zhang
2015-01-21 13:35         ` Jisheng Zhang
2015-01-21 13:56           ` Lorenzo Pieralisi
     [not found]             ` <20150121135610.GA21950-7AyDDHkRsp3ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2015-01-22  4:33               ` Jisheng Zhang
2015-01-22  6:29                 ` Jisheng Zhang
2015-01-22 11:59                   ` Lorenzo Pieralisi
2015-01-22 12:09                     ` Jisheng Zhang [this message]
2015-02-04 16:10       ` Mark Rutland
2015-02-05 13:28         ` Sudeep Holla
     [not found]           ` <54D37000.8000006-5wv7dgnIgG8@public.gmane.org>
2015-02-05 13:32             ` Mark Rutland
2015-02-05 13:49               ` Sudeep Holla
2015-01-21 11:35   ` [PATCH RFC 2/2] ARM64: psci: implement system suspend using PSCI v0.2 CPU SUSPEND Sudeep Holla
     [not found]     ` <1421840155-18990-3-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2015-01-22  6:18       ` Leo Yan
2015-01-22 12:08         ` Lorenzo Pieralisi
2015-01-22 14:34           ` Leo Yan
2015-01-23 10:58             ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150122200912.4d85434d@xhacker \
    --to=jszhang-eyqppykdwxrbdgjk7y7tuq@public.gmane.org \
    --cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=Sudeep.Holla-5wv7dgnIgG8@public.gmane.org \
    --cc=amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jonghwa3.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).