Skip to content

Commit dfdcff3

Browse files
committed
Merge tag 'riscv/for-v5.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley: "Some RISC-V fixes: - Fix the virtual memory layout so the fixaddr region doesn't overlap with other regions. (This was originally intended to go in as part of an earlier patch, but I inadvertently dropped it during a rebase) - Add the DT chosen/stdout-path property to the HiFive Unleashed DT file. This is so "earlycon" can be specified with no arguments on the kernel command line, and the correct UART will be automatically selected. And two cleanup patches: - Simplify the code in our breakpoint trap handler. - Drop a comment in our TLB flush code that has caused some confusion" * tag 'riscv/for-v5.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START riscv: tlbflush: remove confusing comment on local_flush_tlb_all() riscv: dts: HiFive Unleashed: add default chosen/stdout-path riscv: remove the switch statement in do_trap_break()
2 parents b9959c7 + 5bf4e52 commit dfdcff3

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
compatible = "sifive,hifive-unleashed-a00", "sifive,fu540-c000";
1414

1515
chosen {
16+
stdout-path = "serial0";
1617
};
1718

1819
cpus {

arch/riscv/include/asm/pgtable.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[];
8787
#define VMALLOC_END (PAGE_OFFSET - 1)
8888
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
8989

90-
#define FIXADDR_TOP VMALLOC_START
91-
#ifdef CONFIG_64BIT
92-
#define FIXADDR_SIZE PMD_SIZE
93-
#else
94-
#define FIXADDR_SIZE PGDIR_SIZE
95-
#endif
96-
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
97-
9890
/*
9991
* Roughly size the vmemmap space to be large enough to fit enough
10092
* struct pages to map half the virtual address space. Then
@@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[];
108100

109101
#define vmemmap ((struct page *)VMEMMAP_START)
110102

103+
#define FIXADDR_TOP (VMEMMAP_START)
104+
#ifdef CONFIG_64BIT
105+
#define FIXADDR_SIZE PMD_SIZE
106+
#else
107+
#define FIXADDR_SIZE PGDIR_SIZE
108+
#endif
109+
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
110+
111111
/*
112112
* ZERO_PAGE is a global shared page that is always zero,
113113
* used for zero-mapped memory areas, etc.

arch/riscv/include/asm/tlbflush.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#include <linux/mm_types.h>
1111
#include <asm/smp.h>
1212

13-
/*
14-
* Flush entire local TLB. 'sfence.vma' implicitly fences with the instruction
15-
* cache as well, so a 'fence.i' is not necessary.
16-
*/
1713
static inline void local_flush_tlb_all(void)
1814
{
1915
__asm__ __volatile__ ("sfence.vma" : : : "memory");

arch/riscv/kernel/traps.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,24 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
124124

125125
asmlinkage void do_trap_break(struct pt_regs *regs)
126126
{
127-
if (!user_mode(regs)) {
127+
if (user_mode(regs)) {
128+
force_sig_fault(SIGTRAP, TRAP_BRKPT,
129+
(void __user *)(regs->sepc));
130+
return;
131+
}
132+
#ifdef CONFIG_GENERIC_BUG
133+
{
128134
enum bug_trap_type type;
129135

130136
type = report_bug(regs->sepc, regs);
131-
switch (type) {
132-
#ifdef CONFIG_GENERIC_BUG
133-
case BUG_TRAP_TYPE_WARN:
137+
if (type == BUG_TRAP_TYPE_WARN) {
134138
regs->sepc += get_break_insn_length(regs->sepc);
135139
return;
136-
case BUG_TRAP_TYPE_BUG:
137-
#endif /* CONFIG_GENERIC_BUG */
138-
default:
139-
die(regs, "Kernel BUG");
140140
}
141-
} else {
142-
force_sig_fault(SIGTRAP, TRAP_BRKPT,
143-
(void __user *)(regs->sepc));
144141
}
142+
#endif /* CONFIG_GENERIC_BUG */
143+
144+
die(regs, "Kernel BUG");
145145
}
146146

147147
#ifdef CONFIG_GENERIC_BUG

0 commit comments

Comments
 (0)