Skip to content

Commit 081cd62

Browse files
author
Matt Fleming
committed
x86/efi: Allow mapping BGRT on x86-32
CONFIG_X86_32 doesn't map the boot services regions into the EFI memory map (see commit 7008701 ("x86, efi: Don't map Boot Services on i386")), and so efi_lookup_mapped_addr() will fail to return a valid address. Executing the ioremap() path in efi_bgrt_init() causes the following warning on x86-32 because we're trying to ioremap() RAM, WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:102 __ioremap_caller+0x2ad/0x2c0() Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0-0.rc5.git0.1.2.fc21.i686 #1 Hardware name: DellInc. Venue 8 Pro 5830/09RP78, BIOS A02 10/17/2013 00000000 00000000 c0c0df08 c09a5196 00000000 c0c0df38 c0448c1e c0b41310 00000000 00000000 c0b37bc1 00000066 c043bbfd c043bbfd 00e7dfe0 00073eff 00073eff c0c0df48 c0448ce2 00000009 00000000 c0c0df9c c043bbfd 00078d88 Call Trace: [<c09a5196>] dump_stack+0x41/0x52 [<c0448c1e>] warn_slowpath_common+0x7e/0xa0 [<c043bbfd>] ? __ioremap_caller+0x2ad/0x2c0 [<c043bbfd>] ? __ioremap_caller+0x2ad/0x2c0 [<c0448ce2>] warn_slowpath_null+0x22/0x30 [<c043bbfd>] __ioremap_caller+0x2ad/0x2c0 [<c0718f92>] ? acpi_tb_verify_table+0x1c/0x43 [<c0719c78>] ? acpi_get_table_with_size+0x63/0xb5 [<c087cd5e>] ? efi_lookup_mapped_addr+0xe/0xf0 [<c043bc2b>] ioremap_nocache+0x1b/0x20 [<c0cb01c8>] ? efi_bgrt_init+0x83/0x10c [<c0cb01c8>] efi_bgrt_init+0x83/0x10c [<c0cafd82>] efi_late_init+0x8/0xa [<c0c9bab2>] start_kernel+0x3ae/0x3c3 [<c0c9b53b>] ? repair_env_string+0x51/0x51 [<c0c9b378>] i386_start_kernel+0x12e/0x131 Switch to using early_memremap(), which won't trigger this warning, and has the added benefit of more accurately conveying what we're trying to do - map a chunk of memory. This patch addresses the following bug report, https://bugzilla.kernel.org/show_bug.cgi?id=67911 Reported-by: Adam Williamson <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Matthew Garrett <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Signed-off-by: Matt Fleming <[email protected]>
1 parent 38dbfb5 commit 081cd62

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/x86/platform/efi/efi-bgrt.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,25 @@ void __init efi_bgrt_init(void)
4949

5050
image = efi_lookup_mapped_addr(bgrt_tab->image_address);
5151
if (!image) {
52-
image = ioremap(bgrt_tab->image_address, sizeof(bmp_header));
52+
image = early_memremap(bgrt_tab->image_address,
53+
sizeof(bmp_header));
5354
ioremapped = true;
5455
if (!image)
5556
return;
5657
}
5758

5859
memcpy_fromio(&bmp_header, image, sizeof(bmp_header));
5960
if (ioremapped)
60-
iounmap(image);
61+
early_iounmap(image, sizeof(bmp_header));
6162
bgrt_image_size = bmp_header.size;
6263

6364
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL);
6465
if (!bgrt_image)
6566
return;
6667

6768
if (ioremapped) {
68-
image = ioremap(bgrt_tab->image_address, bmp_header.size);
69+
image = early_memremap(bgrt_tab->image_address,
70+
bmp_header.size);
6971
if (!image) {
7072
kfree(bgrt_image);
7173
bgrt_image = NULL;
@@ -75,5 +77,5 @@ void __init efi_bgrt_init(void)
7577

7678
memcpy_fromio(bgrt_image, image, bgrt_image_size);
7779
if (ioremapped)
78-
iounmap(image);
80+
early_iounmap(image, bmp_header.size);
7981
}

0 commit comments

Comments
 (0)