Compare commits

...

79 Commits

Author SHA1 Message Date
David Abdurachmanov c9a88c57af Merge remote-tracking branch 'up/f31' into private-davidlt-try1 2019-09-28 06:49:02 +02:00
Laura Abbott 138f36aa16 bring in some x86 PCI ids 2019-09-26 16:21:16 -04:00
Peter Robinson b07dd9aa6f build for iwlwifi fix 2019-09-24 21:38:30 +01:00
Peter Robinson e0ac22bfc2 Upstream patch for iwlwifi 8000 series FW issues (rhbz: 1749949) 2019-09-24 15:16:01 +01:00
Laura Abbott 0498fb5dc5 Linux v5.3.1 2019-09-23 08:21:06 -04:00
Laura Abbott 06340ec177 Update to work with 5.x 2019-09-23 08:19:02 -04:00
David Abdurachmanov 51056b416e
Do not set CONFIG_SND_SOC_ES8328_SPI for riscv64
Error: Mismatches found in configuration files
Found CONFIG_SND_SOC_ES8328_SPI=is not set after generation, had CONFIG_SND_SOC_ES8328_SPI=n in Source tree

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-20 13:45:46 +03:00
David Abdurachmanov f5451a35e8
Update riscv64 configs
Error: Mismatches found in configuration files
Found # CONFIG_SND_SOC_ES8328 is not set, after generation, had CONFIG_SND_SOC_ES8328 m in Source tree

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-20 12:34:59 +03:00
David Abdurachmanov f7296f0f1f
Update riscv64 configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-20 12:04:20 +03:00
David Abdurachmanov 4874335a34
Update riscv64 configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-20 11:26:01 +03:00
David Abdurachmanov 6fe4640c1a
Remove obsolete patches
The TLB issues might have been solved within OpenSBI.
Networking for SiFive has been merged into the final v5.3.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-20 10:10:47 +03:00
Laura Abbott 9f3562b7a0 Add the patch 2019-09-19 17:41:06 -04:00
Laura Abbott a948dfad97 Fix for dwc3 (rhbz 1753099) 2019-09-19 17:36:19 -04:00
David Abdurachmanov 576b1ae843
Update RISCV (riscv64) configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-09-18 22:11:26 +03:00
David Abdurachmanov 98989ae15a Merge remote-tracking branch 'up/f31' into master-riscv64 2019-09-18 21:42:58 +03:00
David Abdurachmanov d67f20b6af
Switch to Image target for kernel on RISC-V
Starting 5.3 kernel Image and Image.gz incl. 64 bytes header for
bootloaders. For example this can be used with U-Boot booti command,
which currently doesn't support compressed Image.gz. This also means
that we do not need to wrap kernel and initramfs for U-Boot.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-27 20:44:52 -07:00
David Abdurachmanov c02a88f6c2 Merge remote-tracking branch 'up/master' into master-riscv64 2019-08-27 20:44:01 -07:00
David Abdurachmanov 61f194cc7d
Add a fix for TLB flush
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-25 02:06:56 -07:00
David Abdurachmanov 1eeb636d12
Fix patch filename
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-25 00:40:26 -07:00
David Abdurachmanov 43dcced80c
Update out-of-tree patches for RISC-V (riscv64)
- SECCOMP v2 was posted for review (one failing kernel selftest)
- SiFive Ethernet driver is approved upstream and might land in 5.3
- SiFive CPUFreq support is WIP, but people reported it working

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-25 00:03:31 -07:00
David Abdurachmanov c12dd026dd
Update RISC-V (riscv64) configs
New options added:

CONFIG_SOC_SIFIVE=y
CONFIG_EDAC_SIFIVE=y
CONFIG_PWM_SIFIVE=y

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 23:10:49 -07:00
David Abdurachmanov 6bc8810bf1
Regenerate configs for RISC-V (riscv64)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 15:50:26 -07:00
David Abdurachmanov e765a7ca2e
Build DTB for RISC-V (riscv64)
We need these for FSBL (SiFive Unleashed board) and OpenSBI.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 15:48:34 -07:00
David Abdurachmanov 0ebe98255d
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 15:46:48 -07:00
David Abdurachmanov 77b49c9b18
Update riscv configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-07-02 15:21:10 +03:00
David Abdurachmanov b54ad78b02
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-07-02 15:16:59 +03:00
David Abdurachmanov ecef7281d5
Update SECCOMP patch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-24 19:01:53 +03:00
David Abdurachmanov 5e0efa7c70
Fix patch format
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-24 17:50:29 +03:00
David Abdurachmanov 6d70f5be5f
Fix Release
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-24 17:24:38 +03:00
David Abdurachmanov 601e6a0b25
Add support for SECCOMP (v2)
The patch is added for testing before publishing on linux-riscv.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-24 17:15:53 +03:00
David Abdurachmanov 394552ce0a
Update configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-20 20:03:51 +03:00
David Abdurachmanov 509fb7c884
Remove obsolete patch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-20 19:25:19 +03:00
David Abdurachmanov 8a92f6bb9e
Update RISC-V configs (incl. new SiFive drivers)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-20 18:45:40 +03:00
David Abdurachmanov 0be8868348 Merge remote-tracking branch 'up/master' into master-riscv64 2019-06-20 18:13:25 +03:00
David Abdurachmanov afe42142a2
Update RISC-V configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-05-04 21:03:00 +03:00
David Abdurachmanov f27a56dd4f
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-05-04 21:02:37 +03:00
David Abdurachmanov 8c11451ed6
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-11 10:08:13 +02:00
David Abdurachmanov 6a92c8e473
Update RISC-V (riscv64) configs
Solves:

  Found CONFIG_NF_REJECT_IPV4=y after generation, had CONFIG_NF_REJECT_IPV4=m in Source tree

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-03 23:31:11 +02:00
David Abdurachmanov 985dca2019
Update RISC-V (riscv64) configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-03 22:21:01 +02:00
David Abdurachmanov da7a473ed6
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-03 22:20:03 +02:00
David Abdurachmanov 32d304786a
Bump release
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-19 14:42:55 +01:00
David Abdurachmanov 9d19b9acba
Build Image.gz
Note, that currently BBL and OpenSBI would require manually
uncompressing it for usage. U-boot will support compressed kernel
payloads.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-19 14:41:11 +01:00
David Abdurachmanov 73b70fe83d
Update configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-18 18:13:56 +01:00
David Abdurachmanov 08e119a980
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-18 17:57:55 +01:00
David Abdurachmanov 512dd80333
Fix ARM_TIMER_SP804 on RISC-V
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-09 20:51:43 +01:00
David Abdurachmanov da577e4814
Update riscv64 configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-09 20:15:46 +01:00
David Abdurachmanov e644ae139d
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-09 20:08:11 +01:00
David Abdurachmanov 4d63228929
riscv: fix ARM_TIMER_SP804 (again)
Bring back 6f9cf326c7

[..]
Found unset config items, please set them to an appropriate value
CONFIG_ARM_TIMER_SP804=n
[..]

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-02-18 12:27:07 +01:00
David Abdurachmanov d932ad52cf
Regenerate riscv64 configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-02-18 11:54:52 +01:00
David Abdurachmanov 625fa4a062
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-02-18 11:54:01 +01:00
David Abdurachmanov 6f9cf326c7
riscv: fix ARM_TIMER_SP804
[..]
Found unset config items, please set them to an appropriate value
CONFIG_ARM_TIMER_SP804=n
[..]

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-01-15 03:36:51 +01:00
David Abdurachmanov a0a6f7a375
riscv: update config
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-01-15 03:33:20 +01:00
David Abdurachmanov fc9138ad11
riscv: update config
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-01-15 02:11:24 +01:00
David Abdurachmanov ff3e5b658b
riscv: regenerate configs (enable CONFIG_AUDIT)
Audit support for Linux was merged in 5.0-rc2.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-01-15 01:23:20 +01:00
David Abdurachmanov 9db5e7124c
Remove riscv64-fixes.patch
All the changes are finalized in upstream.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-01-15 01:19:46 +01:00
David Abdurachmanov c84bdfed84 Merge remote-tracking branch 'up/master' into master-riscv64 2019-01-15 01:14:08 +01:00
David Abdurachmanov f49ba59706
riscv: bring back syscalls.h and enable ARCH_HAS_SG_CHAIN
ARCH_HAS_SG_CHAIN change should land in upstream 4.21.
syscalls.h header is being used by glibc.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-12-06 10:18:35 +01:00
David Abdurachmanov e9615025d3
riscv: regenerate configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-12-06 09:56:38 +01:00
David Abdurachmanov 6e04e00c1f Merge remote-tracking branch 'up/master' into master-riscv64 2018-12-06 09:55:58 +01:00
David Abdurachmanov 24ef14817b
riscv: remove obsolete patch (upstreamed)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-26 21:51:40 +01:00
David Abdurachmanov f72820cd8f
Move CONFIG_ARCH_RV64I to generic/riscv/riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-26 21:03:11 +01:00
David Abdurachmanov 4b722cac34 Merge remote-tracking branch 'up/master' into f29-riscv64 2018-11-26 21:01:11 +01:00
David Abdurachmanov 22e71c9173
Merge remote-tracking branch 'up/master' into f29-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-20 22:56:58 +01:00
David Abdurachmanov bf6565ba91
riscv64: update configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-20 10:14:20 +01:00
David Abdurachmanov 7a2f3d62e7
Merge remote-tracking branch 'up/master' into f29-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-20 09:59:17 +01:00
David Abdurachmanov 6afa6a1d1d
Add riscv to create_headers_tarball.sh (needed for kernel-headers)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-10 15:56:46 +01:00
David Abdurachmanov 61da5462ab
riscv: we don't have /lib/modules/../dtb
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-08 19:40:50 +01:00
David Abdurachmanov 1838232458
riscv: rebuild configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-08 08:31:25 +01:00
David Abdurachmanov 8d4ff40415
riscv: modify CONFIG_* options
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-08 07:02:28 +01:00
David Abdurachmanov f47d31c65b
riscv: update CONFIG_* options
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-08 00:02:51 +01:00
David Abdurachmanov 80112e26ae
riscv: set CONFIG_FRAME_WARN to 2048 (lower is unrealistic)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-07 22:15:53 +01:00
David Abdurachmanov 676aad9847
riscv: fix vdso_install and a warning
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-07 22:11:46 +01:00
David Abdurachmanov 65627459ed Merge remote-tracking branch 'up/master' into riscv64 2018-11-07 21:22:49 +01:00
David Abdurachmanov fd01e1b407
riscv: change CONFIG_* options
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 19:20:06 +01:00
David Abdurachmanov e93b45642b
riscv: adjust CONFIG_* options again
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 17:19:04 +01:00
David Abdurachmanov 088edc4af9
riscv: re-gen configs
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 16:28:28 +01:00
David Abdurachmanov 681c2dab76
riscv: add missing CONFIG_* options
Found unset config items, please set them to an appropriate value
CONFIG_ARCH_RV32I=n
CONFIG_ARCH_RV64I=y
CONFIG_CMODEL_MEDLOW=n
CONFIG_CMODEL_MEDANY=y
CONFIG_MAXPHYSMEM_2GB=n
CONFIG_MAXPHYSMEM_128GB=y
CONFIG_NR_CPUS=8
CONFIG_TUNE_GENERIC=y
CONFIG_RISCV_ISA_C=y
CONFIG_RISCV_BASE_PMU=y
CONFIG_FPU=y
CONFIG_CMDLINE_BOOL=n
CONFIG_PCIE_CADENCE_EP=n
CONFIG_PCI_ENDPOINT_CONFIGFS=n
CONFIG_PCI_EPF_TEST=n
CONFIG_NETWORK_SECMARK=n
CONFIG_NETFILTER_XT_TARGET_HL=m
CONFIG_MTD_OF_PARTS=m
CONFIG_OF_UNITTEST=n
CONFIG_OF_OVERLAY=n
CONFIG_KEYBOARD_BCM=n
CONFIG_GPIO_74XX_MMIO=n
CONFIG_POWER_RESET_GPIO=n
CONFIG_POWER_RESET_GPIO_RESTART=n
CONFIG_THERMAL=m
CONFIG_FB_SSD1307=n
CONFIG_SND_SOC_AC97_CODEC=n
CONFIG_SND_SOC_ES8328_I2C=n
CONFIG_SIFIVE_PLIC=n
CONFIG_PROFILE_ALL_BRANCHES=n

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 15:51:18 +01:00
David Abdurachmanov 7094da6400
riscv: change kernel image
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 14:57:46 +01:00
David Abdurachmanov b3c173bfe0
Add initial RISC-V 64-bit (riscv64) support
UNTESTED

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-11-03 14:36:46 +01:00
260 changed files with 13108 additions and 26 deletions

View File

@ -0,0 +1,184 @@
From 0cb0b507d7eaff090b2607799de3acad464fa446 Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
Date: Mon, 24 Jun 2019 18:58:45 +0300
Subject: [PATCH] riscv: add SECCOMP support
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 0c4b12205632..6f89a83c1e9c 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -30,6 +30,7 @@ config RISCV
select GENERIC_SMP_IDLE_THREAD
select GENERIC_ATOMIC64 if !64BIT
select HAVE_ARCH_AUDITSYSCALL
+ select HAVE_ARCH_SECCOMP_FILTER
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_DMA_CONTIGUOUS
select HAVE_FUTEX_CMPXCHG if FUTEX
@@ -223,6 +224,19 @@ menu "Kernel features"
source "kernel/Kconfig.hz"
+config SECCOMP
+ bool "Enable seccomp to safely compute untrusted bytecode"
+ help
+ This kernel feature is useful for number crunching applications
+ that may need to compute untrusted bytecode during their
+ execution. By using pipes or other transports made available to
+ the process as file descriptors supporting the read/write
+ syscalls, it's possible to isolate those applications in
+ their own address space using seccomp. Once seccomp is
+ enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
+ and the task is only allowed to execute a few safe syscalls
+ defined by each seccomp mode.
+
endmenu
menu "Boot options"
diff --git a/arch/riscv/include/asm/seccomp.h b/arch/riscv/include/asm/seccomp.h
new file mode 100644
index 000000000000..bf7744ee3b3d
--- /dev/null
+++ b/arch/riscv/include/asm/seccomp.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_SECCOMP_H
+#define _ASM_SECCOMP_H
+
+#include <asm/unistd.h>
+
+#include <asm-generic/seccomp.h>
+
+#endif /* _ASM_SECCOMP_H */
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
index 905372d7eeb8..a0b2a29a0da1 100644
--- a/arch/riscv/include/asm/thread_info.h
+++ b/arch/riscv/include/asm/thread_info.h
@@ -75,6 +75,7 @@ struct thread_info {
#define TIF_MEMDIE 5 /* is terminating due to OOM killer */
#define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing */
+#define TIF_SECCOMP 8 /* syscall secure computing */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@@ -82,11 +83,13 @@ struct thread_info {
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
+#define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_WORK_MASK \
(_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED)
#define _TIF_SYSCALL_WORK \
- (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT)
+ (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT | \
+ _TIF_SECCOMP )
#endif /* _ASM_RISCV_THREAD_INFO_H */
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index bc7a56e1ca6f..0bbedfa3e47d 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -203,8 +203,25 @@ check_syscall_nr:
/* Check to make sure we don't jump to a bogus syscall number. */
li t0, __NR_syscalls
la s0, sys_ni_syscall
- /* Syscall number held in a7 */
- bgeu a7, t0, 1f
+ /*
+ * The tracer can change syscall number to valid/invalid value.
+ * We use syscall_set_nr helper in syscall_trace_enter thus we
+ * cannot trust the current value in a7 and have to reload from
+ * the current task pt_regs.
+ */
+ REG_L a7, PT_A7(sp)
+ /*
+ * Syscall number held in a7.
+ * If syscall number is above allowed value, redirect to ni_syscall.
+ */
+ bge a7, t0, 1f
+ /*
+ * Check if syscall is rejected by tracer or seccomp, i.e., a7 == -1.
+ * If yes, we pretend it was executed.
+ */
+ li t1, -1
+ beq a7, t1, ret_from_syscall_rejected
+ /* Call syscall */
la s0, sys_call_table
slli t0, a7, RISCV_LGPTR
add s0, s0, t0
@@ -215,6 +232,12 @@ check_syscall_nr:
ret_from_syscall:
/* Set user a0 to kernel a0 */
REG_S a0, PT_A0(sp)
+ /*
+ * We didn't execute the actual syscall.
+ * Seccomp already set return value for the current task pt_regs.
+ * (If it was configured with SECCOMP_RET_ERRNO/TRACE)
+ */
+ret_from_syscall_rejected:
/* Trace syscalls, but only if requested by the user. */
REG_L t0, TASK_TI_FLAGS(tp)
andi t0, t0, _TIF_SYSCALL_WORK
diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index 368751438366..63e47c9f85f0 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -154,6 +154,16 @@ void do_syscall_trace_enter(struct pt_regs *regs)
if (tracehook_report_syscall_entry(regs))
syscall_set_nr(current, regs, -1);
+ /*
+ * Do the secure computing after ptrace; failures should be fast.
+ * If this fails we might have return value in a0 from seccomp
+ * (via SECCOMP_RET_ERRNO/TRACE).
+ */
+ if (secure_computing(NULL) == -1) {
+ syscall_set_nr(current, regs, -1);
+ return;
+ }
+
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
trace_sys_enter(regs, syscall_get_nr(current, regs));
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index dc66fe852768..e30864b25fb5 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -112,6 +112,8 @@ struct seccomp_data {
# define __NR_seccomp 383
# elif defined(__aarch64__)
# define __NR_seccomp 277
+# elif defined(__riscv)
+# define __NR_seccomp 277
# elif defined(__hppa__)
# define __NR_seccomp 338
# elif defined(__powerpc__)
@@ -1582,6 +1584,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
# define ARCH_REGS struct user_pt_regs
# define SYSCALL_NUM regs[8]
# define SYSCALL_RET regs[0]
+#elif defined(__riscv) && __riscv_xlen == 64
+# define ARCH_REGS struct user_regs_struct
+# define SYSCALL_NUM a7
+# define SYSCALL_RET a0
#elif defined(__hppa__)
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM gr[20]
@@ -1671,7 +1677,7 @@ void change_syscall(struct __test_metadata *_metadata,
EXPECT_EQ(0, ret) {}
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
- defined(__s390__) || defined(__hppa__)
+ defined(__s390__) || defined(__hppa__) || defined(__riscv)
{
regs.SYSCALL_NUM = syscall;
}
--
2.21.0

View File

@ -0,0 +1,92 @@
From af4e1c5eca95bed1192d8dc45c8ed63aea2209e8 Mon Sep 17 00:00:00 2001
From: Marcel Bocu <marcel.p.bocu@gmail.com>
Date: Mon, 22 Jul 2019 20:45:10 +0300
Subject: [PATCH] x86/amd_nb: Add PCI device IDs for family 17h, model 70h
The AMD Ryzen gen 3 processors came with a different PCI IDs for the
function 3 & 4 which are used to access the SMN interface. The root
PCI address however remained at the same address as the model 30h.
Adding the F3/F4 PCI IDs respectively to the misc and link ids appear
to be sufficient for k10temp, so let's add them and follow up on the
patch if other functions need more tweaking.
Vicki Pfau sent an identical patch after I checked that no-one had
written this patch. I would have been happy about dropping my patch but
unlike for his patch series, I had already Cc:ed the x86 people and
they already reviewed the changes. Since Vicki has not answered to
any email after his initial series, let's assume she is on vacation
and let's avoid duplication of reviews from the maintainers and merge
my series. To acknowledge Vicki's anteriority, I added her S-o-b to
the patch.
v2, suggested by Guenter Roeck and Brian Woods:
- rename from 71h to 70h
Signed-off-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Marcel Bocu <marcel.p.bocu@gmail.com>
Tested-by: Marcel Bocu <marcel.p.bocu@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Brian Woods <brian.woods@amd.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci_ids.h
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: "Woods, Brian" <Brian.Woods@amd.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Link: https://lore.kernel.org/r/20190722174510.2179-1-marcel.p.bocu@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
arch/x86/kernel/amd_nb.c | 3 +++
include/linux/pci_ids.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index d63e63b7d1d9..251c795b4eb3 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -21,6 +21,7 @@
#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464
#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494
+#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444
/* Protect the PCI config register pairs used for SMN and DF indirect access. */
static DEFINE_MUTEX(smn_mutex);
@@ -50,6 +51,7 @@ const struct pci_device_id amd_nb_misc_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) },
{}
};
EXPORT_SYMBOL_GPL(amd_nb_misc_ids);
@@ -63,6 +65,7 @@ static const struct pci_device_id amd_nb_link_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) },
{}
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c842735a4f45..4b97f427cc92 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -548,6 +548,7 @@
#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463
#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493
+#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443
#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
#define PCI_DEVICE_ID_AMD_LANCE 0x2000
#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
--
2.21.0

View File

@ -0,0 +1,140 @@
From 8d741d97eeb3a0c1b9aa09da15fbb1c5c7214fcd Mon Sep 17 00:00:00 2001
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
Date: Sun, 25 Aug 2019 06:58:34 +0000
Subject: [PATCH 2/2] SiFive Unleashed CPUFreq
Signed-off-by: Fedora Kernel Team <kernel-team@fedoraproject.org>
---
arch/riscv/Kconfig | 8 +++++
arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 5 +++
.../boot/dts/sifive/hifive-unleashed-a00.dts | 34 +++++++++++++++++++
arch/riscv/configs/defconfig | 5 +++
4 files changed, 52 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 441e63f..ccd590c 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -298,6 +298,14 @@ endchoice
endmenu
+menu "CPU Power Management"
+
+source "drivers/cpuidle/Kconfig"
+
+source "drivers/cpufreq/Kconfig"
+
+endmenu
+
menu "Power management options"
source "kernel/power/Kconfig"
diff --git a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
index 42b5ec2..b07079f 100644
--- a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
+++ b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
@@ -29,6 +29,7 @@
i-cache-size = <16384>;
reg = <0>;
riscv,isa = "rv64imac";
+ clocks = <&prci PRCI_CLK_COREPLL>;
status = "disabled";
cpu0_intc: interrupt-controller {
#interrupt-cells = <1>;
@@ -53,6 +54,7 @@
reg = <1>;
riscv,isa = "rv64imafdc";
tlb-split;
+ clocks = <&prci PRCI_CLK_COREPLL>;
cpu1_intc: interrupt-controller {
#interrupt-cells = <1>;
compatible = "riscv,cpu-intc";
@@ -77,6 +79,7 @@
reg = <2>;
riscv,isa = "rv64imafdc";
tlb-split;
+ clocks = <&prci PRCI_CLK_COREPLL>;
cpu2_intc: interrupt-controller {
#interrupt-cells = <1>;
compatible = "riscv,cpu-intc";
@@ -101,6 +104,7 @@
reg = <3>;
riscv,isa = "rv64imafdc";
tlb-split;
+ clocks = <&prci PRCI_CLK_COREPLL>;
cpu3_intc: interrupt-controller {
#interrupt-cells = <1>;
compatible = "riscv,cpu-intc";
@@ -125,6 +129,7 @@
reg = <4>;
riscv,isa = "rv64imafdc";
tlb-split;
+ clocks = <&prci PRCI_CLK_COREPLL>;
cpu4_intc: interrupt-controller {
#interrupt-cells = <1>;
compatible = "riscv,cpu-intc";
diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index 54fc701..5b43bdf 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -40,6 +40,40 @@
clock-frequency = <RTCCLK_FREQ>;
clock-output-names = "rtcclk";
};
+
+ fu540_c000_opp_table: opp-table {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp-350000000 {
+ opp-hz = /bits/ 64 <350000000>;
+ };
+ opp-700000000 {
+ opp-hz = /bits/ 64 <700000000>;
+ };
+ opp-999999999 {
+ opp-hz = /bits/ 64 <999999999>;
+ };
+ opp-1400000000 {
+ opp-hz = /bits/ 64 <1400000000>;
+ };
+ };
+};
+
+&cpu0 {
+ operating-points-v2 = <&fu540_c000_opp_table>;
+};
+&cpu1 {
+ operating-points-v2 = <&fu540_c000_opp_table>;
+};
+&cpu2 {
+ operating-points-v2 = <&fu540_c000_opp_table>;
+};
+&cpu3 {
+ operating-points-v2 = <&fu540_c000_opp_table>;
+};
+&cpu4 {
+ operating-points-v2 = <&fu540_c000_opp_table>;
};
&uart0 {
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 3efff55..c9542a9 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -16,6 +16,11 @@ CONFIG_EXPERT=y
CONFIG_BPF_SYSCALL=y
CONFIG_SOC_SIFIVE=y
CONFIG_SMP=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_STAT=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+CONFIG_CPUFREQ_DT=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_NET=y
--
2.23.0

View File

@ -81,6 +81,8 @@ function merge_configs()
echo "# arm64" > $name
elif [ "x$arch" == "xppc64le" ]; then
echo "# powerpc" > $name
elif [ "x$arch" == "xriscv64" ]; then
echo "# riscv" > $name
elif [ "x$arch" == "xs390x" ]; then
echo "# s390" > $name
elif [ "x$arch" == "xarmv7hl" ]; then

View File

@ -28,6 +28,10 @@ s390x-debug=generic:generic-s390x:debug
aarch64=generic:generic-arm:generic-arm-aarch64
aarch64-debug=generic:generic-arm:generic-arm-aarch64:debug:debug-arm
# riscv64
riscv64=generic:generic-riscv:generic-riscv-riscv64
riscv64-debug=generic:generic-riscv:generic-riscv-riscv64:debug
# arm
armv7hl=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-armv7
armv7hl-debug=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-armv7:debug:debug-arm

View File

@ -0,0 +1 @@
# CONFIG_ARM_TIMER_SP804 is not set

View File

@ -0,0 +1 @@
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m

View File

@ -0,0 +1 @@
# CONFIG_ARCH_RV32I is not set

View File

@ -0,0 +1 @@
CONFIG_AUTOFS4_FS=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV_BSG=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV_DM=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV_DM_BUILTIN=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV_LOOP=y

View File

@ -0,0 +1 @@
CONFIG_BLK_DEV_NBD=y

View File

@ -0,0 +1 @@
CONFIG_BRIDGE=y

View File

@ -0,0 +1 @@
CONFIG_BTRFS_FS_POSIX_ACL=y

View File

@ -0,0 +1 @@
CONFIG_CFS_BANDWIDTH=y

View File

@ -0,0 +1 @@
CONFIG_CGROUPS=y

View File

@ -0,0 +1 @@
CONFIG_CGROUP_SCHED=y

View File

@ -0,0 +1 @@
CONFIG_CHECKPOINT_RESTORE=y

View File

@ -0,0 +1 @@
CONFIG_CLK_SIFIVE=y

View File

@ -0,0 +1 @@
CONFIG_CLK_SIFIVE_FU540_PRCI=y

View File

@ -0,0 +1 @@
CONFIG_CMDLINE=""

View File

@ -0,0 +1 @@
# CONFIG_CMDLINE_BOOL is not set

View File

@ -0,0 +1 @@
CONFIG_CMODEL_MEDANY=y

View File

@ -0,0 +1 @@
# CONFIG_CMODEL_MEDLOW is not set

View File

@ -0,0 +1 @@
CONFIG_CPUFREQ_DT=y

View File

@ -0,0 +1 @@
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set

View File

@ -0,0 +1 @@
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER_API=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER_API_AEAD=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER_API_HASH=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER_API_RNG=y

View File

@ -0,0 +1 @@
CONFIG_CRYPTO_USER_API_SKCIPHER=y

View File

@ -0,0 +1 @@
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y

View File

@ -0,0 +1 @@
CONFIG_DEVTMPFS=y

View File

@ -0,0 +1 @@
CONFIG_DMIID=y

View File

@ -0,0 +1 @@
CONFIG_DM_BIO_PRISON=y

View File

@ -0,0 +1 @@
CONFIG_DM_BUFIO=y

View File

@ -0,0 +1 @@
CONFIG_DM_CACHE=y

View File

@ -0,0 +1 @@
CONFIG_DM_CACHE_SMQ=y

View File

@ -0,0 +1 @@
CONFIG_DM_CRYPT=y

View File

@ -0,0 +1 @@
CONFIG_DM_DEBUG=y

View File

@ -0,0 +1 @@
CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING=y

View File

@ -0,0 +1 @@
CONFIG_DM_DELAY=y

View File

@ -0,0 +1 @@
CONFIG_DM_FLAKEY=y

View File

@ -0,0 +1 @@
CONFIG_DM_INTEGRITY=y

View File

@ -0,0 +1 @@
CONFIG_DM_LOG_USERSPACE=y

View File

@ -0,0 +1 @@
CONFIG_DM_LOG_WRITES=y

View File

@ -0,0 +1 @@
CONFIG_DM_MIRROR=y

View File

@ -0,0 +1 @@
CONFIG_DM_MULTIPATH=y

View File

@ -0,0 +1 @@
CONFIG_DM_MULTIPATH_QL=y

View File

@ -0,0 +1 @@
CONFIG_DM_MULTIPATH_ST=y

View File

@ -0,0 +1 @@
CONFIG_DM_PERSISTENT_DATA=y

View File

@ -0,0 +1 @@
CONFIG_DM_RAID=y

View File

@ -0,0 +1 @@
CONFIG_DM_SNAPSHOT=y

View File

@ -0,0 +1 @@
CONFIG_DM_SWITCH=y

View File

@ -0,0 +1 @@
CONFIG_DM_THIN_PROVISIONING=y

View File

@ -0,0 +1 @@
CONFIG_DM_UEVENT=y

View File

@ -0,0 +1 @@
CONFIG_DM_UNSTRIPED=y

View File

@ -0,0 +1 @@
CONFIG_DM_VERITY=y

View File

@ -0,0 +1 @@
CONFIG_DM_VERITY_FEC=y

View File

@ -0,0 +1 @@
CONFIG_DM_ZERO=y

View File

@ -0,0 +1 @@
CONFIG_DM_ZONED=y

View File

@ -0,0 +1 @@
CONFIG_DNS_RESOLVER=y

View File

@ -0,0 +1 @@
CONFIG_DRM_PANEL=y

View File

@ -0,0 +1 @@
CONFIG_DRM_VIRTIO_GPU=m

View File

@ -0,0 +1 @@
CONFIG_EDAC_SIFIVE=y

View File

@ -0,0 +1 @@
CONFIG_EFIVAR_FS=y

View File

@ -0,0 +1 @@
CONFIG_EFI_PARTITION=y

View File

@ -0,0 +1 @@
CONFIG_EPOLL=y

View File

@ -0,0 +1 @@
CONFIG_EXT4_FS=y

View File

@ -0,0 +1 @@
CONFIG_EXT4_FS_SECURITY=y

View File

@ -0,0 +1 @@
CONFIG_EXT4_POSIX_ACL=y

View File

@ -0,0 +1 @@
CONFIG_FAILOVER=y

View File

@ -0,0 +1 @@
CONFIG_FAIR_GROUP_SCHED=y

View File

@ -0,0 +1 @@
# CONFIG_FB_SSD1307 is not set

View File

@ -0,0 +1 @@
CONFIG_FHANDLE=y

View File

@ -0,0 +1 @@
CONFIG_FILE_LOCKING=y

View File

@ -0,0 +1 @@
CONFIG_FPU=y

View File

@ -0,0 +1 @@
CONFIG_FRAME_WARN=2048

View File

@ -0,0 +1 @@
# CONFIG_FW_LOADER_USER_HELPER is not set

View File

@ -0,0 +1 @@
CONFIG_GENERIC_PHY=y

View File

@ -0,0 +1 @@
# CONFIG_GPIO_74XX_MMIO is not set

View File

@ -0,0 +1 @@
CONFIG_HOTPLUG_PCI=y

View File

@ -0,0 +1 @@
CONFIG_HOTPLUG_PCI_PCIE=y

View File

@ -0,0 +1 @@
CONFIG_HVC_RISCV_SBI=y

View File

@ -0,0 +1 @@
CONFIG_I2C_MUX=m

View File

@ -0,0 +1 @@
CONFIG_INET=y

View File

@ -0,0 +1 @@
CONFIG_INOTIFY_USER=y

View File

@ -0,0 +1 @@
CONFIG_INPUT_MATRIXKMAP=m

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_FILTER=y

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_IPTABLES=y

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_MANGLE=y

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_NAT=y

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_RAW=y

View File

@ -0,0 +1 @@
CONFIG_IP6_NF_TARGET_REJECT=y

View File

@ -0,0 +1 @@
CONFIG_IPV6=y

Some files were not shown because too many files have changed in this diff Show More