For some years it worked,but now,maybe due to the recent changes added on the FreeBSD 13 and 14 code,it does not work anymore : I'm talking about the ability to passthru one Nvidia GpU from the host os (FreeBSD 14.0 in this case) to any Linux vm. The same procedure that worked until "yesterday" it does not work anymore (for me).
The developer does not reply to my message anymore. I would like to be sure that is true that it is bugged,as it seems,and not that I'm making some mistake. So,I will explain what I do to enable this functionality. I hope that someone wants to also try or that he tries a different procedure that works. The most important thing is that we will be able to enable the function.
So,time ago the developer gave me 3 scripts to run in sequence. They are the following :
a) setup_git_140.sh
git clone https://github.com/beckhoff/freebsd-src /usr/corvin-src-140 b) build_branch_140.sh
#!/bin/sh usage() { cat >&2 << EOF Usage: ${0} <branch> [<build_options>] Checkouts to <branch> and builds it with <build_options> (see build.sh for more information). EOF exit 1 } set -e set -u readonly script_path="$(cd "$(dirname "${0}")" && pwd)" readonly branch="${1?Missing <branch>$(usage)}" shift echo $branch cd /usr/corvin-src-140 git fetch --all --prune git checkout -f "${branch}" ${script_path}/build_140.sh "$@" c) build_build_140.sh
#!/bin/sh usage() { cat >&2 << EOF Usage: ${0} [--no-bhf] [--reboot] [--verbose] [--without- kernel] Builds bhyve EOF exit 1 } build_module() { local _path _path="${1}" # change to module path cd "${_path}" # clean module if test "${clean}" = "true"; then make clean > "${cmd_redirect}" 2>&1 fi # build module make > "${cmd_redirect}" 2>&1 # install module make install > "${cmd_redirect}" } build() { build_module "${src_dir}/include" build_module "${src_dir}/lib/libvmmapi" build_module "${src_dir}/sys/modules/vmm" # build kernel if test "${with_kernel}" = "true"; then cd "${src_dir}" local kern_opts kern_opts="-j$(sysctl -n hw.ncpu)" if test "${with_bhf}" = "true"; then kern_opts="${kern_opts} KERNCONF=BHF" fi if ! test "${clean}" = "true"; then kern_opts="${kern_opts} NO_CLEAN=YES" fi make kernel ${kern_opts} > "${cmd_redirect}" 2>&1 fi build_module "${src_dir}/usr.sbin/bhyve" build_module "${src_dir}/usr.sbin/bhyvectl" build_module "${src_dir}/usr.sbin/bhyveload" if test "${with_reboot}" = "true"; then reboot fi } set -e set -u while test $# -gt 0; do case "${1-}" in --clean) clean="true" shift ;; --reboot) with_reboot="true" shift ;; --src-dir=*) src_dir="${1#*=}" shift ;; --verbose) cmd_redirect="/dev/stdout" shift ;; --without-bhf) with_bhf="false" shift ;; --without-kernel) with_kernel="false" shift ;; *) usage ;; esac done readonly clean="${clean-"false"}" readonly cmd_redirect="${cmd_redirect-"/dev/null"}" readonly src_dir="${src_dir-"/usr/corvin-src-140"}" echo $src_dir readonly with_bhf="${with_bhf-"true"}" readonly with_kernel="${with_kernel-"true"}" readonly with_reboot="${with_reboot-"false"}" build Here we go. This is what I do to start the compilation that should produce the working bhyve system files that will give to use the passthru of one nvidia gpu on FreeBSD 14.0 :
a) ./setup_git_140.sh b) ./build_branch_140.sh origin/phab/corvink/14.0/nvidia-wip --without-bhf --verbose ok. It compiled the code without giving errors,until a certain point,when it happens what you see below. I want to understand if the code is bugged. Please help me :
/usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1174:21: error: use of undeclared identifier 'ctx' passthru_cfgwrite(ctx, vcpu, pi, offset - 0x88000, size, value); ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1174:26: error: use of undeclared identifier 'vcpu' passthru_cfgwrite(ctx, vcpu, pi, offset - 0x88000, size, value); ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1209:20: error: use of undeclared identifier 'ctx' passthru_cfgread(ctx, vcpu, pi, offset - 0x88000, size, (uint32_t *)&val); ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1209:25: error: use of undeclared identifier 'vcpu' passthru_cfgread(ctx, vcpu, pi, offset - 0x88000, size, (uint32_t *)&val); ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1302:29: error: use of undeclared identifier 'ctx' if (vm_unmap_pptdev_mmio(ctx, sc- >psc_sel.pc_bus, ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1309:27: error: use of undeclared identifier 'ctx' if (vm_map_pptdev_mmio(ctx, sc- >psc_sel.pc_bus, ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1327:29: error: use of undeclared identifier 'ctx' if (vm_unmap_pptdev_mmio(ctx, sc- >psc_sel.pc_bus, ^ /usr/corvin-src-140/usr.sbin/bhyve/pci_passthru.c:1334:27: error: use of undeclared identifier 'ctx' if (vm_map_pptdev_mmio(ctx, sc- >psc_sel.pc_bus, ^ 8 errors generated. *** Error code 1 The passthru of one nvidia card inside a linux vm WILL NOT work if you don't do what I have explained. The FreeBSD wiki does not talk about the nvidia gpu,but only about network interfaces. If you want to help me,if you have one nvidia card, if you want to pass it through inside a Linux VM,you SHOULD repeat the steps that I have explained. And tell me if you are able to compile the code successfully.
Thanks
setup_git_140.shto pull by TAG and not the entire repo/main, and you'd see the mistake. Release Tags. As you can see there is no 14.0.0 tag, which means you need to see if it builds on 13, as that is the last available tag. Unfortunately, it looks like the headers were altered in version 14. I believe the identifiers are defined in the Kernel Header Files. They were either removed or renamed, which is what's causing the error.