]> git.dujemihanovic.xyz Git - u-boot.git/commit
x86: mtrr: Abort if requested size is not power of 2
authorBin Meng <bmeng.cn@gmail.com>
Sat, 31 Jul 2021 08:45:26 +0000 (16:45 +0800)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 2 Aug 2021 07:11:41 +0000 (15:11 +0800)
commit9a7c6fde07d04e392dadfd406b7837c04aed0d72
tree02e024f7f95da9b256d73d384a98942e14c07707
parent3bcd6cf89efee5c8088dce2f770bdd5592186efb
x86: mtrr: Abort if requested size is not power of 2

The size parameter of mtrr_add_request() and mtrr_set_next_var()
shall be power of 2, otherwise the logic creates a mask that does
not meet the requirement of IA32_MTRR_PHYSMASK register.

Programming such a mask value to IA32_MTRR_PHYSMASK generates #GP.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/mtrr.c
arch/x86/include/asm/mtrr.h