diff options
| author | Satya Durga Srinivasu Prabhala <satyap@codeaurora.org> | 2016-08-15 10:20:54 -0700 |
|---|---|---|
| committer | Satya Durga Srinivasu Prabhala <satyap@codeaurora.org> | 2016-08-15 15:08:53 -0700 |
| commit | 4e6dcec1bd2adf5eb072fde7b51bac7a5d5744de (patch) | |
| tree | 628ffc798101bbc24f0a3ff083fa83eef0d3a282 /arch/arm64/kernel | |
| parent | fc3f95def2495ac08f1bac213a52acb934678097 (diff) | |
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 <satyap@codeaurora.org>
Diffstat (limited to 'arch/arm64/kernel')
| -rw-r--r-- | arch/arm64/kernel/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm64/kernel/app_api.c | 75 | ||||
| -rw-r--r-- | arch/arm64/kernel/app_setting.c | 120 | ||||
| -rw-r--r-- | arch/arm64/kernel/entry-fpsimd.S | 16 | ||||
| -rw-r--r-- | arch/arm64/kernel/fpsimd.c | 13 |
5 files changed, 16 insertions, 210 deletions
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 <linux/bitops.h> -#include <linux/spinlock.h> -#include <linux/cpu.h> -#include <linux/export.h> - -#include <asm/app_api.h> - -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 <linux/module.h> -#include <linux/cpu.h> -#include <linux/slab.h> -#include <linux/notifier.h> - -#include <asm/app_api.h> - -#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 <asm/fpsimd.h> #include <asm/cputype.h> -#include <asm/app_api.h> #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. */ |
