Page MenuHomeFreeBSD

bhyve: add support for MTRR
ClosedPublic

Authored by c.koehne_beckhoff.com on Dec 8 2021, 12:01 PM.

Details

Summary

Some guests or driver might depend on MTRR to work properly. E.g. the
nvidia gpu driver won't work without MTRR.

Note:
I've only tested this patch on an Intel system.

The patch is also published on https://github.com/Beckhoff/freebsd-src/commits/phab/corvink/mtrr.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/amd64/vmm/x86.c
671

This isn't right, there is one field for each variable range, but there are two registers associated with each range, base and mask.

  • add base and mask register for variable ranges
c.koehne_beckhoff.com added inline comments.
sys/amd64/vmm/x86.c
671

Sry for my late update. Thanks for catching this.

sys/amd64/vmm/x86.c
671

Why uint64_t? num is a u_int.

689

Which MSRs is this comment referring to?

c.koehne_beckhoff.com marked an inline comment as done.
  • fix type of MTRR offset
  • handle writes to reserved fields
c.koehne_beckhoff.com added inline comments.
sys/amd64/vmm/x86.c
689

Reserved fields should be checked for each MSR. I've added a check for it to all MSRs now.

markj added inline comments.
sys/amd64/vmm/x86.c
698

def_type will be 0 by default, it looks like at least FreeBSD's MTRR driver expects the "enabled" and "fixed-enabled" bits to be set by the BIOS. I guess it's ok to leave those bits off though...

This revision is now accepted and ready to land.Jan 7 2022, 3:36 PM
This revision was automatically updated to reflect the committed changes.