Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp467927pxm; Wed, 2 Mar 2022 02:06:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzBgcVG14/AxmdcPKNWaCgj7o9HCmJiwyn6qP8CAl9//vrnDEAHF0PAzG3OWmtUoD95slx X-Received: by 2002:a17:90b:3504:b0:1bc:7bc8:bd4a with SMTP id ls4-20020a17090b350400b001bc7bc8bd4amr26408055pjb.226.1646215612149; Wed, 02 Mar 2022 02:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646215612; cv=none; d=google.com; s=arc-20160816; b=Crbt/66U543A+LfoVuxTxjCjMXXKCwiMguKaD3Rf6lEn1e/i/e9KZc+sn+7I+qrNsl Q9gpElrxeCMoaLoMo88CZCtjUKEujnH5dZTTYjKyV1X5OEtD2nJti6ioF2zoo74aSBgf u5EClqb5EMXOBSMxAnj9eJFz9aKj1YR/FcqYD9p2ztuWMhkrqHZQ7QewCboRUJifZsqu J5Nisl9aiZlLpAEiwS/7Vgkk7mPMSO+SFLUCPOV+iXGWQpagmmi2A3UAr3bSwqgLgX2q IoY3tCroZApTs6QZU2aAQxB2oVGYzw8Z2Q6nMuN9fDJuuti4Fo4oBPPdzVudUYJ0/SRJ WGAw== 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=wS/4vUPXRYVqIGA3oZCkB12D/JLXUJDmy57hV8s4aLk=; b=QS7IKCXwIAQJ1akoJBSR5BP1/SD5C0tOAZgO7GIMCW+PS5gdtYLfKJhkrdnVhE+Uy4 uM+Tdgu6e1Fa8qQ2SWfmIvx6+R9V8jWaZpcbj2eZCg6aEILPISaw232Om+Ym+BQ0vDZD xK5oSFI6gv9bY6uKSKwCYaOaQWNFhTXqJeZEVayqNx0WsndMLBMFzJHYuqiIf01kC8Jy ru1ndIqyZEG+zweCnu8xqAtrzMuewu6OA4Rw2Iwas4qFemI4l7Hj82xZ0ErfoDa2Tkua dMnchHqlnEb6yO26h69JDcPcbw/AlAlT+mgsL8OEvMCQRu63WBiwsMQWihtWulDsR7T5 A95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jfxy4e3b; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d195-20020a6336cc000000b0036c94298bbfsi15437442pga.469.2022.03.02.02.06.13; Wed, 02 Mar 2022 02:06:52 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=jfxy4e3b; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240414AbiCBJVu (ORCPT + 99 others); Wed, 2 Mar 2022 04:21:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240411AbiCBJVr (ORCPT ); Wed, 2 Mar 2022 04:21:47 -0500 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC007BB56E; Wed, 2 Mar 2022 01:21:04 -0800 (PST) Received: by mail-ua1-x931.google.com with SMTP id l45so515556uad.1; Wed, 02 Mar 2022 01:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wS/4vUPXRYVqIGA3oZCkB12D/JLXUJDmy57hV8s4aLk=; b=jfxy4e3b7tvL4FubDYhKLeFBCXnNgn7ZkIvZ7G6Ju1whiXXeKffe9kqLGDhACXK8rd wmVresVL6k2wakjfk5MY0MUCwcilUrr3rppfSnjXIDcAU4ZQjTvXPCAkuGKo7vH8/pBR h1LDbG56PfkGM48Z8VvlzemcDciMYJ0pVCI4Z8SUbmuFrh0nfSEGROzepQPJBzEtJY99 rnQyPAiufVJgxUffMXNqHfRNOhYuSv+xVPGZ6FgzhXfgMMsdpUKrE60wI44s35MyYbVr iym250wu1uxjesqc3Vc9ACnAEWu1weRPETdBzURsv9TD5N5BquiZZ4BP7hLKTpD5sNKD MMJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wS/4vUPXRYVqIGA3oZCkB12D/JLXUJDmy57hV8s4aLk=; b=6UmJ1SMSbyIvLa8Y6uaSb3K7ftxMwUP41negb+m6x3etL9gPb4RhNHpp0vlg4oUxRO yNFECYRdVf3D9uTP2ADF3JuSemsptdUXk7z3c9R89xESmTkNjgoqs96jpAVOi+99m4V1 RQIBXUMZX8ScrtllJqTOXLCBXdBhdn5m8PVBRYM6+FxnToTLnWlfghyGM15Gm6hw8elj Wxy1tK7m7+UZqsVugmHUJ3CR6tCbTfMwmSTF/BbB+9m7xqWK+dfooyo1B4p+XqSxgmBC fJcK0PknaRnq0+AOc6ct8cQO4abEYQIlN4zoTN5PRKuoSgj8jizEsxL6/6sXRFEOnHnH HSwA== X-Gm-Message-State: AOAM533gRvFunJHdvQeyZ23A0s/rrblVVqa7cuZlP5TVagdifG+r3N5S pdYPb2xzL2ieytIg5zwLeDzvFuaaiJkALMvNdiBmDmG8xRw= X-Received: by 2002:ab0:654d:0:b0:347:27e5:cb4a with SMTP id x13-20020ab0654d000000b0034727e5cb4amr5995264uap.67.1646212863772; Wed, 02 Mar 2022 01:21:03 -0800 (PST) MIME-Version: 1.0 References: <20220226110338.77547-1-chenhuacai@loongson.cn> <20220226110338.77547-10-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Wed, 2 Mar 2022 17:20:53 +0800 Message-ID: Subject: Re: [PATCH V6 09/22] LoongArch: Add boot and setup routines To: Ard Biesheuvel Cc: Arnd Bergmann , Greg Kroah-Hartman , Huacai Chen , "Rafael J. Wysocki" , Len Brown , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch , Linux Doc Mailing List , Linux Kernel Mailing List , Xuefeng Li , Yanteng Si , Jiaxun Yang , linux-efi Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi, Ard, On Wed, Mar 2, 2022 at 4:58 PM Ard Biesheuvel wrote: > > On Wed, 2 Mar 2022 at 09:56, Huacai Chen wrote: > > > > Hi, Arnd & Ard, > > > > On Tue, Mar 1, 2022 at 6:19 PM Arnd Bergmann wrote: > > > > > > On Tue, Mar 1, 2022 at 5:17 AM Huacai Chen wrote: > > > > On Mon, Feb 28, 2022 at 7:35 PM Ard Biesheuvel wrote: > > > > > On Mon, 28 Feb 2022 at 12:24, Arnd Bergmann wrote: > > > > > > On Mon, Feb 28, 2022 at 11:42 AM Huacai Chen wrote: > > > > > > Can't you just use the UEFI protocol for kernel entry regardless > > > > > > of the bootloader? It seems odd to use a different protocol for loading > > > > > > grub and the kernel, especially if that means you end up having to > > > > > > support both protocols inside of u-boot and grub, in order to chain-load > > > > > > a uefi application like grub. > > > > > > > > > > > > > > > > I think this would make sense. Now that the EFI stub has generic > > > > > support for loading the initrd via a UEFI specific protocol (of which > > > > > u-boot already carries an implementation), booting via UEFI only would > > > > > mean that no Linux boot protocol would need to be defined outside of > > > > > the kernel at all (i.e., where to load the kernel, where to put the > > > > > command line, where to put the initrd, other arch specific rules etc > > > > > etc) UEFI already supports both ACPI and DT boot > > > > > > > > After one night thinking, I agree with Ard that we can use RISCV-style > > > > fdt to support the raw elf kernel at present, and add efistub support > > > > after new UEFI SPEC released. > > > > > > I think that is the opposite of what Ard and I discussed above. > > Hmm, I thought that new UEFI SPEC is a requirement of efistub, maybe I'm wrong? > > > > > > > > > If I'm right, it seems that RISC-V passes a0 (hartid) and a1 (fdt > > > > pointer, which contains cmdline, initrd, etc.) to the raw elf kernel. > > > > And in my opinion, the main drawback of current LoongArch method > > > > (a0=argc a1=argv a2=bootparamsinterface pointer) is it uses a > > > > non-standard method to pass kernel args and initrd. So, can the below > > > > new solution be acceptable? > > > > > > > > a0=bootparamsinterface pointer (the same as a2 in current method) > > > > a1=fdt pointer (contains cmdline, initrd, etc., like RISC-V, I think > > > > this is the standard method) > > > > > > It would seem more logical to me to keep those details as part of the > > > interface between the EFI stub and the kernel, rather than the > > > documented boot interface. > > > > > > You said that there is already grub support using the UEFI > > > loader, so I assume you have a working draft of the boot > > > protocol. Are there still open questions about the interface > > > definition for that preventing you from using it as the only > > > way to enter the kernel from a bootloader? > > Things become simple if we only consider efistub rather than raw elf. > > But there are still some problems: > > 1, We want the first patch series as minimal as possible, efistub > > support will add a lot of code. > > 2, EFISTUB hides the interface between bootloader and raw kernel, but > > the interface does actually exist (efistub itself is also a > > bootloader, though it binds with the raw kernel). In the current > > implementation (a0=argc a1=argv a2=bootparaminterface), we should > > select EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER which is marked as > > deprecated. Is this acceptable? If not, we still need to change the > > bootloader-kernel interface, maybe use the method in my previous > > email? > > Why do you need this? Because in the current implementation (a0=argc a1=argv a2=bootparaminterface), initrd should be passed by cmdline (initrd=xxxx). If without that option, efi_load_initrd_cmdline() will not call handle_cmdline_files(). Huacai > > > 3, I know things without upstream means "nothing" for the community, > > but if we can provide raw elf kernel support to be compatible with > > existing products (not just a working draft, they are widely used > > now), it also seems reasonable. > > > > Huacai > > > > > > > > Arnd