Commit 3f9ab2a6 authored by Mark Brown's avatar Mark Brown Committed by Will Deacon

arm64/mte: Document ABI for asymmetric mode

MTE3 adds a new mode which is synchronous for reads but asynchronous for
writes. Document the userspace ABI for this feature, we call the new
mode ASYMM and add a new prctl flag and mte_tcf_preferred value for it.
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220216173224.2342152-2-broonie@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 38ddf7da
...@@ -76,6 +76,9 @@ configurable behaviours: ...@@ -76,6 +76,9 @@ configurable behaviours:
with ``.si_code = SEGV_MTEAERR`` and ``.si_addr = 0`` (the faulting with ``.si_code = SEGV_MTEAERR`` and ``.si_addr = 0`` (the faulting
address is unknown). address is unknown).
- *Asymmetric* - Reads are handled as for synchronous mode while writes
are handled as for asynchronous mode.
The user can select the above modes, per thread, using the The user can select the above modes, per thread, using the
``prctl(PR_SET_TAGGED_ADDR_CTRL, flags, 0, 0, 0)`` system call where ``flags`` ``prctl(PR_SET_TAGGED_ADDR_CTRL, flags, 0, 0, 0)`` system call where ``flags``
contains any number of the following values in the ``PR_MTE_TCF_MASK`` contains any number of the following values in the ``PR_MTE_TCF_MASK``
...@@ -85,6 +88,7 @@ bit-field: ...@@ -85,6 +88,7 @@ bit-field:
(ignored if combined with other options) (ignored if combined with other options)
- ``PR_MTE_TCF_SYNC`` - *Synchronous* tag check fault mode - ``PR_MTE_TCF_SYNC`` - *Synchronous* tag check fault mode
- ``PR_MTE_TCF_ASYNC`` - *Asynchronous* tag check fault mode - ``PR_MTE_TCF_ASYNC`` - *Asynchronous* tag check fault mode
- ``PR_MTE_TCF_ASYMM`` - *Asymmetric* tag check fault mode
If no modes are specified, tag check faults are ignored. If a single If no modes are specified, tag check faults are ignored. If a single
mode is specified, the program will run in that mode. If multiple mode is specified, the program will run in that mode. If multiple
...@@ -139,18 +143,23 @@ tag checking mode as the CPU's preferred tag checking mode. ...@@ -139,18 +143,23 @@ tag checking mode as the CPU's preferred tag checking mode.
The preferred tag checking mode for each CPU is controlled by The preferred tag checking mode for each CPU is controlled by
``/sys/devices/system/cpu/cpu<N>/mte_tcf_preferred``, to which a ``/sys/devices/system/cpu/cpu<N>/mte_tcf_preferred``, to which a
privileged user may write the value ``async`` or ``sync``. The default privileged user may write the value ``async``, ``sync`` or ``asymm``. The
preferred mode for each CPU is ``async``. default preferred mode for each CPU is ``async``.
To allow a program to potentially run in the CPU's preferred tag To allow a program to potentially run in the CPU's preferred tag
checking mode, the user program may set multiple tag check fault mode checking mode, the user program may set multiple tag check fault mode
bits in the ``flags`` argument to the ``prctl(PR_SET_TAGGED_ADDR_CTRL, bits in the ``flags`` argument to the ``prctl(PR_SET_TAGGED_ADDR_CTRL,
flags, 0, 0, 0)`` system call. If the CPU's preferred tag checking flags, 0, 0, 0)`` system call. If the CPU's preferred tag checking
mode is in the task's set of provided tag checking modes (this will mode is in the task's set of provided tag checking modes, that
always be the case at present because the kernel only supports two
tag checking modes, but future kernels may support more modes), that
mode will be selected. Otherwise, one of the modes in the task's mode mode will be selected. Otherwise, one of the modes in the task's mode
set will be selected in a currently unspecified manner. selected by the kernel using the preference order:
1. Asynchronous
2. Asymmetric
3. Synchronous
If asymmetric mode is specified by the program but not supported by
either the system or the kernel then an error will be returned.
Initial process state Initial process state
--------------------- ---------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment