[tip: x86/cleanups] x86/boot: Avoid redundant %cr4 write in startup_64()

tip-bot2 for Khalid Ali posted 1 patch 2 months, 3 weeks ago
arch/x86/kernel/head_64.S | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[tip: x86/cleanups] x86/boot: Avoid redundant %cr4 write in startup_64()
Posted by tip-bot2 for Khalid Ali 2 months, 3 weeks ago
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     0149fff886a62465b21d80fa53615ee7de3d72f1
Gitweb:        https://git.kernel.org/tip/0149fff886a62465b21d80fa53615ee7de3d72f1
Author:        Khalid Ali <khaliidcaliy@gmail.com>
AuthorDate:    Tue, 15 Jul 2025 18:16:10 
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 15 Jul 2025 20:52:56 +02:00

x86/boot: Avoid redundant %cr4 write in startup_64()

When initializing %cr4 bits PSE and PGE, %cr4 is written after each bit is
set. Remove the redundant write.

No functional changes.

  [ bp: Massage. ]

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://lore.kernel.org/20250715181709.1040-1-khaliidcaliy@gmail.com
---
 arch/x86/kernel/head_64.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 3e9b3a3..5c4be47 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -224,11 +224,7 @@ SYM_INNER_LABEL(common_startup_64, SYM_L_LOCAL)
 
 	/* Even if ignored in long mode, set PSE uniformly on all logical CPUs. */
 	btsl	$X86_CR4_PSE_BIT, %ecx
-	movq	%rcx, %cr4
-
-	/*
-	 * Set CR4.PGE to re-enable global translations.
-	 */
+	/* Set CR4.PGE to re-enable global translations. */
 	btsl	$X86_CR4_PGE_BIT, %ecx
 	movq	%rcx, %cr4