diff mbox series

[RFT,2/2] arm64: efi: Force use of SetVirtualAddressMap() on MS Surface

Message ID 20230117142718.564299-3-ardb@kernel.org
State New
Headers show
Series arm64: efi: Call SetVaMap() with a 1:1 mapping | expand

Commit Message

Ard Biesheuvel Jan. 17, 2023, 2:27 p.m. UTC
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 mbox series

Patch

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");