linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thorsten Leemhuis <regressions@leemhuis.info>
To: Yicong Yang <yangyicong@huawei.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-efi@vger.kernel.org
Cc: yangyicong@hisilicon.com, linux-arm-kernel@lists.infradead.org,
	mark.rutland@arm.com, probinson@gmail.com, andersson@kernel.org,
	catalin.marinas@arm.com, will@kernel.org,
	Linuxarm <linuxarm@huawei.com>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>
Subject: Re: [PATCH] efi/libstub: arm64: avoid SetVirtualAddressMap() when possible
Date: Thu, 20 Oct 2022 14:39:09 +0200	[thread overview]
Message-ID: <9c06c75d-5079-dd27-6533-c053c986083e@leemhuis.info> (raw)
In-Reply-To: <56877644-8173-d2ed-ed00-7973734a3698@huawei.com>

[TLDR: I'm adding this regression report to the list of tracked
regressions; all text from me you find below is based on a few templates
paragraphs you might have encountered already already in similar form.]

Hi, this is your Linux kernel regression tracker. CCing the regression
mailing list, as it should be in the loop for all regressions, as
explained here:
https://www.kernel.org/doc/html/latest/admin-guide/reporting-issues.html
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.

Thanks for the report. To be sure below issue doesn't fall through the
cracks unnoticed, I'm adding it to regzbot, my Linux kernel regression
tracking bot:

#regzbot ^introduced d3549a938b73f203ef522562ae9f2d38aa43d234
#regzbot title efi/libstub: arm64: efi runtime services stopped working
#regzbot ignore-activity

This isn't a regression? This issue or a fix for it are already
discussed somewhere else? It was fixed already? You want to clarify when
the regression started to happen? Or point out I got the title or
something else totally wrong? Then just reply -- ideally with also
telling regzbot about it, as explained here:
https://linux-regtracking.leemhuis.info/tracked-regression/

Reminder for developers: When fixing the issue, add 'Link:' tags
pointing to the report (the mail this one replies to), as explained for
in the Linux kernel's documentation; above webpage explains why this is
important for tracked regressions.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)

P.S.: As the Linux kernel's regression tracker I deal with a lot of
reports and sometimes miss something important when writing mails like
this. If that's the case here, don't hesitate to tell me in a public
reply, it's in everyone's interest to set the public record straight.

> On 2022/9/16 18:18, Ard Biesheuvel wrote:
>> EFI's SetVirtualAddressMap() runtime service is a horrid hack that we'd
>> like to avoid using, if possible. For 64-bit architectures such as
>> arm64, the user and kernel mappings are entirely disjoint, and given
>> that we use the user region for mapping the UEFI runtime regions when
>> running under the OS, we don't rely on SetVirtualAddressMap() in the
>> conventional way, i.e., to permit kernel mappings of the OS to coexist
>> with kernel region mappings of the firmware regions. This means that, in
>> principle, we should be able to avoid SetVirtualAddressMap() altogether,
>> and simply use the 1:1 mapping that UEFI uses at boot time. (Note that
>> omitting SetVirtualAddressMap() is explicitly permitted by the UEFI
>> spec).
>>
>> However, there is a corner case on arm64, which, if configured for
>> 3-level paging (or 2-level paging when using 64k pages), may not be able
>> to cover the entire range of firmware mappings (which might contain both
>> memory and MMIO peripheral mappings).
>>
>> So let's avoid SetVirtualAddressMap() on arm64, but only if the VA space
>> is guaranteed to be of sufficient size.
>>
>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>> ---
>>  drivers/firmware/efi/libstub/arm64-stub.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
>> index cd3bea25c762..4fff6c32899e 100644
>> --- a/drivers/firmware/efi/libstub/arm64-stub.c
>> +++ b/drivers/firmware/efi/libstub/arm64-stub.c
>> @@ -31,6 +31,15 @@ efi_status_t check_platform_features(void)
>>  			efi_err("This 16 KB granular kernel is not supported by your CPU\n");
>>  		return EFI_UNSUPPORTED;
>>  	}
>> +
>> +	/*
>> +	 * If we have 48 bits of VA space for TTBR0 mappings, we can map the
>> +	 * UEFI runtime regions 1:1 and so calling SetVirtualAddressMap() is
>> +	 * unnecessary.
>> +	 */
>> +	if (VA_BITS_MIN >= 48)
>> +		efi_novamap = true;
>> +
>>  	return EFI_SUCCESS;
>>  }
>>  
>>
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-10-20 12:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16 10:18 [PATCH] efi/libstub: arm64: avoid SetVirtualAddressMap() when possible Ard Biesheuvel
2022-09-16 10:20 ` Ard Biesheuvel
2022-10-19  3:24 ` Yicong Yang
2022-10-20 12:39   ` Thorsten Leemhuis [this message]
2022-10-20 13:04     ` Ard Biesheuvel
2022-10-21  1:59       ` Yicong Yang
2022-10-23 14:58     ` [PATCH] efi/libstub: arm64: avoid SetVirtualAddressMap() when possible #forregzbot Thorsten Leemhuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c06c75d-5079-dd27-6533-c053c986083e@leemhuis.info \
    --to=regressions@leemhuis.info \
    --cc=andersson@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=probinson@gmail.com \
    --cc=regressions@lists.linux.dev \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).