#
c76c2a19 |
| 18-Feb-2025 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Consolidate code which manages guest memory regions
On all three platforms supported by vmm, we have mostly duplicated code to manage guest physical memory regions. Deduplicate much of this co
vmm: Consolidate code which manages guest memory regions
On all three platforms supported by vmm, we have mostly duplicated code to manage guest physical memory regions. Deduplicate much of this code and move it into sys/dev/vmm/vmm_mem.c.
To avoid exporting struct vm outside of machdep vmm.c, add a new struct vm_mem to contain the memory segment descriptors, and add a vm_mem() accessor, akin to vm_vmspace(). This way vmm_mem.c can implement its routines without needing to see the layout of struct vm.
The handling of the per-VM vmspace is also duplicated but will be moved to vmm_mem.c in a follow-up patch.
On amd64, move the ppt_is_mmio() check out of vm_mem_allocated() to keep the code MI, as PPT is only implemented on amd64. There are only a couple of callers, so this is not unreasonable.
No functional change intended.
Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D48270
show more ...
|
#
fbacadf1 |
| 14-Feb-2025 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Add vmm_fence.c to SRCS for vmm.ko on riscv
Fixes: 8f6b66a9d3f2 ("riscv vmm: implement SBI RFNC extension.")
|
Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3 |
|
#
c6170b00 |
| 24-Jan-2025 |
Andrew Turner <andrew@FreeBSD.org> |
vmm: Depend on vmm_hyp* files as needed
The arm64 vmm_nvhe* files depend on a vmm_hyp file to provide most of the implementation. As these are built with custom rules the normal generated dependency
vmm: Depend on vmm_hyp* files as needed
The arm64 vmm_nvhe* files depend on a vmm_hyp file to provide most of the implementation. As these are built with custom rules the normal generated dependency information is not used, even if generated.
Add a dependency between these two sets of files to ensure when the implementation is updated the file will be rebuilt.
Sponsored by: Arm Ltd
show more ...
|
#
9be0058e |
| 02-Jan-2025 |
Ruslan Bukin <br@FreeBSD.org> |
riscv vmm: virtual timer support.
Add a virtual timer implementation based on SBI Time extension. This is needed for Eswin EIC7700 SoC which does not include the newer SSTC extension.
Timer interru
riscv vmm: virtual timer support.
Add a virtual timer implementation based on SBI Time extension. This is needed for Eswin EIC7700 SoC which does not include the newer SSTC extension.
Timer interrupt pending bit (STIP) could not be cleared in the guest system, so rework interrupts handling: add new "interrupts_pending" field. Use it for timer interrupt only for now, but later we can extend to store all pending interrupts (Timer, IPI and External).
With this I'm able to boot FreeBSD (SMP) guest on HiFive Premier P550, which is the first real hardware with RISC-V 'H'-spec included.
Differential Revision: https://reviews.freebsd.org/D48133
show more ...
|
Revision tags: release/14.2.0 |
|
#
0a897e67 |
| 13-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
riscv: Add support for building vmm as a kernel module
- Update sys/modules/vmm/Makefile. - Add some required symbol definitions. - Hook up vmm in sys/modules/Makefile.
Reviewed by: br Differential
riscv: Add support for building vmm as a kernel module
- Update sys/modules/vmm/Makefile. - Add some required symbol definitions. - Hook up vmm in sys/modules/Makefile.
Reviewed by: br Differential Revision: https://reviews.freebsd.org/D47477
show more ...
|
#
f95acbd8 |
| 04-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Rename the amdiommu driver to amdviiommu
To avoid a conflict with the new amdiommu driver imported recently.
Fixes: 0f5116d7efe3 ("AMD IOMMU driver") Reviewed by: kib Differential Revision: h
vmm: Rename the amdiommu driver to amdviiommu
To avoid a conflict with the new amdiommu driver imported recently.
Fixes: 0f5116d7efe3 ("AMD IOMMU driver") Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D47415
show more ...
|
Revision tags: release/13.4.0 |
|
#
b9ef152b |
| 26-Aug-2024 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Merge vmm_dev.c
This file contains the vmm device file implementation. Most of this code is not machine-dependent and so shouldn't be duplicated this way. Move most of it into a generic dev/vm
vmm: Merge vmm_dev.c
This file contains the vmm device file implementation. Most of this code is not machine-dependent and so shouldn't be duplicated this way. Move most of it into a generic dev/vmm/vmm_dev.c. This will make it easier to introduce a cdev-based interface for VM creation, which in turn makes it possible to implement support for running bhyve as an unprivileged user.
Machine-dependent ioctls continue to be handled in machine-dependent code. To make the split a bit easier to handle, introduce a pair of tables which define MI and MD ioctls. Each table entry can set flags which determine which locks need to be held in order to execute the handler. vmmdev_ioctl() now looks up the ioctl in one of the tables, acquires locks and either handles the ioctl directly or calls vmmdev_machdep_ioctl() to handle it.
No functional change intended. There is a lot of churn in this change but the underlying logic in the ioctl handlers is the same. For now, vmm_dev.h is still mostly separate, even though some parts could be merged in principle. This would involve changing include paths for userspace, though.
Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D46431
show more ...
|
#
93e81baa |
| 26-Aug-2024 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Move duplicated stats code into a generic file
There is a small difference between the arm64 and amd64 implementations: the latter makes use of a "scope" to exclude AMD-specific stats on Intel
vmm: Move duplicated stats code into a generic file
There is a small difference between the arm64 and amd64 implementations: the latter makes use of a "scope" to exclude AMD-specific stats on Intel systems and vice-versa. Replace this with a more generic predicate callback which can be used for the same purpose.
No functional change intended.
Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D46430
show more ...
|
#
bbe97db3 |
| 19-Aug-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64/vmm: Add the VHE exception and switcher files
These just need to include the common code with macros to ensure it is built correctly.
Sponsored by: Arm Ltd Differential Revision: https://revi
arm64/vmm: Add the VHE exception and switcher files
These just need to include the common code with macros to ensure it is built correctly.
Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46083
show more ...
|
#
55aa3148 |
| 19-Aug-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64/vmm: Create functions to call into EL2
These will become ifuncs to enable VHE in a later change.
Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46075
|
#
3d61bcf1 |
| 19-Aug-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64/vmm: Start to extract code not needed by VHE
We can share some of the vmm code between VHE and non-VHE modes. To support this create new files that include the common code and create macros to
arm64/vmm: Start to extract code not needed by VHE
We can share some of the vmm code between VHE and non-VHE modes. To support this create new files that include the common code and create macros to name what will be the common functions.
Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46072
show more ...
|
#
12a6257a |
| 19-Aug-2024 |
Andrew Turner <andrew@FreeBSD.org> |
sys/conf: Introduce NOSAN_CFLAGS and NOSAN_C
To simplify disabling the kernel sanitizers in some files add NOSAN_CFLAGS and NOSAN_C variables. These are CFLAGS and NORMAL_C with the sanitizer flags
sys/conf: Introduce NOSAN_CFLAGS and NOSAN_C
To simplify disabling the kernel sanitizers in some files add NOSAN_CFLAGS and NOSAN_C variables. These are CFLAGS and NORMAL_C with the sanitizer flags removed.
While here add MSAN_CFLAGS to simplify keeping KMSAN in kern_kcov.c
Reviewed by: khng, brooks, imp, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45498
show more ...
|
#
f21a6a6a |
| 01-Aug-2024 |
Warner Losh <imp@FreeBSD.org> |
vmm: Build with proper ldscript on aarch64
A new instance of using ld with -T to bring in the kernel ld script crept into the tree after I originally did the refactoring. It too needs -L ${SYSDIR}/c
vmm: Build with proper ldscript on aarch64
A new instance of using ld with -T to bring in the kernel ld script crept into the tree after I originally did the refactoring. It too needs -L ${SYSDIR}/conf added.
Fixes: 37d6d682af59 Sponsored by: Netflix
show more ...
|
#
e9ac4169 |
| 15-Jul-2024 |
Warner Losh <imp@FreeBSD.org> |
Remove residual blank line at start of Makefile
This is a residual of the $FreeBSD$ removal.
MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
|
#
7cd91315 |
| 14-Jul-2024 |
Mark Johnston <markj@FreeBSD.org> |
vmm: Conditionalize addition of opt_*.h headers
These are only included in the amd64 vmm code, so it doesn't make sense to list them unconditionally.
PR: 280171 Reviewed by: wosch, imp, emaste Dif
vmm: Conditionalize addition of opt_*.h headers
These are only included in the amd64 vmm code, so it doesn't make sense to list them unconditionally.
PR: 280171 Reviewed by: wosch, imp, emaste Differential Revision: https://reviews.freebsd.org/D45964
show more ...
|
#
63f7a383 |
| 10-Jun-2024 |
Andrew Turner <andrew@FreeBSD.org> |
vmm: Only link the arm64 hyp code in vmm.ko once
This code runs at EL2 while the kernel runs at EL1. We build these files for EL2 through a dependency in vmm_hyp_blob.elf.full so there is no need to
vmm: Only link the arm64 hyp code in vmm.ko once
This code runs at EL2 while the kernel runs at EL1. We build these files for EL2 through a dependency in vmm_hyp_blob.elf.full so there is no need to include them in SRCS.
Reviewed by: imp, kib, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45467
show more ...
|
#
c2e0d56f |
| 04-Jun-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Support BTI checking in most of the kernel
LLD has the -zbti-report=error argument to check if the BTI note is present when linking. To allow for this to be used when linking the kernel and m
arm64: Support BTI checking in most of the kernel
LLD has the -zbti-report=error argument to check if the BTI note is present when linking. To allow for this to be used when linking the kernel and modules: - Add the BTI note to the remaining assembly files - Mark ptrauth.c as protected by BTI - Disable -zbti-report for vmm hypervisor switching code as it's not used there.
The linux64 module doesn't build with the flag as it includes vdso code that doesn't include the note.
Reviewed by: imp, kib, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45466
show more ...
|
Revision tags: release/14.1.0 |
|
#
52f3d650 |
| 10-Apr-2024 |
Mark Johnston <markj@FreeBSD.org> |
arm64/vmm: Define a dummy _start symbol in vmm_hyp_blob.elf
To silence a linker warning about _start being missing. This blob contains code executed at EL2 and is only meant to be entered via excep
arm64/vmm: Define a dummy _start symbol in vmm_hyp_blob.elf
To silence a linker warning about _start being missing. This blob contains code executed at EL2 and is only meant to be entered via exception handlers.
Reviewed by: bz, emaste Fixes: 47e073941f4e ("Import the kernel parts of bhyve/arm64") Differential Revision: https://reviews.freebsd.org/D44735
show more ...
|
#
26173a91 |
| 22-Mar-2024 |
Mark Johnston <markj@FreeBSD.org> |
arm64/vmm: Exclude more sanitizer compiler flags from certain files
Reported by: rscheff Fixes: 47e073941f4e ("Import the kernel parts of bhyve/arm64")
|
#
7b133b34 |
| 12-Mar-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
vmm: fix standalone module build
|
Revision tags: release/13.3.0 |
|
#
47e07394 |
| 09-Jan-2024 |
Andrew Turner <andrew@FreeBSD.org> |
Import the kernel parts of bhyve/arm64
To support virtual machines on arm64 add the vmm code. This is based on earlier work by Mihai Carabas and Alexandru Elisei at University Politehnica of Buchare
Import the kernel parts of bhyve/arm64
To support virtual machines on arm64 add the vmm code. This is based on earlier work by Mihai Carabas and Alexandru Elisei at University Politehnica of Bucharest, with further work by myself and Mark Johnston.
All AArch64 CPUs should work, however only the GICv3 interrupt controller is supported. There is initial support to allow the GICv2 to be supported in the future. Only pure Armv8.0 virtualisation is supported, the Virtualization Host Extensions are not currently used.
With a separate userspace patch and U-Boot port FreeBSD guests are able to boot to multiuser mode, and the hypervisor can be tested with the kvm unit tests. Linux partially boots, but hangs before entering userspace. Other operating systems are untested.
Sponsored by: Arm Ltd Sponsored by: Innovate UK Sponsored by: The FreeBSD Foundation Sponsored by: University Politehnica of Bucharest Differential Revision: https://reviews.freebsd.org/D37428
show more ...
|
Revision tags: release/14.0.0 |
|
#
8e1a7e29 |
| 10-Oct-2023 |
Mark Johnston <markj@FreeBSD.org> |
sanitizers: Avoid building genassym.c and genoffset.c with sanitizers
Some, particularly KASAN, may insert redzones around global symbols, resulting in incorrect offset definitions because genassym.
sanitizers: Avoid building genassym.c and genoffset.c with sanitizers
Some, particularly KASAN, may insert redzones around global symbols, resulting in incorrect offset definitions because genassym.sh (ab)uses symbol sizes to assign semantic meaning.
(Ideally I would be able to define this pattern in one place, but I haven't found a way to define a GENSYM_CFLAGS that actually works for all of the consumers (kern.post.mk, kmod.mk, sys/conf/files*).)
MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc.
show more ...
|
#
c6ae97c4 |
| 27-Dec-2023 |
Alex Xu (Hello71) <alex_y_xu@yahoo.ca> |
sys: ${CFLAGS:N-flto} -> ${CFLAGS:N-flto*}
For the same reason as the original https://reviews.freebsd.org/D9659: -flto=<N>, -flto=full, and -flto=thin also produce the GIMPLE/bitcode which is not s
sys: ${CFLAGS:N-flto} -> ${CFLAGS:N-flto*}
For the same reason as the original https://reviews.freebsd.org/D9659: -flto=<N>, -flto=full, and -flto=thin also produce the GIMPLE/bitcode which is not supported by genassym, so filter those out as well.
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/898
show more ...
|
#
031beb4e |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
Revision tags: release/13.2.0 |
|
#
c3dd45c4 |
| 01-Mar-2023 |
John Baldwin <jhb@FreeBSD.org> |
sys/modules: Make use of SRCS.${KERN_OPT}.
kmod.mk appends the value of SRCS.${KERN_OPT} for each defined kernel option to SRCS. This helper is shorter than appending to SRCS under explicit checks
sys/modules: Make use of SRCS.${KERN_OPT}.
kmod.mk appends the value of SRCS.${KERN_OPT} for each defined kernel option to SRCS. This helper is shorter than appending to SRCS under explicit checks on KERN_OPTS.
Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D38738
show more ...
|