Page MenuHomeFreeBSD

bhyve: add support for MTRR
ClosedPublic

Authored by corvink on Dec 8 2021, 12:01 PM.
Tags
Referenced Files
Unknown Object (File)
Sat, Nov 2, 4:44 AM
Unknown Object (File)
Sat, Nov 2, 4:43 AM
Unknown Object (File)
Sat, Nov 2, 4:43 AM
Unknown Object (File)
Sat, Nov 2, 4:43 AM
Unknown Object (File)
Sat, Nov 2, 4:43 AM
Unknown Object (File)
Sat, Nov 2, 4:23 AM
Unknown Object (File)
Mon, Oct 28, 9:43 AM
Unknown Object (File)
Mon, Oct 28, 6:42 AM

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
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/amd64/vmm/x86.c
672

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
corvink added inline comments.
sys/amd64/vmm/x86.c
672

Sry for my late update. Thanks for catching this.

sys/amd64/vmm/x86.c
672

Why uint64_t? num is a u_int.

690

Which MSRs is this comment referring to?

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

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
699

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.