Commit 072a2767 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86_urgent_for_v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

 - Fix build error on RHEL where -Werror=maybe-uninitialized is set.

 - Restore the firmware's IDT when calling EFI boot services and before
   ExitBootServices() has been called. This fixes a boot failure on what
   appears to be a tablet with 32-bit UEFI running a 64-bit kernel.

* tag 'x86_urgent_for_v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/resctrl: Fix a maybe-uninitialized build warning treated as error
  x86/efi: Restore Firmware IDT before calling ExitBootServices()
parents f6a3308d 527f7214
...@@ -5,9 +5,8 @@ ...@@ -5,9 +5,8 @@
* Early support for invoking 32-bit EFI services from a 64-bit kernel. * Early support for invoking 32-bit EFI services from a 64-bit kernel.
* *
* Because this thunking occurs before ExitBootServices() we have to * Because this thunking occurs before ExitBootServices() we have to
* restore the firmware's 32-bit GDT before we make EFI service calls, * restore the firmware's 32-bit GDT and IDT before we make EFI service
* since the firmware's 32-bit IDT is still currently installed and it * calls.
* needs to be able to service interrupts.
* *
* On the plus side, we don't have to worry about mangling 64-bit * On the plus side, we don't have to worry about mangling 64-bit
* addresses into 32-bits because we're executing with an identity * addresses into 32-bits because we're executing with an identity
...@@ -39,7 +38,7 @@ SYM_FUNC_START(__efi64_thunk) ...@@ -39,7 +38,7 @@ SYM_FUNC_START(__efi64_thunk)
/* /*
* Convert x86-64 ABI params to i386 ABI * Convert x86-64 ABI params to i386 ABI
*/ */
subq $32, %rsp subq $64, %rsp
movl %esi, 0x0(%rsp) movl %esi, 0x0(%rsp)
movl %edx, 0x4(%rsp) movl %edx, 0x4(%rsp)
movl %ecx, 0x8(%rsp) movl %ecx, 0x8(%rsp)
...@@ -49,14 +48,19 @@ SYM_FUNC_START(__efi64_thunk) ...@@ -49,14 +48,19 @@ SYM_FUNC_START(__efi64_thunk)
leaq 0x14(%rsp), %rbx leaq 0x14(%rsp), %rbx
sgdt (%rbx) sgdt (%rbx)
addq $16, %rbx
sidt (%rbx)
/* /*
* Switch to gdt with 32-bit segments. This is the firmware GDT * Switch to IDT and GDT with 32-bit segments. This is the firmware GDT
* that was installed when the kernel started executing. This * and IDT that was installed when the kernel started executing. The
* pointer was saved at the EFI stub entry point in head_64.S. * pointers were saved at the EFI stub entry point in head_64.S.
* *
* Pass the saved DS selector to the 32-bit code, and use far return to * Pass the saved DS selector to the 32-bit code, and use far return to
* restore the saved CS selector. * restore the saved CS selector.
*/ */
leaq efi32_boot_idt(%rip), %rax
lidt (%rax)
leaq efi32_boot_gdt(%rip), %rax leaq efi32_boot_gdt(%rip), %rax
lgdt (%rax) lgdt (%rax)
...@@ -67,7 +71,7 @@ SYM_FUNC_START(__efi64_thunk) ...@@ -67,7 +71,7 @@ SYM_FUNC_START(__efi64_thunk)
pushq %rax pushq %rax
lretq lretq
1: addq $32, %rsp 1: addq $64, %rsp
movq %rdi, %rax movq %rdi, %rax
pop %rbx pop %rbx
...@@ -128,10 +132,13 @@ SYM_FUNC_START_LOCAL(efi_enter32) ...@@ -128,10 +132,13 @@ SYM_FUNC_START_LOCAL(efi_enter32)
/* /*
* Some firmware will return with interrupts enabled. Be sure to * Some firmware will return with interrupts enabled. Be sure to
* disable them before we switch GDTs. * disable them before we switch GDTs and IDTs.
*/ */
cli cli
lidtl (%ebx)
subl $16, %ebx
lgdtl (%ebx) lgdtl (%ebx)
movl %cr4, %eax movl %cr4, %eax
...@@ -166,6 +173,11 @@ SYM_DATA_START(efi32_boot_gdt) ...@@ -166,6 +173,11 @@ SYM_DATA_START(efi32_boot_gdt)
.quad 0 .quad 0
SYM_DATA_END(efi32_boot_gdt) SYM_DATA_END(efi32_boot_gdt)
SYM_DATA_START(efi32_boot_idt)
.word 0
.quad 0
SYM_DATA_END(efi32_boot_idt)
SYM_DATA_START(efi32_boot_cs) SYM_DATA_START(efi32_boot_cs)
.word 0 .word 0
SYM_DATA_END(efi32_boot_cs) SYM_DATA_END(efi32_boot_cs)
......
...@@ -319,6 +319,9 @@ SYM_INNER_LABEL(efi32_pe_stub_entry, SYM_L_LOCAL) ...@@ -319,6 +319,9 @@ SYM_INNER_LABEL(efi32_pe_stub_entry, SYM_L_LOCAL)
movw %cs, rva(efi32_boot_cs)(%ebp) movw %cs, rva(efi32_boot_cs)(%ebp)
movw %ds, rva(efi32_boot_ds)(%ebp) movw %ds, rva(efi32_boot_ds)(%ebp)
/* Store firmware IDT descriptor */
sidtl rva(efi32_boot_idt)(%ebp)
/* Disable paging */ /* Disable paging */
movl %cr0, %eax movl %cr0, %eax
btrl $X86_CR0_PG_BIT, %eax btrl $X86_CR0_PG_BIT, %eax
......
...@@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr) ...@@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr)
case QOS_L3_MBM_LOCAL_EVENT_ID: case QOS_L3_MBM_LOCAL_EVENT_ID:
m = &rr->d->mbm_local[rmid]; m = &rr->d->mbm_local[rmid];
break; break;
default:
/*
* Code would never reach here because an invalid
* event id would fail the __rmid_read.
*/
return RMID_VAL_ERROR;
} }
if (rr->first) { if (rr->first) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment