From fc3f95def2495ac08f1bac213a52acb934678097 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 15 Aug 2016 10:16:57 -0700 Subject: [PATCH 1/5] Revert "defconfig: arm64: Enable app specific setting on MSM8996" This reverts commit fa5a089eb6b7 ("defconfig: arm64: Enable app specific setting on MSM8996"). Feature is not applicable to msmcobalt and only applicable to MSM8996. CRs-Fixed: 1054373 Change-Id: I9464305f6cac6aedb3e5763979dba4cba92e050b Signed-off-by: Satya Durga Srinivasu Prabhala --- arch/arm64/configs/msm-perf_defconfig | 1 - arch/arm64/configs/msm_defconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/arm64/configs/msm-perf_defconfig b/arch/arm64/configs/msm-perf_defconfig index 210017d4467e..4e6b1e6644ae 100644 --- a/arch/arm64/configs/msm-perf_defconfig +++ b/arch/arm64/configs/msm-perf_defconfig @@ -45,7 +45,6 @@ CONFIG_ARCH_MSM8996=y CONFIG_PCI=y CONFIG_PCI_MSM=y CONFIG_ENABLE_FP_SIMD_SETTINGS=y -CONFIG_MSM_APP_SETTINGS=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y diff --git a/arch/arm64/configs/msm_defconfig b/arch/arm64/configs/msm_defconfig index f263139cd2ec..7d32273a754c 100644 --- a/arch/arm64/configs/msm_defconfig +++ b/arch/arm64/configs/msm_defconfig @@ -42,7 +42,6 @@ CONFIG_ARCH_MSM8996=y CONFIG_PCI=y CONFIG_PCI_MSM=y CONFIG_ENABLE_FP_SIMD_SETTINGS=y -CONFIG_MSM_APP_SETTINGS=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y From 4e6dcec1bd2adf5eb072fde7b51bac7a5d5744de Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 15 Aug 2016 10:20:54 -0700 Subject: [PATCH 2/5] Revert "arm64: Add support for app specific settings" This reverts commit 7ab05c20ad43 ("arm64: Add support for app specific settings"). Feature is not applicable to msmcobalt and only applicable to MSM8996. CRs-Fixed: 1054373 Change-Id: I12d3a22362b965c7d302976c83ab0e757c98d3c6 Signed-off-by: Satya Durga Srinivasu Prabhala --- arch/arm64/Kconfig | 21 ------ arch/arm64/include/asm/app_api.h | 42 ----------- arch/arm64/include/asm/fpsimd.h | 4 ++ arch/arm64/kernel/Makefile | 2 - arch/arm64/kernel/app_api.c | 75 ------------------- arch/arm64/kernel/app_setting.c | 120 ------------------------------- arch/arm64/kernel/entry-fpsimd.S | 16 +++++ arch/arm64/kernel/fpsimd.c | 13 ---- include/linux/mm_types.h | 4 -- kernel/sched/core.c | 8 --- mm/mmap.c | 9 --- 11 files changed, 20 insertions(+), 294 deletions(-) delete mode 100644 arch/arm64/include/asm/app_api.h delete mode 100644 arch/arm64/kernel/app_api.c delete mode 100644 arch/arm64/kernel/app_setting.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 69c9b84b367b..706129c86096 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -513,20 +513,9 @@ config ARM64_64K_PAGES endchoice -config MSM_APP_API - bool "API support to enable / disable app settings for MSM8996" - depends on ARCH_MSM8996 && (ENABLE_FP_SIMD_SETTINGS || MSM_APP_SETTINGS) - help - Add API support to enable / disable the app settings to be used - at runtime. These APIs are used to enable / disable app setting - when specific aarch32 or aarch64 processes are running. - - If you are not sure what to do, select 'N' here. - config ENABLE_FP_SIMD_SETTINGS bool "Enable FP(Floating Point) Settings for Qualcomm MSM8996" depends on ARCH_MSM8996 - select MSM_APP_API help Enable FP(Floating Point) and SIMD settings for the MSM8996 during the execution of the aarch32 processes and disable these settings @@ -534,16 +523,6 @@ config ENABLE_FP_SIMD_SETTINGS If you are not sure what to do, select 'N' here. -config MSM_APP_SETTINGS - bool "Support to enable / disable app settings for MSM8996" - depends on ARCH_MSM8996 - select MSM_APP_API - help - Expose an interface used by the userspace at runtime to - enable / disable the app specific settings. - - If you are not sure what to do, select 'N' here. - choice prompt "Virtual address space size" default ARM64_VA_BITS_39 if ARM64_4K_PAGES diff --git a/arch/arm64/include/asm/app_api.h b/arch/arm64/include/asm/app_api.h deleted file mode 100644 index 2162400fde13..000000000000 --- a/arch/arm64/include/asm/app_api.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __ASM_APP_API_H -#define __ASM_APP_API_H - -#include -#include -#include - -#define APP_SETTING_BIT 30 -#define MAX_ENTRIES 10 - -/* - * APIs to set / clear the app setting bits - * in the register. - */ -#ifdef CONFIG_MSM_APP_API -extern void set_app_setting_bit(uint32_t bit); -extern void clear_app_setting_bit(uint32_t bit); -#else -static inline void set_app_setting_bit(uint32_t bit) {} -static inline void clear_app_setting_bit(uint32_t bit) {} -#endif - -#ifdef CONFIG_MSM_APP_SETTINGS -extern void switch_app_setting_bit(struct task_struct *prev, - struct task_struct *next); -extern void apply_app_setting_bit(struct file *file); -extern bool use_app_setting; -#endif - -#endif diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 3efaa5cebc03..355871b7022f 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -84,9 +84,13 @@ extern void fpsimd_load_partial_state(struct fpsimd_partial_state *state); #ifdef CONFIG_ENABLE_FP_SIMD_SETTINGS extern void fpsimd_disable_trap(void); extern void fpsimd_enable_trap(void); +extern void fpsimd_settings_disable(void); +extern void fpsimd_settings_enable(void); #else static inline void fpsimd_disable_trap(void) {} static inline void fpsimd_enable_trap(void) {} +static inline void fpsimd_settings_disable(void) {} +static inline void fpsimd_settings_enable(void) {} #endif #endif diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 57e55e4d5fcc..9f7794c5743f 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -43,8 +43,6 @@ arm64-obj-$(CONFIG_EFI) += efi.o efi-entry.stub.o arm64-obj-$(CONFIG_PCI) += pci.o arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o arm64-obj-$(CONFIG_ACPI) += acpi.o -arm64-obj-$(CONFIG_MSM_APP_API) += app_api.o -arm64-obj-$(CONFIG_MSM_APP_SETTINGS) += app_setting.o obj-y += $(arm64-obj-y) vdso/ obj-m += $(arm64-obj-m) diff --git a/arch/arm64/kernel/app_api.c b/arch/arm64/kernel/app_api.c deleted file mode 100644 index 39eeee1a9029..000000000000 --- a/arch/arm64/kernel/app_api.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include - -#include - -static spinlock_t spinlock; -static DEFINE_PER_CPU(int, app_config_applied); -static unsigned long app_config_set[NR_CPUS]; -static unsigned long app_config_clear[NR_CPUS]; - -void set_app_setting_bit(uint32_t bit) -{ - unsigned long flags; - uint64_t reg; - int cpu; - - spin_lock_irqsave(&spinlock, flags); - asm volatile("mrs %0, S3_1_C15_C15_0" : "=r" (reg)); - reg = reg | BIT(bit); - isb(); - asm volatile("msr S3_1_C15_C15_0, %0" : : "r" (reg)); - isb(); - if (bit == APP_SETTING_BIT) { - cpu = raw_smp_processor_id(); - app_config_set[cpu]++; - - this_cpu_write(app_config_applied, 1); - } - spin_unlock_irqrestore(&spinlock, flags); - -} -EXPORT_SYMBOL(set_app_setting_bit); - -void clear_app_setting_bit(uint32_t bit) -{ - unsigned long flags; - uint64_t reg; - int cpu; - - spin_lock_irqsave(&spinlock, flags); - asm volatile("mrs %0, S3_1_C15_C15_0" : "=r" (reg)); - reg = reg & ~BIT(bit); - isb(); - asm volatile("msr S3_1_C15_C15_0, %0" : : "r" (reg)); - isb(); - if (bit == APP_SETTING_BIT) { - cpu = raw_smp_processor_id(); - app_config_clear[cpu]++; - - this_cpu_write(app_config_applied, 0); - } - spin_unlock_irqrestore(&spinlock, flags); -} -EXPORT_SYMBOL(clear_app_setting_bit); - -static int __init init_app_api(void) -{ - spin_lock_init(&spinlock); - return 0; -} -early_initcall(init_app_api); diff --git a/arch/arm64/kernel/app_setting.c b/arch/arm64/kernel/app_setting.c deleted file mode 100644 index 6b4eb28d0e24..000000000000 --- a/arch/arm64/kernel/app_setting.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include - -#include - -#define MAX_LEN 100 - -static char *lib_names[MAX_ENTRIES]; -static unsigned int count; -static struct mutex mutex; - -static char lib_str[MAX_LEN] = ""; -static struct kparam_string kps = { - .string = lib_str, - .maxlen = MAX_LEN, -}; -static int set_name(const char *str, struct kernel_param *kp); -module_param_call(lib_name, set_name, param_get_string, &kps, S_IWUSR); - -bool use_app_setting = true; -module_param(use_app_setting, bool, 0644); -MODULE_PARM_DESC(use_app_setting, "control use of app specific settings"); - -static int set_name(const char *str, struct kernel_param *kp) -{ - int len = strlen(str); - char *name; - - if (len >= MAX_LEN) { - pr_err("app_setting: name string too long\n"); - return -ENOSPC; - } - - /* - * echo adds '\n' which we need to chop off later - */ - name = kzalloc(len + 1, GFP_KERNEL); - if (!name) - return -ENOMEM; - - strlcpy(name, str, len + 1); - - if (name[len - 1] == '\n') - name[len - 1] = '\0'; - - mutex_lock(&mutex); - if (count < MAX_ENTRIES) { - lib_names[count] = name; - /* - * mb to ensure that the new lib_names entry is present - * before updating the view presented by get_lib_names - */ - mb(); - count++; - } else { - pr_err("app_setting: set name failed. Max entries reached\n"); - kfree(name); - mutex_unlock(&mutex); - return -EPERM; - } - mutex_unlock(&mutex); - - return 0; -} - -void switch_app_setting_bit(struct task_struct *prev, struct task_struct *next) -{ - if (prev->mm && unlikely(prev->mm->app_setting)) - clear_app_setting_bit(APP_SETTING_BIT); - - if (next->mm && unlikely(next->mm->app_setting)) - set_app_setting_bit(APP_SETTING_BIT); -} -EXPORT_SYMBOL(switch_app_setting_bit); - -void apply_app_setting_bit(struct file *file) -{ - bool found = false; - int i; - - if (file && file->f_path.dentry) { - const char *name = file->f_path.dentry->d_name.name; - - for (i = 0; i < count; i++) { - if (unlikely(!strcmp(name, lib_names[i]))) { - found = true; - break; - } - } - if (found) { - preempt_disable(); - set_app_setting_bit(APP_SETTING_BIT); - /* This will take care of child processes as well */ - current->mm->app_setting = 1; - preempt_enable(); - } - } -} -EXPORT_SYMBOL(apply_app_setting_bit); - -static int __init app_setting_init(void) -{ - mutex_init(&mutex); - return 0; -} -module_init(app_setting_init); diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S index 1ffe15459c92..d90efa4852b2 100644 --- a/arch/arm64/kernel/entry-fpsimd.S +++ b/arch/arm64/kernel/entry-fpsimd.S @@ -78,6 +78,22 @@ ENTRY(fpsimd_disable_trap) msr cpacr_el1, x0 ret ENDPROC(fpsimd_disable_trap) +ENTRY(fpsimd_settings_enable) + mrs x0, s3_1_c15_c15_0 + orr x0, x0, #(1 << 31) + isb + msr s3_1_c15_c15_0, x0 + isb + ret +ENDPROC(fpsimd_settings_enable) +ENTRY(fpsimd_settings_disable) + mrs x0, s3_1_c15_c15_0 + bic x0, x0, #(1 << 31) + isb + msr s3_1_c15_c15_0, x0 + isb + ret +ENDPROC(fpsimd_settings_disable) #endif #endif diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 2ed553f3a4ae..74bc79e99717 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -28,7 +28,6 @@ #include #include -#include #define FPEXC_IOF (1 << 0) #define FPEXC_DZF (1 << 1) @@ -37,8 +36,6 @@ #define FPEXC_IXF (1 << 4) #define FPEXC_IDF (1 << 7) -#define FP_SIMD_BIT 31 - /* * In order to reduce the number of times the FPSIMD state is needlessly saved * and restored, we need to keep track of two things: @@ -97,16 +94,6 @@ static DEFINE_PER_CPU(int, fpsimd_stg_enable); static int fpsimd_settings = 0x1; /* default = 0x1 */ module_param(fpsimd_settings, int, 0644); -void fpsimd_settings_enable(void) -{ - set_app_setting_bit(FP_SIMD_BIT); -} - -void fpsimd_settings_disable(void) -{ - clear_app_setting_bit(FP_SIMD_BIT); -} - /* * Trapped FP/ASIMD access. */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 9f9e60736eba..ea0009064bbc 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -522,10 +522,6 @@ struct mm_struct { #ifdef CONFIG_HUGETLB_PAGE atomic_long_t hugetlb_usage; #endif -#ifdef CONFIG_MSM_APP_SETTINGS - int app_setting; -#endif - }; static inline void mm_init_cpumask(struct mm_struct *mm) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58303b3dc356..db0472b37feb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -85,9 +85,6 @@ #ifdef CONFIG_PARAVIRT #include #endif -#ifdef CONFIG_MSM_APP_SETTINGS -#include -#endif #include "sched.h" #include "../workqueue_internal.h" @@ -5895,11 +5892,6 @@ prepare_task_switch(struct rq *rq, struct task_struct *prev, fire_sched_out_preempt_notifiers(prev, next); prepare_lock_switch(rq, next); prepare_arch_switch(next); - -#ifdef CONFIG_MSM_APP_SETTINGS - if (use_app_setting) - switch_app_setting_bit(prev, next); -#endif } /** diff --git a/mm/mmap.c b/mm/mmap.c index 8b0a0ed2c466..6c561acdca92 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -48,10 +48,6 @@ #include #include -#ifdef CONFIG_MSM_APP_SETTINGS -#include -#endif - #include "internal.h" #ifndef arch_mmap_check @@ -1301,11 +1297,6 @@ unsigned long do_mmap(struct file *file, unsigned long addr, if (!len) return -EINVAL; -#ifdef CONFIG_MSM_APP_SETTINGS - if (use_app_setting) - apply_app_setting_bit(file); -#endif - /* * Does the application expect PROT_READ to imply PROT_EXEC? * From 787ddf0e6e4f22cb4666b9069f4bbfec8dc46895 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 15 Aug 2016 10:55:10 -0700 Subject: [PATCH 3/5] Revert "defconfig: arm64: Enable FP settings for msm8996" This reverts commit 8df2feee092a ("defconfig: arm64: Enable FP settings for msm8996"). Feature is not applicable to msmcobalt and only applicable to MSM8996. CRs-Fixed: 1054373 Change-Id: I0d2c9bc8f27c2ac938754ab97b4bdc7feb6325b1 Signed-off-by: Satya Durga Srinivasu Prabhala --- arch/arm64/configs/msm-perf_defconfig | 1 - arch/arm64/configs/msm_defconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/arm64/configs/msm-perf_defconfig b/arch/arm64/configs/msm-perf_defconfig index 4e6b1e6644ae..9ded3e3d5ff4 100644 --- a/arch/arm64/configs/msm-perf_defconfig +++ b/arch/arm64/configs/msm-perf_defconfig @@ -44,7 +44,6 @@ CONFIG_ARCH_QCOM=y CONFIG_ARCH_MSM8996=y CONFIG_PCI=y CONFIG_PCI_MSM=y -CONFIG_ENABLE_FP_SIMD_SETTINGS=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y diff --git a/arch/arm64/configs/msm_defconfig b/arch/arm64/configs/msm_defconfig index 7d32273a754c..3f987b5372c5 100644 --- a/arch/arm64/configs/msm_defconfig +++ b/arch/arm64/configs/msm_defconfig @@ -41,7 +41,6 @@ CONFIG_ARCH_QCOM=y CONFIG_ARCH_MSM8996=y CONFIG_PCI=y CONFIG_PCI_MSM=y -CONFIG_ENABLE_FP_SIMD_SETTINGS=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y From 0a3bee11ebe2d5da0d4432ec6530a708694bd3d4 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 15 Aug 2016 11:01:47 -0700 Subject: [PATCH 4/5] Revert "arm64: fpsimd: add support to enable/disable fpsimd_settings." This reverts commit 1f7d497b0ace ("arm64: fpsimd: add support to enable/disable fpsimd_settings."). Feature is not applicable to msmcobalt and only applicable to MSM8996. CRs-Fixed: 1054373 Change-Id: I8d11c596d61f0435f4ee2d1007f4903843650aed Signed-off-by: Satya Durga Srinivasu Prabhala --- arch/arm64/include/asm/elf.h | 2 ++ arch/arm64/kernel/fpsimd.c | 15 +-------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 99733665be07..6c0f3564f6a9 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -180,6 +180,8 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; #define compat_start_thread compat_start_thread #define COMPAT_SET_PERSONALITY(ex) \ do { \ + if (current->mm) \ + fpsimd_enable_trap(); \ set_thread_flag(TIF_32BIT); \ } while (0) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 74bc79e99717..10133c0c60f4 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -91,17 +90,11 @@ static DEFINE_PER_CPU(struct fpsimd_state *, fpsimd_last_state); static DEFINE_PER_CPU(int, fpsimd_stg_enable); -static int fpsimd_settings = 0x1; /* default = 0x1 */ -module_param(fpsimd_settings, int, 0644); - /* * Trapped FP/ASIMD access. */ void do_fpsimd_acc(unsigned int esr, struct pt_regs *regs) { - if (!fpsimd_settings) - return; - fpsimd_disable_trap(); fpsimd_settings_disable(); this_cpu_write(fpsimd_stg_enable, 0); @@ -109,9 +102,6 @@ void do_fpsimd_acc(unsigned int esr, struct pt_regs *regs) void do_fpsimd_acc_compat(unsigned int esr, struct pt_regs *regs) { - if (!fpsimd_settings) - return; - fpsimd_disable_trap(); fpsimd_settings_enable(); this_cpu_write(fpsimd_stg_enable, 1); @@ -154,7 +144,7 @@ void fpsimd_thread_switch(struct task_struct *next) if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) fpsimd_save_state(¤t->thread.fpsimd_state); - if (fpsimd_settings && __this_cpu_read(fpsimd_stg_enable)) { + if (__this_cpu_read(fpsimd_stg_enable)) { fpsimd_settings_disable(); this_cpu_write(fpsimd_stg_enable, 0); } @@ -177,9 +167,6 @@ void fpsimd_thread_switch(struct task_struct *next) set_ti_thread_flag(task_thread_info(next), TIF_FOREIGN_FPSTATE); - if (!fpsimd_settings) - return; - if (test_ti_thread_flag(task_thread_info(next), TIF_32BIT)) fpsimd_enable_trap(); else From c14c8b7e5568aee21796230b4d03e18d028fcda5 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 15 Aug 2016 11:03:23 -0700 Subject: [PATCH 5/5] Revert "arm64: fpsimd: Enable FP(floating-point) settings for msm8996" This reverts commit 2dae58c4af32 ("arm64: fpsimd: Enable FP(floating-point) settings for msm8996"). Feature is not applicable to msmcobalt and only applicable to MSM8996. CRs-Fixed: 1054373 Change-Id: I8f21787f0a45dd9f7be8986b4f332f498add3203 Signed-off-by: Satya Durga Srinivasu Prabhala --- arch/arm64/Kconfig | 10 ---------- arch/arm64/include/asm/elf.h | 9 +-------- arch/arm64/include/asm/fpsimd.h | 12 ------------ arch/arm64/kernel/entry-fpsimd.S | 32 -------------------------------- arch/arm64/kernel/entry.S | 13 +------------ arch/arm64/kernel/fpsimd.c | 23 ++--------------------- 6 files changed, 4 insertions(+), 95 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 706129c86096..0314b80695ca 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -513,16 +513,6 @@ config ARM64_64K_PAGES endchoice -config ENABLE_FP_SIMD_SETTINGS - bool "Enable FP(Floating Point) Settings for Qualcomm MSM8996" - depends on ARCH_MSM8996 - help - Enable FP(Floating Point) and SIMD settings for the MSM8996 during - the execution of the aarch32 processes and disable these settings - when you switch to the aarch64 processes. - - If you are not sure what to do, select 'N' here. - choice prompt "Virtual address space size" default ARM64_VA_BITS_39 if ARM64_4K_PAGES diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 6c0f3564f6a9..faad6df49e5b 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -23,7 +23,6 @@ */ #include #include -#include typedef unsigned long elf_greg_t; @@ -178,13 +177,7 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; ((x)->e_flags & EF_ARM_EABI_MASK)) #define compat_start_thread compat_start_thread -#define COMPAT_SET_PERSONALITY(ex) \ -do { \ - if (current->mm) \ - fpsimd_enable_trap(); \ - set_thread_flag(TIF_32BIT); \ -} while (0) - +#define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT); #define COMPAT_ARCH_DLINFO extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 355871b7022f..50f559f574fe 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -81,18 +81,6 @@ extern void fpsimd_save_partial_state(struct fpsimd_partial_state *state, u32 num_regs); extern void fpsimd_load_partial_state(struct fpsimd_partial_state *state); -#ifdef CONFIG_ENABLE_FP_SIMD_SETTINGS -extern void fpsimd_disable_trap(void); -extern void fpsimd_enable_trap(void); -extern void fpsimd_settings_disable(void); -extern void fpsimd_settings_enable(void); -#else -static inline void fpsimd_disable_trap(void) {} -static inline void fpsimd_enable_trap(void) {} -static inline void fpsimd_settings_disable(void) {} -static inline void fpsimd_settings_enable(void) {} -#endif - #endif #endif diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S index d90efa4852b2..c44a82f146b1 100644 --- a/arch/arm64/kernel/entry-fpsimd.S +++ b/arch/arm64/kernel/entry-fpsimd.S @@ -64,36 +64,4 @@ ENTRY(fpsimd_load_partial_state) ret ENDPROC(fpsimd_load_partial_state) -#ifdef CONFIG_ENABLE_FP_SIMD_SETTINGS -ENTRY(fpsimd_enable_trap) - mrs x0, cpacr_el1 - bic x0, x0, #(3 << 20) - orr x0, x0, #(1 << 20) - msr cpacr_el1, x0 - ret -ENDPROC(fpsimd_enable_trap) -ENTRY(fpsimd_disable_trap) - mrs x0, cpacr_el1 - orr x0, x0, #(3 << 20) - msr cpacr_el1, x0 - ret -ENDPROC(fpsimd_disable_trap) -ENTRY(fpsimd_settings_enable) - mrs x0, s3_1_c15_c15_0 - orr x0, x0, #(1 << 31) - isb - msr s3_1_c15_c15_0, x0 - isb - ret -ENDPROC(fpsimd_settings_enable) -ENTRY(fpsimd_settings_disable) - mrs x0, s3_1_c15_c15_0 - bic x0, x0, #(1 << 31) - isb - msr s3_1_c15_c15_0, x0 - isb - ret -ENDPROC(fpsimd_settings_disable) -#endif - #endif diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 485186bff022..e3131b39fbf2 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -427,7 +427,7 @@ el0_sync_compat: cmp x24, #ESR_ELx_EC_IABT_LOW // instruction abort in EL0 b.eq el0_ia cmp x24, #ESR_ELx_EC_FP_ASIMD // FP/ASIMD access - b.eq el0_fpsimd_acc_compat + b.eq el0_fpsimd_acc cmp x24, #ESR_ELx_EC_FP_EXC32 // FP/ASIMD exception b.eq el0_fpsimd_exc cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception @@ -498,17 +498,6 @@ el0_fpsimd_acc: mov x1, sp bl do_fpsimd_acc b ret_to_user -el0_fpsimd_acc_compat: - /* - * Floating Point or Advanced SIMD access - */ - enable_dbg - ct_user_exit - mov x0, x25 - mov x1, sp - bl do_fpsimd_acc_compat - b ret_to_user - el0_fpsimd_exc: /* * Floating Point or Advanced SIMD exception diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 10133c0c60f4..4c46c54a3ad7 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -88,23 +88,14 @@ * whatever is in the FPSIMD registers is not saved to memory, but discarded. */ static DEFINE_PER_CPU(struct fpsimd_state *, fpsimd_last_state); -static DEFINE_PER_CPU(int, fpsimd_stg_enable); /* * Trapped FP/ASIMD access. */ void do_fpsimd_acc(unsigned int esr, struct pt_regs *regs) { - fpsimd_disable_trap(); - fpsimd_settings_disable(); - this_cpu_write(fpsimd_stg_enable, 0); -} - -void do_fpsimd_acc_compat(unsigned int esr, struct pt_regs *regs) -{ - fpsimd_disable_trap(); - fpsimd_settings_enable(); - this_cpu_write(fpsimd_stg_enable, 1); + /* TODO: implement lazy context saving/restoring */ + WARN_ON(1); } /* @@ -144,11 +135,6 @@ void fpsimd_thread_switch(struct task_struct *next) if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) fpsimd_save_state(¤t->thread.fpsimd_state); - if (__this_cpu_read(fpsimd_stg_enable)) { - fpsimd_settings_disable(); - this_cpu_write(fpsimd_stg_enable, 0); - } - if (next->mm) { /* * If we are switching to a task whose most recent userland @@ -166,11 +152,6 @@ void fpsimd_thread_switch(struct task_struct *next) else set_ti_thread_flag(task_thread_info(next), TIF_FOREIGN_FPSTATE); - - if (test_ti_thread_flag(task_thread_info(next), TIF_32BIT)) - fpsimd_enable_trap(); - else - fpsimd_disable_trap(); } }