xref: /openbmc/linux/Documentation/arch/arm64/legacy_instructions.rst (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1*e4624435SJonathan Corbet===================
2*e4624435SJonathan CorbetLegacy instructions
3*e4624435SJonathan Corbet===================
4*e4624435SJonathan Corbet
5*e4624435SJonathan CorbetThe arm64 port of the Linux kernel provides infrastructure to support
6*e4624435SJonathan Corbetemulation of instructions which have been deprecated, or obsoleted in
7*e4624435SJonathan Corbetthe architecture. The infrastructure code uses undefined instruction
8*e4624435SJonathan Corbethooks to support emulation. Where available it also allows turning on
9*e4624435SJonathan Corbetthe instruction execution in hardware.
10*e4624435SJonathan Corbet
11*e4624435SJonathan CorbetThe emulation mode can be controlled by writing to sysctl nodes
12*e4624435SJonathan Corbet(/proc/sys/abi). The following explains the different execution
13*e4624435SJonathan Corbetbehaviours and the corresponding values of the sysctl nodes -
14*e4624435SJonathan Corbet
15*e4624435SJonathan Corbet* Undef
16*e4624435SJonathan Corbet    Value: 0
17*e4624435SJonathan Corbet
18*e4624435SJonathan Corbet  Generates undefined instruction abort. Default for instructions that
19*e4624435SJonathan Corbet  have been obsoleted in the architecture, e.g., SWP
20*e4624435SJonathan Corbet
21*e4624435SJonathan Corbet* Emulate
22*e4624435SJonathan Corbet    Value: 1
23*e4624435SJonathan Corbet
24*e4624435SJonathan Corbet  Uses software emulation. To aid migration of software, in this mode
25*e4624435SJonathan Corbet  usage of emulated instruction is traced as well as rate limited
26*e4624435SJonathan Corbet  warnings are issued. This is the default for deprecated
27*e4624435SJonathan Corbet  instructions, .e.g., CP15 barriers
28*e4624435SJonathan Corbet
29*e4624435SJonathan Corbet* Hardware Execution
30*e4624435SJonathan Corbet    Value: 2
31*e4624435SJonathan Corbet
32*e4624435SJonathan Corbet  Although marked as deprecated, some implementations may support the
33*e4624435SJonathan Corbet  enabling/disabling of hardware support for the execution of these
34*e4624435SJonathan Corbet  instructions. Using hardware execution generally provides better
35*e4624435SJonathan Corbet  performance, but at the loss of ability to gather runtime statistics
36*e4624435SJonathan Corbet  about the use of the deprecated instructions.
37*e4624435SJonathan Corbet
38*e4624435SJonathan CorbetThe default mode depends on the status of the instruction in the
39*e4624435SJonathan Corbetarchitecture. Deprecated instructions should default to emulation
40*e4624435SJonathan Corbetwhile obsolete instructions must be undefined by default.
41*e4624435SJonathan Corbet
42*e4624435SJonathan CorbetNote: Instruction emulation may not be possible in all cases. See
43*e4624435SJonathan Corbetindividual instruction notes for further information.
44*e4624435SJonathan Corbet
45*e4624435SJonathan CorbetSupported legacy instructions
46*e4624435SJonathan Corbet-----------------------------
47*e4624435SJonathan Corbet* SWP{B}
48*e4624435SJonathan Corbet
49*e4624435SJonathan Corbet:Node: /proc/sys/abi/swp
50*e4624435SJonathan Corbet:Status: Obsolete
51*e4624435SJonathan Corbet:Default: Undef (0)
52*e4624435SJonathan Corbet
53*e4624435SJonathan Corbet* CP15 Barriers
54*e4624435SJonathan Corbet
55*e4624435SJonathan Corbet:Node: /proc/sys/abi/cp15_barrier
56*e4624435SJonathan Corbet:Status: Deprecated
57*e4624435SJonathan Corbet:Default: Emulate (1)
58*e4624435SJonathan Corbet
59*e4624435SJonathan Corbet* SETEND
60*e4624435SJonathan Corbet
61*e4624435SJonathan Corbet:Node: /proc/sys/abi/setend
62*e4624435SJonathan Corbet:Status: Deprecated
63*e4624435SJonathan Corbet:Default: Emulate (1)*
64*e4624435SJonathan Corbet
65*e4624435SJonathan Corbet  Note: All the cpus on the system must have mixed endian support at EL0
66*e4624435SJonathan Corbet  for this feature to be enabled. If a new CPU - which doesn't support mixed
67*e4624435SJonathan Corbet  endian - is hotplugged in after this feature has been enabled, there could
68*e4624435SJonathan Corbet  be unexpected results in the application.
69