pub struct HvCall {
initialized: bool,
vtl: Vtl,
tdx_io_page: Option<TdxHypercallPage>,
}
Expand description
Provides mechanisms to invoke hypercalls within the boot shim. Internally uses static buffers for the hypercall page, the input page, and the output page, so this should not be used in any multi-threaded capacity (which the boot shim currently is not).
Fields§
§initialized: bool
§vtl: Vtl
§tdx_io_page: Option<TdxHypercallPage>
Implementations§
Source§impl HvCall
impl HvCall
fn input_page() -> &'static mut HvcallPage
fn output_page() -> &'static mut HvcallPage
Sourcepub fn hypercall_page(&mut self) -> u64
pub fn hypercall_page(&mut self) -> u64
Returns the address of the hypercall page, mapping it first if necessary.
fn init_if_needed(&mut self)
Sourcepub fn initialize(&mut self)
pub fn initialize(&mut self)
Hypercall initialization.
Sourcepub fn uninitialize(&mut self)
pub fn uninitialize(&mut self)
Call before jumping to kernel.
Sourcefn dispatch_hvcall(
&mut self,
code: HypercallCode,
rep_count: Option<usize>,
) -> HypercallOutput
fn dispatch_hvcall( &mut self, code: HypercallCode, rep_count: Option<usize>, ) -> HypercallOutput
Makes a hypercall. rep_count is Some for rep hypercalls
Sourcepub fn set_register(
&mut self,
name: HvRegisterName,
value: HvRegisterValue,
) -> Result<(), HvError>
pub fn set_register( &mut self, name: HvRegisterName, value: HvRegisterValue, ) -> Result<(), HvError>
Hypercall for setting a register to a value.
Sourcepub fn get_register(
&mut self,
name: HvRegisterName,
) -> Result<HvRegisterValue, HvError>
pub fn get_register( &mut self, name: HvRegisterName, ) -> Result<HvRegisterValue, HvError>
Hypercall for setting a register to a value.
Sourcepub fn apply_vtl2_protections(
&mut self,
range: MemoryRange,
) -> Result<(), HvError>
pub fn apply_vtl2_protections( &mut self, range: MemoryRange, ) -> Result<(), HvError>
Hypercall to apply vtl protections to the pages from address start to end
Sourcepub fn accept_vtl2_pages(
&mut self,
range: MemoryRange,
memory_type: AcceptMemoryType,
) -> Result<(), HvError>
pub fn accept_vtl2_pages( &mut self, range: MemoryRange, memory_type: AcceptMemoryType, ) -> Result<(), HvError>
Hypercall to accept vtl2 pages from address start to end with VTL 2 protections and no host visibility
Sourcepub fn get_vp_index_from_hw_id<const N: usize>(
&mut self,
hw_ids: &[u32],
output: &mut ArrayVec<u32, N>,
) -> Result<(), HvError>
pub fn get_vp_index_from_hw_id<const N: usize>( &mut self, hw_ids: &[u32], output: &mut ArrayVec<u32, N>, ) -> Result<(), HvError>
Get the corresponding VP indices from a list of VP hardware IDs (APIC IDs on x64, MPIDR on ARM64).
This always queries VTL0, since the hardware IDs are the same across the VTLs in practice, and the hypercall only succeeds for VTL2 once VTL2 has been enabled (which it might not be at this point).
Source§impl HvCall
impl HvCall
Sourcepub fn initialize_tdx(&mut self, tdx_io_page: TdxHypercallPage)
pub fn initialize_tdx(&mut self, tdx_io_page: TdxHypercallPage)
Initialize HvCall for use in a TDX CVM
Sourcepub fn uninitialize_tdx(&mut self)
pub fn uninitialize_tdx(&mut self)
Uninitialize HvCall for TDX, unshare IO pages with the hypervisor
Sourcepub fn tdx_enable_vp_vtl2(&mut self, vp_index: u32) -> Result<(), HvError>
pub fn tdx_enable_vp_vtl2(&mut self, vp_index: u32) -> Result<(), HvError>
Hypercall to enable VTL2 on a TDX VP
Sourcepub fn tdx_start_vp(&mut self, vp_index: u32) -> Result<(), HvError>
pub fn tdx_start_vp(&mut self, vp_index: u32) -> Result<(), HvError>
Hypercall to start VP on TDX