pub struct MshvVtl { /* private fields */ }Expand description
An open mshv_vtl device file.
Implementations§
Source§impl MshvVtl
impl MshvVtl
Sourcepub fn get_realm_config(&self) -> Result<RsiRealmConfig, Error>
pub fn get_realm_config(&self) -> Result<RsiRealmConfig, Error>
Get the realm-specific parameters from the RMM
Sourcepub fn rsi_sysreg_write(
&self,
vtl: GuestVtl,
sysreg: u64,
value: u64,
) -> Result<(), SetRegError>
pub fn rsi_sysreg_write( &self, vtl: GuestVtl, sysreg: u64, value: u64, ) -> Result<(), SetRegError>
Write the value of a system register for the given VTL
Sourcepub fn rsi_sysreg_read(
&self,
vtl: GuestVtl,
sysreg: u64,
value: &mut u64,
) -> Result<(), GetRegError>
pub fn rsi_sysreg_read( &self, vtl: GuestVtl, sysreg: u64, value: &mut u64, ) -> Result<(), GetRegError>
Read the value of a system register for the given VTL.
Sourcepub fn rsi_set_mem_perm(
&self,
vtl: GuestVtl,
range: &MemoryRange,
) -> Result<(), HvError>
pub fn rsi_set_mem_perm( &self, vtl: GuestVtl, range: &MemoryRange, ) -> Result<(), HvError>
Assign given memory range to the VTL.
Sourcepub fn rsi_get_ipa_state(
&self,
fipa: u64,
) -> Result<Option<u64>, GetIpaStateError>
pub fn rsi_get_ipa_state( &self, fipa: u64, ) -> Result<Option<u64>, GetIpaStateError>
Get the ipa RIPAS state
Source§impl MshvVtl
impl MshvVtl
Sourcepub fn pvalidate_pages(
&self,
range: MemoryRange,
validate: bool,
terminate_on_failure: bool,
) -> Result<(), SnpPageError>
pub fn pvalidate_pages( &self, range: MemoryRange, validate: bool, terminate_on_failure: bool, ) -> Result<(), SnpPageError>
Execute the pvalidate instruction on the specified memory range.
The range must not be mapped in the kernel as RAM.
Sourcepub fn rmpadjust_pages(
&self,
range: MemoryRange,
value: SevRmpAdjust,
terminate_on_failure: bool,
) -> Result<(), SnpPageError>
pub fn rmpadjust_pages( &self, range: MemoryRange, value: SevRmpAdjust, terminate_on_failure: bool, ) -> Result<(), SnpPageError>
Execute the rmpadjust instruction on the specified memory range.
The range must not be mapped in the kernel as RAM.
Sourcepub fn rmpquery_page(
&self,
gpa: u64,
vtl: GuestVtl,
) -> Result<SevRmpAdjust, SnpPageError>
pub fn rmpquery_page( &self, gpa: u64, vtl: GuestVtl, ) -> Result<SevRmpAdjust, SnpPageError>
Gets the current vtl permissions for a page. Note: only supported on Genoa+
Source§impl MshvVtl
impl MshvVtl
Sourcepub fn tdx_set_page_attributes(
&self,
range: MemoryRange,
attributes: TdgMemPageGpaAttr,
mask: TdgMemPageAttrWriteR8,
) -> Result<(), TdCallResultCode>
pub fn tdx_set_page_attributes( &self, range: MemoryRange, attributes: TdgMemPageGpaAttr, mask: TdgMemPageAttrWriteR8, ) -> Result<(), TdCallResultCode>
Issues a tdcall to set page attributes.
Sourcepub fn tdx_accept_pages(
&self,
range: MemoryRange,
attributes: Option<(TdgMemPageGpaAttr, TdgMemPageAttrWriteR8)>,
) -> Result<(), AcceptPagesError>
pub fn tdx_accept_pages( &self, range: MemoryRange, attributes: Option<(TdgMemPageGpaAttr, TdgMemPageAttrWriteR8)>, ) -> Result<(), AcceptPagesError>
Issues a tdcall to accept pages, optionally also setting attributes.
These operations are combined because this code tries accepting at 2MB
granularity first and then falls back to 4KB. A separate call to
Self::tdx_set_page_attributes has to re-derive the appropriate
granularity.
Sourcepub fn tdx_release_pages(
&self,
range: MemoryRange,
) -> Result<(), TdgPageReleaseError>
pub fn tdx_release_pages( &self, range: MemoryRange, ) -> Result<(), TdgPageReleaseError>
Issues tdcalls to release pages.
Sourcepub fn tdx_get_config_flags(&self) -> TdConfigFlags
pub fn tdx_get_config_flags(&self) -> TdConfigFlags
Issues tdcall to get TD-scoped config flags.
Sourcepub fn tdx_read_features0(&self) -> Result<TdxFeatures0, TdCallResult>
pub fn tdx_read_features0(&self) -> Result<TdxFeatures0, TdCallResult>
Reads the global-scope TDX_FEATURES0 metadata field via the
TDG.SYS.RD TDCALL, which enumerates optional TDX module features
(including hardware-bound sealing support).
Returns an error if the module does not support TDG.SYS.RD (older
modules) or rejects the field.
Sourcepub fn tdx_enable_hw_seal_keys(&self) -> Result<bool, TdCallResult>
pub fn tdx_enable_hw_seal_keys(&self) -> Result<bool, TdCallResult>
Attempts to opt this TD into hardware-bound seal keys by setting
TD_CTLS.ENABLE_HW_SEAL_KEYS, enabling the TDG.MR.KEY.GET TDCALL that
backs VMGS hardware key sealing.
Returns Ok(true) if the bit is set after the operation (sealing keys
are available), or Ok(false) if the TDX module does not support
sealing.
A TDX module that does not implement sealing treats
ENABLE_HW_SEAL_KEYS as a reserved bit and may silently ignore the
masked write while still returning success. The write status alone is
therefore not sufficient, so this reads TD_CTLS back and reports
whether the bit actually stuck.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MshvVtl
impl RefUnwindSafe for MshvVtl
impl Send for MshvVtl
impl Sync for MshvVtl
impl Unpin for MshvVtl
impl UnsafeUnpin for MshvVtl
impl UnwindSafe for MshvVtl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.