Skip to content

Conversation

scfarley
Copy link

Following the instructions from GPU passthrough with bhyve - Corvin Köhne - EuroBSDcon 2023, a few additional settings are needed to pass the proper values and in the correct order:

  • passthruX_options: Options given to the passthru device to specify rom and/or bootindex.
  • loader_fwcfg: Assigns a type (bhyve or qemu) on what and how information is passed to the guest firmware.
  • bhyve_extra: Options that are passed to bhyve at the end of the command-line.

Passthru device backends can take options such as rom and bootindex.
Accept those via passthruX_options settings.
The boot ROM device can take a type (fwcfg) to pass information to the
guest firmware.  Accept loader_fwcfg to pass this type.  This setting is
only parsed when the loader is UEFI.
bhyve can be dependent upon the order of the options is receives, so add
a setting similar to bhyve_options, called bhyve_extra, that is passed
to bhyve as the last options.

"-s 31,lpc" is passed by vm-bhyve after the options provided by
bhyve_options.  However, this causes bhyve to return an error when
attempting to use GPU passthru with an Intel iGPU due to additional
options needing to be passed.

Example:
$ bhyve ... -o pci.0.31.0.pcireg.vendor=host -s 31,lpc ...
pci slot 0:31:0 already occupied!
@scfarley
Copy link
Author

Other possibilities outside my experience with bhyve:

  • Expand loader_fwcfg to be less specific, so other loader-specific options can be given.
  • Instead of bhyve_extra, move bhyve_options to after the devices are passed to bhyve. I did not know if that would cause other problems.
  • Rename bhyve_extra to bhyve_final.

@leper
Copy link

leper commented Sep 8, 2025

@scfarley Thanks for those changes, I just needed the rom change but I managed to get GPU passthrough working. Since development has moved to https://github.com/freebsd/vm-bhyve would you consider submitting this there again?

@scfarley
Copy link
Author

I need to test the changes later, but I have created a draft PR for it: freebsd/vm-bhyve#49

@leper
Copy link

leper commented Sep 10, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants