Skip to content

Commit a7b7751

Browse files
committed
Merge tag 'riscv-for-linus-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Palmer Dabbelt: - A handful of build fixes for the T-Head errata, including some functional issues the compilers found - A fix for a nasty sigreturn bug * tag 'riscv-for-linus-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: RISC-V: Avoid coupling the T-Head CMOs and Zicbom riscv: fix a nasty sigreturn bug... riscv: make t-head erratas depend on MMU riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning RISC-V: Clean up the Zicbom block size probing
2 parents 317fab7 + c589e3c commit a7b7751

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ config RISCV_ISA_C
386386
config RISCV_ISA_SVPBMT
387387
bool "SVPBMT extension support"
388388
depends on 64BIT && MMU
389+
depends on !XIP_KERNEL
389390
select RISCV_ALTERNATIVE
390391
default y
391392
help

arch/riscv/Kconfig.erratas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ config ERRATA_THEAD
4646

4747
config ERRATA_THEAD_PBMT
4848
bool "Apply T-Head memory type errata"
49-
depends on ERRATA_THEAD && 64BIT
49+
depends on ERRATA_THEAD && 64BIT && MMU
5050
select RISCV_ALTERNATIVE_EARLY
5151
default y
5252
help
@@ -57,7 +57,7 @@ config ERRATA_THEAD_PBMT
5757

5858
config ERRATA_THEAD_CMO
5959
bool "Apply T-Head cache management errata"
60-
depends on ERRATA_THEAD
60+
depends on ERRATA_THEAD && MMU
6161
select RISCV_DMA_NONCOHERENT
6262
default y
6363
help

arch/riscv/errata/thead/errata.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static bool errata_probe_cmo(unsigned int stage,
3737
if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
3838
return false;
3939

40+
riscv_cbom_block_size = L1_CACHE_BYTES;
4041
riscv_noncoherent_supported();
4142
return true;
4243
#else

arch/riscv/include/asm/cacheflush.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
4242

4343
#endif /* CONFIG_SMP */
4444

45+
/*
46+
* The T-Head CMO errata internally probe the CBOM block size, but otherwise
47+
* don't depend on Zicbom.
48+
*/
49+
extern unsigned int riscv_cbom_block_size;
4550
#ifdef CONFIG_RISCV_ISA_ZICBOM
4651
void riscv_init_cbom_blocksize(void);
4752
#else

arch/riscv/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ void __init setup_arch(char **cmdline_p)
296296
setup_smp();
297297
#endif
298298

299-
riscv_fill_hwcap();
300299
riscv_init_cbom_blocksize();
300+
riscv_fill_hwcap();
301301
apply_boot_alternatives();
302302
}
303303

arch/riscv/kernel/signal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
124124
if (restore_altstack(&frame->uc.uc_stack))
125125
goto badframe;
126126

127+
regs->cause = -1UL;
128+
127129
return regs->a0;
128130

129131
badframe:

arch/riscv/mm/dma-noncoherent.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <linux/of_device.h>
1313
#include <asm/cacheflush.h>
1414

15-
static unsigned int riscv_cbom_block_size = L1_CACHE_BYTES;
15+
unsigned int riscv_cbom_block_size;
1616
static bool noncoherent_supported;
1717

1818
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
@@ -79,38 +79,41 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
7979
void riscv_init_cbom_blocksize(void)
8080
{
8181
struct device_node *node;
82+
unsigned long cbom_hartid;
83+
u32 val, probed_block_size;
8284
int ret;
83-
u32 val;
8485

86+
probed_block_size = 0;
8587
for_each_of_cpu_node(node) {
8688
unsigned long hartid;
87-
int cbom_hartid;
8889

8990
ret = riscv_of_processor_hartid(node, &hartid);
9091
if (ret)
9192
continue;
9293

93-
if (hartid < 0)
94-
continue;
95-
9694
/* set block-size for cbom extension if available */
9795
ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
9896
if (ret)
9997
continue;
10098

101-
if (!riscv_cbom_block_size) {
102-
riscv_cbom_block_size = val;
99+
if (!probed_block_size) {
100+
probed_block_size = val;
103101
cbom_hartid = hartid;
104102
} else {
105-
if (riscv_cbom_block_size != val)
106-
pr_warn("cbom-block-size mismatched between harts %d and %lu\n",
103+
if (probed_block_size != val)
104+
pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
107105
cbom_hartid, hartid);
108106
}
109107
}
108+
109+
if (probed_block_size)
110+
riscv_cbom_block_size = probed_block_size;
110111
}
111112
#endif
112113

113114
void riscv_noncoherent_supported(void)
114115
{
116+
WARN(!riscv_cbom_block_size,
117+
"Non-coherent DMA support enabled without a block size\n");
115118
noncoherent_supported = true;
116119
}

0 commit comments

Comments
 (0)