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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6C1FC433F5 for ; Tue, 1 Mar 2022 04:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232216AbiCAESB (ORCPT ); Mon, 28 Feb 2022 23:18:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbiCAER4 (ORCPT ); Mon, 28 Feb 2022 23:17:56 -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 EC1BC473A9; Mon, 28 Feb 2022 20:17:15 -0800 (PST) Received: by mail-vs1-xe35.google.com with SMTP id e5so15214432vsg.12; Mon, 28 Feb 2022 20:17:15 -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=XX+IWGQPoFeh97VSAKm6031fD11VKSEYMPq0/2cLTeY=; b=JFOATMfyEe+q2YvZrNExXmlIiIjnIwcxdvHk/WzuC0p/XbwABgHaZFREv0E2vYcOCh 44pY9ThY1M5Y7nwfcQWLFmDp6IMbLLs3M/oeUuISm7mV189rZoSNx2aws5ZDt5Cgr7+K t/QIzoA5kzWRBKBOhtDlw5oKY4auHKRoUizfIFNWNqPsTLw4LI0UI2WeuiEvOmD8Ka5J dkuGJ2gRwfEwNpgli04YlIxiKa6c9U+NnrXu2mnyW0pKYXc3r1XFqU7bmXJGn6MvEILs WLNyII5lJ6h4OQg2CsqcsBMIO0N1d+mzet+gJwMUbuvzxfU4CYZO025TqeAxzilU4b/e LDyg== 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=XX+IWGQPoFeh97VSAKm6031fD11VKSEYMPq0/2cLTeY=; b=7VQxrg83EMfy5ULK7+5mPBvOVztxegDnAH3wlZrH2xpVijd1bcFdGHFb3gdoLUHuzD 4XNEcAMCoKAzo/PsBrigIrLBUGAEBRgdBfWeXA5w/ua3fwxJ4wzZXGSjlPvsslVdGL5U jLCw8SEpIZ4XpjM0px/wn7GNw1aQzTRlq/c2k1OgK5WjSj78y9X4j7dm+QPiLwMhIPNm gmgoHjw+R34EoD0ICqOM0dYwB4rDCZcSY2PtG05yVUCRDpJ/QFETqZmBjMqo5ba+qFdZ Ml7qxQmZqpuJuEPuUnaa68/afn8zkAbD2PKQyn0Vw0jvO2w3oeVG/5j9arwnUkiFKv02 j41A== X-Gm-Message-State: AOAM533yHptaWTlztSmqDBxb/EhE+hzdWJdUmvtML5KOnQRFV+E+Nk5h IH2w8CP+q1/r4+Sa6QypK0eKCzfEbfJeagOPRqrG2ecZ3S/Q+w== X-Google-Smtp-Source: ABdhPJwsPqTLqByAywbPvHbUlZ0RmBQQuT3nqAGrXPiTyDCpCNQ4pE+4K+lDpxX3ZVso8ruv7YjBCeaONpdv8zk6tdU= X-Received: by 2002:a67:c10e:0:b0:31b:7197:5751 with SMTP id d14-20020a67c10e000000b0031b71975751mr9775554vsj.43.1646108235078; Mon, 28 Feb 2022 20:17:15 -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: Tue, 1 Mar 2022 12:17:03 +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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Ard & Arnd, 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: > > > On Mon, Feb 28, 2022 at 4:52 PM Ard Biesheuvel wrote: > > > > On Mon, 28 Feb 2022 at 09:38, Huacai Chen wrote: > > > > > > > > > > > > RISC-V is a useful reference for the changes needed - this is the most > > > > > > recent addition to the EFI stub, and avoids some legacy stuff that new > > > > > > architectures have no need for. > > > > > We still want to support the raw elf kernel (RISC-V also does), > > > > > because LoongArch also has MCU and SoC and we want to support FDT (I > > > > > think this is reasonable, because RISC-V also supports raw elf). > > > > > > > > > > > > > That is fine. So perhaps the best course of action is to omit the > > > > UEFI/ACPI parts entirely for now, and focus on the DT/embedded use > > > > case. Once all the spec pieces are in place, the UEFI + ACPI changes > > > > can be presented as a single coherent set. > > > It seems that I made you confusing. :) > > > There are big CPUs and small CPUs (MCU and SoC), big CPUs use > > > UEFI+ACPI, while small CPUs use FDT. > > > At present, the only matured LoongArch CPU is Loongson-3A5000 (big > > > CPU) which uses UEFI+ACPI. > > > We want to support raw elf because it can run on both ACPI firmware > > > and FDT firmware, but at present we only have ACPI firmware. > > > > 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. 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) Huacai