HomeFreeBSD

vmm: Fix AP startup compatibility for old bhyve executables

Description

vmm: Fix AP startup compatibility for old bhyve executables

These changes unbreak AP startup when using a 13.1-RELEASE bhyve
executable with a newer kernel:

  • Correct the destination mask for the VM_EXITCODE_IPI message generated by an INIT or STARTUP IPI in vlapic_icrlo_write_handler().
  • Only initialize vlapics on active vCPUs. 13.1-RELEASE bhyve activates AP vCPUs only after the BSP starts them with an IPI, and vmm now allocates vcpu structures lazily, so the STARTUP handling in vm_handle_ipi() could trigger a page fault.
  • Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP message.

Fixes: 7c326ab5bb9a ("vmm: don't lock a mtx in the icr_low write handler")
Reviewed by: jhb, corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38446

Details

Provenance
markjAuthored on Feb 9 2023, 8:52 PM
Reviewer
jhb
Differential Revision
D38446: vmm: Fix AP startup compatibility
Parents
rGba34de1b3bf9: vmm: Remove an unneeded initialization of "retu"
Branches
Unknown
Tags
Unknown