Skip to content

Commit

Permalink
specification: Define the device disconnection flow
Browse files Browse the repository at this point in the history
Fixes #58

Signed-off-by: Samuel Ortiz <sameo@rivosinc.com>
  • Loading branch information
sameo committed May 12, 2024
1 parent aa2db35 commit be240c6
Showing 1 changed file with 99 additions and 1 deletion.
100 changes: 99 additions & 1 deletion src/07-theory_operations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ Loop 3 times (For each sub-stream)
TSM ->> TSM: Generate SPDM request IDE_KM_K_SET_GO
TSM ->> VMM: [COVH] - spdm_req(IDE_KM_K_SET_GO)
VMM ->> RoT: [DOE] - SPDM_IDE_KM_K_SET_GO
RoT ->> Device: Trigger Tx IDE
RoT ->> VMM: [DOE] - SPDM_IDE_KM_K_GOSTOP_ACK
VMM ->> TSM: [COVH] - spdm_resp(IDE_KM_K_GOSTOP_ACK)
end
Expand Down Expand Up @@ -556,6 +555,105 @@ VMM ->> RootPort: Enable IDE for the selected stream

=== Device Disconnection

The host supervisor domain manager may decide to reclaim all resources related
to a connected device. All TDIs tracking states, TDISP resources, SPDM session
context or allocated IDE stream can be reclaimed by disconnecting the TSM from
the device. This is achieved through a `sbi_covh_disconnect_device()` `COVH`
ABI call to the connected TSM.

TSMs servicing the `sbi_covh_disconnect_device()` request must return an error
if some TDIs belonging to the related device are still bound to one or more TVMs
managed by the TSM. The host supervisor domain manager must first unbind all
TDIs from their respective TVMs before attempting to disconnect the device from
the TSM.

To bind again a TDI from the disconnected device to a TVM, the host supervisor
domain manager must first xref:device-connection[establish a new connection]
between the device's DSM and the related TSM.

==== Disconnection Flow

1. Tear IDE down
2. End SPDM session

.Device Disconnection
[source,mermaid]
....
%%{init: {'theme': 'neutral', 'themeVariables': {'darkMode': true}, "flowchart" : { "curve" : "basis" } } }%%
sequenceDiagram
autonumber
participant DSM as Device DSM
participant Device as PCIe Device
participant RootPort as PCIe Root Port
participant RoT as RoT (RP DSM)
participant VMM as Host Supervisor Domain Manager (VMM)
participant TSM
Loop For all TDIs bound to a TVM
VMM ->> TSM: [COVH] sbi_covh_unbind_interface()
TSM ->> VMM: [COVH] sbi_covh_unbind_interface()
end
VMM ->> Device: Disable IDE from the IDE extended capability
VMM ->> TSM: [COVH] sbi_covh_disconnect_device()
Note over TSM,DSM: TSM: IDE Link Teardown
TSM ->> RoT: Disable IDE from the RP IDE extended capability
Loop 3 times - TSM requests the Device to stop using the IDE stream Tx key (For each sub-stream) (For each sub-stream)
TSM ->> TSM: Generate SPDM request IDE_KM_K_SET_STOP
TSM ->> VMM: [COVH] - spdm_req(IDE_KM_K_SET_STOP)
VMM ->> DSM: [DOE] - SPDM_IDE_KM_K_SET_STOP
DSM ->> Device: Clear IDE Tx key
DSM ->> VMM: [DOE] - SPDM_IDE_KM_K_GOSTOP_ACK
VMM ->> TSM: [COVH] - spdm_resp(IDE_KM_K_GOSTOP_ACK)
end
Loop 3 times - TSM requests the RP to stop using the IDE stream Tx key (For each sub-stream)
TSM ->> TSM: Generate SPDM request IDE_KM_K_SET_STOP
TSM ->> VMM: [COVH] - spdm_req(IDE_KM_K_SET_STOP)
VMM ->> RoT: [DOE] - SPDM_IDE_KM_K_SET_STOP
RoT ->> RootPort: Clear IDE Tx key
RoT ->> VMM: [DOE] - SPDM_IDE_KM_K_GOSTOP_ACK
VMM ->> TSM: [COVH] - spdm_resp(IDE_KM_K_GOSTOP_ACK)
end
Loop 3 times - TSM requests the Device to stop using the IDE stream Rx key (For each sub-stream)
TSM ->> TSM: Generate SPDM request IDE_KM_K_SET_STOP
TSM ->> VMM: [COVH] - spdm_req(IDE_KM_K_SET_STOP)
VMM ->> DSM: [DOE] - SPDM_IDE_KM_K_SET_STOP
DSM ->> Device: Clear IDE Rx key
DSM ->> VMM: [DOE] - SPDM_IDE_KM_K_GOSTOP_ACK
VMM ->> TSM: [COVH] - spdm_resp(IDE_KM_K_GOSTOP_ACK)
end
Loop 3 times - TSM requests the TP to stop using the IDE stream Rx key (For each sub-stream)
TSM ->> TSM: Generate SPDM request IDE_KM_K_SET_STOP
TSM ->> VMM: [COVH] - spdm_req(IDE_KM_K_SET_STOP)
VMM ->> RoT: [DOE] - SPDM_IDE_KM_K_SET_STOP
RoT ->> RooTPort: Clear IDE x key
RoT ->> VMM: [DOE] - SPDM_IDE_KM_K_GOSTOP_ACK
VMM ->> TSM: [COVH] - spdm_resp(IDE_KM_K_GOSTOP_ACK)
end
TSM ->> TSM: Clear stored IDE keys for the device stream
Note over TSM,DSM: TSM: SPDM Session Termination
TSM ->> TSM: Generate SPDM request: END_SESSION
TSM ->> VMM: [COVH] - spdm_req(END_SESSION)
VMM ->> DSM: [DOE] - SPDM_END_SESSION
DSM ->> VMM: [DOE] - END_SESSION_ACK
VMM ->> TSM: [COVH] - spdm_resp(END_SESSION_ACK)
TSM ->> TSM: Clear all SPDM session secrets and data
TSM ->> VMM: [COVH] sbi_covh_disconnect_device()
....

=== Interface Binding

Once both the SPDM session and the IDE link are secured and established, the
Expand Down

0 comments on commit be240c6

Please sign in to comment.