aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-12-13 23:13:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-12-13 23:13:05 -0500
commit4e746cf4f721d6397bace501f5feadb46eec1314 (patch)
treecdae0fd17a74cae07c5fb55c7112d8aa038b7837
parentd39a01eff9af1045f6e30ff9db40310517c4b45f (diff)
parent27b0174525325bf18919597016483a709f3372f8 (diff)
Merge tag 'riscv-for-linus-4.15-rc4-riscv_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux
Pull RISC-V fixes from Palmer Dabbelt: "This contains three small fixes: - A fix to a typo in sys_riscv_flush_icache. This only effects error handling, but I think it's a small and obvious enough change that it's sane outside the merge window. - The addition of smp_mb__after_spinlock(), which was recently removed due to an incorrect comment. This is largly a comment change (as there's a big one now), and while it's necessary for complience with the RISC-V memory model the lack of this fence shouldn't manifest as a bug on current implementations. Nonetheless, it still seems saner to have the fence in 4.15. - The removal of some of the HVC_RISCV_SBI driver that snuck into the arch port. This is compile-time dead code in 4.15 (as the driver isn't in yet), and during the review process we found a better way to implement early printk on RISC-V. While this change doesn't do anything, it will make staging our HVC driver easier: without this change the HVC driver we hope to upstream won't build on 4.15 (because the 4.15 arch code would reference a function that no longer exists). I don't think this is the last patch set we'll want for 4.15: I think I'll want to remove some of the first-level irqchip driver that snuck in as well, which will look a lot like the HVC patch here. This is pending some asm-generic cleanup I'm doing that I haven't quite gotten clean enough to send out yet, though, but hopefully it'll be ready by next week (and still OK for that late)" * tag 'riscv-for-linus-4.15-rc4-riscv_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux: RISC-V: Remove unused CONFIG_HVC_RISCV_SBI code RISC-V: Resurrect smp_mb__after_spinlock() RISC-V: Logical vs Bitwise typo
-rw-r--r--arch/riscv/include/asm/barrier.h19
-rw-r--r--arch/riscv/kernel/setup.c11
-rw-r--r--arch/riscv/kernel/sys_riscv.c2
3 files changed, 20 insertions, 12 deletions
diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h
index 773c4e039cd7..c0319cbf1eec 100644
--- a/arch/riscv/include/asm/barrier.h
+++ b/arch/riscv/include/asm/barrier.h
@@ -38,6 +38,25 @@
38#define smp_rmb() RISCV_FENCE(r,r) 38#define smp_rmb() RISCV_FENCE(r,r)
39#define smp_wmb() RISCV_FENCE(w,w) 39#define smp_wmb() RISCV_FENCE(w,w)
40 40
41/*
42 * This is a very specific barrier: it's currently only used in two places in
43 * the kernel, both in the scheduler. See include/linux/spinlock.h for the two
44 * orderings it guarantees, but the "critical section is RCsc" guarantee
45 * mandates a barrier on RISC-V. The sequence looks like:
46 *
47 * lr.aq lock
48 * sc lock <= LOCKED
49 * smp_mb__after_spinlock()
50 * // critical section
51 * lr lock
52 * sc.rl lock <= UNLOCKED
53 *
54 * The AQ/RL pair provides a RCpc critical section, but there's not really any
55 * way we can take advantage of that here because the ordering is only enforced
56 * on that one lock. Thus, we're just doing a full fence.
57 */
58#define smp_mb__after_spinlock() RISCV_FENCE(rw,rw)
59
41#include <asm-generic/barrier.h> 60#include <asm-generic/barrier.h>
42 61
43#endif /* __ASSEMBLY__ */ 62#endif /* __ASSEMBLY__ */
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 8fbb6749910d..cb7b0c63014e 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -38,10 +38,6 @@
38#include <asm/tlbflush.h> 38#include <asm/tlbflush.h>
39#include <asm/thread_info.h> 39#include <asm/thread_info.h>
40 40
41#ifdef CONFIG_HVC_RISCV_SBI
42#include <asm/hvc_riscv_sbi.h>
43#endif
44
45#ifdef CONFIG_DUMMY_CONSOLE 41#ifdef CONFIG_DUMMY_CONSOLE
46struct screen_info screen_info = { 42struct screen_info screen_info = {
47 .orig_video_lines = 30, 43 .orig_video_lines = 30,
@@ -212,13 +208,6 @@ static void __init setup_bootmem(void)
212 208
213void __init setup_arch(char **cmdline_p) 209void __init setup_arch(char **cmdline_p)
214{ 210{
215#if defined(CONFIG_HVC_RISCV_SBI)
216 if (likely(early_console == NULL)) {
217 early_console = &riscv_sbi_early_console_dev;
218 register_console(early_console);
219 }
220#endif
221
222#ifdef CONFIG_CMDLINE_BOOL 211#ifdef CONFIG_CMDLINE_BOOL
223#ifdef CONFIG_CMDLINE_OVERRIDE 212#ifdef CONFIG_CMDLINE_OVERRIDE
224 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 213 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c
index a2ae936a093e..79c78668258e 100644
--- a/arch/riscv/kernel/sys_riscv.c
+++ b/arch/riscv/kernel/sys_riscv.c
@@ -70,7 +70,7 @@ SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, uintptr_t, end,
70 bool local = (flags & SYS_RISCV_FLUSH_ICACHE_LOCAL) != 0; 70 bool local = (flags & SYS_RISCV_FLUSH_ICACHE_LOCAL) != 0;
71 71
72 /* Check the reserved flags. */ 72 /* Check the reserved flags. */
73 if (unlikely(flags & !SYS_RISCV_FLUSH_ICACHE_ALL)) 73 if (unlikely(flags & ~SYS_RISCV_FLUSH_ICACHE_ALL))
74 return -EINVAL; 74 return -EINVAL;
75 75
76 flush_icache_mm(mm, local); 76 flush_icache_mm(mm, local);