x86/mm: Add prot_sethuge() helper to abstract out _PAGE_PSE handling
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 28 Sep 2022 07:30:31 +0000 (09:30 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 29 Sep 2022 16:01:40 +0000 (18:01 +0200)
commit334b2cea811944df99ae2172bcc0effcdfdbe862
tree9fba5dd5bc8bf91a127092d79de51da9e7dd459a
parenta3d3163fbe690cfec354fc20808adf0629adf8da
x86/mm: Add prot_sethuge() helper to abstract out _PAGE_PSE handling

We still have some historic cases of direct fiddling of page
attributes with (dangerous & fragile) type casting and address shifting.

Add the prot_sethuge() helper instead that gets the types right and
doesn't have to transform addresses.

( Also add a debug check to make sure this doesn't get applied
  to _PAGE_BIT_PAT/_PAGE_BIT_PAT_LARGE pages. )

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
arch/x86/mm/init_64.c