osphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget//translations/zh_CN/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget//translations/zh_TW/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget//translations/it_IT/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget//translations/ja_JP/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget//translations/ko_KR/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget//translations/sp_SP/arch/arm64/asymmetric-32bitmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hAsymmetric 32-bit SoCsh]hAsymmetric 32-bit SoCs}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhI/var/lib/git/docbuild/linux/Documentation/arch/arm64/asymmetric-32bit.rsthKubh paragraph)}(h%Author: Will Deacon h](hAuthor: Will Deacon <}(hhhhhNhNubh reference)}(hwill@kernel.orgh]hwill@kernel.org}(hhhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:will@kernel.orguh1hhhubh>}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hsThis document describes the impact of asymmetric 32-bit SoCs on the execution of 32-bit (``AArch32``) applications.h](hYThis document describes the impact of asymmetric 32-bit SoCs on the execution of 32-bit (}(hhhhhNhNubhliteral)}(h ``AArch32``h]hAArch32}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh) applications.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hDate: 2021-05-17h]hDate: 2021-05-17}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(h Introductionh]h Introduction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhK ubh)}(hXSome Armv9 SoCs suffer from a big.LITTLE misfeature where only a subset of the CPUs are capable of executing 32-bit user applications. On such a system, Linux by default treats the asymmetry as a "mismatch" and disables support for both the ``PER_LINUX32`` personality and ``execve(2)`` of 32-bit ELF binaries, with the latter returning ``-ENOEXEC``. If the mismatch is detected during late onlining of a 64-bit-only CPU, then the onlining operation fails and the new CPU is unavailable for scheduling.h](hSome Armv9 SoCs suffer from a big.LITTLE misfeature where only a subset of the CPUs are capable of executing 32-bit user applications. On such a system, Linux by default treats the asymmetry as a “mismatch” and disables support for both the }(hjhhhNhNubh)}(h``PER_LINUX32``h]h PER_LINUX32}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh personality and }(hjhhhNhNubh)}(h ``execve(2)``h]h execve(2)}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh3 of 32-bit ELF binaries, with the latter returning }(hjhhhNhNubh)}(h ``-ENOEXEC``h]h-ENOEXEC}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh. If the mismatch is detected during late onlining of a 64-bit-only CPU, then the onlining operation fails and the new CPU is unavailable for scheduling.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hSurprisingly, these SoCs have been produced with the intention of running legacy 32-bit binaries. Unsurprisingly, that doesn't work very well with the default behaviour of Linux.h]hSurprisingly, these SoCs have been produced with the intention of running legacy 32-bit binaries. Unsurprisingly, that doesn’t work very well with the default behaviour of Linux.}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXVIt seems inevitable that future SoCs will drop 32-bit support altogether, so if you're stuck in the unenviable position of needing to run 32-bit code on one of these transitionary platforms then you would be wise to consider alternatives such as recompilation, emulation or retirement. If neither of those options are practical, then read on.h]hXXIt seems inevitable that future SoCs will drop 32-bit support altogether, so if you’re stuck in the unenviable position of needing to run 32-bit code on one of these transitionary platforms then you would be wise to consider alternatives such as recompilation, emulation or retirement. If neither of those options are practical, then read on.}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hEnabling kernel supporth]hEnabling kernel support}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK#ubh)}(hXSince the kernel support is not completely transparent to userspace, allowing 32-bit tasks to run on an asymmetric 32-bit system requires an explicit "opt-in" and can be enabled by passing the ``allow_mismatched_32bit_el0`` parameter on the kernel command-line.h](hSince the kernel support is not completely transparent to userspace, allowing 32-bit tasks to run on an asymmetric 32-bit system requires an explicit “opt-in” and can be enabled by passing the }(hjhhhNhNubh)}(h``allow_mismatched_32bit_el0``h]hallow_mismatched_32bit_el0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh& parameter on the kernel command-line.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK%hjhhubh)}(hFor the remainder of this document we will refer to an *asymmetric system* to mean an asymmetric 32-bit SoC running Linux with this kernel command-line option enabled.h](h7For the remainder of this document we will refer to an }(hjhhhNhNubhemphasis)}(h*asymmetric system*h]hasymmetric system}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh] to mean an asymmetric 32-bit SoC running Linux with this kernel command-line option enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK*hjhhubeh}(h]enabling-kernel-supportah ]h"]enabling kernel supportah$]h&]uh1hhhhhhhhK#ubh)}(hhh](h)}(hUserspace impacth]hUserspace impact}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK/ubh)}(h32-bit tasks running on an asymmetric system behave in mostly the same way as on a homogeneous system, with a few key differences relating to CPU affinity.h]h32-bit tasks running on an asymmetric system behave in mostly the same way as on a homogeneous system, with a few key differences relating to CPU affinity.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjhhubh)}(hhh](h)}(hsysfsh]hsysfs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK6ubh)}(hThe subset of CPUs capable of running 32-bit tasks is described in ``/sys/devices/system/cpu/aarch32_el0`` and is documented further in Documentation/ABI/testing/sysfs-devices-system-cpu.h](hCThe subset of CPUs capable of running 32-bit tasks is described in }(hjhhhNhNubh)}(h'``/sys/devices/system/cpu/aarch32_el0``h]h#/sys/devices/system/cpu/aarch32_el0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhQ and is documented further in Documentation/ABI/testing/sysfs-devices-system-cpu.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjhhubh)}(h**Note:** CPUs are advertised by this file as they are detected and so late-onlining of 32-bit-capable CPUs can result in the file contents being modified by the kernel at runtime. Once advertised, CPUs are never removed from the file.h](hstrong)}(h **Note:**h]hNote:}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j5hj1ubh CPUs are advertised by this file as they are detected and so late-onlining of 32-bit-capable CPUs can result in the file contents being modified by the kernel at runtime. Once advertised, CPUs are never removed from the file.}(hj1hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK