Re: [PATCHv9 04/16] x86/cpu: Defer CR pinning setup until core initcall
From: Kirill A. Shutemov <hidden>
Date: 2025-07-09 09:38:52
Also in:
linux-efi, linux-mm, lkml
On Tue, Jul 08, 2025 at 06:19:03PM -0700, Sohil Mehta wrote:
On 7/7/2025 1:03 AM, Kirill A. Shutemov wrote:quoted
From: Alexander Shishkin <alexander.shishkin@linux.intel.com> In order to map the EFI runtime services, set_virtual_address_map() needs to be called, which resides in the lower half of the address space. This means that LASS needs to be temporarily disabled around this call. This can only be done before the CR pinning is set up. Instead of moving setup_cr_pinning() below efi_enter_virtual_mode() in arch_cpu_finalize_init(), defer it until core initcall. Wrapping efi_enter_virtual_mode() into lass_stac()/clac() is not enough because AC flag gates data accesses, but not instruction fetch. Clearing the CR4 bit is required.I think the wording might need to be reordered. How about? In order to map the EFI runtime services, set_virtual_address_map() needs to be called, which resides in the lower half of the address space. This means that LASS needs to be temporarily disabled around this call. Wrapping efi_enter_virtual_mode() into lass_stac()/clac() is not enough because AC flag gates data accesses, but not instruction fetch. Clearing the CR4 bit is required. However, this must be done before the CR pinning is set up. Instead of arbitrarily moving setup_cr_pinning() after efi_enter_virtual_mode() in arch_cpu_finalize_init(), defer it until core initcall. Other than that, Reviewed-by: Sohil Mehta <redacted>
Okay, looks good, thanks! -- Kiryl Shutsemau / Kirill A. Shutemov