Skip to content

Commit

Permalink
RISC-V: capitalise CMO op macros
Browse files Browse the repository at this point in the history
The CMO op macros initially used lower case, as the original iteration
of the ALT_CMO_OP alternative stringified the first parameter to
finalise the assembly for the standard variant.
As a knock-on, the T-Head versions of these CMOs had to use mixed case
defines. Commit dd23e95 ("RISC-V: replace cbom instructions with
an insn-def") removed the asm construction with stringify, replacing it
an insn-def macro, rending the lower-case surplus to requirements.
As far as I can tell from a brief check, CBO_zero does not see similar
use and didn't require the mixed case define in the first place.
Replace the lower case characters now for consistency with other
insn-def macros in the standard and T-Head forms, and adjust the
callsites.

Suggested-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20230915-aloe-dollar-994937477776@spud
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
  • Loading branch information
Conor Dooley authored and Palmer Dabbelt committed Nov 5, 2023
1 parent c20d36c commit d3eabf2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions arch/riscv/include/asm/errata_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ asm volatile(ALTERNATIVE( \
* | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
* 0000000 11001 00000 000 00000 0001011
*/
#define THEAD_inval_A0 ".long 0x0265000b"
#define THEAD_clean_A0 ".long 0x0255000b"
#define THEAD_flush_A0 ".long 0x0275000b"
#define THEAD_INVAL_A0 ".long 0x0265000b"
#define THEAD_CLEAN_A0 ".long 0x0255000b"
#define THEAD_FLUSH_A0 ".long 0x0275000b"
#define THEAD_SYNC_S ".long 0x0190000b"

#define ALT_CMO_OP(_op, _start, _size, _cachesize) \
Expand Down
8 changes: 4 additions & 4 deletions arch/riscv/include/asm/insn-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,19 @@
INSN_R(OPCODE_SYSTEM, FUNC3(0), FUNC7(51), \
__RD(0), RS1(gaddr), RS2(vmid))

#define CBO_inval(base) \
#define CBO_INVAL(base) \
INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \
RS1(base), SIMM12(0))

#define CBO_clean(base) \
#define CBO_CLEAN(base) \
INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \
RS1(base), SIMM12(1))

#define CBO_flush(base) \
#define CBO_FLUSH(base) \
INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \
RS1(base), SIMM12(2))

#define CBO_zero(base) \
#define CBO_ZERO(base) \
INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0), \
RS1(base), SIMM12(4))

Expand Down
32 changes: 16 additions & 16 deletions arch/riscv/lib/clear_page.S
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,41 @@ SYM_FUNC_START(clear_page)
lw a1, riscv_cboz_block_size
add a2, a0, a2
.Lzero_loop:
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(11, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(10, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(9, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(8, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
CBO_zero(a0)
CBO_ZERO(a0)
add a0, a0, a1
bltu a0, a2, .Lzero_loop
ret
Expand Down
8 changes: 4 additions & 4 deletions arch/riscv/mm/dma-noncoherent.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static inline void arch_dma_cache_wback(phys_addr_t paddr, size_t size)
return;
}
#endif
ALT_CMO_OP(clean, vaddr, size, riscv_cbom_block_size);
ALT_CMO_OP(CLEAN, vaddr, size, riscv_cbom_block_size);
}

static inline void arch_dma_cache_inv(phys_addr_t paddr, size_t size)
Expand All @@ -45,7 +45,7 @@ static inline void arch_dma_cache_inv(phys_addr_t paddr, size_t size)
}
#endif

ALT_CMO_OP(inval, vaddr, size, riscv_cbom_block_size);
ALT_CMO_OP(INVAL, vaddr, size, riscv_cbom_block_size);
}

static inline void arch_dma_cache_wback_inv(phys_addr_t paddr, size_t size)
Expand All @@ -59,7 +59,7 @@ static inline void arch_dma_cache_wback_inv(phys_addr_t paddr, size_t size)
}
#endif

ALT_CMO_OP(flush, vaddr, size, riscv_cbom_block_size);
ALT_CMO_OP(FLUSH, vaddr, size, riscv_cbom_block_size);
}

static inline bool arch_sync_dma_clean_before_fromdevice(void)
Expand Down Expand Up @@ -131,7 +131,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
}
#endif

ALT_CMO_OP(flush, flush_addr, size, riscv_cbom_block_size);
ALT_CMO_OP(FLUSH, flush_addr, size, riscv_cbom_block_size);
}

void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/mm/pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void arch_wb_cache_pmem(void *addr, size_t size)
return;
}
#endif
ALT_CMO_OP(clean, addr, size, riscv_cbom_block_size);
ALT_CMO_OP(CLEAN, addr, size, riscv_cbom_block_size);
}
EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);

Expand All @@ -29,6 +29,6 @@ void arch_invalidate_pmem(void *addr, size_t size)
return;
}
#endif
ALT_CMO_OP(inval, addr, size, riscv_cbom_block_size);
ALT_CMO_OP(INVAL, addr, size, riscv_cbom_block_size);
}
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);

0 comments on commit d3eabf2

Please sign in to comment.