From nobody Sun Apr 5 19:50:06 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D629133F36B; Sat, 14 Mar 2026 17:51:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773510715; cv=none; b=J2HtOMebGQO17VVwIi3JWI6YQTPoI+qwWW6zfPnXWkyiFpDLKfHVZR3wOS3roYHnYN3HigBHd9M7c5MCFvomwD61oX0AI5rMEawAOg3cQVVzjPhAwQZUY0D0AdCTYIl2KLXSXrbyzLZyJpwHL5Sb754+tkCd+hKiX9rA1h6WVU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773510715; c=relaxed/simple; bh=gC1ASY4XTWOU9NSvQyEf85WEp3yTpQCXJkzGjWaR5EM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dcsYAn8wY842+DqBKBnnOQcuh/mvDMWT/NSHEUf8UNB2xnHpthju+29Q4JNx0TEyH+p8fEDGKRDP4cjuX3t0/nDbkDKCQN/xByxF8ALg7bYlyf8OztxUanTcnhwjoxueW8WLyNKD2yNwX397peOiGVhJOv7BWN/v7Dpu1GKz0Fg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4413E175D; Sat, 14 Mar 2026 10:51:48 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E6DCE3F73B; Sat, 14 Mar 2026 10:51:51 -0700 (PDT) From: Yeoreum Yun To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, oupton@kernel.org, miko.lenczewski@arm.com, kevin.brodsky@arm.com, broonie@kernel.org, ardb@kernel.org, suzuki.poulose@arm.com, lpieralisi@kernel.org, joey.gouly@arm.com, yuzenghui@huawei.com, yeoreum.yun@arm.com Subject: [PATCH v17 6/8] arm64: armv8_deprecated: disable swp emulation when FEAT_LSUI present Date: Sat, 14 Mar 2026 17:51:31 +0000 Message-Id: <20260314175133.1084528-7-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260314175133.1084528-1-yeoreum.yun@arm.com> References: <20260314175133.1084528-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The purpose of supporting LSUI is to eliminate PAN toggling. CPUs that support LSUI are unlikely to support a 32-bit runtime. Since environments that support both LSUI and a 32-bit runtimeare expected to be extremely rare, not to emulate the SWP instruction using LSUI instructions in order to remove PAN toggling, and instead simply disable SWP emulation. Signed-off-by: Yeoreum Yun --- arch/arm64/kernel/armv8_deprecated.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8= _deprecated.c index e737c6295ec7..049754f7da36 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -610,6 +610,22 @@ static int __init armv8_deprecated_init(void) } =20 #endif + +#ifdef CONFIG_SWP_EMULATION + /* + * The purpose of supporting LSUI is to eliminate PAN toggling. + * CPUs that support LSUI are unlikely to support a 32-bit runtime. + * Since environments that support both LSUI and a 32-bit runtime + * are expected to be extremely rare, we choose not to emulate + * the SWP instruction using LSUI instructions in order to remove PAN tog= gling, + * and instead simply disable SWP emulation. + */ + if (cpus_have_final_cap(ARM64_HAS_LSUI)) { + insn_swp.status =3D INSN_UNAVAILABLE; + pr_info("swp/swpb instruction emulation is not supported on this system\= n"); + } +#endif + for (int i =3D 0; i < ARRAY_SIZE(insn_emulations); i++) { struct insn_emulation *ie =3D insn_emulations[i]; =20 --=20 LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}