• Venkatesh Pallipadi's avatar
    x86, mtrr: Support mtrr lookup for range spanning across MTRR range · 351e5a70
    Venkatesh Pallipadi authored
    mtrr_type_lookup [start:end] looked up the resultant MTRR type for that
    range, based on fixed and all variable MTRR ranges. It did check for multiple
    MTRR var ranges overlapping [start:end] and returned the net type.
    
    However, if the [start:end] range spanned across any var MTRR range,
    mtrr_type_lookup would return an error return of 0xFE. This was based on
    typical usage of mtrr_type_lookup in PAT mapping, where region being
    mapped would not normally span across MTRR ranges and also trying
    to keep the code simple.
    
    Mark recently reported the problem with this limitation. When there are
    two continguous MTRR's of type "writeback" and if there is a memory mapping
    over a region starting in one MTRR range and ending in another MTRR range,
    such mapping will fallback to "uncached" due to the above limitation.
    
    Change below adds support for such lookups spanning multiple MTRR ranges.
    We now have a wrapper mtrr_type_lookup that dynamically splits such a region
    into smaller chunks that fit within one MTRR range and does a
    __mtrr_type_lookup on it and combine the results later.
    Reported-by: default avatarMark Langsdorf <mark.langsdorf@amd.com>
    Signed-off-by: default avatarVenkatesh Pallipadi <venki@google.com>
    LKML-Reference: <1284159350-19841-3-git-send-email-venki@google.com>
    Reviewed-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
    Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    351e5a70
generic.c 20.9 KB