Webcentive RISC-V Reference

cbo.inval

Cache Block Invalidate

Extension
Zicbom/Zicbop/Zicboz
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
cbo.inval (xs1)
Length
32-bit

Encoding

3120191514121176210
000000000000rs1010000000001111

Match 0x0000200f, mask 0xfff07fff. Source: cbo.inval rs1 31..20=0 14..12=2 11..7=0 6..2=0x03 1..0=3 in riscv-opcodes/extensions/rv_zicbo.

FieldBitsriscv-opcodes name
rs119:15rs1

Description

Either invalidates or flushes (clean + invalidate) a cache block, depending on the current mode and value of menvcfg.CBIE, senvcfg.CBIE, and/or henvcfg.CBIE.

The instruction is an invalidate (without a clean) when:

  • In M-mode
  • In (H)S-mode and menvcfg.CBIE == 11
  • In U-mode and menvcfg.CBIE == 11 and senvcfg.CBIE == 11
  • In VS-mode and menvcfg.CBIE == 11 and henvcfg.CBIE == 11
  • In VU-mode and menvcfg.CBIE == 11 and henvcfg.CBIE == 11 and senvcfg.CBIE == 11

Otherwise, if the instruction does not trap (see Access section), the operation is a flush. The table below summarizes the options.

menvcfg.CBIEsenvcfg.CBIEhenvcfg.CBIE
cbe.inval Operation
M-modeS-modeU-modeVS-modeVU-mode
00--InvalidateIllegal InstructionIllegal InstructionIllegal InstructionIllegal Instruction
010000InvalidateFlushIllegal InstructionVirtual InstructionVirtual Instruction
010001InvalidateFlushIllegal InstructionFlushVirtual Instruction
010011InvalidateFlushIllegal InstructionFlushVirtual Instruction
010100InvalidateFlushFlushVirtual InstructionVirtual Instruction
010101InvalidateFlushFlushFlushFlush
010111InvalidateFlushFlushFlushFlush
011100InvalidateFlushFlushVirtual InstructionVirtual Instruction
011101InvalidateFlushFlushFlushFlush
011111InvalidateFlushFlushFlushFlush
110000InvalidateInvalidateIllegal InstructionVirtual InstructionVirtual Instruction
110001InvalidateInvalidateIllegal InstructionFlushVirtual Instruction
110011InvalidateInvalidateIllegal InstructionInvalidateVirtual Instruction
110100InvalidateInvalidateFlushVirtual InstructionVirtual Instruction
110101InvalidateInvalidateFlushFlushFlush
110111InvalidateInvalidateFlushInvalidateFlush
111100InvalidateInvalidateInvalidateVirtual InstructionVirtual Instruction
111101InvalidateInvalidateInvalidateFlushFlush
111111InvalidateInvalidateInvalidateInvalidateInvalidate

cbo.inval is ordered by FENCE instructions but not FENCE.I or SFENCE.VMA.

When (CACHE_BLOCK_SIZE.bit_length - 1) > [PMP_GRANULARITY, PMA_GRANULARITY].min:

Both PMP and PMA access control must be the same for all bytes in the block; otherwise, cbo.inval has UNSPECIFIED behavior.

Invalidate operations are treated as stores for page and access permissions. If permission checks fail, one of the following exceptions will occur:

When H is implemented:

  • Store/AMO Guest-Page Fault if virtual memory translation fails during G-stage translation.
  • Store/AMO Page Fault if virtual memory translation fails (when H is implemented: when V=0 or during VS-stage translation)
  • Store/AMO Access Fault if a PMP or PMA access check fails.

When (CACHE_BLOCK_SIZE.bit_length - 1) <= [PMP_GRANULARITY, PMA_GRANULARITY].min:

Because cache blocks are naturally aligned and always fit in a single PMP or PMA regions, the PMP and PMA access checks only need to check a single address in the line.

CBO operations never raise a misaligned address fault.

Description from riscv-unified-db, reformatted.

Specification and related pages