linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Ard Biesheuvel <ardb@kernel.org>,
	Johan Hovold <johan+linaro@kernel.org>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Steev Klimaszewski <steev@kali.org>,
	Shawn Guo <shawn.guo@linaro.org>
Subject: [RFT PATCH 2/2] arm64: efi: Force use of SetVirtualAddressMap() on MS Surface
Date: Tue, 17 Jan 2023 15:27:18 +0100	[thread overview]
Message-ID: <20230117142718.564299-3-ardb@kernel.org> (raw)
In-Reply-To: <20230117142718.564299-1-ardb@kernel.org>

Qualcomm Snapdragon based Surface machines crash in the ResetSystem()
EFI runtime service if SetVirtualAddressMap() has not been called prior.

Unfortunately, SetVirtualAddressMap() itself crashes at boot time unless
the mapping being installed is a 1:1 mapping, as these firmware
implementations violate the EFI spec by accessing the new mapping before
SetVirtualAddressMap() completes.

Now that we have worked around the latter issue by always using a 1:1
map when the size of the VA space permits it, we can safely call
SetVirtualAddressMap() in such cases.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/arm64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/arm64.c b/drivers/firmware/efi/libstub/arm64.c
index ff2d18c42ee74979..cc3757fc29bdda24 100644
--- a/drivers/firmware/efi/libstub/arm64.c
+++ b/drivers/firmware/efi/libstub/arm64.c
@@ -22,7 +22,8 @@ static bool system_needs_vamap(void)
 	 * Ampere Altra machines crash in SetTime() if SetVirtualAddressMap()
 	 * has not been called prior.
 	 */
-	if (!type1_family || strcmp(type1_family, "Altra"))
+	if (!type1_family ||
+	    (strcmp(type1_family, "Altra") && strcmp(type1_family, "Surface")))
 		return false;
 
 	efi_warn("Working around broken SetVirtualAddressMap()\n");
-- 
2.39.0


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

  parent reply	other threads:[~2023-01-17 14:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 14:27 [RFT PATCH 0/2] arm64: efi: Call SetVaMap() with a 1:1 mapping Ard Biesheuvel
2023-01-17 14:27 ` [RFT PATCH 1/2] arm64: efi: Prefer a flat virtual mapping of the runtime services Ard Biesheuvel
2023-01-17 14:27 ` Ard Biesheuvel [this message]
2023-01-17 15:20 ` [RFT PATCH 0/2] arm64: efi: Call SetVaMap() with a 1:1 mapping Ard Biesheuvel
2023-01-17 17:30   ` Nathan Chancellor
2023-01-18  7:56     ` Ard Biesheuvel
2023-01-18 15:26       ` Nathan Chancellor
2023-01-18 15:33         ` Ard Biesheuvel
2023-02-27 19:43           ` Darren Hart

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=20230117142718.564299-3-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=nathan@kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=steev@kali.org \
    /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).