Skip to content

Commit bf14e3b

Browse files
committed
sysctl: Enable PARISC "unaligned-trap" to be used cross-arch
PARISC defines /proc/sys/kernel/unaligned-trap to runtime toggle unaligned access emulation. The exact mechanics of enablig/disabling are still arch specific, we can make the sysctl usable by other arches. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Acked-by: Helge Deller <deller@gmx.de> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Serge Hallyn <serge.hallyn@canonical.com>
1 parent 4d86dfb commit bf14e3b

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ config PARISC
2020
select ARCH_HAVE_NMI_SAFE_CMPXCHG
2121
select GENERIC_SMP_IDLE_THREAD
2222
select GENERIC_STRNCPY_FROM_USER
23+
select SYSCTL_ARCH_UNALIGN_ALLOW
2324
select HAVE_MOD_ARCH_SPECIFIC
2425
select MODULES_USE_ELF_RELA
2526
select CLONE_BACKWARDS

init/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,14 @@ config SYSCTL_EXCEPTION_TRACE
12321232
help
12331233
Enable support for /proc/sys/debug/exception-trace.
12341234

1235+
config SYSCTL_ARCH_UNALIGN_ALLOW
1236+
bool
1237+
help
1238+
Enable support for /proc/sys/kernel/unaligned-trap
1239+
Allows arches to define/use @unaligned_enabled to runtime toggle
1240+
the unaligned access emulation.
1241+
see arch/parisc/kernel/unaligned.c for reference
1242+
12351243
config KALLSYMS
12361244
bool "Load all symbols for debugging/ksymoops" if EXPERT
12371245
default y

kernel/sysctl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ extern int sysctl_tsb_ratio;
157157

158158
#ifdef __hppa__
159159
extern int pwrsw_enabled;
160+
#endif
161+
162+
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
160163
extern int unaligned_enabled;
161164
#endif
162165

@@ -545,6 +548,8 @@ static struct ctl_table kern_table[] = {
545548
.mode = 0644,
546549
.proc_handler = proc_dointvec,
547550
},
551+
#endif
552+
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
548553
{
549554
.procname = "unaligned-trap",
550555
.data = &unaligned_enabled,

0 commit comments

Comments
 (0)