Skip to content

Commit c313751

Browse files
committed
Merge tag 'riscv-for-linus-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Palmer Dabbelt: - A fix for a missing icache flush in uprobes, which manifests as at least a BFF selftest failure on the Spacemit X1 - A workaround for build warnings in flush_icache_range() * tag 'riscv-for-linus-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: uprobes: Add missing fence.i after building the XOL buffer riscv: Replace function-like macro by static inline function
2 parents c405e18 + 7d1d19a commit c313751

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

arch/riscv/include/asm/cacheflush.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ static inline void flush_dcache_page(struct page *page)
3434
flush_dcache_folio(page_folio(page));
3535
}
3636

37-
/*
38-
* RISC-V doesn't have an instruction to flush parts of the instruction cache,
39-
* so instead we just flush the whole thing.
40-
*/
41-
#define flush_icache_range(start, end) flush_icache_all()
4237
#define flush_icache_user_page(vma, pg, addr, len) \
4338
do { \
4439
if (vma->vm_flags & VM_EXEC) \
@@ -78,6 +73,16 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
7873

7974
#endif /* CONFIG_SMP */
8075

76+
/*
77+
* RISC-V doesn't have an instruction to flush parts of the instruction cache,
78+
* so instead we just flush the whole thing.
79+
*/
80+
#define flush_icache_range flush_icache_range
81+
static inline void flush_icache_range(unsigned long start, unsigned long end)
82+
{
83+
flush_icache_all();
84+
}
85+
8186
extern unsigned int riscv_cbom_block_size;
8287
extern unsigned int riscv_cboz_block_size;
8388
void riscv_init_cbo_blocksizes(void);

arch/riscv/kernel/probes/uprobes.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
167167
/* Initialize the slot */
168168
void *kaddr = kmap_atomic(page);
169169
void *dst = kaddr + (vaddr & ~PAGE_MASK);
170+
unsigned long start = (unsigned long)dst;
170171

171172
memcpy(dst, src, len);
172173

@@ -176,13 +177,6 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
176177
*(uprobe_opcode_t *)dst = __BUG_INSN_32;
177178
}
178179

180+
flush_icache_range(start, start + len);
179181
kunmap_atomic(kaddr);
180-
181-
/*
182-
* We probably need flush_icache_user_page() but it needs vma.
183-
* This should work on most of architectures by default. If
184-
* architecture needs to do something different it can define
185-
* its own version of the function.
186-
*/
187-
flush_dcache_page(page);
188182
}

0 commit comments

Comments
 (0)