mtrr

Firmware Test Suite - mtrr test

The mtrr test sanity checks the firmware configuration of the Memory Type Range Registers (MTRRs). The MTRRs are a set of control registers that allow the kernel to control caching access to memory ranges by the processor.

Three basic tests are performed:

  • Validate the kernel MTRR IOMEM setup. This will examine each MTRR configuration against the kernel settings from /proc/iomem
  • Check that the kernel has not warned about inconsistent MTRRs across the CPUs.
  • Check that the kernel has detected that MTRRFixDramModEnBit has not been cleared by the BIOS and has to fix this.

Example of the output is as follows:

MTRR validation.
--------------------------------------------------------------------------------
MTRR overview
-------------
Reg 0: 0x00000000ffc00000 - 0x0000000100000000 (     4 MB)   Write-Protect
Reg 1: 0x0000000000000000 - 0x0000000080000000 (  2048 MB)   Write-Back
Reg 2: 0x0000000080000000 - 0x00000000c0000000 (  1024 MB)   Write-Back
Reg 3: 0x00000000c0000000 - 0x00000000e0000000 (   512 MB)   Write-Back
Reg 4: 0x00000000dc000000 - 0x00000000e0000000 (    64 MB)   Uncached
Reg 5: 0x00000000db000000 - 0x00000000dc000000 (    16 MB)   Uncached
Reg 6: 0x0000000100000000 - 0x0000000180000000 (  2048 MB)   Write-Back
Reg 7: 0x0000000180000000 - 0x00000001a0000000 (   512 MB)   Write-Back
Reg 8: 0x000000019f000000 - 0x00000001a0000000 (    16 MB)   Uncached
Reg 9: 0x000000019e800000 - 0x000000019f000000 (     8 MB)   Uncached

Test 1 of 3: Validate the kernel MTRR IOMEM setup.
PASSED: Test 1, Memory ranges seem to have correct attributes.

Test 2 of 3: Validate the MTRR setup across all processors.
PASSED: Test 2, All processors have the a consistent MTRR setup.

Test 3 of 3: Check for AMD MtrrFixDramModEn being cleared by the BIOS.
SKIPPED: Test 3, CPU is not an AMD, cannot test.

================================================================================
2 passed, 0 failed, 0 warnings, 0 aborted, 1 skipped, 0 info only.
================================================================================

Examples:

sudo fwts mtrr - 

..runs the test on your machine and dumps the output to stdout.

sudo fwts mtrr  

..runs the test on your machine and appends the output to the default log results.log.

Explanation of test results

Certain test results may require a little more explanation. This section will try and give some context to specific test failures.

Error ID

Explanation

MTRRIncorrectAttr

A memory range from /proc/iomem has the incorrect caching attribute.

MTRRLackingAttr

A memory range from /proc/iomem is lacking a caching attribute.

MTRRCPUsMisconfigured

MTRRs across CPUs are not configured consistently.

MTRRFixDramModEnBit

The BIOS is expected to clear MtrrFixDramModEn bit, see for example "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD Opteron Processors" (26094 Rev. 3.30 February 2006), section 13.2.1.2 SYSCFG Register. The MtrrFixDramModEn bit should be set to 1 during BIOS initalization of the fixed MTRRs, then cleared to 0 for operation.

Possible Workarounds and Debugging Steps

The MTRR cleanup code is compiled into the kernel but for release prior to Oneiric it is not turned on by default. To enable this, boot with kernel parameter "enable_mtrr_cleanup" - this may fix and/or workaround the misconfigured MTRRs

One can also turn on MTRR cleanup debug to see in the kernel log what the MTRR cleanup code is attempting to fix. To enable this, boot with kernel parameter "mtrr_cleanup_debug"

FirmwareTestSuite/Reference/mtrr (last edited 2016-01-11 07:25:21 by anthonywong)