Merge tag 'riscv/for-v5.4-rc5-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley:
"Several minor fixes and cleanups for v5.4-rc5:
- Three build fixes for various SPARSEMEM-related kernel
configurations
- Two cleanup patches for the kernel bug and breakpoint trap handler
code"
* tag 'riscv/for-v5.4-rc5-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: cleanup do_trap_break
riscv: cleanup <asm/bug.h>
riscv: Fix undefined reference to vmemmap_populate_basepages
riscv: Fix implicit declaration of 'page_to_section'
riscv: fix fs/proc/kcore.c compilation with sparsemem enabled
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <asm/asm.h>
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#define __INSN_LENGTH_MASK _UL(0x3)
|
||||
#define __INSN_LENGTH_32 _UL(0x3)
|
||||
#define __COMPRESSED_INSN_MASK _UL(0xffff)
|
||||
@@ -20,7 +19,6 @@
|
||||
#define __BUG_INSN_32 _UL(0x00100073) /* ebreak */
|
||||
#define __BUG_INSN_16 _UL(0x9002) /* c.ebreak */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef u32 bug_insn_t;
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
@@ -43,6 +41,7 @@ typedef u32 bug_insn_t;
|
||||
RISCV_SHORT " %2"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#define __BUG_FLAGS(flags) \
|
||||
do { \
|
||||
__asm__ __volatile__ ( \
|
||||
@@ -58,14 +57,10 @@ do { \
|
||||
"i" (flags), \
|
||||
"i" (sizeof(struct bug_entry))); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#else /* CONFIG_GENERIC_BUG */
|
||||
#ifndef __ASSEMBLY__
|
||||
#define __BUG_FLAGS(flags) do { \
|
||||
__asm__ __volatile__ ("ebreak\n"); \
|
||||
} while (0)
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
#define BUG() do { \
|
||||
@@ -79,15 +74,10 @@ do { \
|
||||
|
||||
#include <asm-generic/bug.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
struct pt_regs;
|
||||
struct task_struct;
|
||||
|
||||
extern void die(struct pt_regs *regs, const char *str);
|
||||
extern void do_trap(struct pt_regs *regs, int signo, int code,
|
||||
unsigned long addr);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
void die(struct pt_regs *regs, const char *str);
|
||||
void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr);
|
||||
|
||||
#endif /* _ASM_RISCV_BUG_H */
|
||||
|
||||
@@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
|
||||
return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
|
||||
}
|
||||
|
||||
static inline pte_t mk_pte(struct page *page, pgprot_t prot)
|
||||
{
|
||||
return pfn_pte(page_to_pfn(page), prot);
|
||||
}
|
||||
#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
|
||||
|
||||
#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
|
||||
|
||||
@@ -428,9 +425,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
|
||||
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
|
||||
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
|
||||
|
||||
#ifdef CONFIG_FLATMEM
|
||||
#define kern_addr_valid(addr) (1) /* FIXME */
|
||||
#endif
|
||||
|
||||
extern void *dtb_early_va;
|
||||
extern void setup_bootmem(void);
|
||||
|
||||
@@ -111,7 +111,6 @@ DO_ERROR_INFO(do_trap_ecall_s,
|
||||
DO_ERROR_INFO(do_trap_ecall_m,
|
||||
SIGILL, ILL_ILLTRP, "environment call from M-mode");
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
static inline unsigned long get_break_insn_length(unsigned long pc)
|
||||
{
|
||||
bug_insn_t insn;
|
||||
@@ -120,28 +119,15 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
|
||||
return 0;
|
||||
return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
|
||||
}
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
asmlinkage void do_trap_break(struct pt_regs *regs)
|
||||
{
|
||||
if (user_mode(regs)) {
|
||||
force_sig_fault(SIGTRAP, TRAP_BRKPT,
|
||||
(void __user *)(regs->sepc));
|
||||
return;
|
||||
}
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
{
|
||||
enum bug_trap_type type;
|
||||
|
||||
type = report_bug(regs->sepc, regs);
|
||||
if (type == BUG_TRAP_TYPE_WARN) {
|
||||
regs->sepc += get_break_insn_length(regs->sepc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
die(regs, "Kernel BUG");
|
||||
if (user_mode(regs))
|
||||
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
|
||||
else if (report_bug(regs->sepc, regs) == BUG_TRAP_TYPE_WARN)
|
||||
regs->sepc += get_break_insn_length(regs->sepc);
|
||||
else
|
||||
die(regs, "Kernel BUG");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
|
||||
@@ -458,7 +458,7 @@ void __init paging_init(void)
|
||||
zone_sizes_init();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPARSEMEM
|
||||
#ifdef CONFIG_SPARSEMEM_VMEMMAP
|
||||
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
|
||||
struct vmem_altmap *altmap)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user