xref: /openbmc/linux/Documentation/riscv/uabi.rst (revision f07b2b3f)
106267eb2SPalmer Dabbelt.. SPDX-License-Identifier: GPL-2.0
206267eb2SPalmer Dabbelt
306267eb2SPalmer DabbeltRISC-V Linux User ABI
406267eb2SPalmer Dabbelt=====================
506267eb2SPalmer Dabbelt
6*f07b2b3fSConor DooleyISA string ordering in /proc/cpuinfo
7*f07b2b3fSConor Dooley------------------------------------
8*f07b2b3fSConor Dooley
9*f07b2b3fSConor DooleyThe canonical order of ISA extension names in the ISA string is defined in
10*f07b2b3fSConor Dooleychapter 27 of the unprivileged specification.
11*f07b2b3fSConor DooleyThe specification uses vague wording, such as should, when it comes to ordering,
12*f07b2b3fSConor Dooleyso for our purposes the following rules apply:
13*f07b2b3fSConor Dooley
14*f07b2b3fSConor Dooley#. Single-letter extensions come first, in canonical order.
15*f07b2b3fSConor Dooley   The canonical order is "IMAFDQLCBKJTPVH".
16*f07b2b3fSConor Dooley
17*f07b2b3fSConor Dooley#. All multi-letter extensions will be separated from other extensions by an
18*f07b2b3fSConor Dooley   underscore.
19*f07b2b3fSConor Dooley
20*f07b2b3fSConor Dooley#. Additional standard extensions (starting with 'Z') will be sorted after
21*f07b2b3fSConor Dooley   single-letter extensions and before any higher-privileged extensions.
22*f07b2b3fSConor Dooley
23*f07b2b3fSConor Dooley#. For additional standard extensions, the first letter following the 'Z'
24*f07b2b3fSConor Dooley  conventionally indicates the most closely related alphabetical
25*f07b2b3fSConor Dooley  extension category. If multiple 'Z' extensions are named, they will be ordered
26*f07b2b3fSConor Dooley  first by category, in canonical order, as listed above, then alphabetically
27*f07b2b3fSConor Dooley  within a category.
28*f07b2b3fSConor Dooley
29*f07b2b3fSConor Dooley#. Standard supervisor-level extensions (starting with 'S') will be listed
30*f07b2b3fSConor Dooley   after standard unprivileged extensions.  If multiple supervisor-level
31*f07b2b3fSConor Dooley   extensions are listed, they will be ordered alphabetically.
32*f07b2b3fSConor Dooley
33*f07b2b3fSConor Dooley#. Standard machine-level extensions (starting with 'Zxm') will be listed
34*f07b2b3fSConor Dooley   after any lower-privileged, standard extensions. If multiple machine-level
35*f07b2b3fSConor Dooley   extensions are listed, they will be ordered alphabetically.
36*f07b2b3fSConor Dooley
37*f07b2b3fSConor Dooley#. Non-standard extensions (starting with 'X') will be listed after all standard
38*f07b2b3fSConor Dooley   extensions. If multiple non-standard extensions are listed, they will be
39*f07b2b3fSConor Dooley   ordered alphabetically.
40*f07b2b3fSConor Dooley
41*f07b2b3fSConor DooleyAn example string following the order is::
42*f07b2b3fSConor Dooley
43*f07b2b3fSConor Dooley   rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux
44*f07b2b3fSConor Dooley
45*f07b2b3fSConor DooleyMisaligned accesses
46*f07b2b3fSConor Dooley-------------------
47*f07b2b3fSConor Dooley
4806267eb2SPalmer DabbeltMisaligned accesses are supported in userspace, but they may perform poorly.
49