x86/mm: Only check uniform after calling mtrr_type_lookup()
authorJuergen Gross <jgross@suse.com>
Tue, 2 May 2023 12:09:30 +0000 (14:09 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 1 Jun 2023 13:04:33 +0000 (15:04 +0200)
commit12f0dd8df14285a5604f35ed3af8b8c33e8fd97f
treee4f9b1e89503c63dde760ace4ef7e4ed7d1ab226
parent973df1942068c0cc72244ce7dce5e5aeca03ad5f
x86/mm: Only check uniform after calling mtrr_type_lookup()

Today pud_set_huge() and pmd_set_huge() test for the MTRR type to be
WB or INVALID after calling mtrr_type_lookup().

Those tests can be dropped as the only reason not to use a large mapping
would be uniform being 0.

Any MTRR type can be accepted as long as it applies to the whole memory
range covered by the mapping, as the alternative would only be to map
the same region with smaller pages instead, using the same PAT type as
for the large mapping.

  [ bp: Massage commit message. ]

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20230502120931.20719-16-jgross@suse.com
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
arch/x86/mm/pgtable.c