All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-03 18:51 ` Aaro Koskinen
  0 siblings, 0 replies; 10+ messages in thread
From: Aaro Koskinen @ 2019-04-03 18:51 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi, linux-arm-kernel, linux-kernel
  Cc: Aaro Koskinen

From: Aaro Koskinen <aaro.koskinen@nokia.com>

Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
1.1 specification.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---

	v2: Added #define PSCI_1_1_SYSTEM_RESET_WARM. 
	    Refactored psci_probe.

	v1: https://marc.info/?l=linux-arm-kernel&m=155431514204495&w=2

 drivers/firmware/psci.c   | 42 ++++++++++++++++++++++++++++++++++-----
 include/uapi/linux/psci.h |  6 ++++++
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index c80ec1d03274..004a394de2c3 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -73,6 +73,7 @@ enum psci_function {
 	PSCI_FN_CPU_ON,
 	PSCI_FN_CPU_OFF,
 	PSCI_FN_MIGRATE,
+	PSCI_FN_SYSTEM_RESET2,
 	PSCI_FN_MAX,
 };
 
@@ -256,6 +257,15 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
 }
 
+static void psci_sys_reset2(enum reboot_mode reboot_mode, const char *cmd)
+{
+	if (reboot_mode == REBOOT_WARM)
+		invoke_psci_fn(psci_function_id[PSCI_FN_SYSTEM_RESET2],
+			       PSCI_1_1_SYSTEM_RESET_WARM, 0, 0);
+	else
+		psci_sys_reset(reboot_mode, cmd);
+}
+
 static void psci_sys_poweroff(void)
 {
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
@@ -564,6 +574,20 @@ static void __init psci_0_2_set_functions(void)
 	pm_power_off = psci_sys_poweroff;
 }
 
+static void __init psci_1_1_set_functions(void)
+{
+	int sys_reset2;
+	int feature;
+
+	sys_reset2 = PSCI_FN_NATIVE(1_1, SYSTEM_RESET2);
+	feature	= psci_features(sys_reset2);
+
+	if (feature != PSCI_RET_NOT_SUPPORTED) {
+		psci_function_id[PSCI_FN_SYSTEM_RESET2] = sys_reset2;
+		arm_pm_restart = psci_sys_reset2;
+	}
+}
+
 /*
  * Probe function for PSCI firmware versions >= 0.2
  */
@@ -584,11 +608,19 @@ static int __init psci_probe(void)
 
 	psci_init_migrate();
 
-	if (PSCI_VERSION_MAJOR(ver) >= 1) {
-		psci_init_smccc();
-		psci_init_cpu_suspend();
-		psci_init_system_suspend();
-	}
+	if (ver < PSCI_VERSION(1, 0))
+		return 0;
+
+	/* PSCI 1.0 setup */
+	psci_init_smccc();
+	psci_init_cpu_suspend();
+	psci_init_system_suspend();
+
+	if (ver < PSCI_VERSION(1, 1))
+		return 0;
+
+	/* PSCI 1.1 setup */
+	psci_1_1_set_functions();
 
 	return 0;
 }
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
index b3bcabe380da..bf5a90c05e79 100644
--- a/include/uapi/linux/psci.h
+++ b/include/uapi/linux/psci.h
@@ -52,6 +52,12 @@
 
 #define PSCI_1_0_FN64_SYSTEM_SUSPEND		PSCI_0_2_FN64(14)
 
+#define PSCI_1_1_FN_SYSTEM_RESET2		PSCI_0_2_FN(18)
+#define PSCI_1_1_FN64_SYSTEM_RESET2		PSCI_0_2_FN64(18)
+
+/* PSCI v1.1 parameter values for SYSTEM_RESET2 */
+#define PSCI_1_1_SYSTEM_RESET_WARM		0
+
 /* PSCI v0.2 power state encoding for CPU_SUSPEND function */
 #define PSCI_0_2_POWER_STATE_ID_MASK		0xffff
 #define PSCI_0_2_POWER_STATE_ID_SHIFT		0
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-03 18:51 ` Aaro Koskinen
  0 siblings, 0 replies; 10+ messages in thread
From: Aaro Koskinen @ 2019-04-03 18:51 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi, linux-arm-kernel, linux-kernel
  Cc: Aaro Koskinen

From: Aaro Koskinen <aaro.koskinen@nokia.com>

Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
1.1 specification.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---

	v2: Added #define PSCI_1_1_SYSTEM_RESET_WARM. 
	    Refactored psci_probe.

	v1: https://marc.info/?l=linux-arm-kernel&m=155431514204495&w=2

 drivers/firmware/psci.c   | 42 ++++++++++++++++++++++++++++++++++-----
 include/uapi/linux/psci.h |  6 ++++++
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index c80ec1d03274..004a394de2c3 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -73,6 +73,7 @@ enum psci_function {
 	PSCI_FN_CPU_ON,
 	PSCI_FN_CPU_OFF,
 	PSCI_FN_MIGRATE,
+	PSCI_FN_SYSTEM_RESET2,
 	PSCI_FN_MAX,
 };
 
@@ -256,6 +257,15 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
 }
 
+static void psci_sys_reset2(enum reboot_mode reboot_mode, const char *cmd)
+{
+	if (reboot_mode == REBOOT_WARM)
+		invoke_psci_fn(psci_function_id[PSCI_FN_SYSTEM_RESET2],
+			       PSCI_1_1_SYSTEM_RESET_WARM, 0, 0);
+	else
+		psci_sys_reset(reboot_mode, cmd);
+}
+
 static void psci_sys_poweroff(void)
 {
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
@@ -564,6 +574,20 @@ static void __init psci_0_2_set_functions(void)
 	pm_power_off = psci_sys_poweroff;
 }
 
+static void __init psci_1_1_set_functions(void)
+{
+	int sys_reset2;
+	int feature;
+
+	sys_reset2 = PSCI_FN_NATIVE(1_1, SYSTEM_RESET2);
+	feature	= psci_features(sys_reset2);
+
+	if (feature != PSCI_RET_NOT_SUPPORTED) {
+		psci_function_id[PSCI_FN_SYSTEM_RESET2] = sys_reset2;
+		arm_pm_restart = psci_sys_reset2;
+	}
+}
+
 /*
  * Probe function for PSCI firmware versions >= 0.2
  */
@@ -584,11 +608,19 @@ static int __init psci_probe(void)
 
 	psci_init_migrate();
 
-	if (PSCI_VERSION_MAJOR(ver) >= 1) {
-		psci_init_smccc();
-		psci_init_cpu_suspend();
-		psci_init_system_suspend();
-	}
+	if (ver < PSCI_VERSION(1, 0))
+		return 0;
+
+	/* PSCI 1.0 setup */
+	psci_init_smccc();
+	psci_init_cpu_suspend();
+	psci_init_system_suspend();
+
+	if (ver < PSCI_VERSION(1, 1))
+		return 0;
+
+	/* PSCI 1.1 setup */
+	psci_1_1_set_functions();
 
 	return 0;
 }
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
index b3bcabe380da..bf5a90c05e79 100644
--- a/include/uapi/linux/psci.h
+++ b/include/uapi/linux/psci.h
@@ -52,6 +52,12 @@
 
 #define PSCI_1_0_FN64_SYSTEM_SUSPEND		PSCI_0_2_FN64(14)
 
+#define PSCI_1_1_FN_SYSTEM_RESET2		PSCI_0_2_FN(18)
+#define PSCI_1_1_FN64_SYSTEM_RESET2		PSCI_0_2_FN64(18)
+
+/* PSCI v1.1 parameter values for SYSTEM_RESET2 */
+#define PSCI_1_1_SYSTEM_RESET_WARM		0
+
 /* PSCI v0.2 power state encoding for CPU_SUSPEND function */
 #define PSCI_0_2_POWER_STATE_ID_MASK		0xffff
 #define PSCI_0_2_POWER_STATE_ID_SHIFT		0
-- 
2.17.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
  2019-04-03 18:51 ` Aaro Koskinen
@ 2019-04-05  3:28   ` saiprakash.ranjan
  -1 siblings, 0 replies; 10+ messages in thread
From: saiprakash.ranjan @ 2019-04-05  3:28 UTC (permalink / raw)
  To: Aaro Koskinen, Sudeep Holla, Michal Simek
  Cc: Mark Rutland, Lorenzo Pieralisi, linux-arm-kernel, linux-kernel,
	Aaro Koskinen

On 2019-04-04 00:21, Aaro Koskinen wrote:
> From: Aaro Koskinen <aaro.koskinen@nokia.com>
> 
> Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> 1.1 specification.
> 

There is already a patch sent by Sudeep for this support.

- 
https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-05  3:28   ` saiprakash.ranjan
  0 siblings, 0 replies; 10+ messages in thread
From: saiprakash.ranjan @ 2019-04-05  3:28 UTC (permalink / raw)
  To: Aaro Koskinen, Sudeep Holla, Michal Simek
  Cc: Mark Rutland, Lorenzo Pieralisi, linux-kernel, linux-arm-kernel,
	Aaro Koskinen

On 2019-04-04 00:21, Aaro Koskinen wrote:
> From: Aaro Koskinen <aaro.koskinen@nokia.com>
> 
> Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> 1.1 specification.
> 

There is already a patch sent by Sudeep for this support.

- 
https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
  2019-04-05  3:28   ` saiprakash.ranjan
@ 2019-04-05  9:42     ` Aaro Koskinen
  -1 siblings, 0 replies; 10+ messages in thread
From: Aaro Koskinen @ 2019-04-05  9:42 UTC (permalink / raw)
  To: saiprakash.ranjan, Sudeep Holla
  Cc: Michal Simek, Mark Rutland, Lorenzo Pieralisi, linux-arm-kernel,
	linux-kernel, Aaro Koskinen

Hi,

On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> On 2019-04-04 00:21, Aaro Koskinen wrote:
> >From: Aaro Koskinen <aaro.koskinen@nokia.com>
> >
> >Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> >1.1 specification.
> >
> 
> There is already a patch sent by Sudeep for this support.
> 
> - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/

OK, I have missed that. Sudeep, are you planning to send a new version
of this patch? Looks like the last was sent almost a year ago.

A.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-05  9:42     ` Aaro Koskinen
  0 siblings, 0 replies; 10+ messages in thread
From: Aaro Koskinen @ 2019-04-05  9:42 UTC (permalink / raw)
  To: saiprakash.ranjan, Sudeep Holla
  Cc: Mark Rutland, Lorenzo Pieralisi, linux-kernel, Michal Simek,
	Aaro Koskinen, linux-arm-kernel

Hi,

On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> On 2019-04-04 00:21, Aaro Koskinen wrote:
> >From: Aaro Koskinen <aaro.koskinen@nokia.com>
> >
> >Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> >1.1 specification.
> >
> 
> There is already a patch sent by Sudeep for this support.
> 
> - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/

OK, I have missed that. Sudeep, are you planning to send a new version
of this patch? Looks like the last was sent almost a year ago.

A.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
  2019-04-05  9:42     ` Aaro Koskinen
@ 2019-04-10 11:42       ` Sudeep Holla
  -1 siblings, 0 replies; 10+ messages in thread
From: Sudeep Holla @ 2019-04-10 11:42 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: saiprakash.ranjan, Michal Simek, Mark Rutland, Lorenzo Pieralisi,
	linux-arm-kernel, linux-kernel, Aaro Koskinen

On Fri, Apr 05, 2019 at 12:42:43PM +0300, Aaro Koskinen wrote:
> Hi,
>
> On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> > On 2019-04-04 00:21, Aaro Koskinen wrote:
> > >From: Aaro Koskinen <aaro.koskinen@nokia.com>
> > >
> > >Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> > >1.1 specification.
> > >
> >
> > There is already a patch sent by Sudeep for this support.
> >
> > - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/
>
> OK, I have missed that. Sudeep, are you planning to send a new version
> of this patch? Looks like the last was sent almost a year ago.
>

Sure I can, if there's a requirement and someone can test it.

--
Regards,
Sudeep


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-10 11:42       ` Sudeep Holla
  0 siblings, 0 replies; 10+ messages in thread
From: Sudeep Holla @ 2019-04-10 11:42 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Mark Rutland, saiprakash.ranjan, Lorenzo Pieralisi, Michal Simek,
	linux-kernel, Aaro Koskinen, linux-arm-kernel

On Fri, Apr 05, 2019 at 12:42:43PM +0300, Aaro Koskinen wrote:
> Hi,
>
> On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> > On 2019-04-04 00:21, Aaro Koskinen wrote:
> > >From: Aaro Koskinen <aaro.koskinen@nokia.com>
> > >
> > >Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> > >1.1 specification.
> > >
> >
> > There is already a patch sent by Sudeep for this support.
> >
> > - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/
>
> OK, I have missed that. Sudeep, are you planning to send a new version
> of this patch? Looks like the last was sent almost a year ago.
>

Sure I can, if there's a requirement and someone can test it.

--
Regards,
Sudeep


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] drivers: firmware: psci: add support for warm reset
  2019-04-10 11:42       ` Sudeep Holla
@ 2019-04-10 12:19         ` Koskinen, Aaro (Nokia - FI/Espoo)
  -1 siblings, 0 replies; 10+ messages in thread
From: Koskinen, Aaro (Nokia - FI/Espoo) @ 2019-04-10 12:19 UTC (permalink / raw)
  To: Sudeep Holla, Aaro Koskinen
  Cc: saiprakash.ranjan, Michal Simek, Mark Rutland, Lorenzo Pieralisi,
	linux-arm-kernel, linux-kernel

Hi,

From: Sudeep Holla [sudeep.holla@arm.com]:
> On Fri, Apr 05, 2019 at 12:42:43PM +0300, Aaro Koskinen wrote:
> > On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> > > There is already a patch sent by Sudeep for this support.
> > >
> > > - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/
> >
> > OK, I have missed that. Sudeep, are you planning to send a new version
> > of this patch? Looks like the last was sent almost a year ago.
> >
>
> Sure I can, if there's a requirement and someone can test it.

Yes, I use this feature.

A.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] drivers: firmware: psci: add support for warm reset
@ 2019-04-10 12:19         ` Koskinen, Aaro (Nokia - FI/Espoo)
  0 siblings, 0 replies; 10+ messages in thread
From: Koskinen, Aaro (Nokia - FI/Espoo) @ 2019-04-10 12:19 UTC (permalink / raw)
  To: Sudeep Holla, Aaro Koskinen
  Cc: Mark Rutland, saiprakash.ranjan, Lorenzo Pieralisi, Michal Simek,
	linux-kernel, linux-arm-kernel

Hi,

From: Sudeep Holla [sudeep.holla@arm.com]:
> On Fri, Apr 05, 2019 at 12:42:43PM +0300, Aaro Koskinen wrote:
> > On Fri, Apr 05, 2019 at 08:58:30AM +0530, saiprakash.ranjan@codeaurora.org wrote:
> > > There is already a patch sent by Sudeep for this support.
> > >
> > > - https://lore.kernel.org/lkml/1525257003-8608-1-git-send-email-sudeep.holla@arm.com/
> >
> > OK, I have missed that. Sudeep, are you planning to send a new version
> > of this patch? Looks like the last was sent almost a year ago.
> >
>
> Sure I can, if there's a requirement and someone can test it.

Yes, I use this feature.

A.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-10 12:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 18:51 [PATCH v2] drivers: firmware: psci: add support for warm reset Aaro Koskinen
2019-04-03 18:51 ` Aaro Koskinen
2019-04-05  3:28 ` saiprakash.ranjan
2019-04-05  3:28   ` saiprakash.ranjan
2019-04-05  9:42   ` Aaro Koskinen
2019-04-05  9:42     ` Aaro Koskinen
2019-04-10 11:42     ` Sudeep Holla
2019-04-10 11:42       ` Sudeep Holla
2019-04-10 12:19       ` Koskinen, Aaro (Nokia - FI/Espoo)
2019-04-10 12:19         ` Koskinen, Aaro (Nokia - FI/Espoo)

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.