selftests/powerpc/dexcr: Add DEXCR status utility lsdexcr
authorBenjamin Gray <bgray@linux.ibm.com>
Mon, 19 Jun 2023 07:36:28 +0000 (17:36 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 19 Jun 2023 07:36:28 +0000 (17:36 +1000)
commita16e472c3546ba0b8a4be265c008d02ef6aed899
treebd20346d3e883507e7d93abc34608341fbe4580a
parentbdb07f35a52f40c461c7da06ddcbaca1950fb9e0
selftests/powerpc/dexcr: Add DEXCR status utility lsdexcr

Add a utility 'lsdexcr' to print the current DEXCR status. Useful for
quickly checking the status such as when debugging test failures or
verifying the new default DEXCR does what you want (for userspace at
least). Example output:

    # ./lsdexcr
       uDEXCR: 04000000 (NPHIE)
       HDEXCR: 00000000
    Effective: 04000000 (NPHIE)

            SBHE   (0): clear   (Speculative branch hint enable)
          IBRTPD   (3): clear   (Indirect branch recurrent target ...)
           SRAPD   (4): clear   (Subroutine return address ...)
           NPHIE * (5): set   (Non-privileged hash instruction enable)
            PHIE   (6): clear   (Privileged hash instruction enable)

    DEXCR[NPHIE] enabled: hashst/hashchk working

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230616034846.311705-12-bgray@linux.ibm.com
tools/testing/selftests/powerpc/dexcr/.gitignore
tools/testing/selftests/powerpc/dexcr/Makefile
tools/testing/selftests/powerpc/dexcr/lsdexcr.c [new file with mode: 0644]