Print this page
13275 bhyve needs richer INIT/SIPI support
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
*** 54,63 ****
--- 54,64 ----
#include <assert.h>
#include "bhyverun.h"
#include "spinup_ap.h"
+ #ifdef __FreeBSD__
static void
spinup_ap_realmode(struct vmctx *ctx, int newcpu, uint64_t *rip)
{
int vector, error;
uint16_t cs;
*** 99,126 ****
error = vcpu_reset(ctx, newcpu);
assert(error == 0);
fbsdrun_set_capabilities(ctx, newcpu);
- #ifdef __FreeBSD__
/*
* Enable the 'unrestricted guest' mode for 'newcpu'.
*
* Set up the processor state in power-on 16-bit mode, with the CS:IP
* init'd to the specified low-mem 4K page.
*/
error = vm_set_capability(ctx, newcpu, VM_CAP_UNRESTRICTED_GUEST, 1);
assert(error == 0);
- #else
- /* Unrestricted Guest is always enabled on illumos */
- #endif
spinup_ap_realmode(ctx, newcpu, &rip);
- #ifdef __FreeBSD__
fbsdrun_addcpu(ctx, vcpu, newcpu, rip);
- #else
- fbsdrun_addcpu(ctx, vcpu, newcpu, rip, false);
- #endif
return (newcpu);
}
--- 100,139 ----
error = vcpu_reset(ctx, newcpu);
assert(error == 0);
fbsdrun_set_capabilities(ctx, newcpu);
/*
* Enable the 'unrestricted guest' mode for 'newcpu'.
*
* Set up the processor state in power-on 16-bit mode, with the CS:IP
* init'd to the specified low-mem 4K page.
*/
error = vm_set_capability(ctx, newcpu, VM_CAP_UNRESTRICTED_GUEST, 1);
assert(error == 0);
spinup_ap_realmode(ctx, newcpu, &rip);
fbsdrun_addcpu(ctx, vcpu, newcpu, rip);
return (newcpu);
}
+ #else /* __FreeBSD__ */
+ void
+ spinup_halted_ap(struct vmctx *ctx, int newcpu)
+ {
+ int error;
+
+ assert(newcpu != 0);
+ assert(newcpu < guest_ncpus);
+
+ error = vcpu_reset(ctx, newcpu);
+ assert(error == 0);
+
+ fbsdrun_set_capabilities(ctx, newcpu);
+
+ error = vm_set_run_state(ctx, newcpu, VRS_HALT, 0);
+ assert(error == 0);
+
+ fbsdrun_addcpu(ctx, newcpu, 0, false);
+ }
+ #endif /* __FreeBSD__ */