]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "x86/spec: Add 'lfence_enabled' in sysfs"
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 27 Feb 2018 01:13:00 +0000 (20:13 -0500)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 2 Mar 2018 01:10:22 +0000 (17:10 -0800)
This reverts commit d4ac621c1079ddd1b390ab2f56eedbda4aa8d1d7.

OraBug: 27601789
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/include/asm/spec_ctrl.h
arch/x86/kernel/cpu/spec_ctrl.c

index 1d5af47454468eba88fd4fdf0372f4c02d714a00..4d3577c54e514b363d6ccf19a9192a5e9325f515 100644 (file)
@@ -273,13 +273,6 @@ extern u32 sysctl_lfence_enabled;
 static inline void set_lfence_disabled(void)
 {
        use_ibrs |= SPEC_CTRL_LFENCE_OFF;
-       sysctl_lfence_enabled = 0;
-}
-
-static inline void clear_lfence_disabled(void)
-{
-       use_ibrs &= ~SPEC_CTRL_LFENCE_OFF;
-       sysctl_lfence_enabled = 1;
 }
 
 /* indicate usage of IBPB to control execution speculation */
index 93aa00cede932c7f946df4aecc3656d8a1d1dfd4..ec3e307f0289ae51af48fd42c403f9aecb108927 100644 (file)
@@ -15,8 +15,6 @@
  */
 
 u32 sysctl_ibrs_enabled = 0, sysctl_ibpb_enabled = 0;
-/* By default it is enabled. */
-u32 sysctl_lfence_enabled = 1;
 EXPORT_SYMBOL(sysctl_ibrs_enabled);
 EXPORT_SYMBOL(sysctl_ibpb_enabled);
 
@@ -148,71 +146,12 @@ static const struct file_operations fops_ibpb_enabled = {
        .llseek = default_llseek,
 };
 
-static ssize_t lfence_enabled_read(struct file *file, char __user *user_buf,
-                                 size_t count, loff_t *ppos)
-{
-       uint32_t dummy = 0;
-
-       if (ibrs_disabled)
-               return __enabled_read(file, user_buf, count, ppos, &sysctl_lfence_enabled);
-
-       return __enabled_read(file, user_buf, count, ppos, &dummy);
-}
-
-static ssize_t lfence_enabled_write(struct file *file,
-                                 const char __user *user_buf,
-                                 size_t count, loff_t *ppos)
-{
-       char buf[32];
-       ssize_t len;
-       unsigned int enable;
-
-       /* You have to disable IBRS first. */
-       if (ibrs_inuse || retpoline_enabled()) {
-               pr_warn("%s is enabled. Ignoring request to change lfence_enabled state.\n",
-                       ibrs_inuse ? "IBRS" : "retpoline");
-               return -EINVAL;
-       }
-
-       len = min(count, sizeof(buf) - 1);
-       if (copy_from_user(buf, user_buf, len))
-               return -EFAULT;
-
-       buf[len] = '\0';
-       if (kstrtouint(buf, 0, &enable))
-               return -EINVAL;
-
-       /* Only 0 and 1 are allowed */
-       if (enable > 1)
-               return -EINVAL;
-
-       mutex_lock(&spec_ctrl_mutex);
-
-       if (!enable)
-               set_lfence_disabled();
-       else
-               clear_lfence_disabled();
-
-       refresh_set_spectre_v2_enabled();
-
-       mutex_unlock(&spec_ctrl_mutex);
-       return count;
-}
-
-static const struct file_operations fops_lfence_enabled = {
-       .read = lfence_enabled_read,
-       .write = lfence_enabled_write,
-       .llseek = default_llseek,
-};
-
 static int __init debugfs_spec_ctrl(void)
 {
         debugfs_create_file("ibrs_enabled", S_IRUSR | S_IWUSR,
                             arch_debugfs_dir, NULL, &fops_ibrs_enabled);
        debugfs_create_file("ibpb_enabled", S_IRUSR | S_IWUSR,
                            arch_debugfs_dir, NULL, &fops_ibpb_enabled);
-       debugfs_create_file("lfence_enabled", S_IRUSR | S_IWUSR,
-                           arch_debugfs_dir, NULL, &fops_lfence_enabled);
         return 0;
 }
 late_initcall(debugfs_spec_ctrl);