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

Ard Biesheuvel ardb at kernel.org
Tue Jan 17 06:27:18 PST 2023


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 at 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




More information about the linux-arm-kernel mailing list