diff options
author | grehan <grehan@FreeBSD.org> | 2011-05-19 21:53:25 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2011-05-19 21:53:25 +0000 |
commit | 5a44aef8a38d88c0d5b265a72c5d90ef2d73cf95 (patch) | |
tree | 025b0a5578ec9688795c45d9e672d8faf8d42845 /sys | |
parent | 692383a3a7117fc9a24f086a4638739dacdc8d73 (diff) | |
download | FreeBSD-src-5a44aef8a38d88c0d5b265a72c5d90ef2d73cf95.zip FreeBSD-src-5a44aef8a38d88c0d5b265a72c5d90ef2d73cf95.tar.gz |
Changes to allow the GENERIC+bhye kernel built from this branch to
run as a 1/2 CPU guest on an 8.1 bhyve host.
bhyve/inout.c
inout.h
fbsdrun.c
- Rather than exiting on accesses to unhandled i/o ports, emulate
hardware by returning -1 on reads and ignoring writes to unhandled
ports. Support the previous mode by allowing a 'strict' parameter
to be set from the command line.
The 8.1 guest kernel was vastly cut down from GENERIC and had no
ISA devices. Booting GENERIC exposes a massive amount of random
touching of i/o ports (hello syscons/vga/atkbdc).
bhyve/consport.c
dev/bvm/bvm_console.c
- implement a simplistic signature for the bvm console by returning
'bv' for an inw on the port. Also, set the priority of the console
to CN_REMOTE if the signature was returned. This works better in
an environment where multiple consoles are in the kernel (hello syscons)
bhyve/rtc.c
- return 0 for the access to RTC_EQUIPMENT (yes, you syscons)
amd64/vmm/x86.c
x86.h
- hide a bunch more CPUID leaf 1 bits from the guest to prevent
cpufreq drivers from probing.
The next step will be to move CPUID handling completely into
user-space. This will allow the full spectrum of changes from
presenting a lowest-common-denominator CPU type/feature set, to
exposing (almost) everything that the host can support.
Reviewed by: neel
Obtained from: NetApp
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/vmm/x86.c | 21 | ||||
-rw-r--r-- | sys/amd64/vmm/x86.h | 1 | ||||
-rw-r--r-- | sys/dev/bvm/bvm_console.c | 16 |
3 files changed, 30 insertions, 8 deletions
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c index 45c4c53..f6b38e0 100644 --- a/sys/amd64/vmm/x86.c +++ b/sys/amd64/vmm/x86.c @@ -75,13 +75,19 @@ x86_emulate_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) regs[1] |= (0 << CPUID_0000_0001_APICID_SHIFT); /* - * Don't expose VMX capability. + * Don't expose VMX, SpeedStep or TME capability. * Advertise x2APIC capability. */ - regs[2] &= ~CPUID_0000_0001_FEAT0_VMX; + regs[2] &= ~(CPUID_0000_0001_FEAT0_VMX | CPUID2_EST | + CPUID2_TM2); regs[2] |= CPUID2_X2APIC; /* + * Hide thermal monitoring + */ + regs[3] &= ~(CPUID_ACPI | CPUID_TM); + + /* * Machine check handling is done in the host. * Hide MTRR capability. */ @@ -89,6 +95,17 @@ x86_emulate_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) break; + case CPUID_0000_0006: + /* + * Handle the access, but report 0 for + * all options + */ + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + break; + case CPUID_0000_000B: /* * XXXSMP fixme diff --git a/sys/amd64/vmm/x86.h b/sys/amd64/vmm/x86.h index bc4f8a4..b437d61 100644 --- a/sys/amd64/vmm/x86.h +++ b/sys/amd64/vmm/x86.h @@ -34,6 +34,7 @@ #define CPUID_0000_0002 (0x2) #define CPUID_0000_0003 (0x3) #define CPUID_0000_0004 (0x4) +#define CPUID_0000_0006 (0x6) #define CPUID_0000_000A (0xA) #define CPUID_0000_000B (0xB) #define CPUID_8000_0000 (0x80000000) diff --git a/sys/dev/bvm/bvm_console.c b/sys/dev/bvm/bvm_console.c index ac12b6f..392346e 100644 --- a/sys/dev/bvm/bvm_console.c +++ b/sys/dev/bvm/bvm_console.c @@ -70,6 +70,8 @@ static int alt_break_state; #define BVM_CONS_PORT 0x220 static int bvm_cons_port = BVM_CONS_PORT; +#define BVM_CONS_SIG ('b' << 8 | 'v') + static void bvm_timeout(void *); static cn_probe_t bvm_cnprobe; @@ -171,14 +173,16 @@ bvm_cnprobe(struct consdev *cp) int disabled, port; disabled = 0; + cp->cn_pri = CN_DEAD; + resource_int_value("bvmconsole", 0, "disabled", &disabled); - if (disabled) - cp->cn_pri = CN_DEAD; - else - cp->cn_pri = CN_NORMAL; + if (!disabled) { + if (resource_int_value("bvmconsole", 0, "port", &port) == 0) + bvm_cons_port = port; - if (resource_int_value("bvmconsole", 0, "port", &port) == 0) - bvm_cons_port = port; + if (inw(bvm_cons_port) == BVM_CONS_SIG) + cp->cn_pri = CN_REMOTE; + } } static void |