From: Beleswar Padhi <b-padhi@ti.com>
To: <nm@ti.com>, <kristo@kernel.org>, <ssantosh@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <afd@ti.com>, <u-kumar1@ti.com>,
<vigneshr@ti.com>, <b-padhi@ti.com>
Subject: [PATCH 4/6] firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs
Date: Thu, 1 Oct 2026 01:11:29 +0530 [thread overview]
Message-ID: <20260930194131.117129-5-b-padhi@ti.com> (raw)
In-Reply-To: <20260930194131.117129-1-b-padhi@ti.com>
The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
a. Increased latency: An extra forwarding hop through DM adds latency
in requests and responses.
b. Freedom From Interference (FFI) concerns: Having Safety service
proxy Security's requests (& vice versa) undermines the isolation
and FFI of the system.
c. Potential Deadlock Scenario: Forwarding messages between Safety
and Security cores can result in a deadlock if there are circular
dependencies.
To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation
and FFI change.
In ABI5.0, the request message structure for set_device_resets API has
been updated to split the existing single reset bitmap variable into
explicit local_reset and module_reset variables. Add a new API to
extract the module reset and local reset values from reset_state
function parameter and populate them separately in the request. Any
other reset bit cannot be expressed in ABI5.0, so reject it with
-EINVAL.
ABI5.0 also exposes the exclusive status of a device in the response of
get_device_state request. But the layout of the remaining fields (like
'resets') is unchanged. Since there is no user of the exclusive status
info in Linux, reuse this same API for ABI5 and ignore the trailing 8
bytes containing it.
Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/
drivers/firmware/ti/ti_sci.h | 25 ++++++++++++
drivers/firmware/ti/ti_sci_core.c | 14 +++++++
drivers/firmware/ti/ti_sci_device.c | 62 +++++++++++++++++++++++++++++
3 files changed, 101 insertions(+)
diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index 708cc95dfc48c..2f633aeab70b1 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -120,6 +120,8 @@ struct ti_sci_info {
#define TI_SCI_SUPPORTS_PDM_OPS BIT(0)
#define TI_SCI_SUPPORTS_SEC_OPS BIT(1)
+#define TI_SCI_LRESET_MASK BIT(0)
+#define TI_SCI_MRESET_MASK BIT(1)
/* Generic Messages */
#define TI_SCI_MSG_ENABLE_WDT 0x0000
@@ -407,6 +409,28 @@ struct ti_sci_msg_req_set_device_resets {
u32 resets;
} __packed;
+/**
+ * struct ti_sci_msg_req_set_device_resets_abi5_pdm - Set the desired resets
+ * configuration of the device
+ * @hdr: Generic header
+ * @id: Indicates which device to modify
+ * @local_reset: State of the PSC local reset of the device. 0 indicates
+ * releasing the local reset while 1 indicates keeping it
+ * held.
+ * @module_reset: State of the PSC module reset of the device. 0
+ * indicates releasing the module reset while 1 indicates
+ * keeping it held.
+ *
+ * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
+ * ACK/NACK message.
+ */
+struct ti_sci_msg_req_set_device_resets_abi5_pdm {
+ struct ti_sci_msg_hdr hdr;
+ u32 id;
+ u32 local_reset;
+ u32 module_reset;
+} __packed;
+
/**
* struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
* @hdr: Generic Header, Certain flags can be set specific to the clocks:
@@ -1712,6 +1736,7 @@ int ti_sci_do_xfer(const struct ti_sci_handle *handle,
void *rx_message, size_t rx_message_size);
void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops);
+void ti_sci_setup_device_ops_abi5(struct ti_sci_dev_ops *dops);
void ti_sci_setup_clock_ops(struct ti_sci_clk_ops *cops);
void ti_sci_setup_pm_ops(struct ti_sci_pm_ops *pmops);
void ti_sci_setup_rm_core_ops(struct ti_sci_rm_core_ops *rm_core_ops);
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index 00c43d699e64c..cea4339ac0af2 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -707,6 +707,18 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
ti_sci_setup_proc_ops(pops);
}
+/*
+ * ti_sci_setup_ops_abi5() - Setup the operations structures (ABI5)
+ * @info: pointer to TISCI pointer
+ */
+static void ti_sci_setup_ops_abi5(struct ti_sci_info *info)
+{
+ struct ti_sci_ops *ops = &info->handle.ops;
+ struct ti_sci_dev_ops *dops = &ops->dev_ops;
+
+ ti_sci_setup_device_ops_abi5(dops);
+}
+
/**
* ti_sci_get_handle() - Get the TI SCI handle for a device
* @dev: Pointer to device for which we want SCI handle
@@ -1371,6 +1383,8 @@ static int ti_sci_probe(struct platform_device *pdev)
goto out;
}
+ ti_sci_setup_ops_abi5(info);
+
ret = devm_register_restart_handler(dev, tisci_reboot_handler_abi5, info);
if (ret) {
dev_err(dev, "reboot registration fail(%d)\n", ret);
diff --git a/drivers/firmware/ti/ti_sci_device.c b/drivers/firmware/ti/ti_sci_device.c
index cb9888ca54a35..06f5a4b3f24bd 100644
--- a/drivers/firmware/ti/ti_sci_device.c
+++ b/drivers/firmware/ti/ti_sci_device.c
@@ -48,6 +48,11 @@ static int ti_sci_set_device_state(const struct ti_sci_handle *handle,
* @p_state: pointer to p_state
* @c_state: pointer to c_state
*
+ * Note: PDM ABI5 returns an additional 'exclusive_status' device info along with
+ * the above ones. However, since there is no user of the 'exclusive_status'
+ * info in Linux, reuse this same API for ABI5 and ignore the trailing 8 bytes
+ * containing exclusive status info.
+ *
* Return: 0 if all went fine, else return appropriate error.
*/
static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
@@ -349,6 +354,41 @@ static int ti_sci_cmd_set_device_resets(const struct ti_sci_handle *handle,
return 0;
}
+/**
+ * ti_sci_cmd_set_device_resets_abi5_pdm() - command to set resets for device
+ * managed by TISCI
+ * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id: Device Identifier
+ * @reset_state: Device reset bit field. Only the PSC local reset (bit 0) and
+ * module reset (bit 1) are supported.
+ *
+ * Return: 0 if all went fine, -EINVAL if @reset_state has any other bit set,
+ * else return appropriate error.
+ */
+static int ti_sci_cmd_set_device_resets_abi5_pdm(const struct ti_sci_handle *handle,
+ u32 id, u32 reset_state)
+{
+ struct ti_sci_msg_req_set_device_resets_abi5_pdm req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ if (reset_state & ~(TI_SCI_LRESET_MASK | TI_SCI_MRESET_MASK))
+ return -EINVAL;
+
+ req.id = id;
+ req.local_reset = !!(reset_state & TI_SCI_LRESET_MASK);
+ req.module_reset = !!(reset_state & TI_SCI_MRESET_MASK);
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_DEVICE_RESETS,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
/**
* ti_sci_cmd_get_device_resets() - Get reset state for device managed
* by TISCI
@@ -386,3 +426,25 @@ void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops)
dops->set_device_resets = ti_sci_cmd_set_device_resets;
dops->get_device_resets = ti_sci_cmd_get_device_resets;
}
+
+/*
+ * ti_sci_setup_device_ops_abi5() - Setup the device operations structures (ABI5)
+ * @dops: pointer to TISCI device ops structure
+ */
+void ti_sci_setup_device_ops_abi5(struct ti_sci_dev_ops *dops)
+{
+ dops->get_device = ti_sci_cmd_get_device;
+ dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive;
+ dops->idle_device = ti_sci_cmd_idle_device;
+ dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive;
+ dops->put_device = ti_sci_cmd_put_device;
+
+ dops->is_valid = ti_sci_cmd_dev_is_valid;
+ dops->get_context_loss_count = ti_sci_cmd_dev_get_clcnt;
+ dops->is_idle = ti_sci_cmd_dev_is_idle;
+ dops->is_stop = ti_sci_cmd_dev_is_stop;
+ dops->is_on = ti_sci_cmd_dev_is_on;
+ dops->is_transitioning = ti_sci_cmd_dev_is_trans;
+ dops->set_device_resets = ti_sci_cmd_set_device_resets_abi5_pdm;
+ dops->get_device_resets = ti_sci_cmd_get_device_resets;
+}
--
2.34.1
next prev parent reply other threads:[~2026-09-30 19:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
2026-09-30 19:41 ` [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern Beleswar Padhi
2026-09-30 19:41 ` [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible Beleswar Padhi
2026-09-30 19:41 ` [PATCH 3/6] firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support Beleswar Padhi
2026-09-30 19:41 ` Beleswar Padhi [this message]
2026-09-30 19:41 ` [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs Beleswar Padhi
2026-09-30 19:41 ` [PATCH 6/6] firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs Beleswar Padhi
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=20260930194131.117129-5-b-padhi@ti.com \
--to=b-padhi@ti.com \
--cc=afd@ti.com \
--cc=kristo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nm@ti.com \
--cc=ssantosh@kernel.org \
--cc=u-kumar1@ti.com \
--cc=vigneshr@ti.com \
/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
all inboxes | Powered by JetHome®