summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/bhyverun.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-06-13 19:10:40 +0000
committerjhb <jhb@FreeBSD.org>2014-06-13 19:10:40 +0000
commitf6a797dc57133b52a2d8569645fbfd6389656a5c (patch)
tree5b2f0382561c4e2ab92cef573a2fe592a6afe4a6 /usr.sbin/bhyve/bhyverun.c
parent2dcd5ca913b612819e80fee6c6ebce613649a1f3 (diff)
downloadFreeBSD-src-f6a797dc57133b52a2d8569645fbfd6389656a5c.zip
FreeBSD-src-f6a797dc57133b52a2d8569645fbfd6389656a5c.tar.gz
MFC 262139,262140,262236,262281,262532:
Various x2APIC fixes and enhancements: - Use spinlocks for the vioapic. - Handle the SELF_IPI MSR. - Simplify the APIC mode switching between MMIO and x2APIC. The guest is no longer allowed to switch modes at runtime. Instead, the desired mode is set when the virtual machine is created. - Disallow MMIO access in x2APIC mode and MSR access in xAPIC mode. - Add support for x2APIC virtualization assist in Intel VT-x.
Diffstat (limited to 'usr.sbin/bhyve/bhyverun.c')
-rw-r--r--usr.sbin/bhyve/bhyverun.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index b6662ca..ea0e60a 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -84,8 +84,9 @@ char *vmname;
int guest_ncpus;
static int pincpu = -1;
-static int guest_vmexit_on_hlt, guest_vmexit_on_pause, disable_x2apic;
+static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
static int virtio_msix = 1;
+static int x2apic_mode = 0; /* default is xAPIC */
static int strictio;
static int strictmsr = 1;
@@ -126,7 +127,7 @@ usage(int code)
fprintf(stderr,
"Usage: %s [-aehwAHIPW] [-g <gdb port>] [-s <pci>]\n"
" %*s [-c vcpus] [-p pincpu] [-m mem] [-l <lpc>] <vm>\n"
- " -a: local apic is in XAPIC mode (default is X2APIC)\n"
+ " -a: local apic is in xAPIC mode (deprecated)\n"
" -A: create an ACPI table\n"
" -g: gdb port\n"
" -c: # cpus (default 1)\n"
@@ -139,7 +140,8 @@ usage(int code)
" -s: <slot,driver,configinfo> PCI slot config\n"
" -l: LPC device configuration\n"
" -m: memory size in MB\n"
- " -w: ignore unimplemented MSRs\n",
+ " -w: ignore unimplemented MSRs\n"
+ " -x: local apic is in x2APIC mode\n",
progname, (int)strlen(progname), "");
exit(code);
@@ -153,13 +155,6 @@ paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
}
int
-fbsdrun_disable_x2apic(void)
-{
-
- return (disable_x2apic);
-}
-
-int
fbsdrun_vmexit_on_pause(void)
{
@@ -576,10 +571,10 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu)
handler[VM_EXITCODE_PAUSE] = vmexit_pause;
}
- if (fbsdrun_disable_x2apic())
- err = vm_set_x2apic_state(ctx, cpu, X2APIC_DISABLED);
- else
+ if (x2apic_mode)
err = vm_set_x2apic_state(ctx, cpu, X2APIC_ENABLED);
+ else
+ err = vm_set_x2apic_state(ctx, cpu, X2APIC_DISABLED);
if (err) {
fprintf(stderr, "Unable to set x2apic state (%d)\n", err);
@@ -604,10 +599,10 @@ main(int argc, char *argv[])
guest_ncpus = 1;
memsize = 256 * MB;
- while ((c = getopt(argc, argv, "abehwAHIPWp:g:c:s:m:l:")) != -1) {
+ while ((c = getopt(argc, argv, "abehwxAHIPWp:g:c:s:m:l:")) != -1) {
switch (c) {
case 'a':
- disable_x2apic = 1;
+ x2apic_mode = 0;
break;
case 'A':
acpi = 1;
@@ -664,6 +659,9 @@ main(int argc, char *argv[])
case 'W':
virtio_msix = 0;
break;
+ case 'x':
+ x2apic_mode = 1;
+ break;
case 'h':
usage(0);
default:
OpenPOWER on IntegriCloud