public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] firmware: ti_sci: Introduce BOARDCFG_MANAGED mode for Jacinto family
@ 2025-10-17 14:44 Thomas Richard (TI.com)
  2025-10-17 14:44 ` [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support Thomas Richard (TI.com)
  2025-10-17 14:44 ` [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume Thomas Richard (TI.com)
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Richard (TI.com) @ 2025-10-17 14:44 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar
  Cc: Gregory CLEMENT, richard.genoud, Udit Kumar, Prasanth Mantena,
	Abhash Kumar, Thomas Petazzoni, linux-arm-kernel, linux-kernel,
	Thomas Richard (TI.com)

This series introduces the BOARDCFG_MANAGED mode, which is used by the
Jacinto family. In this mode, low power configuration is handled
statically for the Device Manager (DM) via boardcfg.
On Jacinto SoCs, the DM-Firmware does not support suspend-resume; instead,
it is restarted from scratch during resume. As a result, the firmware is
unable to restore IRQs, and this responsibility is delegated to the ti_sci
driver.

Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
---
Thomas Richard (TI.com) (2):
      firmware: ti_sci: add BOARDCFG_MANAGED mode support
      firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume

 drivers/firmware/ti_sci.c | 153 ++++++++++++++++++++++++++++++++++++++++++----
 drivers/firmware/ti_sci.h |  14 +++--
 2 files changed, 150 insertions(+), 17 deletions(-)
---
base-commit: cb6649f6217c0331b885cf787f1d175963e2a1d2
change-id: 20251010-ti-sci-jacinto-s2r-restore-irq-428e008fd10c
prerequisite-message-id: 20251014-ti-sci-io-isolation-v1-1-67c7ce5d1b63@bootlin.com
prerequisite-patch-id: 7bbf6ca9fb85214b5360548506ccca7fae2e5a16

Best regards,
-- 
Thomas Richard (TI.com) <thomas.richard@bootlin.com>



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

* [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support
  2025-10-17 14:44 [PATCH RFC 0/2] firmware: ti_sci: Introduce BOARDCFG_MANAGED mode for Jacinto family Thomas Richard (TI.com)
@ 2025-10-17 14:44 ` Thomas Richard (TI.com)
  2025-11-07 11:41   ` Nishanth Menon
  2025-10-17 14:44 ` [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume Thomas Richard (TI.com)
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Richard (TI.com) @ 2025-10-17 14:44 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar
  Cc: Gregory CLEMENT, richard.genoud, Udit Kumar, Prasanth Mantena,
	Abhash Kumar, Thomas Petazzoni, linux-arm-kernel, linux-kernel,
	Thomas Richard (TI.com)

In BOARDCFG_MANAGED mode, the low power mode configuration is done
statically for the DM via the boardcfg. Constraints are not supported, and
prepare_sleep() is not needed.

Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
---
 drivers/firmware/ti_sci.c | 10 +++++++---
 drivers/firmware/ti_sci.h | 14 ++++++++------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index da134ada64e179b4b307f7e0de5ed0f7371a96f2..f9f1a67e8e66b0a4048fae04ce31be54ca5cba7a 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3693,8 +3693,11 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
 			return ti_sci_cmd_prepare_sleep(&info->handle,
 							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
 							0, 0, 0);
+		} else if (info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED) {
+			/* Nothing to do in the BOARDCFG_MANAGED mode */
+			return 0;
 		} else {
-			/* DM Managed is not supported by the firmware. */
+			/* DM Managed and BoardCfg Managed are not supported by the firmware. */
 			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");
 			return -EOPNOTSUPP;
 		}
@@ -3932,12 +3935,13 @@ static int ti_sci_probe(struct platform_device *pdev)
 	}
 
 	ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps);
-	dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s\n",
+	dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s\n",
 		info->fw_caps & MSG_FLAG_CAPS_GENERIC ? "Generic" : "",
 		info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO ? " Partial-IO" : "",
 		info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED ? " DM-Managed" : "",
 		info->fw_caps & MSG_FLAG_CAPS_LPM_ABORT ? " LPM-Abort" : "",
-		info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : ""
+		info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : "",
+		info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED ? " BoardConfig-Managed" : ""
 	);
 
 	ti_sci_setup_ops(info);
diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h
index 7559cde17b6ccfeeb1bc357fce5c5767c3f75c54..ac1cf6971b8678aa1277abb86d9ec672493f4c86 100644
--- a/drivers/firmware/ti_sci.h
+++ b/drivers/firmware/ti_sci.h
@@ -150,6 +150,7 @@ struct ti_sci_msg_req_reboot {
  *		MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM
  *		MSG_FLAG_CAPS_LPM_ABORT: Abort entry to LPM
  *		MSG_FLAG_CAPS_IO_ISOLATION: IO Isolation support
+ *		MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED: LPM config done statically for the DM via boardcfg
  *
  * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
  * providing currently available SOC/firmware capabilities. SoC that don't
@@ -157,12 +158,13 @@ struct ti_sci_msg_req_reboot {
  */
 struct ti_sci_msg_resp_query_fw_caps {
 	struct ti_sci_msg_hdr hdr;
-#define MSG_FLAG_CAPS_GENERIC		TI_SCI_MSG_FLAG(0)
-#define MSG_FLAG_CAPS_LPM_PARTIAL_IO	TI_SCI_MSG_FLAG(4)
-#define MSG_FLAG_CAPS_LPM_DM_MANAGED	TI_SCI_MSG_FLAG(5)
-#define MSG_FLAG_CAPS_LPM_ABORT		TI_SCI_MSG_FLAG(9)
-#define MSG_FLAG_CAPS_IO_ISOLATION	TI_SCI_MSG_FLAG(7)
-#define MSG_MASK_CAPS_LPM		GENMASK_ULL(4, 1)
+#define MSG_FLAG_CAPS_GENERIC			TI_SCI_MSG_FLAG(0)
+#define MSG_FLAG_CAPS_LPM_PARTIAL_IO		TI_SCI_MSG_FLAG(4)
+#define MSG_FLAG_CAPS_LPM_DM_MANAGED		TI_SCI_MSG_FLAG(5)
+#define MSG_FLAG_CAPS_LPM_ABORT			TI_SCI_MSG_FLAG(9)
+#define MSG_FLAG_CAPS_IO_ISOLATION		TI_SCI_MSG_FLAG(7)
+#define MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED	TI_SCI_MSG_FLAG(10)
+#define MSG_MASK_CAPS_LPM			GENMASK_ULL(4, 1)
 	u64 fw_caps;
 } __packed;
 

-- 
2.51.0



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

* [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume
  2025-10-17 14:44 [PATCH RFC 0/2] firmware: ti_sci: Introduce BOARDCFG_MANAGED mode for Jacinto family Thomas Richard (TI.com)
  2025-10-17 14:44 ` [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support Thomas Richard (TI.com)
@ 2025-10-17 14:44 ` Thomas Richard (TI.com)
  2025-11-07 11:54   ` Nishanth Menon
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Richard (TI.com) @ 2025-10-17 14:44 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar
  Cc: Gregory CLEMENT, richard.genoud, Udit Kumar, Prasanth Mantena,
	Abhash Kumar, Thomas Petazzoni, linux-arm-kernel, linux-kernel,
	Thomas Richard (TI.com)

In BOARDCFG_MANAGED mode, the firmware cannot restore IRQs during
resume. This responsibility is delegated to the ti_sci driver,
which maintains an internal list of all requested IRQs. This list
is updated on each set/free operation, and all IRQs are restored
during the resume_noirq() phase.

Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
---
 drivers/firmware/ti_sci.c | 143 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 135 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index f9f1a67e8e66b0a4048fae04ce31be54ca5cba7a..a211f8805dd21c7675b8cefd61929ecfda8e0f7f 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -87,6 +87,16 @@ struct ti_sci_desc {
 	int max_msg_size;
 };
 
+/**
+ * struct ti_sci_irq - Description of allocated irqs
+ * @list: List head
+ * @desc: Description of the irq
+ */
+struct ti_sci_irq {
+	struct list_head list;
+	struct ti_sci_msg_req_manage_irq desc;
+};
+
 /**
  * struct ti_sci_info - Structure representing a TI SCI instance
  * @dev:	Device pointer
@@ -101,6 +111,7 @@ struct ti_sci_desc {
  * @chan_rx:	Receive mailbox channel
  * @minfo:	Message info
  * @node:	list head
+ * @irqs:	List of allocated irqs
  * @host_id:	Host ID
  * @fw_caps:	FW/SoC low power capabilities
  * @users:	Number of users of this instance
@@ -117,6 +128,7 @@ struct ti_sci_info {
 	struct mbox_chan *chan_tx;
 	struct mbox_chan *chan_rx;
 	struct ti_sci_xfers_info minfo;
+	struct ti_sci_irq irqs;
 	struct list_head node;
 	u8 host_id;
 	u64 fw_caps;
@@ -2294,6 +2306,29 @@ static int ti_sci_manage_irq(const struct ti_sci_handle *handle,
 	return ret;
 }
 
+/**
+ * ti_sci_irq_equal() - Helper API to compare two irqs (generic headers are not
+ *                       compared)
+ * @irq_a:	irq_a to compare
+ * @irq_b:	irq_b to compare
+ *
+ * Return: true if the two irqs are equal, else false.
+ */
+static bool ti_sci_irq_equal(struct ti_sci_msg_req_manage_irq irq_a,
+			     struct ti_sci_msg_req_manage_irq irq_b)
+{
+	return irq_a.valid_params == irq_b.valid_params &&
+		irq_a.src_id == irq_b.src_id &&
+		irq_a.src_index == irq_b.src_index &&
+		irq_a.dst_id == irq_b.dst_id &&
+		irq_a.dst_host_irq == irq_b.dst_host_irq &&
+		irq_a.ia_id == irq_b.ia_id &&
+		irq_a.vint == irq_b.vint &&
+		irq_a.global_event == irq_b.global_event &&
+		irq_a.vint_status_bit == irq_b.vint_status_bit &&
+		irq_a.secondary_host == irq_b.secondary_host;
+}
+
 /**
  * ti_sci_set_irq() - Helper api to configure the irq route between the
  *		      requested source and destination
@@ -2317,15 +2352,43 @@ static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params,
 			  u16 dst_host_irq, u16 ia_id, u16 vint,
 			  u16 global_event, u8 vint_status_bit, u8 s_host)
 {
+	struct ti_sci_info *info = handle_to_ti_sci_info(handle);
+	struct ti_sci_msg_req_manage_irq *desc;
+	struct ti_sci_irq *irq;
+	int ret;
+
 	pr_debug("%s: IRQ set with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d,via ia_id = %d, vint = %d, global event = %d,status_bit = %d\n",
 		 __func__, valid_params, src_id, src_index,
 		 dst_id, dst_host_irq, ia_id, vint, global_event,
 		 vint_status_bit);
 
-	return ti_sci_manage_irq(handle, valid_params, src_id, src_index,
-				 dst_id, dst_host_irq, ia_id, vint,
-				 global_event, vint_status_bit, s_host,
-				 TI_SCI_MSG_SET_IRQ);
+	ret = ti_sci_manage_irq(handle, valid_params, src_id, src_index,
+				dst_id, dst_host_irq, ia_id, vint,
+				global_event, vint_status_bit, s_host,
+				TI_SCI_MSG_SET_IRQ);
+
+	if (ret)
+		return ret;
+
+	irq = kzalloc(sizeof(*irq), GFP_KERNEL);
+	if (!irq)
+		return -ENOMEM;
+
+	desc = &irq->desc;
+	desc->valid_params = valid_params;
+	desc->src_id = src_id;
+	desc->src_index = src_index;
+	desc->dst_id = dst_id;
+	desc->dst_host_irq = dst_host_irq;
+	desc->ia_id = ia_id;
+	desc->vint = vint;
+	desc->global_event = global_event;
+	desc->vint_status_bit = vint_status_bit;
+	desc->secondary_host = s_host;
+
+	list_add(&irq->list, &info->irqs.list);
+
+	return 0;
 }
 
 /**
@@ -2351,15 +2414,46 @@ static int ti_sci_free_irq(const struct ti_sci_handle *handle, u32 valid_params,
 			   u16 dst_host_irq, u16 ia_id, u16 vint,
 			   u16 global_event, u8 vint_status_bit, u8 s_host)
 {
+	struct ti_sci_info *info = handle_to_ti_sci_info(handle);
+	struct ti_sci_msg_req_manage_irq irq_desc;
+	struct ti_sci_irq *this_irq;
+	struct list_head *this;
+	int ret;
+
 	pr_debug("%s: IRQ release with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d,via ia_id = %d, vint = %d, global event = %d,status_bit = %d\n",
 		 __func__, valid_params, src_id, src_index,
 		 dst_id, dst_host_irq, ia_id, vint, global_event,
 		 vint_status_bit);
 
-	return ti_sci_manage_irq(handle, valid_params, src_id, src_index,
-				 dst_id, dst_host_irq, ia_id, vint,
-				 global_event, vint_status_bit, s_host,
-				 TI_SCI_MSG_FREE_IRQ);
+	ret = ti_sci_manage_irq(handle, valid_params, src_id, src_index,
+				dst_id, dst_host_irq, ia_id, vint,
+				global_event, vint_status_bit, s_host,
+				TI_SCI_MSG_FREE_IRQ);
+
+	if (ret)
+		return ret;
+
+	irq_desc.valid_params = valid_params;
+	irq_desc.src_id = src_id;
+	irq_desc.src_index = src_index;
+	irq_desc.dst_id = dst_id;
+	irq_desc.dst_host_irq = dst_host_irq;
+	irq_desc.ia_id = ia_id;
+	irq_desc.vint = vint;
+	irq_desc.global_event = global_event;
+	irq_desc.vint_status_bit = vint_status_bit;
+	irq_desc.secondary_host = s_host;
+
+	list_for_each(this, &info->irqs.list) {
+		this_irq = list_entry(this, struct ti_sci_irq, list);
+		if (ti_sci_irq_equal(irq_desc, this_irq->desc)) {
+			list_del(&this_irq->list);
+			kfree(this_irq);
+			break;
+		}
+	}
+
+	return 0;
 }
 
 /**
@@ -3768,6 +3862,9 @@ static int ti_sci_suspend_noirq(struct device *dev)
 static int ti_sci_resume_noirq(struct device *dev)
 {
 	struct ti_sci_info *info = dev_get_drvdata(dev);
+	struct ti_sci_msg_req_manage_irq *irq_desc;
+	struct ti_sci_irq *irq;
+	struct list_head *this;
 	int ret = 0;
 	u32 source;
 	u64 time;
@@ -3780,6 +3877,33 @@ static int ti_sci_resume_noirq(struct device *dev)
 			return ret;
 	}
 
+	switch (pm_suspend_target_state) {
+	case PM_SUSPEND_MEM:
+		if (info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED) {
+			list_for_each(this, &info->irqs.list) {
+				irq = list_entry(this, struct ti_sci_irq, list);
+				irq_desc = &irq->desc;
+				ret = ti_sci_manage_irq(&info->handle,
+							irq_desc->valid_params,
+							irq_desc->src_id,
+							irq_desc->src_index,
+							irq_desc->dst_id,
+							irq_desc->dst_host_irq,
+							irq_desc->ia_id,
+							irq_desc->vint,
+							irq_desc->global_event,
+							irq_desc->vint_status_bit,
+							irq_desc->secondary_host,
+							TI_SCI_MSG_SET_IRQ);
+				if (ret)
+					return ret;
+			}
+		}
+		break;
+	default:
+		break;
+	}
+
 	ret = ti_sci_msg_cmd_lpm_wake_reason(&info->handle, &source, &time, &pin, &mode);
 	/* Do not fail to resume on error as the wake reason is not critical */
 	if (!ret)
@@ -3961,6 +4085,9 @@ static int ti_sci_probe(struct platform_device *pdev)
 	list_add_tail(&info->node, &ti_sci_list);
 	mutex_unlock(&ti_sci_list_mutex);
 
+	if (info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED)
+		INIT_LIST_HEAD(&info->irqs.list);
+
 	return of_platform_populate(dev->of_node, NULL, NULL, dev);
 out:
 	if (!IS_ERR(info->chan_tx))

-- 
2.51.0



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

* Re: [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support
  2025-10-17 14:44 ` [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support Thomas Richard (TI.com)
@ 2025-11-07 11:41   ` Nishanth Menon
  2025-11-10 15:09     ` Thomas Richard
  0 siblings, 1 reply; 7+ messages in thread
From: Nishanth Menon @ 2025-11-07 11:41 UTC (permalink / raw)
  To: Thomas Richard (TI.com)
  Cc: Tero Kristo, Santosh Shilimkar, Gregory CLEMENT, richard.genoud,
	Udit Kumar, Prasanth Mantena, Abhash Kumar, Thomas Petazzoni,
	linux-arm-kernel, linux-kernel

On 16:44-20251017, Thomas Richard (TI.com) wrote:
> In BOARDCFG_MANAGED mode, the low power mode configuration is done
> statically for the DM via the boardcfg. Constraints are not supported, and
> prepare_sleep() is not needed.

Will be good to get pointed to some documentation around this..
> 
> Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
> ---
>  drivers/firmware/ti_sci.c | 10 +++++++---
>  drivers/firmware/ti_sci.h | 14 ++++++++------
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index da134ada64e179b4b307f7e0de5ed0f7371a96f2..f9f1a67e8e66b0a4048fae04ce31be54ca5cba7a 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -3693,8 +3693,11 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
>  			return ti_sci_cmd_prepare_sleep(&info->handle,
>  							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
>  							0, 0, 0);
> +		} else if (info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED) {
> +			/* Nothing to do in the BOARDCFG_MANAGED mode */
> +			return 0;
>  		} else {
> -			/* DM Managed is not supported by the firmware. */
> +			/* DM Managed and BoardCfg Managed are not supported by the firmware. */
>  			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");
>  			return -EOPNOTSUPP;
>  		}
> @@ -3932,12 +3935,13 @@ static int ti_sci_probe(struct platform_device *pdev)
>  	}
>  
>  	ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps);
> -	dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s\n",
> +	dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s\n",
>  		info->fw_caps & MSG_FLAG_CAPS_GENERIC ? "Generic" : "",
>  		info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO ? " Partial-IO" : "",
>  		info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED ? " DM-Managed" : "",
>  		info->fw_caps & MSG_FLAG_CAPS_LPM_ABORT ? " LPM-Abort" : "",
> -		info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : ""
> +		info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : "",
> +		info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED ? " BoardConfig-Managed" : ""
>  	);
>  
>  	ti_sci_setup_ops(info);
> diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h
> index 7559cde17b6ccfeeb1bc357fce5c5767c3f75c54..ac1cf6971b8678aa1277abb86d9ec672493f4c86 100644
> --- a/drivers/firmware/ti_sci.h
> +++ b/drivers/firmware/ti_sci.h
> @@ -150,6 +150,7 @@ struct ti_sci_msg_req_reboot {
>   *		MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM
>   *		MSG_FLAG_CAPS_LPM_ABORT: Abort entry to LPM
>   *		MSG_FLAG_CAPS_IO_ISOLATION: IO Isolation support
> + *		MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED: LPM config done statically for the DM via boardcfg
>   *
>   * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
>   * providing currently available SOC/firmware capabilities. SoC that don't
> @@ -157,12 +158,13 @@ struct ti_sci_msg_req_reboot {
>   */
>  struct ti_sci_msg_resp_query_fw_caps {
>  	struct ti_sci_msg_hdr hdr;
> -#define MSG_FLAG_CAPS_GENERIC		TI_SCI_MSG_FLAG(0)
> -#define MSG_FLAG_CAPS_LPM_PARTIAL_IO	TI_SCI_MSG_FLAG(4)
> -#define MSG_FLAG_CAPS_LPM_DM_MANAGED	TI_SCI_MSG_FLAG(5)
> -#define MSG_FLAG_CAPS_LPM_ABORT		TI_SCI_MSG_FLAG(9)
> -#define MSG_FLAG_CAPS_IO_ISOLATION	TI_SCI_MSG_FLAG(7)
> -#define MSG_MASK_CAPS_LPM		GENMASK_ULL(4, 1)
> +#define MSG_FLAG_CAPS_GENERIC			TI_SCI_MSG_FLAG(0)
> +#define MSG_FLAG_CAPS_LPM_PARTIAL_IO		TI_SCI_MSG_FLAG(4)
> +#define MSG_FLAG_CAPS_LPM_DM_MANAGED		TI_SCI_MSG_FLAG(5)
> +#define MSG_FLAG_CAPS_LPM_ABORT			TI_SCI_MSG_FLAG(9)
> +#define MSG_FLAG_CAPS_IO_ISOLATION		TI_SCI_MSG_FLAG(7)
> +#define MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED	TI_SCI_MSG_FLAG(10)
> +#define MSG_MASK_CAPS_LPM			GENMASK_ULL(4, 1)

Driveby comment: let us not churn formatting..

>  	u64 fw_caps;
>  } __packed;
>  
> 
> -- 
> 2.51.0
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource


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

* Re: [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume
  2025-10-17 14:44 ` [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume Thomas Richard (TI.com)
@ 2025-11-07 11:54   ` Nishanth Menon
  2025-11-10 15:11     ` Thomas Richard
  0 siblings, 1 reply; 7+ messages in thread
From: Nishanth Menon @ 2025-11-07 11:54 UTC (permalink / raw)
  To: Thomas Richard (TI.com)
  Cc: Tero Kristo, Santosh Shilimkar, Gregory CLEMENT, richard.genoud,
	Udit Kumar, Prasanth Mantena, Abhash Kumar, Thomas Petazzoni,
	linux-arm-kernel, linux-kernel

On 16:44-20251017, Thomas Richard (TI.com) wrote:
> In BOARDCFG_MANAGED mode, the firmware cannot restore IRQs during
> resume. This responsibility is delegated to the ti_sci driver,
> which maintains an internal list of all requested IRQs. This list
> is updated on each set/free operation, and all IRQs are restored
> during the resume_noirq() phase.

Couple of drive by comments:

clarify why is this not handled by ia / ir driver?

> 
> Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
> ---
>  drivers/firmware/ti_sci.c | 143 +++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 135 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index f9f1a67e8e66b0a4048fae04ce31be54ca5cba7a..a211f8805dd21c7675b8cefd61929ecfda8e0f7f 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -87,6 +87,16 @@ struct ti_sci_desc {
>  	int max_msg_size;
[...]
> +
> +	irq_desc.valid_params = valid_params;
> +	irq_desc.src_id = src_id;
> +	irq_desc.src_index = src_index;
> +	irq_desc.dst_id = dst_id;
> +	irq_desc.dst_host_irq = dst_host_irq;
> +	irq_desc.ia_id = ia_id;
> +	irq_desc.vint = vint;
> +	irq_desc.global_event = global_event;
> +	irq_desc.vint_status_bit = vint_status_bit;
> +	irq_desc.secondary_host = s_host;
> +
> +	list_for_each(this, &info->irqs.list) {

list_for_each_entry_safe ?

How big is this list on a j784s4 class device? is it worth creating a
irq_desc_hash and using a hlist a better option?


> +		this_irq = list_entry(this, struct ti_sci_irq, list);
> +		if (ti_sci_irq_equal(irq_desc, this_irq->desc)) {
> +			list_del(&this_irq->list);
> +			kfree(this_irq);
> +			break;
> +		}
> +	}
> +

[...]

>  	ret = ti_sci_msg_cmd_lpm_wake_reason(&info->handle, &source, &time, &pin, &mode);
>  	/* Do not fail to resume on error as the wake reason is not critical */
>  	if (!ret)
> @@ -3961,6 +4085,9 @@ static int ti_sci_probe(struct platform_device *pdev)
>  	list_add_tail(&info->node, &ti_sci_list);
>  	mutex_unlock(&ti_sci_list_mutex);
>  
> +	if (info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED)
> +		INIT_LIST_HEAD(&info->irqs.list);

probably not worth doing a conditional initialization here.


-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource


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

* Re: [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support
  2025-11-07 11:41   ` Nishanth Menon
@ 2025-11-10 15:09     ` Thomas Richard
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Richard @ 2025-11-10 15:09 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Tero Kristo, Santosh Shilimkar, Gregory CLEMENT, richard.genoud,
	Udit Kumar, Prasanth Mantena, Abhash Kumar, Thomas Petazzoni,
	linux-arm-kernel, linux-kernel

Hello Nishanth,

Thanks for the review.

On 11/7/25 12:41 PM, Nishanth Menon wrote:
> On 16:44-20251017, Thomas Richard (TI.com) wrote:
>> In BOARDCFG_MANAGED mode, the low power mode configuration is done
>> statically for the DM via the boardcfg. Constraints are not supported, and
>> prepare_sleep() is not needed.
> 
> Will be good to get pointed to some documentation around this..

I agree, but for now there is no public documentation. Once it is
available, I'll update the commit message.

Best Regards,
Thomas



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

* Re: [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume
  2025-11-07 11:54   ` Nishanth Menon
@ 2025-11-10 15:11     ` Thomas Richard
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Richard @ 2025-11-10 15:11 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Tero Kristo, Santosh Shilimkar, Gregory CLEMENT, richard.genoud,
	Udit Kumar, Prasanth Mantena, Abhash Kumar, Thomas Petazzoni,
	linux-arm-kernel, linux-kernel

Hello Nishanth,

On 11/7/25 12:54 PM, Nishanth Menon wrote:
> On 16:44-20251017, Thomas Richard (TI.com) wrote:
>> In BOARDCFG_MANAGED mode, the firmware cannot restore IRQs during
>> resume. This responsibility is delegated to the ti_sci driver,
>> which maintains an internal list of all requested IRQs. This list
>> is updated on each set/free operation, and all IRQs are restored
>> during the resume_noirq() phase.
> 
> Couple of drive by comments:
> 
> clarify why is this not handled by ia / ir driver?

A patch was sent to handle this in intr driver [1], but the feedback
was: this shall be done in ti_sci driver [2].

And now I have an other argument:

I'm actually working on having functional PCIe after a suspend-resume on
J784s4. And I noticed that set_parent (sci-clk driver) shall be restored
during resume. Restoring irqs and set_parent clk config is only needed
on Jacinto platforms. The sci-clk and inta/intr driver don't know if we
are running on a Jacinto platform or not. The ti_sci have the
information so it can take the decision to restore irqs and set_parent
configs.

[1] https://lore.kernel.org/all/20220607061912.12222-1-a-govindraju@ti.com/
[2] https://lore.kernel.org/all/87r0l96f0e.wl-maz@kernel.org/

> 
>>
>> Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
>> ---
>>  drivers/firmware/ti_sci.c | 143 +++++++++++++++++++++++++++++++++++++++++++---
>>  1 file changed, 135 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
>> index f9f1a67e8e66b0a4048fae04ce31be54ca5cba7a..a211f8805dd21c7675b8cefd61929ecfda8e0f7f 100644
>> --- a/drivers/firmware/ti_sci.c
>> +++ b/drivers/firmware/ti_sci.c
>> @@ -87,6 +87,16 @@ struct ti_sci_desc {
>>  	int max_msg_size;
> [...]
>> +
>> +	irq_desc.valid_params = valid_params;
>> +	irq_desc.src_id = src_id;
>> +	irq_desc.src_index = src_index;
>> +	irq_desc.dst_id = dst_id;
>> +	irq_desc.dst_host_irq = dst_host_irq;
>> +	irq_desc.ia_id = ia_id;
>> +	irq_desc.vint = vint;
>> +	irq_desc.global_event = global_event;
>> +	irq_desc.vint_status_bit = vint_status_bit;
>> +	irq_desc.secondary_host = s_host;
>> +
>> +	list_for_each(this, &info->irqs.list) {
> 
> list_for_each_entry_safe ?
> 
> How big is this list on a j784s4 class device? is it worth creating a
> irq_desc_hash and using a hlist a better option?

I did the test with arm64 defconfig on j784s4 and the list has 43 elements.
I'll look at the hlist.

Best Regards,
Thomas


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

end of thread, other threads:[~2025-11-10 15:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 14:44 [PATCH RFC 0/2] firmware: ti_sci: Introduce BOARDCFG_MANAGED mode for Jacinto family Thomas Richard (TI.com)
2025-10-17 14:44 ` [PATCH RFC 1/2] firmware: ti_sci: add BOARDCFG_MANAGED mode support Thomas Richard (TI.com)
2025-11-07 11:41   ` Nishanth Menon
2025-11-10 15:09     ` Thomas Richard
2025-10-17 14:44 ` [PATCH RFC 2/2] firmware: ti_sci: handle IRQ restore in BOARDCFG_MANAGED mode during resume Thomas Richard (TI.com)
2025-11-07 11:54   ` Nishanth Menon
2025-11-10 15:11     ` Thomas Richard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox