vmm_core_defs/lib.rs
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Client definitions for functionality in the `vmm_core` crate.
5
6#![expect(missing_docs)]
7#![forbid(unsafe_code)]
8
9pub mod debug_rpc;
10
11use inspect::Inspect;
12use mesh::MeshPayload;
13use mesh::payload::Protobuf;
14
15/// Default memory layout sizing for a VM, used by the layout engine in
16/// `openvmm_core::worker::memory_layout`.
17///
18/// Consumers that receive their memory layout from the host (such as OpenHCL /
19/// Underhill) do not use these values.
20#[derive(Debug, Clone, MeshPayload)]
21pub struct LayoutConfig {
22 /// Chipset low MMIO range size (below 4 GiB) for VMOD/PCI0 _CRS.
23 /// The address is always allocated dynamically. `0` uses only the
24 /// architectural minimum (LAPIC, IOAPIC, GIC, etc.).
25 pub chipset_low_mmio_size: u32,
26 /// Chipset high MMIO range size (above RAM) for VMOD/PCI0 _CRS.
27 /// The address is always allocated dynamically. `0` disables the range.
28 pub chipset_high_mmio_size: u64,
29 /// VTL2-private chipset MMIO range size for VTL2 VMBus.
30 /// The address is always allocated dynamically. `0` disables the range.
31 pub vtl2_chipset_mmio_size: u64,
32}
33use std::sync::Arc;
34
35/// HaltReason sent by devices and vp_set to the vmm.
36#[derive(Debug, Clone, Eq, PartialEq, Protobuf, Inspect)]
37#[inspect(tag = "halt_reason")]
38pub enum HaltReason {
39 PowerOff,
40 Reset,
41 Hibernate,
42 DebugBreak {
43 #[inspect(rename = "failing_vp")]
44 vp: Option<u32>,
45 },
46 TripleFault {
47 #[inspect(rename = "failing_vp")]
48 vp: u32,
49 #[inspect(skip)]
50 // Arc'ed for size and cheap clones.
51 registers: Option<Arc<virt::vp::Registers>>,
52 },
53 SingleStep {
54 #[inspect(rename = "failing_vp")]
55 vp: u32,
56 },
57 HwBreakpoint {
58 #[inspect(rename = "failing_vp")]
59 vp: u32,
60 #[inspect(skip)]
61 breakpoint: virt::x86::HardwareBreakpoint,
62 },
63 /// The guest watchdog timer expired without being petted.
64 Watchdog,
65}