Skip to content

Commit 97bcbee

Browse files
brooniectmarinas
authored andcommitted
arm64/sve: Make sysctl interface for SVE reusable by SME
The vector length configuration for SME is very similar to that for SVE so in order to allow reuse refactor the SVE configuration so that it takes the vector type from the struct ctl_table. Since there's no dedicated space for this we repurpose the extra1 field to store the vector type, this is otherwise unused for integer sysctls. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent d58071a commit 97bcbee

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

arch/arm64/kernel/fpsimd.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/compiler.h>
1616
#include <linux/cpu.h>
1717
#include <linux/cpu_pm.h>
18+
#include <linux/ctype.h>
1819
#include <linux/kernel.h>
1920
#include <linux/linkage.h>
2021
#include <linux/irqflags.h>
@@ -406,12 +407,13 @@ static unsigned int find_supported_vector_length(enum vec_type type,
406407

407408
#if defined(CONFIG_ARM64_SVE) && defined(CONFIG_SYSCTL)
408409

409-
static int sve_proc_do_default_vl(struct ctl_table *table, int write,
410+
static int vec_proc_do_default_vl(struct ctl_table *table, int write,
410411
void *buffer, size_t *lenp, loff_t *ppos)
411412
{
412-
struct vl_info *info = &vl_info[ARM64_VEC_SVE];
413+
struct vl_info *info = table->extra1;
414+
enum vec_type type = info->type;
413415
int ret;
414-
int vl = get_sve_default_vl();
416+
int vl = get_default_vl(type);
415417
struct ctl_table tmp_table = {
416418
.data = &vl,
417419
.maxlen = sizeof(vl),
@@ -428,15 +430,16 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write,
428430
if (!sve_vl_valid(vl))
429431
return -EINVAL;
430432

431-
set_sve_default_vl(find_supported_vector_length(ARM64_VEC_SVE, vl));
433+
set_default_vl(type, find_supported_vector_length(type, vl));
432434
return 0;
433435
}
434436

435437
static struct ctl_table sve_default_vl_table[] = {
436438
{
437439
.procname = "sve_default_vector_length",
438440
.mode = 0644,
439-
.proc_handler = sve_proc_do_default_vl,
441+
.proc_handler = vec_proc_do_default_vl,
442+
.extra1 = &vl_info[ARM64_VEC_SVE],
440443
},
441444
{ }
442445
};
@@ -1107,7 +1110,7 @@ static void fpsimd_flush_thread_vl(enum vec_type type)
11071110
vl = get_default_vl(type);
11081111

11091112
if (WARN_ON(!sve_vl_valid(vl)))
1110-
vl = SVE_VL_MIN;
1113+
vl = vl_info[type].min_vl;
11111114

11121115
supported_vl = find_supported_vector_length(type, vl);
11131116
if (WARN_ON(supported_vl != vl))

0 commit comments

Comments
 (0)