aboutsummaryrefslogtreecommitdiff
path: root/sys/modules/vmm/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 031beb4e239b)
* AMD-vi: Fix IOMMU device interrupts being overriddenKa Ho Ng2021-04-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AMD-vi PCI-e passthrough will lead to the following lines in dmesg: "kernel: CPU0: local APIC error 0x40 ivhd0: Error: completion failed tail:0x720, head:0x0." After some tracing, the problem is due to the interaction with amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the identification of AMD-vi IVHD is done by walking over the ACPI IVRS table and ivhdX device_ts are added under the acpi bus, while there are no driver handling the corresponding IOMMU PCI function. In amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is called on ivhdX. the IOMMU pci function device_t is only used for pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci function, the IOMMU PCI function device_t's dinfo->cfg.msi is never updated to reflect the supposed msi_data and msi_addr. So the msi_data and msi_addr stay in the value 0. When pci_driver_added() tried to loop over the children of a pci bus, and do pci_cfg_restore() on each of them, msi_addr and msi_data with value 0 will be written to the MSI capability of the IOMMU pci function, thus explaining the errors in dmesg. This change includes an amdiommu driver which currently does attaching, detaching and providing DEVMETHODs for setting up and tearing down interrupt. The purpose of the driver is to prevent pci_driver_added() from calling pci_cfg_restore() on the IOMMU PCI function device_t. The introduction of the amdiommu driver handles allocation of an IRQ resource within the IOMMU PCI function, so that the dinfo->cfg.msi is populated. This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU. Sponsored by: The FreeBSD Foundation Reviewed by: jhb Approved by: philip (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28984 (cherry picked from commit 74ada297e8978b8efda3dffdd1bb24aee7c5faa4)
* Initial support for bhyve save and restore.John Baldwin2020-05-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save and restore (also known as suspend and resume) permits a snapshot to be taken of a guest's state that can later be resumed. In the current implementation, bhyve(8) creates a UNIX domain socket that is used by bhyvectl(8) to send a request to save a snapshot (and optionally exit after the snapshot has been taken). A snapshot currently consists of two files: the first holds a copy of guest RAM, and the second file holds other guest state such as vCPU register values and device model state. To resume a guest, bhyve(8) must be started with a matching pair of command line arguments to instantiate the same set of device models as well as a pointer to the saved snapshot. While the current implementation is useful for several uses cases, it has a few limitations. The file format for saving the guest state is tied to the ABI of internal bhyve structures and is not self-describing (in that it does not communicate the set of device models present in the system). In addition, the state saved for some device models closely matches the internal data structures which might prove a challenge for compatibility of snapshot files across a range of bhyve versions. The file format also does not currently support versioning of individual chunks of state. As a result, the current file format is not a fixed binary format and future revisions to save and restore will break binary compatiblity of snapshot files. The goal is to move to a more flexible format that adds versioning, etc. and at that point to commit to providing a reasonable level of compatibility. As a result, the current implementation is not enabled by default. It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option for userland builds, and the kernel option BHYVE_SHAPSHOT. Submitted by: Mihai Tiganus, Flavius Anton, Darius Mihai Submitted by: Elena Mihailescu, Mihai Carabas, Sergiu Weisz Relnotes: yes Sponsored by: University Politehnica of Bucharest Sponsored by: Matthew Grooms (student scholarships) Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D19495 Notes: svn path=/head/; revision=360648
* More fixes to build the kernel with a compiler that defaults to -fno-commonAlex Richardson2020-04-181-2/+2
| | | | | | | | | Using the same approach as the last commit for the files used by genassym.sh. Obtained from: CheriBSD Notes: svn path=/head/; revision=360072
* Remove more manual additions of -DSMP.Mark Johnston2020-02-061-1/+1
| | | | | | | Since r357598 this should no longer be necessary. Notes: svn path=/head/; revision=357642
* All genassym.sh usage need offset.incBryan Drewery2018-07-031-3/+3
| | | | Notes: svn path=/head/; revision=335910
* Fix cyclic dependency after r326552.Bryan Drewery2017-12-051-2/+5
| | | | | | | | | | | | | | | | | | The OBJS_DEPEND_GUESS mechanism was making vmx_genassym.o depend on all headers along with vmx_assym.h, though vmx_assym.h depends on having vmx_genassym.o present to generate. Moving the headers to DPSRCS is enough to resolve the issue as they will no longer be implicit dependencies for all objects. Because of this we need explicit OBJS_DEPEND_GUESS entries to ensure the headers are generated when needed for the *_support.o files that need them. X-MFC-With: r326552 MFC after: 2 weeks Sponsored by: Dell EMC Notes: svn path=/head/; revision=326569
* Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to ↵Anish Gupta2017-04-301-2/+3
| | | | | | | | | | | | VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1. Reviewed by:bcr Approved by:grehan Tested by:rgrimes Differential Revision:https://reviews.freebsd.org/D10049 Notes: svn path=/head/; revision=317600
* sys/modules: normalize .CURDIR-relative paths to SRCTOPEnji Cooper2017-03-041-8/+8
| | | | | | | | | | | This simplifies make output/logic Tested with: `cd sys/modules; make ALL_MODULES=` on amd64 MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314651
* Exclude -flto when building *genassym.oEd Maste2017-02-211-2/+2
| | | | | | | | | | | | | | | | | The build process generates *assym.h using nm from *genassym.o (which is in turn created from *genassym.c). When compiling with link-time optimization (LTO) using -flto, .o files are LLVM bitcode, not ELF objects. This is not usable by genassym.sh, so remove -flto from those ${CC} invocations. Submitted by: George Rimar Reviewed by: dim MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9659 Notes: svn path=/head/; revision=314054
* Use lapic_ipi_alloc() to dynamically allocate IPI slots needed by bhyve whenNeel Natu2015-03-141-3/+1
| | | | | | | | | | | vmm.ko is loaded. Also relocate the 'justreturn' IPI handler to be alongside all other handlers. Requested by: kib Notes: svn path=/head/; revision=279971
* Replace bhyve's minimal RTC emulation with a fully featured one in vmm.ko.Neel Natu2014-12-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The new RTC emulation supports all interrupt modes: periodic, update ended and alarm. It is also capable of maintaining the date/time and NVRAM contents across virtual machine reset. Also, the date/time fields can now be modified by the guest. Since bhyve now emulates both the PIT and the RTC there is no need for "Legacy Replacement Routing" in the HPET so get rid of it. The RTC device state can be inspected via bhyvectl as follows: bhyvectl --vm=vm --get-rtc-time bhyvectl --vm=vm --set-rtc-time=<unix_time_secs> bhyvectl --vm=vm --rtc-nvram-offset=<offset> --get-rtc-nvram bhyvectl --vm=vm --rtc-nvram-offset=<offset> --set-rtc-nvram=<value> Reviewed by: tychon Discussed with: grehan Differential Revision: https://reviews.freebsd.org/D1385 MFC after: 2 weeks Notes: svn path=/head/; revision=276428
* Retire the '@' symlink. It isn't really needed and causes moreWarner Losh2014-11-061-8/+2
| | | | | | | | | | | | problems than it solves. SYSDIR is already defined almost always and can be used instead. Working around the one case where it isn't is much easier than working around the fact that @ may not exist in 18 other places. Differential Revision: https://reviews.freebsd.org/D1100 Notes: svn path=/head/; revision=274184
* Add foo_genassym.c files to DPSRCS so dependencies for them are generated.John Baldwin2014-10-271-1/+2
| | | | | | | | This ensures these objects are rebuilt to generate an updated header of assembly constants if needed. Notes: svn path=/head/; revision=273744
* Move the ACPI PM timer emulation into vmm.ko.Neel Natu2014-10-261-1/+2
| | | | | | | | | | | | This reduces variability during timer calibration by keeping the emulation "close" to the guest. Additionally having all timer emulations in the kernel will ease the transition to a per-VM clock source (as opposed to using the host's uptime keep track of time). Discussed with: grehan Notes: svn path=/head/; revision=273683
* IFC @r273214Neel Natu2014-10-201-11/+13
|\ | | | | | | Notes: svn path=/projects/bhyve_svm/; revision=273299
| * Fix build to not bogusly always rebuild vmm.ko.Warner Losh2014-10-171-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename vmx_assym.s to vmx_assym.h to reflect that file's actual use and update vmx_support.S's include to match. Add vmx_assym.h to the SRCS to that it gets properly added to the dependency list. Add vmx_support.S to SRCS as well, so it gets built and needs fewer special-case goo. Remove now-redundant special-case goo. Finally, vmx_genassym.o doesn't need to depend on a hand expanded ${_ILINKS} explicitly, that's all taken care of by beforedepend. With these items fixed, we no longer build vmm.ko every single time through the modules on a KERNFAST build. Sponsored by: Netflix Notes: svn path=/head/; revision=273214
* | IFC r271888.Neel Natu2014-09-201-2/+2
|\| | | | | | | | | | | | | Restructure MSR emulation so it is all done in processor-specific code. Notes: svn path=/projects/bhyve_svm/; revision=271912
| * Restructure the MSR handling so it is entirely handled by processor-specificNeel Natu2014-09-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code. There are only a handful of MSRs common between the two so there isn't too much duplicate functionality. The VT-x code has the following types of MSRs: - MSRs that are unconditionally saved/restored on every guest/host context switch (e.g., MSR_GSBASE). - MSRs that are restored to guest values on entry to vmx_run() and saved before returning. This is an optimization for MSRs that are not used in host kernel context (e.g., MSR_KGSBASE). - MSRs that are emulated and every access by the guest causes a trap into the hypervisor (e.g., MSR_IA32_MISC_ENABLE). Reviewed by: grehan Notes: svn path=/head/; revision=271888
* | MFC @ r266724Peter Grehan2014-06-031-0/+3
|\| | | | | | | | | | | | | An SVM update will follow this. Notes: svn path=/projects/bhyve_svm/; revision=266996
| * Move the atpit device model from userspace into vmm.ko for betterTycho Nightingale2014-03-251-0/+1
| | | | | | | | | | | | | | | | | | precision and lower latency. Approved by: grehan (co-mentor) Notes: svn path=/head/; revision=263744
| * Replace the userspace atpic stub with a more functional vmm.ko model.Tycho Nightingale2014-03-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=263035
* | MFC @ r259205 in preparation for some SVM updates. (for real this time)Peter Grehan2014-02-041-1/+2
|\| | | | | | | Notes: svn path=/projects/bhyve_svm/; revision=261461
| * Add HPET device emulation to bhyve.Neel Natu2013-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bhyve supports a single timer block with 8 timers. The timers are all 32-bit and capable of being operated in periodic mode. All timers support interrupt delivery using MSI. Timers 0 and 1 also support legacy interrupt routing. At the moment the timers are not connected to any ioapic pins but that will be addressed in a subsequent commit. This change is based on a patch from Tycho Nightingale (tycho.nightingale@pluribusnetworks.com). Notes: svn path=/head/; revision=258579
| * Move the ioapic device model from userspace into vmm.ko. This is needed forNeel Natu2013-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | upcoming in-kernel device emulations like the HPET. The ioctls VM_IOAPIC_ASSERT_IRQ and VM_IOAPIC_DEASSERT_IRQ are used to manipulate the ioapic pin state. Discussed with: grehan@ Submitted by: Tycho Nightingale (tycho.nightingale@pluribusnetworks.com) Notes: svn path=/head/; revision=258075
| * Remove the 'vdev' abstraction that was meant to sit on top of device modelsNeel Natu2013-11-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | in the kernel. This abstraction was redundant because the only device emulated inside vmm.ko is the local apic and it is always at a fixed guest physical address. Discussed with: grehan Notes: svn path=/head/; revision=257661
* | IFC @ r255692Peter Grehan2013-09-201-3/+3
|\| | | | | | | | | | | | | | | Comment out IA32_MISC_ENABLE MSR access - this doesn't exist on AMD. Need to sort out how arch-specific MSRs will be handled. Notes: svn path=/projects/bhyve_svm/; revision=255720
| * Fix 'make depend'.Ulrich Spörlein2013-08-211-3/+3
| | | | | | | | Notes: svn path=/head/; revision=254596
* | Add in last remaining files to get AMD-SVM operational.Peter Grehan2013-08-231-4/+20
|/ | | | | | | Submitted by: Anish Gupta (akgupt3@gmail.com) Notes: svn path=/projects/bhyve_svm/; revision=254677
* Corral all the host state associated with the virtual machine into its own file.Neel Natu2012-10-291-0/+1
| | | | | | | | | | This state is independent of the type of hardware assist used so there is really no need for it to be in Intel-specific code. Obtained from: NetApp Notes: svn path=/projects/bhyve/; revision=242275
* Add support for trapping MMIO writes to local apic registers and emulating them.Neel Natu2012-09-251-0/+1
| | | | | | | | The default behavior is still to present the local apic to the guest in the x2apic mode. Notes: svn path=/projects/bhyve/; revision=240941
* BHyVe's vmm.ko can now be built with the in-tree binutils.Peter Grehan2012-07-111-5/+0
| | | | | | | Many thanks to jhb@ for making this happen. Notes: svn path=/projects/bhyve/; revision=238380
* Missed this in the previous commit to add 'show vmcs': add opt_ddb.h asJohn Baldwin2011-06-021-1/+1
| | | | | | | a source file. Notes: svn path=/projects/bhyve/; revision=222606
* Remove misleading macro definition (-DOLD_BINUTILS) from CFLAGS.Neel Natu2011-05-171-1/+0
| | | | | | | | | | At this point we require binutils from ports that understands how to assemble the VT-x instructions. Discussed with: grehan@ Notes: svn path=/projects/bhyve/; revision=222024
* First cut at porting the kernel portions of 221828 and 221905 from theJohn Baldwin2011-05-141-2/+2
| | | | | | | BHyVe reference branch to HEAD. Notes: svn path=/projects/bhyve/; revision=221914
* Import of bhyve hypervisor and utilities, part 1.Peter Grehan2011-05-131-0/+66
vmm.ko - kernel module for VT-x, VT-d and hypervisor control bhyve - user-space sequencer and i/o emulation vmmctl - dump of hypervisor register state libvmm - front-end to vmm.ko chardev interface bhyve was designed and implemented by Neel Natu. Thanks to the following folk from NetApp who helped to make this available: Joe CaraDonna Peter Snyder Jeff Heller Sandeep Mann Steve Miller Brian Pawlowski Notes: svn path=/projects/bhyve_ref/; revision=221828