From nobody Thu Oct 9 04:52:43 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73C7728E610; Fri, 20 Jun 2025 13:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750427627; cv=none; b=uIg5+mVBmcG1rXMFEaGEajqYiLeQbr6BEwiruHeceUXZpx/h1H2+kQrWoTPGcPP2pogAT0rnZzKSFi0EEfv+gKND164k/ebnNSYpBCCrqWdWZXxWPJM3LHLIFOjfVVitv4nqvHH66QYNcE3c6tGFrsqP1PQao37v9t2FU4Yf9fM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750427627; c=relaxed/simple; bh=QTbN9NXSoblvysDv8AoUns4aJP3a3HG8dD3wrltp4po=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L8edtJ2GcJj/tErGCeSEqAG+RK0sMUQguHeeKh93V6eNNTRYxmjcg7TOgKuZZxmbGOtTK5FYKRlac1ilV/tgZf93r7wClA+meDNJI/RE6Mxw+JqWYKm31RCO82eNzy09lh6MCBDqDnC89/JexqxXnQ2nVs2Uq5qKhIEnRLs1snY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hSse4H3Z; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.helo=mgamail.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hSse4H3Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750427626; x=1781963626; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QTbN9NXSoblvysDv8AoUns4aJP3a3HG8dD3wrltp4po=; b=hSse4H3Z580o9+vATJ3Nxs7Qwjucxq+2mGhd3Y6aaFj22AYSTZ5gSqgi c2fwvfr2Uy72tPgj3QPE4p+1vePqW9o3RsKiJzNiobv6BR++To2BtW5nV iQ1EK80zod3Yw3Ue7EyN9ttY++j+geWFCq03B4yWLXBI4UkwVwnmU/uYj qciiYFGixGwb9r4vGLrg3iI2z8fdf4X9up9Ju4WkR77i8keNad9Fbjn2r w/ODCD6/+CrQFv/VFdtEp6oRRbkGtYfn2EJeDiIJWncwRIffWX8vLIRyF 6fXL7+RXlQDVS/Ex/fhPGztm5ZAT+0hyMMpDSuILJoxKbG+2hhnrlnjb1 w==; X-CSE-ConnectionGUID: 7NfkzfLWQwWoDr70TvIEAA== X-CSE-MsgGUID: RTcaXiK2RXiIxVp2KQM1EA== X-IronPort-AV: E=McAfee;i="6800,10657,11469"; a="64047049" X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="64047049" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2025 06:53:43 -0700 X-CSE-ConnectionGUID: n+0MzPtZQjqxYuXzQHPI7Q== X-CSE-MsgGUID: BKM2Z4zZTT2q7PYD+E+s4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="150411998" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa006.jf.intel.com with ESMTP; 20 Jun 2025 06:53:32 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 7E65820A; Fri, 20 Jun 2025 16:53:28 +0300 (EEST) From: "Kirill A. Shutemov" To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Ard Biesheuvel , "Paul E. McKenney" , Josh Poimboeuf , Xiongwei Song , Xin Li , "Mike Rapoport (IBM)" , Brijesh Singh , Michael Roth , Tony Luck , Alexey Kardashevskiy , Alexander Shishkin Cc: Jonathan Corbet , Sohil Mehta , Ingo Molnar , Pawan Gupta , Daniel Sneddon , Kai Huang , Sandipan Das , Breno Leitao , Rick Edgecombe , Alexei Starovoitov , Hou Tao , Juergen Gross , Vegard Nossum , Kees Cook , Eric Biggers , Jason Gunthorpe , "Masami Hiramatsu (Google)" , Andrew Morton , Luis Chamberlain , Yuntao Wang , Rasmus Villemoes , Christophe Leroy , Tejun Heo , Changbin Du , Huang Shijie , Geert Uytterhoeven , Namhyung Kim , Arnaldo Carvalho de Melo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCHv6 04/16] x86/efi: Move runtime service initialization to arch/x86 Date: Fri, 20 Jun 2025 16:53:12 +0300 Message-ID: <20250620135325.3300848-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250620135325.3300848-1-kirill.shutemov@linux.intel.com> References: <20250620135325.3300848-1-kirill.shutemov@linux.intel.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" From: Alexander Shishkin The EFI call in start_kernel() is guarded by #ifdef CONFIG_X86. Move the thing to the arch_cpu_finalize_init() path on x86 and get rid of the #ifdef in start_kernel(). No functional change intended. Signed-off-by: Alexander Shishkin Suggested-by: Kirill A. Shutemov Reviewed-by: Sohil Mehta Acked-by: Ard Biesheuvel Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/cpu/common.c | 7 +++++++ init/main.c | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 8feb8fd2957a..4f430be285de 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -26,6 +26,7 @@ #include #include #include +#include =20 #include #include @@ -2529,6 +2530,12 @@ void __init arch_cpu_finalize_init(void) fpu__init_system(); fpu__init_cpu(); =20 + /* + * This needs to follow the FPU initializtion, since EFI depends on it. + */ + if (efi_enabled(EFI_RUNTIME_SERVICES)) + efi_enter_virtual_mode(); + /* * Ensure that access to the per CPU representation has the initial * boot CPU configuration. diff --git a/init/main.c b/init/main.c index 225a58279acd..f9f401b6fdfb 100644 --- a/init/main.c +++ b/init/main.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -1068,10 +1067,6 @@ void start_kernel(void) =20 pid_idr_init(); anon_vma_init(); -#ifdef CONFIG_X86 - if (efi_enabled(EFI_RUNTIME_SERVICES)) - efi_enter_virtual_mode(); -#endif thread_stack_cache_init(); cred_init(); fork_init(); --=20 2.47.2