x86: Add functions to convert between mtrr size and mask
authorSimon Glass <sjg@chromium.org>
Sat, 15 Mar 2025 14:25:42 +0000 (14:25 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 3 Apr 2025 17:41:55 +0000 (11:41 -0600)
commit8bd563707d909d7bb414de2c0ff4ab66eb8009db
tree2c2c62b064691532cc3f4721072d7ff3ab04533e
parent5ee60f3afa146e45752e1e99c382f18dd7f8200e
x86: Add functions to convert between mtrr size and mask

Rather than repeating the same code in several places, add some
functions which can do the conversion.

Use the cpu_phys_address_size() function to obtain the physical-address
size, since it is more reliable with kvm, where the host CPU may have a
different value from the emulation CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/mtrr.c
arch/x86/include/asm/mtrr.h
cmd/x86/mtrr.c