Bug #14261
openbhyve should expose kernel device state
0%
Description
Given that bhyve implements fair amount of device emulation in the kernel vmm (LAPIC, IO-APIC, PIT, etc), it would be nice for live migration (and debugging) to be able to query and manipulate the state of those devices. There are some existing mechanisms for getting/setting general purpose register state, and manipulating the nvram fields of the RTC, but nothing for the rest of the in-kernel state. Rather than adding a bespoke getter/setter interface per device, I propose a more general API which exposes those different kinds of data with a common key-value interface. The state for each device would be covered by a given class, and then within that class, the device would be free to define different identifiers for the various parts of its state. For example, the local APIC state for a given vCPU would be under the LAPIC class with field offsets for the various registers (e.g. IRR0) being used for the identifiers. Those vCPU-specific devices would require that the vcpuid be specified for the given get/set operation. Devices which are machine-wide (like the IOAPIC or PIT) would stand alone with no vcpuid association.
Expected per-vcpu data classes:
- register (GPR, segment, etc)
- MSRs
- FPU
- LAPIC
- VMM (arch-specific vmm state, VMX or SVM)
Expected VM-wide classes:
- IOAPIC
- ATPIT
- ATPIC
- HPET
- PM Timer
- RTC
It may also make sense to include some meta classes for information about the capabilities and expectations of the data transfer interface itself, as well as versioning about the various classes.