From patchwork Wed Jul 10 16:06:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 812370 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 0C6DA194AFC; Wed, 10 Jul 2024 16:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627782; cv=none; b=DQQALVKzK6TwUpIk24Zu8JYMln7+0ge3d3vwFzX7u5lC2+Bv0z6m3bfF57gRS3Exa0qlJWQQIw8LodQ74TWVo6yLwSC+lIR198HOMxwtnicxId0JDzMDQVlGwGw4ugvp6KqQfO/k4SLrGa1h4B2vhGx/0BSDj8diIe75C+9MfMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627782; c=relaxed/simple; bh=V9px3JV2Wl/ar/jIBNnaNIJiRCsSG4GK1x15nw8iC7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dzUcmasKoGuCA/mTlB7U2KOqO9ezoZbb6Gry4tg0jDQz6VZTgqaiPDjVU9JZ+KMQqVi8tfLZ4bX13Nh8RSQ+hgN0xBK7RleGuajfCFYVWO3oyXbX6WVagRmnIt6LxPriPG2VERo9vNiAnSbc6jlziNLq+ti5PIFjR+6njc8ur5Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LvArj8vm; arc=none smtp.client-ip=198.175.65.16 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.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LvArj8vm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720627781; x=1752163781; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V9px3JV2Wl/ar/jIBNnaNIJiRCsSG4GK1x15nw8iC7A=; b=LvArj8vmp1FSzyjz0lVzZ3Rl5pUkLsqLQTY8q+tQ2iHdr+qAJpq0juna o/Pf96t7QWzL2RscIuy0CovhgiqeQeocoE5kmfP9NyYOmZcxyEZzFUeBj ljfhIajT5AU6pqOoxl6yZkSlwDhaKpgfFpvMpjlI1VHss+n6v8NOMwvf/ 9WLjOLO5OeG7Rt4d4OMbJXfAjYlxTyHf/ezDVnZZSOuZXe1Xe8ttGULnJ RCKqvtaRtk2FtpVPrncqWrTu0f3TlAKibvR9WhZOEa1YnjGHLnSVcmAYe +F6ZldI3ePnAC5ORERIRrtvDMWXa/o/SiM0e8q4lvhyJ4EqnukSnl6EsW w==; X-CSE-ConnectionGUID: mRo/3/hKSHCLfkAARkz30w== X-CSE-MsgGUID: YhXbDnMXR96759uJJrveAQ== X-IronPort-AV: E=McAfee;i="6700,10204,11129"; a="18103074" X-IronPort-AV: E=Sophos;i="6.09,198,1716274800"; d="scan'208";a="18103074" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2024 09:09:40 -0700 X-CSE-ConnectionGUID: S7w7cXdtTPGVrNV0zBopdA== X-CSE-MsgGUID: vhTxzJONQAybATYZIRD++A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,198,1716274800"; d="scan'208";a="53084797" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by orviesa003.jf.intel.com with ESMTP; 10 Jul 2024 09:09:28 -0700 From: Alexander Shishkin 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 , "Kirill A. Shutemov" , Alexey Kardashevskiy Cc: Jonathan Corbet , Alexander Shishkin , Sohil Mehta , Ingo Molnar , Pawan Gupta , Daniel Sneddon , Kai Huang , Sandipan Das , Breno Leitao , Rick Edgecombe , Yian Chen , 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 Subject: [PATCH v4 06/16] init/main.c: Move EFI runtime service initialization to x86/cpu Date: Wed, 10 Jul 2024 19:06:42 +0300 Message-ID: <20240710160655.3402786-7-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240710160655.3402786-1-alexander.shishkin@linux.intel.com> References: <20240710160655.3402786-1-alexander.shishkin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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 33a76256a6f5..8aa621dc7d30 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -2364,6 +2365,12 @@ void __init arch_cpu_finalize_init(void) fpu__init_system(); fpu__init_cpu(); + /* + * 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 206acdde51f5..cce4ceaf7c9c 100644 --- a/init/main.c +++ b/init/main.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -1070,10 +1069,6 @@ void start_kernel(void) 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();