Skip to content

Commit 4f8055d

Browse files
Ard Biesheuvelmfleming
authored andcommitted
efi/esrt: Use memremap not ioremap to access ESRT table in memory
On ARM and arm64, ioremap() and memremap() are not interchangeable like on x86, and the use of ioremap() on ordinary RAM is typically flagged as an error if the memory region being mapped is also covered by the linear mapping, since that would lead to aliases with conflicting cacheability attributes. Since what we are dealing with is not an I/O region with side effects, using ioremap() here is arguably incorrect anyway, so let's replace it with memremap() instead. Acked-by: Peter Jones <pjones@redhat.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
1 parent 607271b commit 4f8055d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/firmware/efi/esrt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/device.h>
1717
#include <linux/efi.h>
1818
#include <linux/init.h>
19+
#include <linux/io.h>
1920
#include <linux/kernel.h>
2021
#include <linux/kobject.h>
2122
#include <linux/list.h>
@@ -387,9 +388,9 @@ static int __init esrt_sysfs_init(void)
387388
if (!esrt_data || !esrt_data_size)
388389
return -ENOSYS;
389390

390-
esrt = ioremap(esrt_data, esrt_data_size);
391+
esrt = memremap(esrt_data, esrt_data_size, MEMREMAP_WB);
391392
if (!esrt) {
392-
pr_err("ioremap(%pa, %zu) failed.\n", &esrt_data,
393+
pr_err("memremap(%pa, %zu) failed.\n", &esrt_data,
393394
esrt_data_size);
394395
return -ENOMEM;
395396
}

0 commit comments

Comments
 (0)