Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2666726rwa; Mon, 22 Aug 2022 11:23:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR7y95LG5tjvm6TMLFBVhA7bAYe1OpA7bcr8WdHpXsKrHFbs/yn+rChsV56x1Lwk//w3xca+ X-Received: by 2002:a17:90b:1a8f:b0:1f7:299d:9c08 with SMTP id ng15-20020a17090b1a8f00b001f7299d9c08mr24599192pjb.190.1661192581957; Mon, 22 Aug 2022 11:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661192581; cv=none; d=google.com; s=arc-20160816; b=hYRnqnjS82ODo8fJ3US0OcRC0l88BVXm21GFSDnSr421I4YOMJX87PBrf6Y4x6H+eB zsaO75+YcjhPpln5vY325GfXAiHXPkG1zykMpS9ZCKsl5XAhUQ8WQ/VR40yTF6yhcMHL VBZQxj2MBdMiHVXE8N/eMUzpcMpSGr2JPZi/cBg415lc5laTA8+in504EYK1vEGJVmEE DYyNqpARQIaqmANk+wHodTHrHQJAabvBQA5idsIBPG6fsIfe5WHQV+KlbV/7M8PxnRhh gEyNHGE38bu0JB5jHZkUrlgULyicYQ1KVGVY5di+XiBmq7R+iPYu4i2uKJY5LgNBFYPh 3mKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JCw5k8+PFVcv8qIP5U9PsuiUeSBZubWCY+qgf+WP8Do=; b=Xkip1Twsqf8sIMySKmHPHLtESz/E9+wgPdoDKpPyyot1A+JeIRqSdGgF4BpBPIPAOh CApVga/Aq8IQ0FWsXSIhz+qLOzBqgzLnXMfp6/n7l2qEj8sH/4gtFQU9RUdDHBwaRm6p Am1CTMrojph0wbA0xu8RGJ3d9fAUTDzNGswoCXobxsEyGimVpK+8N2b2G+8/Nsn4G6RR E+Np4Yr+ZkqCI/dRVndCuXLmH8YlChwp9ICtoh6z2wtkdYcQzrIuo+uV4VX3RbZzlSKo HBM82gOKnFhiGgBvNKkNBg7UpNnIKZevkSYMNmJuRnz17KYXNPuH2FrbJ7buV9kYoL8J miGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="n/f09OF6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a63e14f000000b0041bc27b0c1dsi9761353pgk.706.2022.08.22.11.22.50; Mon, 22 Aug 2022 11:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="n/f09OF6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236180AbiHVSD5 (ORCPT + 99 others); Mon, 22 Aug 2022 14:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235832AbiHVSDv (ORCPT ); Mon, 22 Aug 2022 14:03:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB98275C2; Mon, 22 Aug 2022 11:03:37 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id AFB5DB816E6; Mon, 22 Aug 2022 18:03:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F0D5C43141; Mon, 22 Aug 2022 18:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661191415; bh=JCw5k8+PFVcv8qIP5U9PsuiUeSBZubWCY+qgf+WP8Do=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=n/f09OF6skok1n2OaV2CtlrZFv1LmMn3PJkHBT76A5XESBJqqvEFwugLuE1TjKgqP 2vMiEP4EdeJVuGoNMqCTbQQ+ka80LalWkPNTJE1vJWOI5K7j6z990O8E2KIybKzN+B MGuiIdNEecsdRcqsXIBT3FqSqs8MPLXZG2OBm66jztbKHO4ZW8c+kKk88KTIYVd6G3 P1M5Or3I729hys0r+dln38qH2B9rEf/V6gVU79G8GSDYRbpEoGxkTYOaO/mDPyqcD4 LhsA5apCkoEGp/57s/qVfFSCbsseedE6MPmWYP1qIT4MzN5n/pyOQnq48C7d6ugBw2 gsFvSUmw3Aswg== Received: by mail-wm1-f44.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so6449028wms.5; Mon, 22 Aug 2022 11:03:35 -0700 (PDT) X-Gm-Message-State: ACgBeo1a8UiI0W09PPkbqCYcmvlKvM6SIqKnqXNJMqa0DHocezzfbuT0 LGENd1W+/qLj3xZU45fuA0ebaDaDYEuBxusgBow= X-Received: by 2002:a1c:3b55:0:b0:3a6:7b62:3901 with SMTP id i82-20020a1c3b55000000b003a67b623901mr29347wma.113.1661191413596; Mon, 22 Aug 2022 11:03:33 -0700 (PDT) MIME-Version: 1.0 References: <20220819102037.2697798-1-chenhuacai@loongson.cn> In-Reply-To: From: Ard Biesheuvel Date: Mon, 22 Aug 2022 20:03:22 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V3] LoongArch: Add efistub booting support To: Huacai Chen Cc: Arnd Bergmann , Huacai Chen , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Xi Ruoyao Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Aug 2022 at 12:44, Ard Biesheuvel wrote: > > On Fri, 19 Aug 2022 at 12:20, Huacai Chen wrote: > > > > This patch adds efistub booting support, which is the standard UEFI boot > > protocol for us to use. > > > > We use generic efistub, which means we can pass boot information (i.e., > > system table, memory map, kernel command line, initrd) via a light FDT > > and drop a lot of non-standard code. > > > > We use a flat mapping to map the efi runtime in the kernel's address > > space. In efi, VA = PA; in kernel, VA = PA + PAGE_OFFSET. As a result, > > flat mapping is not identity mapping, SetVirtualAddressMap() is still > > needed for the efi runtime. > > > > Tested-by: Xi Ruoyao > > Signed-off-by: Huacai Chen > > --- > > V1 --> V2: > > 1, Call SetVirtualAddressMap() in stub; > > 2, Use core kernel data directly in alloc_screen_info(); > > 3, Remove the magic number in MS-DOS header; > > 4, Disable EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER; > > 5, Some other small changes suggested by Ard Biesheuvel. > > > > V2 --> V3: > > 1, Adjust Makefile to adapt zboot; > > 2, Introduce EFI_RT_VIRTUAL_OFFSET instead of changing flat_va_mapping. > > > > Thanks for the update. > > I am going to queue this up in the efi/next tree. However, due to the > many changes to arch/loongarch in this patch, conflicts are not > unlikely, so I created a signed stable tag for the patch that you can > merge into the loongarch arch tree if you want. > > *However*, you must *not* rebase your tree after merging this tag. > Therefore, it is probably best that the merge of this tag appears as > the very first change on your PR to Linus for v6.1. Everything after > can be rebased at will (assuming there are no other impediments to > doing so) > > You can fetch it and merge it like so: > > git fetch -t git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git > git verify-tag efi-loongarch-for-v6.1 # if you like > git merge efi-loongarch-for-v6.1 > > and all your other v6.1 changes can go on top. > > This way, you can resolve conflicts locally without affecting the EFI > changes going via the other tree. The EFI stub for LoongArch change > will arrive into Linus's tree via whichever tree he pulls first: the > LoongArch one or the EFI one. > > I will rebase my zboot decompressor changes on top of this - I will cc > you again, as the LoongArch builds ok but still does not boot. > I have pushed a branch here that includes EFI decompressor support for LoongArch https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=efi-decompressor-v4 You will need to enable CONFIG_EFI_ZBOOT and build the zImage.efi target. The resulting image should be bootable jus tlike the vmlinux.efi but for some reason, it produces the crash I reported earlier. Please give it a try, and if you manage to figure out what's wrong with my code, please let me know :-) Thanks, Ard.