[PATCH] efi/libstub: arm64: avoid SetVirtualAddressMap() when possible

Yicong Yang yangyicong at huawei.com
Thu Oct 20 18:59:56 PDT 2022


Hi Ard,

On 2022/10/20 21:04, Ard Biesheuvel wrote:
>> On 19.10.22 05:24, Yicong Yang wrote:
>>>
>>> After entering 6.1-rc1 the efi runtime services is not working on my platform:
>>>
>>> [    0.054039] Remapping and enabling EFI services.
>>> [    0.054043] UEFI virtual mapping missing or invalid -- runtime services will not be available
>>>
>>> Not sure this patch is the root cause since I see some refactor of efi codes in 6.1-rc1,
>>> but simply reverting this make EFI runtime services works again. Tested on HiSilicon's
>>> Kunpeng 920 arm64 server using 48 bit VA address:
>>>
>>> CONFIG_ARM64_VA_BITS_48=y
>>> CONFIG_ARM64_VA_BITS=48
>>>
>>> Thanks.
> 
> Hi,
> 
> Can you try the change below please?
> 
> +++ b/drivers/firmware/efi/arm-runtime.c
> @@ -63,7 +63,7 @@ static bool __init efi_virtmap_init(void)
> 
>                 if (!(md->attribute & EFI_MEMORY_RUNTIME))
>                         continue;
> -               if (md->virt_addr == 0)
> +               if (md->virt_addr == 0 && md->phys_addr != 0)
>                         return false;
> 
>                 ret = efi_create_mapping(&efi_mm, md);
> .
> 

Thanks for fixing this. This change works on my machine. I see you've already post a patch including
this [1]. Tested for both this change and that patch, the efi runtime services works again:

[root at localhost ~]# dmesg | grep -i efi
[...]
[    0.015321] Remapping and enabling EFI services.
[    3.821339] Registered efivars operations
[   16.347372] CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 6.1.0-rc1-efi-fix-test+ #18
[   16.674766] rtc-efi rtc-efi.0: registered as rtc0
[   16.687659] rtc-efi rtc-efi.0: setting system clock to 2022-10-21T01:53:35 UTC (1666317215)
[   16.733137] pstore: ignoring unexpected backend 'efi'
[   18.411800]     BOOT_IMAGE=/vmlinuz-6.1.0-rc1-efi-fix-test+

For arm64 part:

Tested-by: Yicong Yang <yangyicong at hisilicon.com>

[1] https://lore.kernel.org/linux-efi/20221020185416.1953242-1-ardb@kernel.org/T/#u

Thanks





More information about the linux-arm-kernel mailing list