x86/mtrr: Remove physical address size calculation
authorJuergen Gross <jgross@suse.com>
Tue, 2 May 2023 12:09:16 +0000 (14:09 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 9 May 2023 12:13:30 +0000 (14:13 +0200)
commitf6b980646b93a8c585b4ed991b8a34e8fc6ef847
tree05b9feaeca4b5d4b3f32dbabb88f523ca075a045
parentac9a78681b921877518763ba0e89202254349d1b
x86/mtrr: Remove physical address size calculation

The physical address width calculation in mtrr_bp_init() can easily be
replaced with using the already available value x86_phys_bits from
struct cpuinfo_x86.

The same information source can be used in mtrr/cleanup.c, removing the
need to pass that value on to mtrr_cleanup().

In print_mtrr_state() use x86_phys_bits instead of recalculating it
from size_or_mask.

Move setting of size_or_mask and size_and_mask into a dedicated new
function in mtrr/generic.c, enabling to make those 2 variables static,
as they are used in generic.c only now.

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-2-jgross@suse.com
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
arch/x86/kernel/cpu/mtrr/cleanup.c
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/cpu/mtrr/mtrr.c
arch/x86/kernel/cpu/mtrr/mtrr.h