From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA119C46467 for ; Wed, 18 Jan 2023 15:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=00/JepDuTxryTiZxw0xmWpdZqMBYoLB3JRFI62UsmLw=; b=yNT7OpCzqqXWqo hhYeP2U9Kt2exxLP5ntlIz8AJFnitglwyfTuWmWmSSvWfSs0TBqVi7oLLhFgECCpQvFWCywyBFmnw rHiWAvRrtuZTM3+A1RcyLHYe2OzLnr3MjPHuUKQzdGkH7owkWChyKa0cuFOYm7Sg7/kNbqT5XCN4Y cUxL0uPyD6ltuibRj7rnfjeBWqFPha5iCssOmV9nJOr24Iyeieq0EdgnQk7BLfHmb7bpEy2zG5KAk tApbIth8tzSe6olGNauVonSAc94R8m3amOTLRSqOCIx4O5WC4DvV9kWU3M/ZTs0r2LX1jiL/gfrx/ e0Twu/a9A18bZCAyGqIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAKb-001Yhy-Sj; Wed, 18 Jan 2023 15:26:29 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAKY-001YhL-1t for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 15:26:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6906E61846; Wed, 18 Jan 2023 15:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64CCAC433D2; Wed, 18 Jan 2023 15:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674055584; bh=npllznJNNerEb28WRrrNfB+An7hPaq62xutQsSMRBDw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uaqvTtkbvGdodb5u/LveV9TW6KWnAtCDAP0dj0/wLb8jRLeotC+baHKzkrCXGRRyS bDLRC+1001yaTlcYBBxvErwh3xl8fVUk0Z7JnPwyblrmsHeQZ0/ilXnvTc226/qzgV Dv9oogLzIsUsMZxEs55hFPBC6Ys5tz92zmqDcLOeQYN0wRb+ho5H9gmiaGiZEAUC+G WlrdF/85y3ZoEMfFYhsWtSho0pItoCvk1e/G7wHoOQkLP0nEoz/AgnSHblYoxKBYeX ARpBGx1M2CNJ2pm30itd1qmr8SeXkzRWH/RglZOMO73+ussOiSETYNsas1uqHs2Nn+ Ff0JIsVGK6gqg== Date: Wed, 18 Jan 2023 08:26:22 -0700 From: Nathan Chancellor To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Johan Hovold , Maximilian Luz , Steev Klimaszewski , Shawn Guo Subject: Re: [RFT PATCH 0/2] arm64: efi: Call SetVaMap() with a 1:1 mapping Message-ID: References: <20230117142718.564299-1-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_072626_192542_B7A677AF X-CRM114-Status: GOOD ( 39.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jan 18, 2023 at 08:56:54AM +0100, Ard Biesheuvel wrote: > On Tue, 17 Jan 2023 at 18:30, Nathan Chancellor wrote: > > > > On Tue, Jan 17, 2023 at 04:20:09PM +0100, Ard Biesheuvel wrote: > > > On Tue, 17 Jan 2023 at 15:27, Ard Biesheuvel wrote: > > > > > > > > Linux on arm64 is now in the same boat as x86, where supporting laptops > > > > that were built to run Windows and never tested beyond what is required > > > > for the Windows Logo certification need workarounds for all kinds of > > > > bizarre behaviors. > > > > > > > > On Snapdragon laptops, we cannot call SetVirtualAddressMap() from the > > > > stub, because the firmware will crash while trying to access memory via > > > > the virtual addresses being installed, which is explicitly unsupported > > > > by the EFI spec. > > > > > > > > However, not calling SetVirtualAddressMap() results in other problems: > > > > on Ampere Altra, it causes SetTime() to crash. On Surface and Flex5g > > > > Windows-on-ARM laptops, it causes ResetSystem() to crash. > > > > > > > > So let's try to work around this while not making too much of a mess. > > > > > > > > First of all, install a 1:1 mapping instead of avoiding SetVaMap() > > > > altogether - from the EFI spec pov, this should amount to the same > > > > thing. > > > > > > > > Then, given that we already use a SMBIOS based hack for Altra to force > > > > the use of SetVirtualAddressMap(), let's check for Surface systems in > > > > the same way. > > > > > > > > Please test, and please report the SMBIOS type 1 family field for which > > > > this workaround is needed. > > > > > > > > Also, note that these changes will not make a difference if the > > > > EFI_RT_PROPERTIES_TABLE lists SetVirtualAddressMap() as not implemented. > > > > > > > > Nathan, I would appreciate it if you could give this a spin on your > > > > Altra box (only patch #1 should make a difference), and for good > > > > measure, double check that hwclock still works as it should. > > > > > > > > Cc: Johan Hovold > > > > Cc: Maximilian Luz > > > > Cc: Nathan Chancellor > > > > Cc: Steev Klimaszewski > > > > Cc: Shawn Guo > > > > > > > > Ard Biesheuvel (2): > > > > arm64: efi: Prefer a flat virtual mapping of the runtime services > > > > arm64: efi: Force use of SetVirtualAddressMap() on MS Surface > > > > > > > > > > Bah this does not even work on Yoga C630, so this is not going to help us. > > > > > > If we want ResetSystem() on these machines, we'll have to retain other > > > memory ranges and map the in the EFI runtime map. Yuck. > > > > > > Nathan - still interested in whether patch #1 works on Altra, > > > > I applied patch 1 on top of commit 6e50979a9c87 ("Merge tag > > 'mm-hotfixes-stable-2023-01-16-15-23' of > > git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm") in Linus' tree > > and everything still appears to be okay with hwclock. If there is any > > more specific testing that I should do, please let me know. Feel free to > > add > > > > Tested-by: Nathan Chancellor > > > > to patch 1 in future revisions, and I am happy to test anything else > > that you might need in this series or future ones. > > > > Mainline: > > > > # uname -mr > > 6.2.0-rc4-00031-g6e50979a9c87 aarch64 > > > > # hwclock > > 2023-01-17 09:04:58.845411-07:00 > > > > Patch: > > > > # uname -mr > > 6.2.0-rc4-00032-g20165e83052e aarch64 > > > > # hwclock > > 2023-01-17 10:25:38.843788-07:00 > > > > Thanks Nathan, > > Forgot to mention, though: it is SetTime() not GetTime() that is > problematic on this platform. Could you please double check whether > setting the RTC using hwclock works too? Ah, okay, makes sense! As far as I can tell, that works too. Mainline: # uname -mr 6.2.0-rc4-00031-g6e50979a9c87 aarch64 # hwclock --systohc # echo $status 0 Patch: # uname -mr 6.2.0-rc4-00032-g20165e83052e aarch64 # hwclock --systohc # echo $status 0 Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel