summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve
Commit message (Collapse)AuthorAgeFilesLines
* Disable the 'uart_drain()' callback when the emulated receive FIFO is full.neel2014-05-051-47/+82
| | | | | | | | | | | Failing to do this will cause the kevent(2) notification to trigger continuously and the bhyve(8) mevent thread will hog the cpu until the characters on the backend tty device are drained. Also, make the uart backend file descriptor non-blocking to avoid a select(2) before every byte read from that backend. Reviewed by: grehan
* Modify the "-p" option to be more flexible when associating a 'vcpu' withneel2014-05-052-17/+50
| | | | | | | | | | a 'hostcpu'. The new format of the argument string is "vcpu:hostcpu". This allows pinning a subset of the vcpus if desired. It also allows pinning a vcpu to more than a single 'hostcpu'. Submitted by: novel (initial version)
* Remove misleading "addcpu" in an error message emitted by fbsdrun_deletecpu().neel2014-05-051-2/+1
| | | | Pointed out by: novel
* Re-adding an event to a kqueue modifies the parameters of the original event.neel2014-05-051-7/+12
| | | | | | | | | | | | However, if the original knote had been disabled then it is not automatically re-enabled. Fix this by using EV_ADD to create an mevent and EV_ENABLE to enable it. Adding a kevent for the first time implicitly enables it so existing callers of mevent_add() don't need to change. Reviewed by: grehan
* Don't allow MPtable generation if there are multiple PCI hierarchies. This isneel2014-05-025-5/+39
| | | | | | | | | | | because there isn't a standard way to relay this information to the guest OS. Add a command line option "-Y" to bhyve(8) to inhibit MPtable generation. If the virtual machine is using PCI devices on buses other than 0 then it can still use ACPI tables to convey this information to the guest. Discussed with: grehan@
* Add logic in the HLT exit handler to detect if the guest has put all vcpusneel2014-05-021-3/+9
| | | | | | | | | | | | to sleep permanently by executing a HLT with interrupts disabled. When this condition is detected the guest with be suspended with a reason of VM_SUSPEND_HALT and the bhyve(8) process will exit. Tested by executing "halt" inside a RHEL7-beta guest. Discussed with: grehan@ Reviewed by: jhb@, tychon@
* Ignore writes to microcode update MSR. This MSR is accessed by RHEL7 guest.neel2014-04-301-0/+2
| | | | Add KTR tracepoints to annotate wrmsr and rdmsr VM exits.
* Some Linux guests will implement a 'halt' by disabling the APIC and executingneel2014-04-291-19/+3
| | | | | | | | | | | | | | | | | | the 'HLT' instruction. This condition was detected by 'vm_handle_hlt()' and converted into the SPINDOWN_CPU exitcode . The bhyve(8) process would exit the vcpu thread in response to a SPINDOWN_CPU and when the last vcpu was spun down it would reset the virtual machine via vm_suspend(VM_SUSPEND_RESET). This functionality was broken in r263780 in a way that made it impossible to kill the bhyve(8) process because it would loop forever in vm_handle_suspend(). Unbreak this by removing the code to spindown vcpus. Thus a 'halt' from a Linux guest will appear to be hung but this is consistent with the behavior on bare metal. The guest can be rebooted by using the bhyvectl options '--force-reset' or '--force-poweroff'. Reviewed by: grehan@
* Allow a virtual machine to be forcibly reset or powered off. This is doneneel2014-04-281-9/+19
| | | | | | | | | | | | | by adding an argument to the VM_SUSPEND ioctl that specifies how the virtual machine should be suspended, viz. VM_SUSPEND_RESET or VM_SUSPEND_POWEROFF. The disposition of VM_SUSPEND is also made available to the exit handler via the 'u.suspended' member of 'struct vm_exit'. This capability is exposed via the '--force-reset' and '--force-poweroff' arguments to /usr/sbin/bhyvectl. Discussed with: grehan@
* Implement legacy interrupts for the AHCI device emulationgrehan2014-04-281-2/+34
| | | | | | | | | | according to the method outlined in the AHCI spec. Tested with FreeBSD 9/10/11 with MSI disabled, and also NetBSD/amd64 (lightly). Reviewed by: neel, tychon MFC after: 3 weeks
* Respect and track the enable bit in the PCI configuration address word.grehan2014-04-251-5/+9
| | | | | | | | | | Ignore writes, and return 0xff's, on config accesses when not set. Behaviour now matches that seen on h/w. Found with a NetBSD/amd64 guest. Reviewed by: tychon MFC after: 3 weeks
* Provide a very basic stub for the 8042 PS/2 keyboard controller.tychon2014-04-253-4/+86
| | | | | Reviewed by: jhb Approved by: neel (co-mentor)
* Use calloc() in favor of malloc + memset.delphij2014-04-229-24/+12
| | | | Reviewed by: neel
* Factor out common ioport handler code for better hygiene -- pointedtychon2014-04-221-22/+12
| | | | | | out by neel@. Approved by: neel (co-mentor)
* Fix ACPI DSDT indentation cosmetic breakage introduced in r264631 --tychon2014-04-181-1/+1
| | | | | | pointed out by jhb@. Approved by: grehan (co-mentor)
* Respect the destination operand size of the 'Input from Port' instruction.tychon2014-04-181-4/+23
| | | | Approved by: grehan (co-mentor)
* Add support for reading the PIT Counter 2 output signal via the NMItychon2014-04-181-0/+18
| | | | | | | | | | | | Status and Control register at port 0x61. Be more conservative about "catching up" callouts that were supposed to fire in the past by skipping an interrupt if it was scheduled too far in the past. Restore the PIT ACPI DSDT entries and add an entry for NMISC too. Approved by: neel (co-mentor)
* Add support for emulating the slave PIC.tychon2014-04-141-2/+2
| | | | | Reviewed by: grehan, jhb Approved by: grehan (co-mentor)
* Constrain the amount of data returned to what is actually availabletychon2014-04-091-3/+5
| | | | | | not the size of the buffer. Approved by: grehan (co-mentor)
* Handle single-byte reads from the bvmcons port (0x220) by returningjhb2014-04-081-0/+9
| | | | | | | | 0xff. Some guests may attempt to read from this port to identify psuedo-PNP ISA devices. (The ie(4) driver in FreeBSD/i386 is one example.) Reviewed by: grehan
* Add support for the virtio RNG entropy-source device.grehan2014-04-024-1/+194
| | | | | | | | | | | | Call through to /dev/random synchronously to fill virtio buffers with RNG data. Tested with FreeBSD-CURRENT and Ubuntu guests. Submitted by: Leon Dang Discussed with: markm MFC after: 3 weeks Sponsored by: Nahanni Systems
* Add an ioctl to suspend a virtual machine (VM_SUSPEND). The ioctl can be calledneel2014-03-261-1/+34
| | | | | | | | | | | | from any context i.e., it is not required to be called from a vcpu thread. The ioctl simply sets a state variable 'vm->suspend' to '1' and returns. The vcpus inspect 'vm->suspend' in the run loop and if it is set to '1' the vcpu breaks out of the loop with a reason of 'VM_EXITCODE_SUSPENDED'. The suspend handler waits until all 'vm->active_cpus' have transitioned to 'vm->suspended_cpus' before returning to userspace. Discussed with: grehan
* Move the atpit device model from userspace into vmm.ko for bettertychon2014-03-253-338/+0
| | | | | | precision and lower latency. Approved by: grehan (co-mentor)
* Use 'cpuset_t' to represent the vcpus active in a virtual machine.neel2014-03-203-20/+16
|
* Don't reissue in-flight commands.tychon2014-03-181-2/+16
| | | | Approved by: neel (co-mentor)
* Though there currently isn't a way to insert new media into an ATAPItychon2014-03-161-0/+18
| | | | | | | drive, at least pretend to support Asynchronous Notification (AN) to avoid a guest needlessly polling for it. Approved by: grehan (co-mentor)
* Support the bootloader's single 16-bit 'outw' access to the Divisortychon2014-03-161-7/+19
| | | | | | Latch MSB and LSB registers. Approved by: neel (co-mentor)
* Replace the userspace atpic stub with a more functional vmm.ko model.tychon2014-03-115-160/+22
| | | | | | | | New ioctls VM_ISA_ASSERT_IRQ, VM_ISA_DEASSERT_IRQ and VM_ISA_PULSE_IRQ can be used to manipulate the pic, and optionally the ioapic, pin state. Reviewed by: jhb, neel Approved by: neel (co-mentor)
* Open the uart emulation's backing tty in non-blocking mode.grehan2014-03-071-1/+1
| | | | | | | | | | | This fixes the issue of bhyve appearing to halt when using nmdm ports for the console, until a connection is made to the other end. bhyveload already does this. Reported by: Many. MFC after: 3 weeks.
* Add SMBIOS support.tychon2014-03-046-11/+890
| | | | | | | A new option, -U, can be used to set the UUID in the System Information (Type 1) structure. Manpage fix to follow. Approved by: grehan (co-mentor)
* Document the "-a" and "-x" options to match the changes in r262236.neel2014-02-261-2/+7
| | | | Reviewed by: grehan
* Queue pending exceptions in the 'struct vcpu' instead of directly updating theneel2014-02-261-4/+10
| | | | | | | | | | | | | | | | | | | | | | | processor-specific VMCS or VMCB. The pending exception will be delivered right before entering the guest. The order of event injection into the guest is: - hardware exception - NMI - maskable interrupt In the Intel VT-x case, a pending NMI or interrupt will enable the interrupt window-exiting and inject it as soon as possible after the hardware exception is injected. Also since interrupts are inherently asynchronous, injecting them after the hardware exception should not affect correctness from the guest perspective. Rename the unused ioctl VM_INJECT_EVENT to VM_INJECT_EXCEPTION and restrict it to only deliver x86 hardware exceptions. This new ioctl is now used to inject a protection fault when the guest accesses an unimplemented MSR. Discussed with: grehan, jhb Reviewed by: jhb
* Fix virtio spec URL.grehan2014-02-211-1/+1
| | | | | Submitted by: lwhsu MFC after: 1 week
* Avoid clobbering the counter mode when issuing a latch command.tychon2014-02-211-2/+3
| | | | Approved by: grehan (co-mentor)
* Simplify APIC mode switching from MMIO to x2APIC. In part this is done toneel2014-02-201-15/+13
| | | | | | | | | | | | | | | | | | | | | simplify the implementation of the x2APIC virtualization assist in VT-x. Prior to this change the vlapic allowed the guest to change its mode from xAPIC to x2APIC. We don't allow that any more and the vlapic mode is locked when the virtual machine is created. This is not very constraining because operating systems already have to deal with BIOS setting up the APIC in x2APIC mode at boot. Fix a bug in the CPUID emulation where the x2APIC capability was leaking from the host to the guest. Ignore MMIO reads and writes to the vlapic in x2APIC mode. Similarly, ignore MSR accesses to the vlapic when it is in xAPIC mode. The default configuration of the vlapic is xAPIC. The "-x" option to bhyve(8) can be used to change the mode to x2APIC instead. Discussed with: grehan@
* Add a check to validate that memory BARs of passthru devices are 4KB aligned.neel2014-02-183-27/+53
| | | | | Also, the MSI-x table offset is not required to be 4KB aligned so take this into account when computing the pages occupied by the MSI-x tables.
* Tweak the handling of PCI capabilities in emulated devices to removejhb2014-02-182-47/+26
| | | | | | | | | | the non-standard zero capability list terminator. Instead, track the start and end of the most recently added capability and use that to adjust the previous capability's next pointer when a capability is added and to determine the range of config registers belonging to PCI capability registers. Reviewed by: neel
* Update bhyve(8) man page to describe the usage of the "-s" option to assignneel2014-02-141-3/+9
| | | | | | | bus numbers to emulated devices. Also add the restriction that the LPC bridge emulation can only be configured on bus 0. Reviewed by: grehan@
* Allow PCI devices to be configured on all valid bus numbers from 0 to 255.neel2014-02-145-107/+270
| | | | | | | | | | | | | | | | | | | | This is done by representing each bus as root PCI device in ACPI. The device implements the _BBN method to return the PCI bus number to the guest OS. Each PCI bus keeps track of the resources that is decodes for devices configured on the bus: i/o, mmio (32-bit) and mmio (64-bit). These windows are advertised to the guest via the _CRS object of the root device. Bus 0 is treated specially since it consumes the I/O ports to access the PCI config space [0xcf8-0xcff]. It also decodes the legacy I/O ports that are consumed by devices on the LPC bus. For this reason the LPC bridge can be configured only on bus 0. The bus number can be specified using the following command line option to bhyve(8): "-s <bus>:<slot>:<func>,<emul>[,<config>]" Discussed with: grehan@ Reviewed by: jhb@
* Provide an indication a "PIO Setup Device to Host FIS" occurred while executingtychon2014-02-121-3/+13
| | | | | | | | | the IDENTIFY DEVICE and IDENTIFY PACKET DEVICE commands. Also, provide an indication a "D2H Register FIS" occurred during a SET FEATURES command. Approved by: grehan (co-mentor)
* Mark the I/O ports used by the bhyve console and debug devices as systemjhb2014-02-072-0/+6
| | | | | | resources. MFC after: 1 week
* Enhance the support for PCI legacy INTx interrupts and enable them injhb2014-01-2912-120/+323
| | | | | | | | | | | | | | | | | | | | | | | | | the virtio backends. - Add a new ioctl to export the count of pins on the I/O APIC from vmm to the hypervisor. - Use pins on the I/O APIC >= 16 for PCI interrupts leaving 0-15 for ISA interrupts. - Populate the MP Table with I/O interrupt entries for any PCI INTx interrupts. - Create a _PRT table under the PCI root bridge in ACPI to route any PCI INTx interrupts appropriately. - Track which INTx interrupts are in use per-slot so that functions that share a slot attempt to distribute their INTx interrupts across the four available pins. - Implicitly mask INTx interrupts if either MSI or MSI-X is enabled and when the INTx DIS bit is set in a function's PCI command register. Either assert or deassert the associated I/O APIC pin when the state of one of those conditions changes. - Add INTx support to the virtio backends. - Always advertise the MSI capability in the virtio backends. Submitted by: neel (7) Reviewed by: neel MFC after: 2 weeks
* Remove support for legacy PCI devices. These haven't been needed sincejhb2014-01-275-55/+10
| | | | | | | support for LPC uart devices was added and it conflicts with upcoming patches to add PCI INTx support. Reviewed by: neel
* Fix issue with stale fields from a recycled request pulled off the freelist.tychon2014-01-221-0/+2
| | | | Approved by: grehan (co-mentor)
* Increase the block-layer backend maximum number of requests to matchtychon2014-01-221-1/+1
| | | | | | | the AHCI command queue depth. This allows a slew of commands issued by a Linux guest to be absorbed without error. Approved by: grehan (co-mentor)
* Fix issue with the virtio descriptor region being truncatedgrehan2014-01-091-1/+1
| | | | | | | | | | if it was above 4GB. This was seen with CentOS 6.5 guests with large RAM, since the block drivers are loaded late in the boot sequence and end up allocating descriptor memory from high addresses. Reported by: Michael Dexter MFC after: 3 days
* virtio-block does not exist, the correct name is virtio-blk.remko2014-01-081-1/+1
| | | | | | | PR: 185573 Submitted by: Allan Jude Facilitated by: Snow B.V. MFC after: 3 days
* Cosmetic change - switch over to vertical SRCS to make itgrehan2014-01-031-5/+31
| | | | | | easier to keep files in alpha order. Reviewed by: neel
* Rework the DSDT generation code a bit to generate more accurate info aboutjhb2014-01-0212-115/+417
| | | | | | | | | | | | | | | | | | | | | | | | | LPC devices. Among other things, the LPC serial ports now appear as ACPI devices. - Move the info for the top-level PCI bus into the PCI emulation code and add ResourceProducer entries for the memory ranges decoded by the bus for memory BARs. - Add a framework to allow each PCI emulation driver to optionally write an entry into the DSDT under the \_SB_.PCI0 namespace. The LPC driver uses this to write a node for the LPC bus (\_SB_.PCI0.ISA). - Add a linker set to allow any LPC devices to write entries into the DSDT below the LPC node. - Move the existing DSDT block for the RTC to the RTC driver. - Add DSDT nodes for the AT PIC, the 8254 ISA timer, and the LPC UART devices. - Add a "SuperIO" device under the LPC node to claim "system resources" aling with a linker set to allow various drivers to add IO or memory ranges that should be claimed as a system resource. - Add system resource entries for the extended RTC IO range, the registers used for ACPI power management, the ELCR, PCI interrupt routing register, and post data register. - Add various helper routines for generating DSDT entries. Reviewed by: neel (earlier version)
* Restructure the VMX code to enter and exit the guest. In large part this changeneel2014-01-011-1/+3
| | | | | | | | | | | | | hides the setjmp/longjmp semantics of VM enter/exit. vmx_enter_guest() is used to enter guest context and vmx_exit_guest() is used to transition back into host context. Fix a longstanding race where a vcpu interrupt notification might be ignored if it happens after vmx_inject_interrupts() but before host interrupts are disabled in vmx_resume/vmx_launch. We now called vmx_inject_interrupts() with host interrupts disabled to prevent this. Suggested by: grehan@
OpenPOWER on IntegriCloud