riscv-CMOs icon indicating copy to clipboard operation
riscv-CMOs copied to clipboard

Clarify prefetch instruction permission

Open whchiao opened this issue 1 year ago • 1 comments

In CMO's spec, it claims "A cache-block prefetch instruction is permitted to access the specified cache block whenever a load instruction, store instruction, or instruction fetch is permitted to access the corresponding physical addresses."

does that mean

  1. prefetch.i is permitted to access the specified cache block if instruction fetch is permitted to access the corresponding physical addresses. prefetch.r is permitted to access the specified cache block if a load is permitted to access the corresponding physical addresses. prefetch.w is permitted to access the specified cache block if a store is permitted to access the corresponding physical addresses. or
  2. Any prefetch instruction (prefetch.i / prefetch.r / prefetch.w) is permitted to access the specified cache block whenever a load instruction, store instruction, or instruction fetch is permitted to access the corresponding physical addresses."

whchiao avatar Mar 31 '23 10:03 whchiao

The intent was the latter (number 2). Since the prefetch instructions are encoded as hints, we don't do any permissions checks, even though the standard address translation applies. The different suffixes really are hints to the memory system for allocation into specific caches (e.g. instruction cache or data cache), with specific cache state permissions (e.g. shared, i.e. read-only, or unique, i.e. read-write), rather than indicating an actual memory operation.

dkruckemyer-ventana avatar Mar 31 '23 15:03 dkruckemyer-ventana