documentation: Fix riscv cmodx example
authorCharlie Jenkins <charlie@rivosinc.com>
Sat, 29 Jun 2024 00:25:49 +0000 (17:25 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 1 Jul 2024 17:50:18 +0000 (10:50 -0700)
ON/OFF in the keys was swapped between the first and second argument of
the prctl. The prctl key is always PR_RISCV_SET_ICACHE_FLUSH_CTX, and
the second argument can be PR_RISCV_CTX_SW_FENCEI_ON or
PR_RISCV_CTX_SW_FENCEI_OFF.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes: 6a08e4709c58 ("documentation: Document PR_RISCV_SET_ICACHE_FLUSH_CTX prctl")
Link: https://lore.kernel.org/r/20240628-fix_cmodx_example-v1-1-e6c6523bc163@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Documentation/arch/riscv/cmodx.rst

index 1c0ca06..8c48bcf 100644 (file)
@@ -62,10 +62,10 @@ cmodx.c::
                printf("Value before cmodx: %d\n", value);
 
                // Call prctl before first fence.i is called inside modify_instruction
-               prctl(PR_RISCV_SET_ICACHE_FLUSH_CTX_ON, PR_RISCV_CTX_SW_FENCEI, PR_RISCV_SCOPE_PER_PROCESS);
+               prctl(PR_RISCV_SET_ICACHE_FLUSH_CTX, PR_RISCV_CTX_SW_FENCEI_ON, PR_RISCV_SCOPE_PER_PROCESS);
                modify_instruction();
                // Call prctl after final fence.i is called in process
-               prctl(PR_RISCV_SET_ICACHE_FLUSH_CTX_OFF, PR_RISCV_CTX_SW_FENCEI, PR_RISCV_SCOPE_PER_PROCESS);
+               prctl(PR_RISCV_SET_ICACHE_FLUSH_CTX, PR_RISCV_CTX_SW_FENCEI_OFF, PR_RISCV_SCOPE_PER_PROCESS);
 
                value = get_value();
                printf("Value after cmodx: %d\n", value);