aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/mtrr/amd.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2022-11-02 08:47:13 +0100
committerBorislav Petkov <bp@suse.de>2022-11-10 13:12:45 +0100
commitf8bd9f25c9815161a39886fdd96d110b536a6074 (patch)
treecd6d1d0bb021b1c735852bc446b5eb2c01a20a9b /arch/x86/kernel/cpu/mtrr/amd.c
parentx86/cacheinfo: Switch cache_ap_init() to hotplug callback (diff)
downloadlinux-f8bd9f25c9815161a39886fdd96d110b536a6074.tar.gz
linux-f8bd9f25c9815161a39886fdd96d110b536a6074.zip
x86/mtrr: Simplify mtrr_ops initialization
The way mtrr_if is initialized with the correct mtrr_ops structure is quite weird. Simplify that by dropping the vendor specific init functions and the mtrr_ops[] array. Replace those with direct assignments of the related vendor specific ops array to mtrr_if. Note that a direct assignment is okay even for 64-bit builds, where the symbol isn't present, as the related code will be subject to "dead code elimination" due to how cpu_feature_enabled() is implemented. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20221102074713.21493-17-jgross@suse.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/x86/kernel/cpu/mtrr/amd.c')
-rw-r--r--arch/x86/kernel/cpu/mtrr/amd.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/amd.c b/arch/x86/kernel/cpu/mtrr/amd.c
index a65a0272096d..eff6ac62c0ff 100644
--- a/arch/x86/kernel/cpu/mtrr/amd.c
+++ b/arch/x86/kernel/cpu/mtrr/amd.c
@@ -109,7 +109,7 @@ amd_validate_add_page(unsigned long base, unsigned long size, unsigned int type)
return 0;
}
-static const struct mtrr_ops amd_mtrr_ops = {
+const struct mtrr_ops amd_mtrr_ops = {
.vendor = X86_VENDOR_AMD,
.set = amd_set_mtrr,
.get = amd_get_mtrr,
@@ -117,9 +117,3 @@ static const struct mtrr_ops amd_mtrr_ops = {
.validate_add_page = amd_validate_add_page,
.have_wrcomb = positive_have_wrcomb,
};
-
-int __init amd_init_mtrr(void)
-{
- set_mtrr_ops(&amd_mtrr_ops);
- return 0;
-}