Enhance TI-SCI FFI with ABI5.0 support
Subsystems (2)
cover Enhance TI-SCI FFI with ABI5.0 support
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 Dealock 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.
This series adds the support for TI TDA54 PDM System Controller across Devicetree bindings and TI-SCI Driver to support the ABI 5.0 change.
Note:
a. The first half of the series i.e, patches
[PATCH 01/06] - [PATCH 02/06] are independent and can be applied directly.
b. The second half of the series i.e, patches
[PATCH 03/06] - [PATCH 06/06] is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/
Testing done:
- Build and Boot tested on all Keystone and K3 platforms.
- Verified ABI5.0 core and device operations on TI TDA54 platform. (after applying an out-of-tree patch to add DTS support)
- Verified that none of the patches in the series generate any warnings or errors.
Logs:
https://gist.github.com/3V3RYONE/d821cea46f5dc1e70a759c97878fa487
Beleswar Padhi (6):
dt-bindings: arm: keystone: ti,sci: Update nodename pattern
dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI
support
firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset
APIs
firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs
firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs
.../bindings/arm/keystone/ti,sci.yaml | 48 ++- drivers/firmware/ti/ti_sci.h | 233 +++++++++++ drivers/firmware/ti/ti_sci_clock.c | 380 ++++++++++++++++++ drivers/firmware/ti/ti_sci_core.c | 204 ++++++++-- drivers/firmware/ti/ti_sci_device.c | 62 +++ drivers/firmware/ti/ti_sci_rm.c | 148 +++++++ 6 files changed, 1039 insertions(+), 36 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/6 dt-bindings: arm: keystone: ti,sci: Update nodename pattern
The $nodename pattern for TI-SCI controllers mandates specifying a unit address, which in turn requires a 'reg' property. This 'reg' is only used to describe an optional memory-mapped debug-messages region.
Some controllers may not implement this debug region, so it has no 'reg' and unit address. Therefore, relax the $nodename pattern to allow the unit address to be omitted for such controllers. Keep the unit address mandatory for the existing ti,k2g-sci and ti,am654-sci controllers.
---
Note: This patch is independent can be applied directly.
.../devicetree/bindings/arm/keystone/ti,sci.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +14 -1
@@ -30,7 +30,7 @@ description: | properties: $nodename: - pattern: "^system-controller@[0-9a-f]+$" + pattern: "^system-controller(@[0-9a-f]+)?$" compatible: oneOf:
@@ -84,6 +84,19 @@ required: - mbox-names - mboxes +allOf: + - if: + properties: + compatible: + contains: + enum: + - ti,k2g-sci + - ti,am654-sci + then: + properties: + $nodename: + pattern: "^system-controller@[0-9a-f]+$" + additionalProperties: false examples:
Signature · 1 line
2.34.1
Re: [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern
Quoted 5 lines · Beleswar Padhi
The $nodename pattern for TI-SCI controllers mandates specifying a unit address, which in turn requires a 'reg' property. This 'reg' is only used to describe an optional memory-mapped debug-messages region.
Some controllers may not implement this debug region, so it has no 'reg'
Which ones?
Quoted 40 lines
and unit address. Therefore, relax the $nodename pattern to allow the unit address to be omitted for such controllers. Keep the unit address mandatory for the existing ti,k2g-sci and ti,am654-sci controllers.
Signed-off-by Beleswar Padhi <[email protected]>---
Note: This patch is independent can be applied directly.Cc Nishanth Menon <[email protected]>Cc Tero Kristo <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Rob Herring <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Conor Dooley <[email protected]>.../devicetree/bindings/arm/keystone/ti,sci.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +3
-1@@ -30,7 +30,7 @@ description: | properties: $nodename: - pattern: "^system-controller@[0-9a-f]+$" + pattern: "^system-controller(@[0-9a-f]+)?$" compatible: oneOf:@@ -84,6 +84,19 @@ required: - mbox-names - mboxes +allOf: + - if:
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml required: · line 98
Quoted 10 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +10
-0+ properties: + compatible: + contains: + enum: + - ti,k2g-sci + - ti,am654-sci + then: + properties: + $nodename: + pattern: "^system-controller@[0-9a-f]+$"
Drop, not worth complexity.
Best regards,
Krzysztof
Re: [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Beleswar Padhi
The $nodename pattern for TI-SCI controllers mandates specifying a unit address, which in turn requires a 'reg' property. This 'reg' is only used to describe an optional memory-mapped debug-messages region.
Some controllers may not implement this debug region, so it has no 'reg'
Which ones?
TDA54 PDM System Controller. I will add this in the commit message in patch revision.
Quoted 39 lines
Quoted 39 lines
and unit address. Therefore, relax the $nodename pattern to allow the unit address to be omitted for such controllers. Keep the unit address mandatory for the existing ti,k2g-sci and ti,am654-sci controllers.
Signed-off-by Beleswar Padhi <[email protected]>---
Note: This patch is independent can be applied directly.Cc Nishanth Menon <[email protected]>Cc Tero Kristo <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Rob Herring <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Conor Dooley <[email protected]>.../devicetree/bindings/arm/keystone/ti,sci.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +1
-1@@ -30,7 +30,7 @@ description: | properties: $nodename: - pattern: "^system-controller@[0-9a-f]+$" + pattern: "^system-controller(@[0-9a-f]+)?$" compatible: oneOf:@@ -84,6 +84,19 @@ required: - mbox-names - mboxes
Quoted 13 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml required: · line 98
Quoted 12 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +12
-0+allOf: + - if: + properties: + compatible: + contains: + enum: + - ti,k2g-sci + - ti,am654-sci + then: + properties: + $nodename: + pattern: "^system-controller@[0-9a-f]+$"Drop, not worth complexity.
Why? We want to make sure dt_binding_check catches system controller nodes which have a debug region but omit the unit address.
Thanks,
Beleswar
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern
Quoted 7 lines · Beleswar
Quoted 5 lines · Krzysztof Kozlowski
Quoted 4 lines · Beleswar Padhi
The $nodename pattern for TI-SCI controllers mandates specifying a unit address, which in turn requires a 'reg' property. This 'reg' is only used to describe an optional memory-mapped debug-messages region.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Some controllers may not implement this debug region, so it has no 'reg'
Which ones?
TDA54 PDM System Controller. I will add this in the commit message in patch revision.
There is no such:
git grep -i TDA54
Please organize your patches correctly. This change makes no sense alone.
Quoted 55 lines
Quoted 40 lines
Quoted 40 lines
and unit address. Therefore, relax the $nodename pattern to allow the unit address to be omitted for such controllers. Keep the unit address mandatory for the existing ti,k2g-sci and ti,am654-sci controllers.
Signed-off-by Beleswar Padhi <[email protected]>---
Note: This patch is independent can be applied directly.Cc Nishanth Menon <[email protected]>Cc Tero Kristo <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Rob Herring <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Conor Dooley <[email protected]>.../devicetree/bindings/arm/keystone/ti,sci.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +1
-1@@ -30,7 +30,7 @@ description: | properties: $nodename: - pattern: "^system-controller@[0-9a-f]+$" + pattern: "^system-controller(@[0-9a-f]+)?$" compatible: oneOf:@@ -84,6 +84,19 @@ required: - mbox-names - mboxesQuoted 13 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml required: · line 98
Quoted 12 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +12
-0+allOf: + - if: + properties: + compatible: + contains: + enum: + - ti,k2g-sci + - ti,am654-sci + then: + properties: + $nodename: + pattern: "^system-controller@[0-9a-f]+$"Drop, not worth complexity.
Quoted 2 lines
Why? We want to make sure
dt_binding_checkcatches system controller nodes which have a debug region but omit the unit address.
As explained many times, individual device schemas are not supposed to enforce names.
Best regards,
Krzysztof
PATCH 2/6 dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
In reply to Beleswar PadhiThe 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.
Add the compatible string for TI TDA54 SoC PDM system controller to support ABI5.0 communication protocol.
---
Note: This patch is independent and can be applied directly.
.../bindings/arm/keystone/ti,sci.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +33 -0
@@ -20,6 +20,11 @@ description: | initialized early into boot process and provides services to Operating Systems on multiple processors including ones running Linux. + The TI TDA54 SoC, however, has two independent system controller instances - a + PDM (Power and Device Management) system controller, which handles Power, + Device, Clock, and Reset Management, and a separate SMS (Security Management + Subsystem) system controller, which handles security services. + See https://software-dl.ti.com/tisci/esd/latest/index.html for protocol definition. The TI-SCI node describes the Texas Instrument's System Controller entity node.
@@ -40,6 +45,10 @@ properties: - description: System controller on TI AM654 SoC items: - const: ti,am654-sci + - description: | + System controller for Power and Device Management on TI TDA54 SoC + items: + - const: ti,tda54-sci-pdm reg-names: description: |
@@ -135,3 +144,27 @@ examples: #reset-cells = <2>; }; }; + + - | + pdm: system-controller { + compatible = "ti,tda54-sci-pdm"; + mbox-names = "rx", "tx"; + mboxes = <&main_secure_proxy1 4>, + <&main_secure_proxy1 435>; + ti,host-id = <66>; + + k3_pdm_pds: power-controller { + compatible = "ti,sci-pm-domain"; + #power-domain-cells = <2>; + }; + + k3_pdm_clks: clock-controller { + compatible = "ti,k2g-sci-clk"; + #clock-cells = <2>; + }; + + k3_pdm_reset: reset-controller { + compatible = "ti,sci-reset"; + #reset-cells = <2>; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
Quoted 17 lines · Beleswar Padhi
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.
Quoted 8 lines
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.
I don't get at all how above description helps to understand this patch and this new compatible, except that this is not compatible with old variants. So 30 lines of text instead of 3?
Quoted 38 lines
Add the compatible string for TI TDA54 SoC PDM system controller to support ABI5.0 communication protocol.
Signed-off-by Beleswar Padhi <[email protected]>---
Note: This patch is independent and can be applied directly.Cc Nishanth Menon <[email protected]>Cc Tero Kristo <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Rob Herring <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Conor Dooley <[email protected]>.../bindings/arm/keystone/ti,sci.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +5
-0@@ -20,6 +20,11 @@ description: | initialized early into boot process and provides services to Operating Systems on multiple processors including ones running Linux. + The TI TDA54 SoC, however, has two independent system controller instances - a + PDM (Power and Device Management) system controller, which handles Power, + Device, Clock, and Reset Management, and a separate SMS (Security Management + Subsystem) system controller, which handles security services. + See https://software-dl.ti.com/tisci/esd/latest/index.html for protocol definition. The TI-SCI node describes the Texas Instrument's System Controller entity node.
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml properties: · line 49
Quoted 5 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +2
-0@@ -40,6 +45,10 @@ properties: - description: System controller on TI AM654 SoC items: - const: ti,am654-sci + - description: | + System controller for Power and Device Management on TI TDA54 SoC
That's redundant, you just repeated the compatible.
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml properties: · line 51
Quoted 2 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +2
-0+ items: + - const: ti,tda54-sci-pdm
Why it cannot be enum with existing entry(ies)?
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml examples: · line 149
Quoted 10 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +3
-0reg-names: description: |@@ -135,3 +144,27 @@ examples: #reset-cells = <2>; }; }; + + - | + pdm: system-controller {
No need for new example which is the same.
Best regards,
Krzysztof
Re: [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
Quoted 26 lines · Krzysztof Kozlowski
Quoted 17 lines · Beleswar Padhi
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.Quoted 8 lines
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.
Quoted 3 lines
I don't get at all how above description helps to understand this patch and this new compatible, except that this is not compatible with old variants.
You just answered your own question.
Quoted 1 line
So 30 lines of text instead of 3?
The existing system controllers have been compatible in all TI SoCs for over 10+ years since Keystone generations. Using 30 lines of text to explain "why" the new system controller is not compatible with old variants is worth it.
Quoted 36 lines
Quoted 36 lines
Add the compatible string for TI TDA54 SoC PDM system controller to support ABI5.0 communication protocol.
Signed-off-by Beleswar Padhi <[email protected]>---
Note: This patch is independent and can be applied directly.Cc Nishanth Menon <[email protected]>Cc Tero Kristo <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Rob Herring <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Conor Dooley <[email protected]>.../bindings/arm/keystone/ti,sci.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +5
-0@@ -20,6 +20,11 @@ description: | initialized early into boot process and provides services to Operating Systems on multiple processors including ones running Linux. + The TI TDA54 SoC, however, has two independent system controller instances - a + PDM (Power and Device Management) system controller, which handles Power, + Device, Clock, and Reset Management, and a separate SMS (Security Management + Subsystem) system controller, which handles security services. + See https://software-dl.ti.com/tisci/esd/latest/index.html for protocol definition.
Quoted 8 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml properties: · line 49
Quoted 7 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +2
-0The TI-SCI node describes the Texas Instrument's System Controller entity node.@@ -40,6 +45,10 @@ properties: - description: System controller on TI AM654 SoC items: - const: ti,am654-sci + - description: | + System controller for Power and Device Management on TI TDA54 SoCThat's redundant, you just repeated the compatible.
I did not. The compatible says "pdm". Not everyone understands the acronym.
Quoted 4 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml properties: · line 51
Quoted 3 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +2
-0+ items: + - const: ti,tda54-sci-pdmWhy it cannot be enum with existing entry(ies)?
It should be. Will address this in revision.
Quoted 12 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml examples: · line 149
Quoted 11 lines
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml +3
-0reg-names: description: |@@ -135,3 +144,27 @@ examples: #reset-cells = <2>; }; }; + + - | + pdm: system-controller {No need for new example which is the same.
Okay, will drop in revision.
Thanks,
Beleswar
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
Quoted 35 lines · Beleswar
Quoted 26 lines · Krzysztof Kozlowski
Quoted 17 lines · Beleswar Padhi
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.Quoted 8 lines
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.
Quoted 3 lines
I don't get at all how above description helps to understand this patch and this new compatible, except that this is not compatible with old variants.
You just answered your own question.
Quoted 7 lines
Quoted 1 line
So 30 lines of text instead of 3?
The existing system controllers have been compatible in all TI SoCs for over 10+ years since Keystone generations. Using 30 lines of text to explain "why" the new system controller is not compatible with old variants is worth it.
If you decide to spam us with a lot of description, including marketing crap ("To realize this enhanced isolation in hardware", "this improved isolation") instead of writing concise and precise messages, accept the outcome of maintainers choosing to allocate their time in "improved way".
Best regards,
Krzysztof
Re: [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
Quoted 36 lines · Krzysztof Kozlowski
Quoted 35 lines · Beleswar
Quoted 26 lines · Krzysztof Kozlowski
Quoted 17 lines · Beleswar Padhi
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.Quoted 8 lines
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.
Quoted 3 lines
I don't get at all how above description helps to understand this patch and this new compatible, except that this is not compatible with old variants.
You just answered your own question.
Quoted 1 line
So 30 lines of text instead of 3?
Quoted 7 lines
Quoted 4 lines
The existing system controllers have been compatible in all TI SoCs for over 10+ years since Keystone generations. Using 30 lines of text to explain "why" the new system controller is not compatible with old variants is worth it.
If you decide to spam us with a lot of description, including marketing crap ("To realize this enhanced isolation in hardware", "this improved isolation")
I am a Open Source Developer at TI. Marketing about TI Product/Hardware is of no interest to me, neither is my intent. I was just describing why & how the hardware has changed. If it gives the impression of marketing, then sure, I will drop the "crap" to not waste your time.
Thanks,
Beleswar
Quoted 5 lines
instead of writing concise and precise messages, accept the
outcome of maintainers choosing to allocate their time in "improved way".Best regards,
Krzysztof
PATCH 3/6 firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support
In reply to Beleswar PadhiThe 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 by splitting the TI-SCI message IDs into two distinct address spaces differing in the MSB. As a result, the system reset message has been re-assigned an ID from the Safety address space:TI_SCI_MSG_SYS_RESET_ABI5_PDM.
Add support in the driver to probe PDM system controller and add new ABI5 compliant APIs for Generic system control (Version, System reset). Existing system controller's support remain unaffected with this change.
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/
drivers/firmware/ti/ti_sci.h | 36 ++++++ drivers/firmware/ti/ti_sci_core.c | 184 ++++++++++++++++++++++++------ 2 files changed, 185 insertions(+), 35 deletions(-)
drivers/firmware/ti/ti_sci.h +36 -0
@@ -12,6 +12,7 @@#ifndef __TI_SCI_H#define __TI_SCI_H +#include <linux/bits.h> #include <linux/compiler_types.h> #include <linux/completion.h> #include <linux/container_of.h>
@@ -63,12 +64,14 @@ struct ti_sci_xfers_info {* @max_msgs: Maximum number of messages that can be pending * simultaneously in the system * @max_msg_size: Maximum size of data per message that can be handled. +* @sci_services: bitmap representing services supported by SCI */ struct ti_sci_desc {u8 default_host_id;int max_rx_timeout_ms;int max_msgs;int max_msg_size; +u8 sci_services; };/**
@@ -115,6 +118,9 @@ struct ti_sci_info {#define cl_to_ti_sci_info (c) container_of(c, struct ti_sci_info, cl)#define handle_to_ti_sci_info (h) container_of(h, struct ti_sci_info, handle) +#define TI_SCI_SUPPORTS_PDM_OPS BIT(0) +#define TI_SCI_SUPPORTS_SEC_OPS BIT(1) +/* Generic Messages */ #define TI_SCI_MSG_ENABLE_WDT 0x0000#define TI_SCI_MSG_WAKE_RESET 0x0001
@@ -122,7 +128,11 @@ struct ti_sci_info {#define TI_SCI_MSG_WAKE_REASON 0x0003#define TI_SCI_MSG_GOODBYE 0x0004#define TI_SCI_MSG_SYS_RESET 0x0005 +/* ABI5.0 PDM Generic Message */ +#define TI_SCI_MSG_VERSION_ABI5_PDM 0x000F#define TI_SCI_MSG_QUERY_FW_CAPS 0x0022 +/* ABI5.0 PDM System Reset Message */ +#define TI_SCI_MSG_SYS_RESET_ABI5_PDM 0x0400/* Device requests */ #define TI_SCI_MSG_SET_DEVICE_STATE 0x0200
@@ -233,6 +243,32 @@ struct ti_sci_msg_resp_version {u8 abi_minor; } __packed; +/** +* struct ti_sci_msg_resp_version_abi5_pdm - Response for a PDM get_version msg +* @hdr: Generic header +* @version: Version number of the PDM firmware +* @sub_version: Sub-version number of the PDM firmware +* @patch_version: Patch version number of the PDM firmware +* @abi_major: Major version of the ABI that PDM firmware supports +* @abi_minor: Minor version of the ABI that PDM firmware supports +* @sci_server_version: String describing the PDM SCI server version +* +* In general, ABI version changes follow the rule that minor version increments +* are backward compatible. Major revision changes in ABI may not be +* backward compatible. +* +* Response to a message with message type TI_SCI_MSG_VERSION_ABI5_PDM +*/ +struct ti_sci_msg_resp_version_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u16 version; +u8 sub_version; +u8 patch_version; +u8 abi_major; +u8 abi_minor; +char sci_server_version[26 ]; +} __packed; +/** * struct ti_sci_msg_req_reboot - Reboot the SoC * @hdr: Generic Header
drivers/firmware/ti/ti_sci_core.c +149 -35
248 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 4/6 firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs
In reply to Beleswar PadhiThe 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.
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/
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(+)
drivers/firmware/ti/ti_sci.h +25 -0
@@ -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);
drivers/firmware/ti/ti_sci_core.c +14 -0
@@ -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);
drivers/firmware/ti/ti_sci_device.c +62 -0
77 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 5/6 firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs
In reply to Beleswar PadhiThe 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 message structures for set_clock_state, get_clock_state, query_clock_freq, set_clock_freq, and get_clock_freq APIs have been updated to combine the existing u8 clk_id and u32 clk_id_32 into a single u32 clk_id. This is a good cleanup that came as a by-product of the major ABI update. So, add new ABI5.0 compliant APIs to account for this change.
Note: The following TI-SCI messages are not supported with ABI5.0, since parent clock configuration is done internally by PDM firmware:TI_SCI_MSG_SET_CLOCK_PARENT, TI_SCI_MSG_GET_CLOCK_PARENT, and TI_SCI_MSG_GET_NUM_CLOCK_PARENTS. Hence, the corresponding clock parent ops are left unset. Also, SSC support is not enabled in hardware on the TDA54 SoC, so the needs_ssc argument of get_clock is ignored.
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/
drivers/firmware/ti/ti_sci.h | 138 +++++++++++ drivers/firmware/ti/ti_sci_clock.c | 380 +++++++++++++++++++++++++++++ drivers/firmware/ti/ti_sci_core.c | 2 + 3 files changed, 520 insertions(+)
drivers/firmware/ti/ti_sci.h +138 -0
@@ -483,6 +483,34 @@ struct ti_sci_msg_req_set_clock_state {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_set_clock_state_abi5_pdm - Request to setup a Clock state +* @hdr: Generic Header, Certain flags can be set specific to the clocks. +* Uses the MSG_FLAG_CLOCK_* flags defined for +* &struct ti_sci_msg_req_set_clock_state. +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* @request_state: Request the state for the clock to be set to. +* Uses the MSG_CLOCK_SW_STATE_* values defined for +* &struct ti_sci_msg_req_set_clock_state. +* +* Normally, all required clocks are managed by TISCI entity, this is used +* only for specific control *IF* required. Auto managed state is +* MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote +* will explicitly control. +* +* Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic +* ACK or NACK message. +*/ +struct ti_sci_msg_req_set_clock_state_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +u8 request_state; +} __packed; +/** * struct ti_sci_msg_req_get_clock_state - Request for clock state * @hdr: Generic Header
@@ -505,6 +533,23 @@ struct ti_sci_msg_req_get_clock_state {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_get_clock_state_abi5_pdm - Request for clock state +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to get state of. +* +* Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state +* of the clock +*/ +struct ti_sci_msg_req_get_clock_state_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_get_clock_state - Response to get clock state * @hdr: Generic Header
@@ -659,6 +704,37 @@ struct ti_sci_msg_req_query_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_query_clock_freq_abi5_pdm - Request to query a frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @target_freq_hz: The target clock frequency. A frequency will be found +* as close to this target frequency as possible. +* @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In case of specific requests, TISCI evaluates capability to achieve +* requested frequency within provided range and responds with +* result message. +* +* Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message, +* or NACK in case of inability to satisfy request. +*/ +struct ti_sci_msg_req_query_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u64 min_freq_hz; +u64 target_freq_hz; +u64 max_freq_hz; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query * @hdr: Generic Header
@@ -718,6 +794,49 @@ struct ti_sci_msg_req_set_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_set_clock_freq_abi5_pdm - Request to setup a clock frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @target_freq_hz: The target clock frequency. The clock will be programmed +* at a rate as close to this target frequency as possible. +* @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In case of specific requests, TISCI evaluates capability to achieve +* requested range and responds with success/failure message. +* +* This sets the desired frequency for a clock within an allowable +* range. This message will fail on an enabled clock unless +* MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally, +* if other clocks have their frequency modified due to this message, +* they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled. +* +* Calling set frequency on a clock input to the SoC pseudo-device will +* inform the PMMC of that clock's frequency. Setting a frequency of +* zero will indicate the clock is disabled. +* +* Calling set frequency on clock outputs from the SoC pseudo-device will +* function similarly to setting the clock frequency on a device. +* +* Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK +* message. +*/ +struct ti_sci_msg_req_set_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u64 min_freq_hz; +u64 target_freq_hz; +u64 max_freq_hz; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency * @hdr: Generic Header
@@ -739,6 +858,24 @@ struct ti_sci_msg_req_get_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_get_clock_freq_abi5_pdm - Request to get the clock frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In some cases, clock frequencies are configured by host. +* +* Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency +* that the clock is currently at. +*/ +struct ti_sci_msg_req_get_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request * @hdr: Generic Header
@@ -1738,6 +1875,7 @@ int ti_sci_do_xfer(const struct ti_sci_handle *handle,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_clock_ops_abi5 (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);void ti_sci_setup_rm_irq_ops (struct ti_sci_rm_irq_ops *iops);
drivers/firmware/ti/ti_sci_clock.c +380 -0
449 lines not on this page · raw message
drivers/firmware/ti/ti_sci_core.c +2 -0
@@ -715,8 +715,10 @@ 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; +struct ti_sci_clk_ops *cops = &ops->clk_ops;ti_sci_setup_device_ops_abi5 (dops); +ti_sci_setup_clock_ops_abi5 (cops); }/**
Signature · 1 line
2.34.1
Re: [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs
Quoted 17 lines · Beleswar Padhi
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.
Quoted 9 lines
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.
Till this point, all patches has repeated commit msg, I don't think you need this repeat in all patches
Quoted 7 lines
In ABI5.0, the message structures for
set_clock_state,get_clock_state,query_clock_freq,set_clock_freq, andget_clock_freqAPIs have been updated to combine the existing u8clk_idand u32clk_id_32into a single u32clk_id. This is a good cleanup that came as a by-product of the major ABI update. So, add new ABI5.0 compliant APIs to account for this change.
Good clean up to get rid from two entries for clock id.
Quoted 45 lines
Note: The following TI-SCI messages are not supported with ABI5.0, since parent clock configuration is done internally by PDM firmware:
TI_SCI_MSG_SET_CLOCK_PARENT,TI_SCI_MSG_GET_CLOCK_PARENT, andTI_SCI_MSG_GET_NUM_CLOCK_PARENTS. Hence, the corresponding clock parent ops are left unset. Also, SSC support is not enabled in hardware on the TDA54 SoC, so theneeds_sscargument ofget_clockis ignored.Signed-off-by Beleswar Padhi <[email protected]>---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/drivers/firmware/ti/ti_sci.h | 138 +++++++++++ drivers/firmware/ti/ti_sci_clock.c | 380 +++++++++++++++++++++++++++++ drivers/firmware/ti/ti_sci_core.c | 2 + 3 files changed, 520 insertions(+)drivers/firmware/ti/ti_sci.h +18
-0@@ -483,6 +483,34 @@ struct ti_sci_msg_req_set_clock_state {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_set_clock_state_abi5_pdm - Request to setup a Clock state +* @hdr: Generic Header, Certain flags can be set specific to the clocks. +* Uses the MSG_FLAG_CLOCK_* flags defined for +* &struct ti_sci_msg_req_set_clock_state. +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* @request_state: Request the state for the clock to be set to. +* Uses the MSG_CLOCK_SW_STATE_* values defined for +* &struct ti_sci_msg_req_set_clock_state. +* +* Normally, all required clocks are managed by TISCI entity, this is used +* only for specific control *IF* required. Auto managed state is +* MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote +* will explicitly control. +*
drivers/firmware/ti/ti_sci.h struct ti_sci_msg_req_set_clock_state { · line 513
Quoted 10 lines
drivers/firmware/ti/ti_sci.h +10
-0+* Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic +* ACK or NACK message. +*/ +struct ti_sci_msg_req_set_clock_state_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +u8 request_state; +} __packed; +
while you are at this, can you think of getting rid of state and encapsulate state with set-freq ie set-freq 0 means disabled and any positive number is enable
Quoted 101 lines
drivers/firmware/ti/ti_sci.h +80
-0/** * struct ti_sci_msg_req_get_clock_state - Request for clock state * @hdr: Generic Header @@ -505,6 +533,23 @@ struct ti_sci_msg_req_get_clock_state {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_get_clock_state_abi5_pdm - Request for clock state +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to get state of. +* +* Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state +* of the clock +*/ +struct ti_sci_msg_req_get_clock_state_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_get_clock_state - Response to get clock state * @hdr: Generic Header @@ -659,6 +704,37 @@ struct ti_sci_msg_req_query_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_query_clock_freq_abi5_pdm - Request to query a frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @target_freq_hz: The target clock frequency. A frequency will be found +* as close to this target frequency as possible. +* @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In case of specific requests, TISCI evaluates capability to achieve +* requested frequency within provided range and responds with +* result message. +* +* Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message, +* or NACK in case of inability to satisfy request. +*/ +struct ti_sci_msg_req_query_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u64 min_freq_hz; +u64 target_freq_hz; +u64 max_freq_hz; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query * @hdr: Generic Header @@ -718,6 +794,49 @@ struct ti_sci_msg_req_set_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_set_clock_freq_abi5_pdm - Request to setup a clock frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @target_freq_hz: The target clock frequency. The clock will be programmed +* at a rate as close to this target frequency as possible. +* @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum +* allowable programmed frequency and does not account for clock +* tolerances and jitter. +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In case of specific requests, TISCI evaluates capability to achieve +* requested range and responds with success/failure message. +* +* This sets the desired frequency for a clock within an allowable +* range. This message will fail on an enabled clock unless +* MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally, +* if other clocks have their frequency modified due to this message, +* they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled. +* +* Calling set frequency on a clock input to the SoC pseudo-device will +* inform the PMMC of that clock's frequency. Setting a frequency of +* zero will indicate the clock is disabled. +* +* Calling set frequency on clock outputs from the SoC pseudo-device will +* function similarly to setting the clock frequency on a device. +* +* Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
drivers/firmware/ti/ti_sci.h struct ti_sci_msg_req_set_clock_freq { · line 838
Quoted 10 lines
drivers/firmware/ti/ti_sci.h +10
-0+* message. +*/ +struct ti_sci_msg_req_set_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u64 min_freq_hz; +u64 target_freq_hz; +u64 max_freq_hz; +u32 clk_id; +} __packed;
ti_sci_msg_req_query_clock_freq_abi5_pdm is same as of above could you combine these two ?
Quoted 113 lines
drivers/firmware/ti/ti_sci.h +20
-0+/** * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency * @hdr: Generic Header @@ -739,6 +858,24 @@ struct ti_sci_msg_req_get_clock_freq {u32 clk_id_32; } __packed; +/** +* struct ti_sci_msg_req_get_clock_freq_abi5_pdm - Request to get the clock frequency +* @hdr: Generic Header +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* +* NOTE: Normally clock frequency management is automatically done by TISCI +* entity. In some cases, clock frequencies are configured by host. +* +* Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency +* that the clock is currently at. +*/ +struct ti_sci_msg_req_get_clock_freq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 dev_id; +u32 clk_id; +} __packed; +/** * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request * @hdr: Generic Header @@ -1738,6 +1875,7 @@ int ti_sci_do_xfer(const struct ti_sci_handle *handle,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_clock_ops_abi5 (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);void ti_sci_setup_rm_irq_ops (struct ti_sci_rm_irq_ops *iops);drivers/firmware/ti/ti_sci_clock.c +61
-0@@ -50,6 +50,40 @@ static int ti_sci_set_clock_state(const struct ti_sci_handle *handle,return 0 ; } +/** +* ti_sci_set_clock_state_abi5_pdm() - Set clock state helper +* @handle: pointer to TI SCI handle +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* @flags: Header flags as needed +* @state: State to request for the clock. +* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_set_clock_state_abi5_pdm (const struct ti_sci_handle *handle, +u32 dev_id,u32 clk_id, +u32 flags,u8 state) +{ +struct ti_sci_msg_req_set_clock_state_abi5_pdm req; +struct ti_sci_msg_hdr resp; +int ret =0 ; + + req.dev_id = dev_id; + req.clk_id = clk_id; + req.request_state = state; + + ret =ti_sci_do_xfer (handle,TI_SCI_MSG_SET_CLOCK_STATE , + flags |TI_SCI_FLAG_REQ_ACK_ON_PROCESSED , + &req,sizeof (req), + &resp,sizeof (resp)); +if (ret) +return ret; + +return 0 ; +} +/** * ti_sci_cmd_get_clock_state() - Get clock state helper * @handle: pointer to TI SCI handle @@ -96,6 +130,47 @@ static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle,return 0 ; } +/** +* ti_sci_cmd_get_clock_state_abi5_pdm() - Get clock state helper +* @handle: pointer to TI SCI handle +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* @programmed_state: State requested for clock to move to +* @current_state: State that the clock is currently in +* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_cmd_get_clock_state_abi5_pdm (const struct ti_sci_handle *handle, +u32 dev_id,u32 clk_id, +u8 *programmed_state,u8 *current_state) +{ +struct ti_sci_msg_req_get_clock_state_abi5_pdm req; +struct ti_sci_msg_resp_get_clock_state resp; +int ret =0 ; + +if (!programmed_state && !current_state) +return -EINVAL ; + + req.dev_id = dev_id; + req.clk_id = clk_id; + + ret = ti_sci_do_xfer(handle, TI_SCI_MSG_GET_CLOCK_STATE,
drivers/firmware/ti/ti_sci_clock.c static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle, · line 169
Quoted 10 lines
drivers/firmware/ti/ti_sci_clock.c +10
-0+TI_SCI_FLAG_REQ_ACK_ON_PROCESSED , + &req,sizeof (req), + &resp, sizeof(resp)); +if (ret) +return ret; + +if (programmed_state) + *programmed_state = resp.programmed_state; +if (current_state) + *current_state = resp.current_state;
Isn't this a bug, if programed state is not equal to current_state for clock ?
Quoted 21 lines
drivers/firmware/ti/ti_sci_clock.c +14
-0+ +return 0 ; +} +/** * ti_sci_cmd_get_clock() - Get control of a clock from TI SCI * @handle: pointer to TI SCI handle @@ -123,6 +198,32 @@ static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id, MSG_CLOCK_SW_STATE_REQ); } +/** +* ti_sci_cmd_get_clock_abi5_pdm() - Get control of a clock from TI SCI +* @handle: pointer to TI SCI handle +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* @needs_ssc: unused, SSC is not supported with ABI5 +* @can_change_freq: 'true' if frequency change is desired, else 'false' +* @enable_input_term: 'true' if input termination is desired, else 'false'
drivers/firmware/ti/ti_sci_clock.c static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id, · line 220
Quoted 10 lines
drivers/firmware/ti/ti_sci_clock.c +10
-0+* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_cmd_get_clock_abi5_pdm (const struct ti_sci_handle *handle,u32 dev_id, +u32 clk_id,bool needs_ssc, +bool can_change_freq,bool enable_input_term) +{ +u32 flags =0 ; + + flags |= can_change_freq ?MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE :0 ;
get is changing freq, why ?
Quoted 10 lines
drivers/firmware/ti/ti_sci_clock.c +6
-0+ flags |= enable_input_term ?MSG_FLAG_CLOCK_INPUT_TERM :0 ; + +return ti_sci_set_clock_state_abi5_pdm (handle, dev_id, clk_id, flags, +MSG_CLOCK_SW_STATE_REQ ); +} +/** * ti_sci_cmd_idle_clock() - Idle a clock which is in our control * @handle: pointer to TI SCI handle
drivers/firmware/ti/ti_sci_clock.c static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle, · line 248
Quoted 5 lines
drivers/firmware/ti/ti_sci_clock.c +2
-0@@ -143,6 +244,26 @@ static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle, MSG_CLOCK_SW_STATE_UNREQ); } +/** +* ti_sci_cmd_idle_clock_abi5_pdm() - Idle a clock which is in our control
Idle means what, you are leaving owner ship and keeping state as is ? or something else, not clear from above comments
Quoted 33 lines
drivers/firmware/ti/ti_sci_clock.c +26
-0+* @handle: pointer to TI SCI handle +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +* +* NOTE: This clock must have been requested by get_clock previously. +* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_cmd_idle_clock_abi5_pdm (const struct ti_sci_handle *handle, +u32 dev_id,u32 clk_id) +{ +return ti_sci_set_clock_state_abi5_pdm (handle, dev_id, clk_id, +MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE , +MSG_CLOCK_SW_STATE_UNREQ ); +} +/** * ti_sci_cmd_put_clock() - Release a clock from our control back to TISCI * @handle: pointer to TI SCI handle @@ -163,6 +284,26 @@ static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, MSG_CLOCK_SW_STATE_AUTO); } +/** +* ti_sci_cmd_put_clock_abi5_pdm() - Release a clock from our control back to TISCI +* @handle: pointer to TI SCI handle +* @dev_id: Device identifier this request is for +* @clk_id: Clock identifier for the device for this request. +* Each device has it's own set of clock inputs. This indexes +* which clock input to modify. +*
drivers/firmware/ti/ti_sci_clock.c static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, · line 304
Quoted 10 lines
drivers/firmware/ti/ti_sci_clock.c +10
-0+* NOTE: This clock must have been requested by get_clock previously. +* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_cmd_put_clock_abi5_pdm (const struct ti_sci_handle *handle, +u32 dev_id,u32 clk_id) +{ +return ti_sci_set_clock_state_abi5_pdm (handle, dev_id, clk_id, +MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE , +MSG_CLOCK_SW_STATE_AUTO );
put clock is , making state is disable , any reason AUTO is selected here
Quoted 10 lines
drivers/firmware/ti/ti_sci_clock.c +2
-0+} +/** * ti_sci_cmd_clk_is_auto() - Is the clock being auto managed * @handle: pointer to TI SCI handle @@ -191,6 +332,34 @@ static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle,return 0 ; }
PATCH 6/6 firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs
In reply to Beleswar PadhiThe 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 message structure for manage_irq has been updated to remove the existing ia_id, vint, global_event, vint_status_bit fields as they are not supported in hardware with TDA54 SoC. Therefore, remove those fields and flags from the ABI5.0 structure definition and add new APIs and wrappers to send the manage_irq message with this updated structure. The TI TDA54 SoC has no Interrupt Aggregator in hardware, so the event map related ops are invalid in ABI5.0
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/[email protected]/
2. https://lore.kernel.org/all/[email protected]/
drivers/firmware/ti/ti_sci.h | 34 +++++++ drivers/firmware/ti/ti_sci_core.c | 4 + drivers/firmware/ti/ti_sci_rm.c | 148 ++++++++++++++++++++++++++++++ 3 files changed, 186 insertions(+)
drivers/firmware/ti/ti_sci.h +34 -0
@@ -1104,6 +1104,39 @@ struct ti_sci_msg_req_manage_irq {u8 secondary_host; } __packed; +/** +* struct ti_sci_msg_req_manage_irq_abi5_pdm - Request to configure/release the route +* between the dev and the host. +* @hdr: Generic Header +* @valid_params: Bit fields defining the validity of interrupt source +* parameters. If a bit is not set, then corresponding +* field is not valid and will not be used for route set. +* Bit field definitions: +* 0 - Valid bit for @dst_id +* 1 - Valid bit for @dst_host_irq +* 31 - Valid bit for @secondary_host +* @src_id: IRQ source peripheral ID. +* @src_index: IRQ source index within the peripheral +* @dst_id: IRQ Destination ID. Based on the architecture it can be +* IRQ controller or host processor ID. +* @dst_host_irq: IRQ number of the destination host IRQ controller +* @secondary_host: Host ID of the IRQ destination computing entity. This is +* required only when destination host id is different +* from ti sci interface host id. +* +* Request type is TI_SCI_MSG_SET/RELEASE_IRQ. +* Response is generic ACK / NACK message. +*/ +struct ti_sci_msg_req_manage_irq_abi5_pdm { +struct ti_sci_msg_hdr hdr; +u32 valid_params; +u16 src_id; +u16 src_index; +u16 dst_id; +u16 dst_host_irq; +u8 secondary_host; +} __packed; +/** * struct ti_sci_irq - Description of allocated irqs * @node: Link to hash table
@@ -1879,6 +1912,7 @@ void ti_sci_setup_clock_ops_abi5(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);void ti_sci_setup_rm_irq_ops (struct ti_sci_rm_irq_ops *iops); +void ti_sci_setup_rm_irq_ops_abi5 (struct ti_sci_rm_irq_ops *iops);void ti_sci_setup_rm_ringacc_ops (struct ti_sci_rm_ringacc_ops *rops);void ti_sci_setup_rm_psil_ops (struct ti_sci_rm_psil_ops *psilops);void ti_sci_setup_rm_udmap_ops (struct ti_sci_rm_udmap_ops *udmap_ops);
drivers/firmware/ti/ti_sci_core.c +4 -0
@@ -716,9 +716,13 @@ 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;struct ti_sci_clk_ops *cops = &ops->clk_ops; +struct ti_sci_rm_core_ops *rm_core_ops = &ops->rm_core_ops; +struct ti_sci_rm_irq_ops *iops = &ops->rm_irq_ops;ti_sci_setup_device_ops_abi5 (dops);ti_sci_setup_clock_ops_abi5 (cops); +ti_sci_setup_rm_core_ops (rm_core_ops); +ti_sci_setup_rm_irq_ops_abi5 (iops); }/**
drivers/firmware/ti/ti_sci_rm.c +148 -0
184 lines not on this page · raw message
Signature · 1 line
2.34.1