Make drm drivers use MTRR write-combine

From: Johannes Lundberg <johalun0_at_gmail.com>
Date: Tue, 14 Aug 2018 10:12:37 +0100
Hi

Something that we have seen for a long time on FreeBSD is the boot message

Failed to add WC MTRR for [0xd0000000-0xdfffffff]: -22; performance may
suffer

Taking a closer look at this with memcontrol I can see that the 256 MB
region that DRM wants to set as WC is already covered by this entry
0xc0000000/0x40000000 BIOS uncacheable set-by-firmware active

Similar on both my Skylake and Broadwell systems.

The linuxkpi wrapper can be found here:
https://github.com/FreeBSDDesktop/kms-drm/blob/drm-v4.15/linuxkpi/gplv2/src/linux_mtrr.c

There doesn't seem to exist a function for changing the properties of a sub
region:
https://github.com/FreeBSDDesktop/freebsd-base/blob/master/sys/dev/mem/memutil.c

Any ideas of a good solution to this? Can this region be blacklisted or is
there a safe way to split the big region into several regions with
different flags when the drm driver loads?

For reference, my AMD machine logs this
# dmesg | grep MTRR
Successfully added WC MTRR for [0xe0000000-0xefffffff]: 0;
# memcontrol list
--SNIP--
0xff000/0x1000 BIOS write-protect fixed-base fixed-length set-by-firmware
active
0x0/0x80000000 BIOS write-back set-by-firmware active
0x80000000/0x40000000 BIOS write-back set-by-firmware active
0xc0000000/0x20000000 BIOS write-back set-by-firmware active
0xe0000000/0x10000000 drm write-combine active

Not sure if it's a BIOS or CPU vendor issue.
Received on Tue Aug 14 2018 - 07:13:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC