pub trait TdispGuestRequestInterface {
// Required methods
fn tdisp_negotiate_protocol(
&mut self,
requested_guest_protocol: TdispGuestProtocolType,
) -> Result<TdispDeviceInterfaceInfo, TdispGuestOperationError>;
fn request_lock_device_resources(
&mut self,
) -> Result<(), TdispGuestOperationError>;
fn request_start_tdi(&mut self) -> Result<(), TdispGuestOperationError>;
fn request_attestation_report(
&mut self,
report_type: TdispReportType,
) -> Result<Vec<u8>, TdispGuestOperationError>;
fn request_unbind(
&mut self,
reason: TdispGuestUnbindReason,
) -> Result<(), TdispGuestOperationError>;
}Expand description
Represents an interface by which guest commands can be dispatched to a backing TDISP state handler in the host. This could be an emulated TDISP device or an assigned TDISP device that is actually connected to the guest.
Required Methods§
Sourcefn tdisp_negotiate_protocol(
&mut self,
requested_guest_protocol: TdispGuestProtocolType,
) -> Result<TdispDeviceInterfaceInfo, TdispGuestOperationError>
fn tdisp_negotiate_protocol( &mut self, requested_guest_protocol: TdispGuestProtocolType, ) -> Result<TdispDeviceInterfaceInfo, TdispGuestOperationError>
Before a guest can communicate with the host, the guest must negotiate a protocol with the host. This is done by calling this function with the guest’s desired protocol type. The host responds with the protocol that it will use to communicate with the guest and includes information about the TDISP capabilities of the device.
If the host reports that this device not TDISP capable,
TdispDeviceInterfaceInfo::guest_protocol_type will be
TdispGuestProtocolType::Invalid.
Sourcefn request_lock_device_resources(
&mut self,
) -> Result<(), TdispGuestOperationError>
fn request_lock_device_resources( &mut self, ) -> Result<(), TdispGuestOperationError>
Transition the device from the Unlocked to Locked state. This takes place after the
device has been assigned to the guest partition and the resources for the device have
been configured by the guest by not yet validated.
The device will in the Locked state can still perform unencrypted operations until it has
been transitioned to the Run state. The device will be attested and moved to the Run state.
Attempting to transition the device to the Locked state while the device is not in the
Unlocked state will cause an error and unbind the device.
Sourcefn request_start_tdi(&mut self) -> Result<(), TdispGuestOperationError>
fn request_start_tdi(&mut self) -> Result<(), TdispGuestOperationError>
Transition the device from the Locked to the Run state. This takes place after the
device has been assigned resources and the resources have been locked to the guest.
The device will then transition to the Run state, where it will be non-functional
until the guest undergoes attestation and resources are accepted into the guest context.
Attempting to transition the device to the Run state while the device is not in the
Locked state will cause an error and unbind the device.
Sourcefn request_attestation_report(
&mut self,
report_type: TdispReportType,
) -> Result<Vec<u8>, TdispGuestOperationError>
fn request_attestation_report( &mut self, report_type: TdispReportType, ) -> Result<Vec<u8>, TdispGuestOperationError>
Retrieves the attestation report for the device when the device is in the Locked or
Run state. The device resources will not be functional until the
resources have been accepted into the guest while the device is in the
Run state.
Attempting to retrieve the attestation report while the device is not in
the Locked or Run state will cause an error and unbind the device.
Sourcefn request_unbind(
&mut self,
reason: TdispGuestUnbindReason,
) -> Result<(), TdispGuestOperationError>
fn request_unbind( &mut self, reason: TdispGuestUnbindReason, ) -> Result<(), TdispGuestOperationError>
Guest initiates a graceful unbind of the device. The guest might initiate an unbind for a variety of reasons:
- Device is being detached/deactivated and is no longer needed in a functional state
- Device is powering down or entering a reset
The device will transition to the Unlocked state. The guest can call
this function at any time in any state to reset the device to the
Unlocked state.