efi/arm*: wire up ESRT table
v2 cover efi/arm*: wire up ESRT table
This v2 is a followup to the series I sent out on Feb 15. These now apply onto Matt's memmap refactoring work which is intended for inclusion in v4.9, and the diffstat below reveals that enabling ESRT is now absolutely trivial. The only things needed are replacing ioremap() with memremap(), and adding the missing efi_esrt_init() invocation.
I dropped the Tested-by tags, simply because the underlying code is completely different now. I kept Peter's ack on #1, though.
Ard Biesheuvel (2):
efi: esrt: use memremap not ioremap to access ESRT table in memory efi/arm*: esrt: add missing call to efi_esrt_init()
drivers/firmware/efi/arm-init.c | 1 + drivers/firmware/efi/esrt.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 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.
--- drivers/firmware/efi/esrt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firmware/efi/esrt.c +3 -2
@@ -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>
@@ -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 ; }
Signature · 1 line
1.9.1
PATCH v2 1/2 efi: esrt: use memremap not ioremap to access ESRT table in memory
Quoted 10 lines · Ard Biesheuvel
On ARM and arm64,
ioremap()andmemremap()are not interchangeable like on x86, and the use ofioremap()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 withmemremap()instead.
Quoted 5 lines
Acked-by Peter Jones <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- drivers/firmware/efi/esrt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Looks sensible, thanks Ard, applied.
PATCH v2 2/2 efi/arm*: esrt: add missing call to efi_esrt_init()
In reply to Ard BiesheuvelESRT support is built by default for all architectures that define CONFIG_EFI. However, this support was not wired up yet for ARM/arm64, since efi_esrt_init() was never called. So add the missing call.
--- drivers/firmware/efi/arm-init.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/arm-init.c +1 -0
@@ -247,6 +247,7 @@ void __init efi_init(void)reserve_regions ();efi_memattr_init (); +efi_esrt_init ();efi_memmap_unmap (); memblock_reserve(params.mmap & PAGE_MASK,
Signature · 1 line
1.9.1
PATCH v2 2/2 efi/arm*: esrt: add missing call to efi_esrt_init()
Quoted 8 lines · Ard Biesheuvel
ESRT support is built by default for all architectures that define
CONFIG_EFI. However, this support was not wired up yet for ARM/arm64, sinceefi_esrt_init()was never called. So add the missing call.Signed-off-by Ard Biesheuvel <[email protected]>--- drivers/firmware/efi/arm-init.c | 1 + 1 file changed, 1 insertion(+)
Thanks Ard, applied and queued up for v4.9 on top of the EFI memmap refactoring.