Skip to content

Commit e2f73d1

Browse files
committed
Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI fixes from Ingo Molnar: "Three EFI fixes: - Fix a slow-boot-scrolling regression but making sure we use WC for EFI earlycon framebuffer mappings on x86 - Fix a mixed EFI mode boot crash - Disable paging explicitly before entering startup_32() in mixed mode bootup" * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/efistub: Disable paging at mixed mode entry efi/libstub/random: Initialize pointer variables to zero for mixed mode efi/earlycon: Fix write-combine mapping on x86
2 parents ba0f472 + 4911ee4 commit e2f73d1

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

arch/x86/boot/compressed/head_64.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ SYM_FUNC_START(efi32_stub_entry)
244244
leal efi32_config(%ebp), %eax
245245
movl %eax, efi_config(%ebp)
246246

247+
/* Disable paging */
248+
movl %cr0, %eax
249+
btrl $X86_CR0_PG_BIT, %eax
250+
movl %eax, %cr0
251+
247252
jmp startup_32
248253
SYM_FUNC_END(efi32_stub_entry)
249254
#endif

drivers/firmware/efi/earlycon.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static const struct console *earlycon_console __initdata;
1717
static const struct font_desc *font;
1818
static u32 efi_x, efi_y;
1919
static u64 fb_base;
20-
static pgprot_t fb_prot;
20+
static bool fb_wb;
2121
static void *efi_fb;
2222

2323
/*
@@ -33,10 +33,8 @@ static int __init efi_earlycon_remap_fb(void)
3333
if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
3434
return 0;
3535

36-
if (pgprot_val(fb_prot) == pgprot_val(PAGE_KERNEL))
37-
efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WB);
38-
else
39-
efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WC);
36+
efi_fb = memremap(fb_base, screen_info.lfb_size,
37+
fb_wb ? MEMREMAP_WB : MEMREMAP_WC);
4038

4139
return efi_fb ? 0 : -ENOMEM;
4240
}
@@ -53,9 +51,12 @@ late_initcall(efi_earlycon_unmap_fb);
5351

5452
static __ref void *efi_earlycon_map(unsigned long start, unsigned long len)
5553
{
54+
pgprot_t fb_prot;
55+
5656
if (efi_fb)
5757
return efi_fb + start;
5858

59+
fb_prot = fb_wb ? PAGE_KERNEL : pgprot_writecombine(PAGE_KERNEL);
5960
return early_memremap_prot(fb_base + start, len, pgprot_val(fb_prot));
6061
}
6162

@@ -215,10 +216,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device,
215216
if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
216217
fb_base |= (u64)screen_info.ext_lfb_base << 32;
217218

218-
if (opt && !strcmp(opt, "ram"))
219-
fb_prot = PAGE_KERNEL;
220-
else
221-
fb_prot = pgprot_writecombine(PAGE_KERNEL);
219+
fb_wb = opt && !strcmp(opt, "ram");
222220

223221
si = &screen_info;
224222
xres = si->lfb_width;

drivers/firmware/efi/libstub/random.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table_arg,
3333
{
3434
efi_guid_t rng_proto = EFI_RNG_PROTOCOL_GUID;
3535
efi_status_t status;
36-
struct efi_rng_protocol *rng;
36+
struct efi_rng_protocol *rng = NULL;
3737

3838
status = efi_call_early(locate_protocol, &rng_proto, NULL,
3939
(void **)&rng);
@@ -162,8 +162,8 @@ efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg)
162162
efi_guid_t rng_proto = EFI_RNG_PROTOCOL_GUID;
163163
efi_guid_t rng_algo_raw = EFI_RNG_ALGORITHM_RAW;
164164
efi_guid_t rng_table_guid = LINUX_EFI_RANDOM_SEED_TABLE_GUID;
165-
struct efi_rng_protocol *rng;
166-
struct linux_efi_random_seed *seed;
165+
struct efi_rng_protocol *rng = NULL;
166+
struct linux_efi_random_seed *seed = NULL;
167167
efi_status_t status;
168168

169169
status = efi_call_early(locate_protocol, &rng_proto, NULL,

0 commit comments

Comments
 (0)