All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lina Iyer <lina.iyer@linaro.org>
To: Vikas Sajjan <sajjan.linux@gmail.com>
Cc: ulf.hansson@linaro.org, Kevin Hilman <khilman@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-pm@vger.kernel.org,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	k.kozlowski@samsung.com,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	ahaslam@baylibre.com, linux-arm-msm@vger.kernel.org,
	sboyd@codeaurora.org, geert@linux-m68k.org,
	andy.gross@linaro.org, mtitinger@baylibre.com
Subject: Re: [PATCH 11/14] drivers: firmware: psci: Allow OS Initiated suspend mode
Date: Fri, 24 Jun 2016 10:53:29 -0600	[thread overview]
Message-ID: <20160624165329.GA1085@linaro.org> (raw)
In-Reply-To: <CAGm_ybjO+jAN62fqFyVrw_+5LOnUumEfn8kxmDa+s5ap0Bqk9A@mail.gmail.com>

On Fri, Jun 24 2016 at 22:25 -0600, Vikas Sajjan wrote:
>Hi Lina,
>
>On Thu, Jun 23, 2016 at 1:06 AM, Lina Iyer <lina.iyer@linaro.org> wrote:
>> PSCI firmware v1.0 onwards may support 2 different modes for
>> CPU_SUSPEND. Platform coordinated mode is the default and every firmware
>> should support it. OS Initiated mode is optional for the firmware to
>> implement and allow Linux to make an better decision on the state of
>> the CPU cluster heirarchy.
>>
>> With the kernel capable of deciding the state for CPU cluster and
>> coherency domains, the OS Initiated mode may now be used by the kernel,
>> provided the firmware supports it. SET_SUSPEND_MODE is a PSCI function
>> available on v1.0 onwards and can be used to set the mode in the
>> firmware.
>>
>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> [Ulf: Rebased on 4.7 rc1]
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/firmware/psci.c   | 22 +++++++++++++++++++++-
>>  include/uapi/linux/psci.h |  5 +++++
>>  2 files changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
>> index 03e0458..3920aba 100644
>> --- a/drivers/firmware/psci.c
>> +++ b/drivers/firmware/psci.c
>> @@ -52,6 +52,7 @@
>>   * require cooperation with a Trusted OS driver.
>>   */
>>  static int resident_cpu = -1;
>> +static bool psci_has_osi_pd;
>>
>>  bool psci_tos_resident_on(int cpu)
>>  {
>> @@ -563,10 +564,29 @@ out_put_node:
>>         return err;
>>  }
>>
>> +static int __init psci_1_0_init(struct device_node *np)
>> +{
>> +       int ret;
>> +
>> +       ret = psci_0_2_init(np);
>> +       if (ret)
>> +               return ret;
>> +
>> +       /* Check if PSCI OSI mode is available */
>> +       ret = psci_features(psci_function_id[PSCI_FN_CPU_SUSPEND]);
>> +       if (ret & PSCI_1_0_OS_INITIATED) {
>> +               ret = psci_features(PSCI_1_0_FN_SET_SUSPEND_MODE);
>> +               if (!ret)
>> +                       psci_has_osi_pd = true;
>
>IMHO, its better to have this done in psci_init_cpu_suspend() itself
>for 2 reasons
>
>a] psci_init_cpu_suspend() already calls
>psci_features(psci_function_id[PSCI_FN_CPU_SUSPEND])
>b] by moving this in psci_init_cpu_suspend() we make this support
>available even for ACPI platforms, since psci_acpi_init() calls
>psci_probe() and this calls  psci_init_cpu_suspend() for
>PSCI_VERSION_MAJOR(ver) >= 1
>
Hmmm.. I can do that.

Thanks,
Lina



>I even posted a patch [1] yesterday, without being aware of your
>patchset for the same.
>
>[1] http://www.spinics.net/lists/arm-kernel/msg513682.html
>
>
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>  static const struct of_device_id psci_of_match[] __initconst = {
>>         { .compatible = "arm,psci",     .data = psci_0_1_init},
>>         { .compatible = "arm,psci-0.2", .data = psci_0_2_init},
>> -       { .compatible = "arm,psci-1.0", .data = psci_0_2_init},
>> +       { .compatible = "arm,psci-1.0", .data = psci_1_0_init},
>>         {},
>>  };
>>
>> diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
>> index 3d7a0fc..7dd778e 100644
>> --- a/include/uapi/linux/psci.h
>> +++ b/include/uapi/linux/psci.h
>> @@ -48,6 +48,7 @@
>>
>>  #define PSCI_1_0_FN_PSCI_FEATURES              PSCI_0_2_FN(10)
>>  #define PSCI_1_0_FN_SYSTEM_SUSPEND             PSCI_0_2_FN(14)
>> +#define PSCI_1_0_FN_SET_SUSPEND_MODE           PSCI_0_2_FN(15)
>>
>>  #define PSCI_1_0_FN64_SYSTEM_SUSPEND           PSCI_0_2_FN64(14)
>>
>> @@ -93,6 +94,10 @@
>>  #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK  \
>>                         (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT)
>>
>> +#define PSCI_1_0_OS_INITIATED                  BIT(0)
>> +#define PSCI_1_0_SUSPEND_MODE_PC               0
>> +#define PSCI_1_0_SUSPEND_MODE_OSI              1
>> +
>>  /* PSCI return values (inclusive of all PSCI versions) */
>>  #define PSCI_RET_SUCCESS                       0
>>  #define PSCI_RET_NOT_SUPPORTED                 -1
>> --
>> 2.7.4
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: lina.iyer@linaro.org (Lina Iyer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/14] drivers: firmware: psci: Allow OS Initiated suspend mode
Date: Fri, 24 Jun 2016 10:53:29 -0600	[thread overview]
Message-ID: <20160624165329.GA1085@linaro.org> (raw)
In-Reply-To: <CAGm_ybjO+jAN62fqFyVrw_+5LOnUumEfn8kxmDa+s5ap0Bqk9A@mail.gmail.com>

On Fri, Jun 24 2016 at 22:25 -0600, Vikas Sajjan wrote:
>Hi Lina,
>
>On Thu, Jun 23, 2016 at 1:06 AM, Lina Iyer <lina.iyer@linaro.org> wrote:
>> PSCI firmware v1.0 onwards may support 2 different modes for
>> CPU_SUSPEND. Platform coordinated mode is the default and every firmware
>> should support it. OS Initiated mode is optional for the firmware to
>> implement and allow Linux to make an better decision on the state of
>> the CPU cluster heirarchy.
>>
>> With the kernel capable of deciding the state for CPU cluster and
>> coherency domains, the OS Initiated mode may now be used by the kernel,
>> provided the firmware supports it. SET_SUSPEND_MODE is a PSCI function
>> available on v1.0 onwards and can be used to set the mode in the
>> firmware.
>>
>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> [Ulf: Rebased on 4.7 rc1]
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/firmware/psci.c   | 22 +++++++++++++++++++++-
>>  include/uapi/linux/psci.h |  5 +++++
>>  2 files changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
>> index 03e0458..3920aba 100644
>> --- a/drivers/firmware/psci.c
>> +++ b/drivers/firmware/psci.c
>> @@ -52,6 +52,7 @@
>>   * require cooperation with a Trusted OS driver.
>>   */
>>  static int resident_cpu = -1;
>> +static bool psci_has_osi_pd;
>>
>>  bool psci_tos_resident_on(int cpu)
>>  {
>> @@ -563,10 +564,29 @@ out_put_node:
>>         return err;
>>  }
>>
>> +static int __init psci_1_0_init(struct device_node *np)
>> +{
>> +       int ret;
>> +
>> +       ret = psci_0_2_init(np);
>> +       if (ret)
>> +               return ret;
>> +
>> +       /* Check if PSCI OSI mode is available */
>> +       ret = psci_features(psci_function_id[PSCI_FN_CPU_SUSPEND]);
>> +       if (ret & PSCI_1_0_OS_INITIATED) {
>> +               ret = psci_features(PSCI_1_0_FN_SET_SUSPEND_MODE);
>> +               if (!ret)
>> +                       psci_has_osi_pd = true;
>
>IMHO, its better to have this done in psci_init_cpu_suspend() itself
>for 2 reasons
>
>a] psci_init_cpu_suspend() already calls
>psci_features(psci_function_id[PSCI_FN_CPU_SUSPEND])
>b] by moving this in psci_init_cpu_suspend() we make this support
>available even for ACPI platforms, since psci_acpi_init() calls
>psci_probe() and this calls  psci_init_cpu_suspend() for
>PSCI_VERSION_MAJOR(ver) >= 1
>
Hmmm.. I can do that.

Thanks,
Lina



>I even posted a patch [1] yesterday, without being aware of your
>patchset for the same.
>
>[1] http://www.spinics.net/lists/arm-kernel/msg513682.html
>
>
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>  static const struct of_device_id psci_of_match[] __initconst = {
>>         { .compatible = "arm,psci",     .data = psci_0_1_init},
>>         { .compatible = "arm,psci-0.2", .data = psci_0_2_init},
>> -       { .compatible = "arm,psci-1.0", .data = psci_0_2_init},
>> +       { .compatible = "arm,psci-1.0", .data = psci_1_0_init},
>>         {},
>>  };
>>
>> diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
>> index 3d7a0fc..7dd778e 100644
>> --- a/include/uapi/linux/psci.h
>> +++ b/include/uapi/linux/psci.h
>> @@ -48,6 +48,7 @@
>>
>>  #define PSCI_1_0_FN_PSCI_FEATURES              PSCI_0_2_FN(10)
>>  #define PSCI_1_0_FN_SYSTEM_SUSPEND             PSCI_0_2_FN(14)
>> +#define PSCI_1_0_FN_SET_SUSPEND_MODE           PSCI_0_2_FN(15)
>>
>>  #define PSCI_1_0_FN64_SYSTEM_SUSPEND           PSCI_0_2_FN64(14)
>>
>> @@ -93,6 +94,10 @@
>>  #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK  \
>>                         (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT)
>>
>> +#define PSCI_1_0_OS_INITIATED                  BIT(0)
>> +#define PSCI_1_0_SUSPEND_MODE_PC               0
>> +#define PSCI_1_0_SUSPEND_MODE_OSI              1
>> +
>>  /* PSCI return values (inclusive of all PSCI versions) */
>>  #define PSCI_RET_SUCCESS                       0
>>  #define PSCI_RET_NOT_SUPPORTED                 -1
>> --
>> 2.7.4
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2016-06-24 16:53 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 19:36 [PATCH 00/14] PM: SoC idle support using PM domains Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 01/14] PM / Domains: Allow domain power states to be read from DT Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-23 17:38   ` Mark Rutland
2016-06-23 17:38     ` Mark Rutland
     [not found] ` <1466624209-27432-1-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-22 19:36   ` [PATCH 02/14] dt/bindings: update binding for PM domain idle states Lina Iyer
2016-06-22 19:36     ` Lina Iyer
     [not found]     ` <1466624209-27432-3-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-23 17:35       ` Mark Rutland
2016-06-23 17:35         ` Mark Rutland
2016-06-23 18:04         ` Lina Iyer
2016-06-23 18:04           ` Lina Iyer
     [not found]           ` <20160623180451.GD1115-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-23 18:19             ` Mark Rutland
2016-06-23 18:19               ` Mark Rutland
2016-06-23 18:39               ` Lina Iyer
2016-06-23 18:39                 ` Lina Iyer
2016-07-27 11:11                 ` [draft] " Brendan Jackman
2016-06-22 19:36 ` [PATCH 03/14] PM / Domains: Abstract genpd locking Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 04/14] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 05/14] PM / doc: update device documentation for devices in " Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-07-25 22:50   ` Kevin Hilman
2016-07-25 22:50     ` Kevin Hilman
2016-07-25 23:21     ` Lina Iyer
2016-07-25 23:21       ` Lina Iyer
2016-06-22 19:36 ` [PATCH 06/14] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 07/14] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 08/14] timer: Export next wake up of a CPU Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-07-26 18:26   ` Kevin Hilman
2016-07-26 18:26     ` Kevin Hilman
2016-07-27  9:14   ` Thomas Gleixner
2016-07-27  9:14     ` Thomas Gleixner
2016-07-27 15:04     ` Lina Iyer
2016-07-27 15:04       ` Lina Iyer
2016-06-22 19:36 ` [PATCH 09/14] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 10/14] doc / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 11/14] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-24  4:25   ` Vikas Sajjan
2016-06-24  4:25     ` Vikas Sajjan
2016-06-24 16:53     ` Lina Iyer [this message]
2016-06-24 16:53       ` Lina Iyer
2016-06-27 10:12     ` Mark Rutland
2016-06-27 10:12       ` Mark Rutland
2016-06-28  6:07       ` Vikas Sajjan
2016-06-28  6:07         ` Vikas Sajjan
2016-06-22 19:36 ` [PATCH 12/14] drivers: firmware: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 13/14] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-06-22 19:36 ` [PATCH 14/14] ARM64: dts: Define CPU power domain " Lina Iyer
2016-06-22 19:36   ` Lina Iyer
2016-07-26 22:08 ` [PATCH 00/14] PM: SoC idle support using PM domains Kevin Hilman
2016-07-26 22:08   ` Kevin Hilman
2016-07-27 15:06   ` Lina Iyer
2016-07-27 15:06     ` Lina Iyer

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=20160624165329.GA1085@linaro.org \
    --to=lina.iyer@linaro.org \
    --cc=ahaslam@baylibre.com \
    --cc=andy.gross@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mtitinger@baylibre.com \
    --cc=rjw@rjwysocki.net \
    --cc=sajjan.linux@gmail.com \
    --cc=sboyd@codeaurora.org \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.