pub trait CpuIo {
// Required methods
fn is_mmio(&self, address: u64) -> bool;
fn acknowledge_pic_interrupt(&self) -> Option<u8>;
fn handle_eoi(&self, irq: u32);
fn signal_synic_event(
&self,
vtl: Vtl,
connection_id: u32,
flag: u16,
) -> HvResult<()>;
fn post_synic_message(
&self,
vtl: Vtl,
connection_id: u32,
secure: bool,
message: &[u8],
) -> HvResult<()>;
fn read_mmio(
&self,
vp: VpIndex,
address: u64,
data: &mut [u8],
) -> impl Future<Output = ()>;
fn write_mmio(
&self,
vp: VpIndex,
address: u64,
data: &[u8],
) -> impl Future<Output = ()>;
fn read_io(
&self,
vp: VpIndex,
port: u16,
data: &mut [u8],
) -> impl Future<Output = ()>;
fn write_io(
&self,
vp: VpIndex,
port: u16,
data: &[u8],
) -> impl Future<Output = ()>;
fn fatal_error(&self, error: Box<dyn Error + Send + Sync>) -> VpHaltReason;
}
Expand description
This trait provides the operations between the VP dispatch loop and the platform’s devices.
Required Methods§
Sourcefn acknowledge_pic_interrupt(&self) -> Option<u8>
fn acknowledge_pic_interrupt(&self) -> Option<u8>
Gets the vector of the next interrupt to inject from the legacy interrupt controller (PIC) and sets the IRQ in service.
Sourcefn handle_eoi(&self, irq: u32)
fn handle_eoi(&self, irq: u32)
Handle End Of Interrupt (EOI)
A u32
is used for the IRQ value for (future) ARM compat.
Sourcefn signal_synic_event(
&self,
vtl: Vtl,
connection_id: u32,
flag: u16,
) -> HvResult<()>
fn signal_synic_event( &self, vtl: Vtl, connection_id: u32, flag: u16, ) -> HvResult<()>
Signal a synic event.
Sourcefn post_synic_message(
&self,
vtl: Vtl,
connection_id: u32,
secure: bool,
message: &[u8],
) -> HvResult<()>
fn post_synic_message( &self, vtl: Vtl, connection_id: u32, secure: bool, message: &[u8], ) -> HvResult<()>
Post a synic message.
Sourcefn read_mmio(
&self,
vp: VpIndex,
address: u64,
data: &mut [u8],
) -> impl Future<Output = ()>
fn read_mmio( &self, vp: VpIndex, address: u64, data: &mut [u8], ) -> impl Future<Output = ()>
Memory mapped IO read.
Sourcefn write_mmio(
&self,
vp: VpIndex,
address: u64,
data: &[u8],
) -> impl Future<Output = ()>
fn write_mmio( &self, vp: VpIndex, address: u64, data: &[u8], ) -> impl Future<Output = ()>
Memory mapped IO write.
Sourcefn read_io(
&self,
vp: VpIndex,
port: u16,
data: &mut [u8],
) -> impl Future<Output = ()>
fn read_io( &self, vp: VpIndex, port: u16, data: &mut [u8], ) -> impl Future<Output = ()>
Programmed IO read.
Sourcefn write_io(
&self,
vp: VpIndex,
port: u16,
data: &[u8],
) -> impl Future<Output = ()>
fn write_io( &self, vp: VpIndex, port: u16, data: &[u8], ) -> impl Future<Output = ()>
Programmed IO write.
Sourcefn fatal_error(&self, error: Box<dyn Error + Send + Sync>) -> VpHaltReason
fn fatal_error(&self, error: Box<dyn Error + Send + Sync>) -> VpHaltReason
Report an internal fatal error.
The intention behind this method is to allow the top-level VMM
to specify an error handling policy, while still being able to capture
stacks and other context from the point of failure. We previously would
return a VpHaltReason::Panic
here, but that meant the stack trace
would be from the point of the panic handler, which lost context.
See vmotherboard’s FatalErrorPolicy
for an example.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.