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 4ABBEC433F5 for ; Fri, 11 Feb 2022 01:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347046AbiBKB5c (ORCPT ); Thu, 10 Feb 2022 20:57:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbiBKB5b (ORCPT ); Thu, 10 Feb 2022 20:57:31 -0500 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85ADF5F65 for ; Thu, 10 Feb 2022 17:57:30 -0800 (PST) Received: by mail-yb1-xb2b.google.com with SMTP id v186so20845480ybg.1 for ; Thu, 10 Feb 2022 17:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AfM/0Cb58q6GUcC0GUIZYtPjVsr66lYC74fJRtgxODI=; b=EnNCJZyXUquzo2MhBkvCK0qbobE9W87IWecoDS+rL4un+opt85eXFhJHJdCsslAAjx vElioYlY8OIHwQO4p5btZ0Q4jHrOejB0Y80AOqNDO2Yc+hxPN32LOA3Im7+SIOIunSkW qf7JLLSDFXR1SDKGYc27cZntGo/Mldylw6Pg0= 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:content-transfer-encoding; bh=AfM/0Cb58q6GUcC0GUIZYtPjVsr66lYC74fJRtgxODI=; b=33xv5l2vqzONFtJqvJsbFm13b5vtT1C9ERi15L9XK4lRDHbheVw+5302GThHVAyF7y hzYGLRrUWr250RSfl1etZQsQiME4af9LzZYybvpGh5PxoawMYdzmHhJdLun2VmWIBRHK LraZRgT8Dov574SH5srYYFiHmo9g7OS4hW7WR3t0o1B0xMBILRVFrll/a1sZzZOrmuDd K3xru/IchD1xBA/asqtJlSlS/GmVHYVJ8iw70knlTGSQRYKvjFQsuXv4HpYWAArzVOop 8ZlDDB5tUIuD8y4ZBiVl0fZK1gkTyAL8gC+GDT6uzHH13o++sk3Pixj/DACYI+aIaOCP a4RA== X-Gm-Message-State: AOAM533we+kr9cxrLK2jZ4PWnz1pb3mOIvrn2yMDdnXDtpVX03QwsJJX SZPHb9G2ATpKzrfusbQ0e+HCh6LoFgYeSnjFYmzq X-Google-Smtp-Source: ABdhPJyiFZ6T4FoqoVQz/JR5+sOYmy012dRZdQn9sj6qa2V2tvtDR13uVkUFSQMHhHHw5byKl0LHTAU/kbr5o1PY5uc= X-Received: by 2002:a81:b148:: with SMTP id p69mr10549545ywh.402.1644544649729; Thu, 10 Feb 2022 17:57:29 -0800 (PST) MIME-Version: 1.0 References: <20220209123800.269774-1-heiko@sntech.de> <20220209123800.269774-9-heiko@sntech.de> <2532021.2vfPgEiFAl@diego> In-Reply-To: <2532021.2vfPgEiFAl@diego> From: Atish Patra Date: Thu, 10 Feb 2022 17:57:19 -0800 Message-ID: Subject: Re: [PATCH v6 08/14] riscv: move boot alternatives to a slightly earlier position To: =?UTF-8?Q?Heiko_St=C3=BCbner?= Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , linux-riscv , devicetree , "linux-kernel@vger.kernel.org List" , Rob Herring , Wei Fu , liush , Guo Ren , Anup Patel , Drew Fustini , Christoph Hellwig , Arnd Bergmann , Chen-Yu Tsai , Maxime Ripard , Greg Favor , Andrea Mondelli , Jonathan Behrens , Xinhaoqu , Bill Huffman , Nick Kossifidis , Allen Baum , Josh Scheid , Richard Trauben , Samuel Holland , Christoph Muellner , Philipp Tomsich Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Thu, Feb 10, 2022 at 5:11 PM Heiko St=C3=BCbner wrote: > > Hi Atish, > > Am Donnerstag, 10. Februar 2022, 23:42:35 CET schrieb Atish Patra: > > On Wed, Feb 9, 2022 at 4:39 AM Heiko Stuebner wrote: > > > > > > Move the application of boot alternatives to soc_early_init(). > > > This allows to catch more generic cases of code needing patches > > > than doing it in smp_prepare_boot_cpu() and also makes it actually > > > work if CONFIG_SMP is disabled for whatever reason. > > > > > > The position is chosen mainly as it is before the actual soc early > > > init runs but also already allows accessing the devicetree > > > via fdt_* functions. > > > > > > Signed-off-by: Heiko Stuebner > > > --- > > > arch/riscv/kernel/head.S | 2 ++ > > > arch/riscv/kernel/smpboot.c | 2 -- > > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S > > > index 2363b43312fc..0e1bb97f9749 100644 > > > --- a/arch/riscv/kernel/head.S > > > +++ b/arch/riscv/kernel/head.S > > > @@ -10,6 +10,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -341,6 +342,7 @@ clear_bss_done: > > > call kasan_early_init > > > #endif > > > /* Start the kernel */ > > > + call apply_boot_alternatives > > > > Do you really need this early ? > > if non-smp configuration is the only option, Can you do it in > > setup_arch() after riscv_fill_hwcap() is called ? > > The issue I see is, we we have the soc_early_init [0] running > directly after this and the one user I see [1] already wants to > ioremap io-memory at this stage. > Kendryte is always a special case. IIRC, ioremap is done so early so that it can use all 8MB of SRAM. > So judging by the fact that more early-inits will get added > in the future I do guess we should've set up the io-memory > page-type by this point? > I hope there won't be :). For any normal mmu capable SoC, I don't see why that would be required. > > Heiko > > [0] https://elixir.bootlin.com/linux/latest/source/arch/riscv/kernel/soc.= c#L14 > [1] https://elixir.bootlin.com/linux/latest/source/drivers/soc/canaan/k21= 0-sysctl.c#L66 > > > By doing that, we can unify the cpu feature probing and you don't need > > a separate DT parsing just for svpbmt. > > > > > call soc_early_init > > > tail start_kernel > > > > > > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.= c > > > index a6d13dca1403..f1e4948a4b52 100644 > > > --- a/arch/riscv/kernel/smpboot.c > > > +++ b/arch/riscv/kernel/smpboot.c > > > @@ -32,7 +32,6 @@ > > > #include > > > #include > > > #include > > > -#include > > > > > > #include "head.h" > > > > > > @@ -41,7 +40,6 @@ static DECLARE_COMPLETION(cpu_running); > > > void __init smp_prepare_boot_cpu(void) > > > { > > > init_cpu_topology(); > > > - apply_boot_alternatives(); > > > } > > > > > > void __init smp_prepare_cpus(unsigned int max_cpus) > > > -- > > > 2.30.2 > > > > > > > > > _______________________________________________ > > > linux-riscv mailing list > > > linux-riscv@lists.infradead.org > > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > > > > > > > > > > > --=20 Regards, Atish