Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp288801pxm; Wed, 2 Mar 2022 15:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+C9DBc9AqWr3aw2/odcQNwVxpp3Rn2ANXodsDB+dJnhnQdtzkw+WDhsb0tfJmJzUOZ/xB X-Received: by 2002:a63:6983:0:b0:37c:4e2a:39ef with SMTP id e125-20020a636983000000b0037c4e2a39efmr1550294pgc.156.1646263913970; Wed, 02 Mar 2022 15:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646263913; cv=none; d=google.com; s=arc-20160816; b=jj6UJzdH2F6t4vZ08cdc5bodYGCYo/GAhTC13m8QX1Sc0B2shW28aP5aTw7GIV3RHD Zw7ymU44fH4F7i85bF+mwsv6jP0h9eI8QCSd50mi3BfSK3UIa8nsPiBI4oHR8PPXwb9o 99Z/epcDtg42+C89uFB8kSTNwUm26swlBmI7xKV/LRaa0hf8Nv40870J3LAPJjNILpzD b0TIydXY3l1KuNVqQpxxRfSYJsLJeFoqBXDvK/uR1r8UTIcewzbGIi134n6qcKsh4FIJ djIVo40a34oLvkl8LGtJ0r9J8hOovT2nsqFtUf+8gbug6hFE7TSfGeYd8G+X/DXOk6vK jHJw== 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=HcoEJcECMe/jotZIINGybFP8QW9wjBMfp8v6i5TG95I=; b=PPUXrGqHe/XDlU2Dkfs8xjC7TPJs1rbihrqH4aF5n1k0AcaAE9o3A/fBCuTKyhyB3+ sXZUjs44PnCzvrtVkPDNQXAxuVE073uvy5YV8j7fSJ1xoE8zEWF8WpOab4G4fSai2Jed E22lZplXtVeN8zpaVw9NzPRdVRkUUK0Dgt642m2AS49gHpkkS1L7ieb6UHRx8TlbvEL1 yzB9WybbIGoVI9l0EL4bEb/s1i2sqN3+46pcUo0VqC9eBAKkSfhCDZu2Eai6t1GbCtNt qqCTx6NCBRPCZAToHGXOt+HW5zzDFIH7b82h4tVCTieJ99JDF9pKaVU6GQQo820cgOBR 2glg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JBlTwDnf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q7-20020a056a00088700b004e17cfb5f6dsi478328pfj.262.2022.03.02.15.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:31:53 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JBlTwDnf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 920F214FBEC; Wed, 2 Mar 2022 15:02:49 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240274AbiCBI5g (ORCPT + 99 others); Wed, 2 Mar 2022 03:57:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240232AbiCBI5f (ORCPT ); Wed, 2 Mar 2022 03:57:35 -0500 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBBE15FF1E; Wed, 2 Mar 2022 00:56:51 -0800 (PST) Received: by mail-vs1-xe35.google.com with SMTP id g21so1081139vsp.6; Wed, 02 Mar 2022 00:56:51 -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=HcoEJcECMe/jotZIINGybFP8QW9wjBMfp8v6i5TG95I=; b=JBlTwDnfrOHbBBo1U81GQiw+GgldS4rNbUVuCvR4Bume8CMcpp7dy2Z6y1HPBVQxx4 fEkTD2Mf2dkkiAPwhi/6LRon4XKgub+wvS7UTjyz7usPC5nHOal2qiIf+1CuIBLxKpM1 FnasKV74JGxVHGuNfW+gt3mqIn4ORlkBV3oNrhMPO6mvWQHjRgJ8uwQfsdFDTKlfiF5n 0QiNc/Ybq5ifH7iq/lx7xbgSTPerbo9Eu+qqyLYEXqok3zlpO4Ov1rg9UvinUs3txdLP KVdN7dxSXweSIKX5bi9vflS4+LXhDKkci7kRx3F52qNOLNchw2mPrW3FoAHWVTAtDFsm 1UHA== 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=HcoEJcECMe/jotZIINGybFP8QW9wjBMfp8v6i5TG95I=; b=e68aW3EGx3/XOIwf5zDIUketclI1o0AjHGv+GBEs0IF7o9yta0N1nkVmlddutfgGwM xOQVpyZHYCdVq5ZXEtv5Wna3sVCC0XxRFx8a8wRiYgItQA5k0M+55u2qOS0/8DoN2Rn2 6q+kibrK95e1fvYDsFBvvR8FeC2L256zJWMjl/X57gGnGT354RK28qF+ddDFI1JSNvl5 vsjC79nHHl74uHHZGe3KYHwStFvsNxPGGvNQbcJfryzPXrYGW0ov9IRihF18HMnoHoKK b3kJilDNCbcPyrxxOTGYTkBIhMwMkW+LV7+5x514Oq1ZhG1NwdzV9mE9YCr/ce34jCkj Nq3Q== X-Gm-Message-State: AOAM5326w/dUS/YOEg68pjZwMXtCXDjwif0a3wboh1Nf4+yhJl406hUw Zaz1vwnImjOSaueD4jdrqScaEBVboAS/pzorRqRdzaBVGJE= X-Received: by 2002:a05:6102:5589:b0:31b:dff9:3ddb with SMTP id dc9-20020a056102558900b0031bdff93ddbmr12089286vsb.62.1646211410984; Wed, 02 Mar 2022 00:56:50 -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 16:56:39 +0800 Message-ID: Subject: Re: [PATCH V6 09/22] LoongArch: Add boot and setup routines To: Arnd Bergmann Cc: Ard Biesheuvel , 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=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, 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? 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