Skip to content

Commit 5191d8d

Browse files
clayton8Copilot
andauthored
MCI Spec Updates for Debug, Straps, and Register Bank (#139)
* Add HW spec details for MCI: Strap, Register Bank Access Restrictions * Change MCI DEBUG_INTENT sampling to once per cold boot. Update descriptions for DEBUG_INTENT register * Add MCU SRAM Diagram * Remove debug access from MCU SRAM diagram and show multiple drivers for fw_exec_region_lock * Update MCU SRAM section with a new diagram and updated description given the removal of debug_axi_user, and adding the mcu_sram_config_axi user. * Fix HW spec typo * Update docs/CaliptraSSHardwareSpecification.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/CaliptraSSHardwareSpecification.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/CaliptraSSHardwareSpecification.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/CaliptraSSHardwareSpecification.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/CaliptraSSHardwareSpecification.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Clarify ECC protection and error handling * MICROSOFT AUTOMATED PIPELINE: Stamp 'ckuchta-misc-changes' with updated timestamp and hash after successful run * Fix typos and improve clarity in documentation * MICROSOFT AUTOMATED PIPELINE: Stamp 'ckuchta-misc-changes' with updated timestamp and hash after successful run --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6ff9cce commit 5191d8d

File tree

6 files changed

+80
-14
lines changed

6 files changed

+80
-14
lines changed

.github/workflow_metadata/pr_hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2984dd1cf150d4928c325667579d18b246e04e3579e3a7a3221d311a5a437536d03dd0f1570fc0b2d7a9e9da16854f95
1+
331debf68c59f81a6036e440dc76296134f4de9e207400e995e88e8536a6b65bb44ad0c5b16751f4440be5f3de6481fc
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1742330095
1+
1742417102

docs/CaliptraSSHardwareSpecification.md

Lines changed: 75 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
- [Overview](#overview)
8080
- [MCI Feature Descriptions](#mci-feature-descriptions)
8181
- [Control/Status Registers (CSRs)](#controlstatus-registers-csrs)
82+
- [MCI CSR Access Restrictions](#mci-csr-access-restrictions)
83+
- [MCI Straps](#mci-straps)
8284
- [Subsystem Boot Finite State Machine (CSS-BootFSM)](#subsystem-boot-finite-state-machine-css-bootfsm)
8385
- [Watchdog Timer](#watchdog-timer)
8486
- [MCU Mailbox](#mcu-mailbox)
@@ -989,6 +991,61 @@ The Control/Status Registers (CSRs) within the MCI are designed to provide criti
989991

990992
**FIXME the link:** caliptra-ss/src/mci/rtl/mci_reg.rdl
991993

994+
#### MCI CSR Access Restrictions
995+
996+
Certain registers within the CSR bank have write access restrictions based off of:
997+
998+
1. AXI User
999+
2. Lock bits (SS_CONFIG_DONE, CAP_LOCK, etc.)
1000+
1001+
The privilaged users for the MCI CSRs are:
1002+
1003+
1. MCU
1004+
2. MCI SOC Config User (MSCU)
1005+
1006+
Both of these AXI Users come from straps and are not modifiable by SW. MCU is given the highest level of access and is expected to configure MCI registers and lock the configuration with various SS_CONFIG_DONE and LOCK bits. It also has access to certain functionalality like timers that are needed by the SOC but are critical for MCU functionality.
1007+
1008+
The MSCU is meant as a secondary config agent if the MCU is unable to configure MCI. Example when in the no ROM config it is expected the MCSCU can configure and lock down the MCI configuration.
1009+
1010+
The registers can be split up into a few different categories:
1011+
1012+
1013+
| **Write restrictions** | **Description** |
1014+
| :--------- | :---------|
1015+
| MCU Only | These registers are only meant for MCU to have access. There is no reason for SOC or the MCI SOC Config User to access the. Example is the MTIMER|
1016+
| MCU or MCSU | Access restricted to trusted agent but not locked. Example:RESET_REQUEST for MCU. |
1017+
| MCU or MCSU and CONFIG locked | Locked configuration by MCU ROM/MCSU and configured after each warm reset |
1018+
| Sticky MCU or MCSU and CONFIG locked | Locked configuration by MCU ROM/MCSU and configured after each cold reset |
1019+
| Locked by SS_CONFIG_DONE_STICKY | Configuration once per cold reset. |
1020+
| MCU or MSCU until CAP_LOCK | Configured by a trusted agent to show HW/FW capabilieds then locked until next warm reset |
1021+
| MBOX_USER_LOCK | Mailbox specific configuration locked by it's own LOCK bit. Configured afer each arem reset. |
1022+
1023+
1024+
### MCI Straps
1025+
1026+
All MCI straps shall be static before mci_rst_b is deasserted.
1027+
1028+
MCI has the following types of straps:
1029+
1030+
| **Strap Type** | **Sampled or Direct Use**|**Description** |
1031+
| :--------- | :---------| :---------|
1032+
| **Non-configurable Direct** |Direct | Used directly by MCI and not sampled at all. These are not overridable by SW. |
1033+
| **Non-configurable Sampled** | Sampled* | Sampled once per cold boot and not overridable by SW |
1034+
| **Configurable Sampled** | Sampled* | Sampled once per cold boot and SW can override via MCI Register Bank until SS_CONFIG_DONE is set.|
1035+
1036+
1037+
*NOTE: Strap sampling occurs when mci_rst_b is deasserted and is typically performed once per cold boot. This process is controlled by the SS_CONFIG_DONE_STICKY register; when set, sampling is skipped. If a warm reset happens before SS_CONFIG_DONE_STICKY is set, the straps will be sampled again, although this is not the usual behavior.
1038+
1039+
| **Strap Name** | **Strap Type**|**Description** |
1040+
| :--------- | :---------| :---------|
1041+
|`strap_mcu_lsu_axi_user`|Non-configurable Direct|MCU Load Store Unit AXI User. Given Special Access within MCI. |
1042+
|`strap_mcu_ifu_axi_user`|Non-configurable Direct|MCU Instruction Fetch Unit AXI User. given special access within MCI.|
1043+
|`strap_mcu_sram_config_axi_user`|Non-configurable Direct|MCU SRAM Config agent who is given special access to MCU SRAM Execution region to load FW image. Typically set to Caliptra's AXI User.|
1044+
|`strap_mci_soc_config_axi_user`|Non-configurable Direct|MCI SOC Config User (MSCU). AXI agent with MCI configuration access. |
1045+
|`strap_mcu_reset_vector`|Configurable Sampled|Default MCU reset vector.|
1046+
|`ss_debug_intent`|Non-configurable Sampled| Provides some debug access to MCI. Show the intent to put the part in a debug unlocked state. Although not writable by SW via AXI. This is writable via DMI.|
1047+
1048+
9921049
### Subsystem Boot Finite State Machine (CSS-BootFSM)
9931050

9941051
The Boot Sequencer FSM is responsible for the orderly and controlled boot process of the Caliptra Subsystem. This state machine ensures that all necessary initialization steps are completed in the correct sequence after power application. The boot sequence includes MCU and Caliptra Reset deassertions, Fuse Controller Initialization, and Lifecycle Controller Initialization.
@@ -1176,34 +1233,43 @@ It is the only agent allowed to set TARGET_USER and update the final CMD_STATUS.
11761233
*NOTE: MBOX SRAM size is configurable, but MBOX always reserves 2MB address space. See [MCU Mailbox Errors](#mcu-mailbox-errors) for how access to and invalid SRAM address are handled.
11771234

11781235
### MCU SRAM
1236+
![](images/MCI-MCU-SRAM-Diagram.png)
11791237

11801238
The MCU SRAM provides essential data and instruction memory for the Manufacturer Control Unit. This SRAM bank is utilized by the MCU to load firmware images, store application data structures, and create a runtime stack. The SRAM is accessible via the AXI interface and is mapped into the MCI's memory space for easy access and management. Exposing this SRAM via a restricted API through the SoC AXI interconnect enables seamless and secured Firmware Updates to be managed by Caliptra.
11811239

1182-
AXI USER filtering is used to restrict access within the MCU SRAM based on system state and accessor. Access permissions are based on the AXI USER input straps (either the Caliptra AXI_USER, or the MCU IFU/LSU AXI USERSs). Any write attempt by an invalid AXI_USER is discarded and returns an error status. Any read attempt returns 0 data and an error status.
1240+
**Min Size**: 4KB
1241+
1242+
**Max Size**: 2MB
11831243

1244+
AXI USER filtering is used to restrict access within the MCU SRAM based on system state and accessor. Access permissions are based on the AXI USER input straps (either the MCU SRAM Config AXI_USER, or the MCU IFU/LSU AXI USERS). Any write attempt by an invalid AXI_USER is discarded and returns an error status. Any read attempt returns 0 data and an error status.
11841245
The MCU SRAM contains two regions, a Protected Data Region and an Updatable Execution Region, each with a different set of access rules.
11851246

1186-
The span of each region is dynamically defined by the MCU ROM during boot up. Once MCU has switched to running Runtime Firmware, the RAM sizing is locked until any SoC-level reset. ROM uses the register FW_SRAM_EXEC_REGION_SIZE to configure the SRAM allocation.
1247+
After each MCU reset the Updateable Execution Region may only be read/written by MCU SRAM Config User (typically Caliptra) prior to mcu_sram_fw_exec_region_lock input signal is set. Once fw_exec_region_lock is set it can be read/written by the MCU IFU or MCU LSU until MCU reset is asserted.
11871248

1188-
The Updateable Execution Region may only be read/written by Caliptra prior to setting the MCU_RUNTIME_LOCK register and may only be read/written by the MCU IFU or MCU LSU after MCU_RUNTIME_LOCK is set. The Protected Data Region may never be accessed by Caliptra or the MCU IFU. Only the MCU LSU is allowed to read or write to the Protected Data Region, regardless of whether MCU ROM or MCU Runtime firmware is running.
1249+
The Protected Data Region is only ever read/write accessible by MCU LSU.
1250+
The span of each region is dynamically defined by the MCU ROM during boot up. Once MCU has switched to running Runtime Firmware, the RAM sizing shall be locked until any SoC-level reset. ROM uses the register FW_SRAM_EXEC_REGION_SIZE to configure the SRAM allocation in 4KB increments. FW_SRAM_EXEC_REGION_SIZE counts in base 0 meaning the smallest the Updateable Execution Region size can be is 4KB. It is possible for the entire SRAM to be allocated to the Updatable Execution Region and there be no Protected Data Region.
11891251

1190-
The entire MCU SRAM has ECC protection. Unlike MCI mailboxes, there is no configuration available to disable MCU SRAM for architectural reasons. Single bit errors are detected and corrected. While double bit errors are detected and error. MCI actions for single bit errors:
1252+
The entire MCU SRAM has ECC protection with no ability to disable. Single bit errors are detected and corrected. Double bit errors are detected and error.
1253+
1254+
**MCI actions for single bit errors:**
11911255
- Correct data and pass corrected data back to the initiator.
11921256
- Send interrupt notification to MCU.
1193-
- MCI actions for double bit errors:
1194-
- AXI response to the initiator
1257+
1258+
**MCI actions for double bit errors:**
1259+
- AXI SLVERR response to the initiator
11951260
- HW_ERROR_FATAL asserted and sent to SOC
11961261

1262+
MCU SRAM is accessible via DMI, see [DMI MCU SRAM Access](#dmi-mcu-sram-access) for more details.
11971263
### MCI AXI Subordinate
11981264

11991265
MCI AXI Subordinate decodes the incoming AXI transaction and passes it onto the appropriate submodule within MCI.
12001266

12011267
The MCI AXI Sub will respond with an AXI error if one of the following conditions is met:
12021268

12031269
1. AXI Address miss
1204-
2. Not all AXI STRB set when accessing submodule other than MCU SRAM
1205-
3. Submodule error response
1206-
4. Invalid MBOX AXI User access (MCU and Debug AXI USERs bypasses this check)
1270+
2. Submodule error response
1271+
3. Invalid MBOX AXI User access (MCU and Debug AXI USERs bypasses this check)
1272+
12071273

12081274
### Interrupts
12091275

74.7 KB
Loading

src/mci/rtl/mci_reg.rdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ addrmap mci_reg {
826826

827827
reg {
828828
name = "Production Debug Unlock PK HASH";
829-
desc = "Production Debug Unlock PK HASH. Initialized from strap inputs, overwritable by MCU until SS_CONFIG_DONE is set.
829+
desc = "Production Debug Unlock PK HASH. Configured by MCU and locked when SS_CONFIG_DONE_STICKY is set.
830830
Once SS_CONFIG_DONE_STICKY is set value persists until cold reset.";
831831
field {sw = rw; hw = r; swwe=ss_config_unlock_sticky; resetsignal = mci_pwrgood;} hash[32]=32'h0;
832832
} PROD_DEBUG_UNLOCK_PK_HASH_REG[8][12] @0x480;

src/mci/rtl/mci_reg_top.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ assign strap_we_sticky = strap_we & ~mci_reg_hwif_out.SS_CONFIG_DONE_STICKY.done
319319
// Value
320320
always_comb begin
321321
// STRAP with TAP ACCESS
322-
mci_reg_hwif_in.SS_DEBUG_INTENT.debug_intent.next = strap_we ? ss_debug_intent : mcu_dmi_uncore_wdata[0];
322+
mci_reg_hwif_in.SS_DEBUG_INTENT.debug_intent.next = strap_we_sticky ? ss_debug_intent : mcu_dmi_uncore_wdata[0];
323323
mci_reg_hwif_in.MCU_RESET_VECTOR.vec.next = strap_we_sticky ? strap_mcu_reset_vector : mcu_dmi_uncore_wdata ;
324324

325325
// REGISTERS WITH TAP ACCESS
@@ -335,7 +335,7 @@ end
335335
// Write enable
336336
always_comb begin
337337
// STRAPS with TAP ACCESS
338-
mci_reg_hwif_in.SS_DEBUG_INTENT.debug_intent.we = strap_we | (mcu_dmi_uncore_dbg_unlocked_wr_en &
338+
mci_reg_hwif_in.SS_DEBUG_INTENT.debug_intent.we = strap_we_sticky | (mcu_dmi_uncore_dbg_unlocked_wr_en &
339339
(mcu_dmi_uncore_addr == MCI_DMI_SS_DEBUG_INTENT));
340340
mci_reg_hwif_in.MCU_RESET_VECTOR.vec.we = strap_we_sticky | (mcu_dmi_uncore_dbg_unlocked_wr_en &
341341
(mcu_dmi_uncore_addr == MCI_DMI_SS_DEBUG_INTENT));

0 commit comments

Comments
 (0)