Skip to content

Commit

Permalink
efi/esrt: Use memremap not ioremap to access ESRT table in memory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ard Biesheuvel authored and Matt Fleming committed Sep 9, 2016
1 parent 4bc9f92 commit f58a37b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/firmware/efi/esrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/device.h>
#include <linux/efi.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/list.h>
Expand Down Expand Up @@ -387,9 +388,9 @@ static int __init esrt_sysfs_init(void)
if (!esrt_data || !esrt_data_size)
return -ENOSYS;

esrt = ioremap(esrt_data, esrt_data_size);
esrt = memremap(esrt_data, esrt_data_size, MEMREMAP_WB);
if (!esrt) {
pr_err("ioremap(%pa, %zu) failed.\n", &esrt_data,
pr_err("memremap(%pa, %zu) failed.\n", &esrt_data,
esrt_data_size);
return -ENOMEM;
}
Expand Down

0 comments on commit f58a37b

Please sign in to comment.