linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2
@ 2020-01-10 19:29 Elliot Berman
  2020-01-10 19:29 ` [RFC] drivers: firmware: psci: Add function to support SYSTEM_RESET2 Elliot Berman
  2020-01-13 10:11 ` [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Elliot Berman @ 2020-01-10 19:29 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla
  Cc: Elliot Berman, Bjorn Andersson, tsoni, psodagud,
	linux-arm-kernel, linux-arm-msm, linux-kernel

This patch adds support for vendor-specific SYSTEM_RESET2 to support
Qualcomm target use cases of rebooting into a RAM dump download mode. I'm
working on the client driver to use the proposed psci_system_reset2()
function but wanted to get this RFC going for PSCI driver changes.


Elliot Berman (1):
  drivers: firmware: psci: Add function to support SYSTEM_RESET2

 drivers/firmware/psci/psci.c | 16 +++++++++++++++-
 include/linux/psci.h         |  3 +++
 include/uapi/linux/psci.h    |  8 ++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [RFC] drivers: firmware: psci: Add function to support SYSTEM_RESET2
  2020-01-10 19:29 [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman
@ 2020-01-10 19:29 ` Elliot Berman
  2020-01-13 10:11 ` [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Elliot Berman @ 2020-01-10 19:29 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla
  Cc: Elliot Berman, Bjorn Andersson, tsoni, psodagud,
	linux-arm-kernel, linux-arm-msm, linux-kernel

Make SYSTEM_RESET2 command part of its own function which client drivers
may also invoke to support vendor-specific reset types.

Signed-off-by: Elliot Berman <eberman@codeaurora.org>
---
 drivers/firmware/psci/psci.c | 16 +++++++++++++++-
 include/linux/psci.h         |  3 +++
 include/uapi/linux/psci.h    |  8 ++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index b3b6c15..338e4be 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -220,6 +220,15 @@ static unsigned long psci_migrate_info_up_cpu(void)
 			      0, 0, 0);
 }
 
+int psci_system_reset2(const u32 reset_type, const unsigned long cookie)
+{
+	if (!psci_system_reset2_supported)
+		return -EOPNOTSUPP;
+	return invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), reset_type,
+			      cookie, 0);
+}
+EXPORT_SYMBOL_GPL(psci_system_reset2);
+
 static void set_conduit(enum arm_smccc_conduit conduit)
 {
 	switch (conduit) {
@@ -267,7 +276,12 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
 		 * reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
 		 * cookie = 0 (ignored by the implementation)
 		 */
-		invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
+		psci_system_reset2(
+			PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET |
+			(PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE <<
+			PSCI_1_1_SYSTEM_RESET2_SHIFT),
+			0
+		);
 	} else {
 		invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
 	}
diff --git a/include/linux/psci.h b/include/linux/psci.h
index ebe0a88..9479952 100644
--- a/include/linux/psci.h
+++ b/include/linux/psci.h
@@ -41,8 +41,11 @@ extern struct psci_operations psci_ops;
 
 #if defined(CONFIG_ARM_PSCI_FW)
 int __init psci_dt_init(void);
+int psci_system_reset2(const u32 reset_type, const unsigned long cookie);
 #else
 static inline int psci_dt_init(void) { return 0; }
+static inline int psci_system_reset2(const u32 reset_type,
+	const unsigned long cookie) { return -ENODEV; }
 #endif
 
 #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
index 2fcad1d..42edbd7 100644
--- a/include/uapi/linux/psci.h
+++ b/include/uapi/linux/psci.h
@@ -72,6 +72,14 @@
 #define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK	\
 				(0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT)
 
+/* PSCI SYSTEM_RESET2 reset_type argument */
+#define PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET	0x0
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_VENDOR		1
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE	0
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT		30
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_MASK		\
+				(0x1 << PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT)
+
 /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
 #define PSCI_0_2_AFFINITY_LEVEL_ON		0
 #define PSCI_0_2_AFFINITY_LEVEL_OFF		1
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2
  2020-01-10 19:29 [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman
  2020-01-10 19:29 ` [RFC] drivers: firmware: psci: Add function to support SYSTEM_RESET2 Elliot Berman
@ 2020-01-13 10:11 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2020-01-13 10:11 UTC (permalink / raw)
  To: Elliot Berman
  Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, tsoni,
	Sudeep Holla, psodagud, linux-arm-kernel, linux-arm-msm,
	linux-kernel

On Fri, Jan 10, 2020 at 11:29:11AM -0800, Elliot Berman wrote:
> This patch adds support for vendor-specific SYSTEM_RESET2 to support
> Qualcomm target use cases of rebooting into a RAM dump download mode. I'm
> working on the client driver to use the proposed psci_system_reset2()
> function but wanted to get this RFC going for PSCI driver changes.
>

Please post along with the client driver to understand the context better.
It saves time trying to understand when reviewing and also avoid asking
lots of questions which the client driver might answer :)

--
Regards,
Sudeep

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

end of thread, other threads:[~2020-01-13 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 19:29 [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman
2020-01-10 19:29 ` [RFC] drivers: firmware: psci: Add function to support SYSTEM_RESET2 Elliot Berman
2020-01-13 10:11 ` [RFC] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Sudeep Holla

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).