ACK: [PATCH 1/3] bios: mtrr: fix cache type corner case at start of mtrr range
Alex Hung
alex.hung at canonical.com
Fri Apr 29 07:57:19 UTC 2016
On 2016-04-28 04:11 AM, Ricardo Neri wrote:
> To assign a cache type to a memory range, we determine if _any_ part of
> it is covered by one or more of the mtrr list entries.
>
> If only the last location of the memory range under test lies inside
> the range described by the mttr entry, we will fail to identify it. As an
> example, consider that the mttr range is from [0x2000, 0x3000) - inclusive
> of 0x1000 but exclusive of 0x2000. If the range under test is [0x1000,
> 0x2000], the second test of the condition will not be met. Thus, it is
> necessary to check whether the end of the memory range under test is less
> _or_ equal to the start of the range given by the mtrr entry.
>
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
> ---
> src/bios/mtrr/mtrr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 0a98465..698a96c 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -174,7 +174,7 @@ static int cache_types(uint64_t start, uint64_t end)
> fwts_list_foreach(item, mtrr_list) {
> entry = fwts_list_data(struct mtrr_entry*, item);
>
> - if (entry->end > start && entry->start < end)
> + if (entry->end > start && entry->start <= end)
> type |= entry->type;
> }
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list