Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2579503pxm; Mon, 28 Feb 2022 01:49:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmXmfWqE8aNaONSih1F0cyTV19YnampLyywLTf1rcj9P9Y2VJrpkgNuHZVv4LGcjb1opSh X-Received: by 2002:a17:902:e848:b0:150:16f7:9aa7 with SMTP id t8-20020a170902e84800b0015016f79aa7mr19053286plg.137.1646041759286; Mon, 28 Feb 2022 01:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646041759; cv=none; d=google.com; s=arc-20160816; b=R76WH7nIr/aNZzj0ju4g+Wjplew/RB50DDBYsJ5N/6uJvtgOgFQzKwwwzi245nI723 s/8ABYkBNdf+RmeyiKyYY6Jl9u5tCpePl9iCcdvYI9YQN1pGvkAAyeCEU6Qda9hikAlO DF/7G5fvD57Ejjsonb1n0VzeVoxiE5OES88ukTWe2C9d+Ae1l5CpvLuQH6vGQnPCCWnp QhqAhzgHkrxs7GlFym5yACOMppD3K1xdO1LJ16INE5Tf6EXMevL+GN85sUccysGpNFkn YnGze0GdI2AifWTlocQfjQwLU2NH7vAiO0WjOCekv9Axk3xuUNUaAD74vEDfDjJnQjc5 BBPg== 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=pQG4s8WE2x1LNgZqIzGp20XGhXGocdIMbbXafkH7Qc8=; b=CQVitlZ8uQI/fD6OsV66fJRjoaG8ndRKx5fQumn4H6DWypKESxxLSahkZu4oWcyN71 uv137tTmfI4i7YK3PLFRb14cFDbVNJlI7XNWZIvknOC+nxD3I6QmIMqlPUAwfk5XMoL9 E35BvmBxFn0rTgJHiRvPN60BVypsQA3i2FQV2r3Fibz/opwM8YswjrxkLwqIO+Wu3Y4k Hq6J1ra1KyyaBHlnipB/KDonPjAS3ReEaIg9EVifLzItcuXwsTV7e7zDHYGaqgsJ7VUR zsmXVnfJEOxqYZdJH9ZLwNaJHnl7xMJpBt2YQuDBnDbIYfOidzg1aMpJuyO25243IRh+ grGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GruZ2YoS; 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 m10-20020a656a0a000000b003745fd0bb24si10932311pgu.494.2022.02.28.01.49.04; Mon, 28 Feb 2022 01:49:19 -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=GruZ2YoS; 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 S232455AbiB1GfR (ORCPT + 99 others); Mon, 28 Feb 2022 01:35:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbiB1GfP (ORCPT ); Mon, 28 Feb 2022 01:35:15 -0500 Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDFC66C83; Sun, 27 Feb 2022 22:34:37 -0800 (PST) Received: by mail-ua1-x92c.google.com with SMTP id 63so4996327uaw.10; Sun, 27 Feb 2022 22:34:37 -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=pQG4s8WE2x1LNgZqIzGp20XGhXGocdIMbbXafkH7Qc8=; b=GruZ2YoSOvvXfZVZ6KA5WEH0ZPPUg9N2AP5RrkdgnOLAviKh6yO5H1ky1McosPzMSP t84aBstIN9acMIz5FhxyewgGkxfrqsPFfkqY7Or8kbGjmt0mDcyUpAi/GnuKKA5N+ZKi R+brUdZB+s2Zq369kTj3/oSCilGJk8RlU+JElfYeXDSf7kgopr7PgIsRSUxpI1mGODSD zheBU/avNxJPTk+Mhpq3zz1tO2FapqfGIGoMKMP5cjOb/Pgr0FA1hkLjIlmxUV/bFKs2 xCMq+QM07HRFWVmJYKN4A7LQBgk/61YwuzwVITqBZCz0GNlIHlKpIqYTvJaQ/fvbMlf1 w5rQ== 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=pQG4s8WE2x1LNgZqIzGp20XGhXGocdIMbbXafkH7Qc8=; b=rKi3ITCjhIqbbH3Wh1NfL0aagwuoMP74K1enrSAM2+GfJmEkIhtEnVMjRgMdrQdZXG vPyUHYA4/iCdVHnCdCSu28lMHUm0JQRBkXeSfrEShQ0wMM72f9qpep2YeB9oXTtHi60W 2OhmU84VPVJ16zjMOFKG3FfINMR5eZox3jtVHyoSIMJZYIxE9cP/ChzygtiYABDTWVuU N7vNwjMNygNu3YgN3rxUh8lOqxKwvmXCKO84SL3ha777MzsU6ifgnMbeNsCaeJoQ8U1N 2uBffgUKnoIEftz4JYQ5FWasSp0Wx5vmLMQCHPwa0orotz0E/Fiy7Ax1ODD+WhyuHnZ9 zQCg== X-Gm-Message-State: AOAM533oghqfBwbgcx6+xEmnTq7/cHSp2NZ3Lv0m5l1oNHSaNtwQkT5v DoF8OtUZM9BII6Y/2xE8V6zL/MSE0AxM4dFUCfhpA+k1hYznZA== X-Received: by 2002:ab0:3da4:0:b0:306:a7f8:f28b with SMTP id l36-20020ab03da4000000b00306a7f8f28bmr7527955uac.47.1646030076362; Sun, 27 Feb 2022 22:34:36 -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: Mon, 28 Feb 2022 14:34:26 +0800 Message-ID: Subject: Re: [PATCH V6 09/22] LoongArch: Add boot and setup routines To: Greg Kroah-Hartman Cc: Ard Biesheuvel , Huacai Chen , "Rafael J. Wysocki" , Len Brown , Arnd Bergmann , 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 and Greg, On Mon, Feb 28, 2022 at 12:40 AM Greg Kroah-Hartman wrote: > > On Sun, Feb 27, 2022 at 03:14:30PM +0100, Ard Biesheuvel wrote: > > (add Greg and ACPI maintainers) > > > > On Sat, 26 Feb 2022 at 12:11, Huacai Chen wrote: > > > > > > This patch adds basic boot, setup and reset routines for LoongArch. > > > LoongArch uses UEFI-based firmware. The firmware uses ACPI and DMI/ > > > SMBIOS to pass configuration information to the Linux kernel (in elf > > > format). > > > > > > Now the boot information passed to kernel is like this: > > > 1, kernel get 3 register values (a0, a1 and a2) from bootloader. > > > 2, a0 is "argc", a1 is "argv", so "kernel cmdline" comes from a0/a1. > > > 3, a2 is "environ", which is a pointer to "struct bootparamsinterface". > > > 4, "struct bootparamsinterface" include a "systemtable" pointer, whose > > > type is "efi_system_table_t". Most configuration information, include > > > ACPI tables and SMBIOS tables, come from here. > > > > > > Cc: Ard Biesheuvel > > > Cc: linux-efi@vger.kernel.org > > > Signed-off-by: Huacai Chen > > > --- > > > arch/loongarch/include/asm/acenv.h | 17 + > > > arch/loongarch/include/asm/acpi.h | 38 ++ > > > arch/loongarch/include/asm/boot_param.h | 97 +++++ > > > arch/loongarch/include/asm/bootinfo.h | 33 ++ > > > arch/loongarch/include/asm/dmi.h | 24 ++ > > > arch/loongarch/include/asm/efi.h | 33 ++ > > > arch/loongarch/include/asm/fw.h | 18 + > > > arch/loongarch/include/asm/reboot.h | 10 + > > > arch/loongarch/include/asm/setup.h | 21 + > > > arch/loongarch/kernel/acpi.c | 338 ++++++++++++++++ > > > arch/loongarch/kernel/cacheinfo.c | 122 ++++++ > > > arch/loongarch/kernel/cmdline.c | 31 ++ > > > arch/loongarch/kernel/cpu-probe.c | 305 +++++++++++++++ > > > arch/loongarch/kernel/efi.c | 208 ++++++++++ > > > arch/loongarch/kernel/env.c | 176 +++++++++ > > > arch/loongarch/kernel/head.S | 72 ++++ > > > arch/loongarch/kernel/mem.c | 89 +++++ > > > arch/loongarch/kernel/reset.c | 90 +++++ > > > arch/loongarch/kernel/setup.c | 495 ++++++++++++++++++++++++ > > > arch/loongarch/kernel/time.c | 220 +++++++++++ > > > arch/loongarch/kernel/topology.c | 13 + > > > 21 files changed, 2450 insertions(+) > > > > As I pointed out in response to an earlier revision of this code, I > > don't think we should merge this until we decide on some ground rules > > regarding the support level of this architecture in the UEFI and ACPI > > subsystems. > > > > The problem is that loongarch does not exist in the ACPI or UEFI > > specifications at all, and as I understand it, the firmware > > implementations themselves do not implement UEFI or ACPI entirely, > > they simply present data structures in memory that look similar enough > > for the Linux UEFI and ACPI code to boot the OS. > > Why isn't this in the ACPI/UEFI specs? Is it a lack of access to the > spec groups by the comapny making these devices, or something else? We have tried our best to make LoongArch parts be in ACPI and UEFI SPECs. ECR for adding LoongArch support in ACPI: https://mantis.uefi.org/mantis/view.php?id=2203 ECR for adding LoongArch support in ACPI (version update): https://mantis.uefi.org/mantis/view.php?id=2268 ECR for adding LoongArch support in UEFI: https://mantis.uefi.org/mantis/view.php?id=2313 ACPI changes of LoongArch have been approved in the last year, but the new version of ACPI SPEC hasn't been made public yet. And UEFI changes of LoongArch are under review now. Is it a must that the kernel code be merged after all SPECs are public? If not, I think we can provide some snapshots (If it is legal, I'm not sure) of mantis.uefi.org to prove the above. Huacai > > > As the UEFI subsystem maintainer, I am concerned that future changes > > to the UEFI subsystem that are rooted in the the UEFI specification as > > it evolves may trigger unanticipated results on this architecture, and > > I imagine the ACPI maintainers may have similar concerns. > > I agree, I would be concerned about that as well. > > > So what can we do about this? Do we merge this code, but as a second > > class citizen in terms of UEFI/ACPI subsystem support, i.e., you are > > welcome to use it, but if something breaks, the UEFI/ACPI maintainers > > are not on the hook to see to it that it gets fixed? I don't think > > this is a great solution, but I'm not sure if there are alternatives > > that are any better. > > That's not going to work, it's the kernel's job to fix up hardware > problems. But as this is all firmware, why can't the firmware be > changed to properly follow the public specifications? What's wrong with > requiring that at this point in time (i.e. _BEFORE_ the code is merged)? > > thanks, > > greg k-h