x86/mtrr: Remove set_all callback from struct mtrr_ops
authorJuergen Gross <jgross@suse.com>
Wed, 2 Nov 2022 07:47:05 +0000 (08:47 +0100)
committerBorislav Petkov <bp@suse.de>
Thu, 10 Nov 2022 12:12:44 +0000 (13:12 +0100)
Instead of using an indirect call to mtrr_if->set_all just call the only
possible target cache_cpu_init() directly. Remove the set_all function
pointer from struct mtrr_ops.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221102074713.21493-9-jgross@suse.com
Signed-off-by: Borislav Petkov <bp@suse.de>
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/cpu/mtrr/mtrr.c
arch/x86/kernel/cpu/mtrr/mtrr.h

index d409c38ee748d898cf8990cb700388733c5f66c5..9d4d2bcaf4e8397709d4a54068a46bfcda6c348c 100644 (file)
@@ -843,7 +843,6 @@ int positive_have_wrcomb(void)
  * Generic structure...
  */
 const struct mtrr_ops generic_mtrr_ops = {
-       .set_all                = cache_cpu_init,
        .get                    = generic_get_mtrr,
        .get_free_region        = generic_get_free_region,
        .set                    = generic_set_mtrr,
index 4209945c4e684a280b09b811eb96782063431a13..a44b510ced0e32f107971850a28cec0676028276 100644 (file)
@@ -170,15 +170,15 @@ static int mtrr_rendezvous_handler(void *info)
         * saved, and we want to replicate that across all the cpus that come
         * online (either at the end of boot or resume or during a runtime cpu
         * online). If we're doing that, @reg is set to something special and on
-        * all the cpu's we do mtrr_if->set_all() (On the logical cpu that
+        * all the CPUs we do cache_cpu_init() (On the logical CPU that
         * started the boot/resume sequence, this might be a duplicate
-        * set_all()).
+        * cache_cpu_init()).
         */
        if (data->smp_reg != ~0U) {
                mtrr_if->set(data->smp_reg, data->smp_base,
                             data->smp_size, data->smp_type);
        } else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
-               mtrr_if->set_all();
+               cache_cpu_init();
        }
        return 0;
 }
@@ -770,7 +770,7 @@ void __init mtrr_bp_init(void)
 
                        if (mtrr_cleanup(phys_addr)) {
                                changed_by_mtrr_cleanup = 1;
-                               mtrr_if->set_all();
+                               cache_cpu_init();
                        }
                }
        }
@@ -856,7 +856,7 @@ void mtrr_bp_restore(void)
        if (!memory_caching_control)
                return;
 
-       mtrr_if->set_all();
+       cache_cpu_init();
 }
 
 static int __init mtrr_init_finialize(void)
index 88b1c4b6174a88f0b08aa2ac23e57d47e4adfe21..3b1883185185eab5af2b910a0f2ec838a0bc9f19 100644 (file)
@@ -16,8 +16,6 @@ struct mtrr_ops {
        u32     vendor;
        void    (*set)(unsigned int reg, unsigned long base,
                       unsigned long size, mtrr_type type);
-       void    (*set_all)(void);
-
        void    (*get)(unsigned int reg, unsigned long *base,
                       unsigned long *size, mtrr_type *type);
        int     (*get_free_region)(unsigned long base, unsigned long size,