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 X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50E93C433E7 for ; Fri, 9 Oct 2020 14:17:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA1842222C for ; Fri, 9 Oct 2020 14:17:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Zl6CqChg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GhGWMmc+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA1842222C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3u/DAOrqm7J5nQMVXlOyLCKnHCFnvRFh17H1Bn9HDkg=; b=Zl6CqChgIOzcqS50wDwegCYcF 3GqwV3OWSebnT6oHtGGpH9ILLICo8mrLmh5PB0RT3oB1edeunBy9TYZrTjXGHcq+VtSLy/ugLPOY7 zN504GljfM5Vz3k9XpmAf/kyIr93koigCx4hKb5KIAnj9eG0McWF7G5SU1s0lqfVGFJl+WA7yWi97 SgO9bah4WVugXG6aibOUcUDefLXIWC1xJKV6UN5FHJ/JAeVbPu5ZR50HNPAyJeZVJaHy3lsByp+QZ Ij+b+SkUr4ZPxH6hneH9NC2KQR8Cwj0mk6H/Ja9ip4o60SwW6iBw3RVXvp4KRXc31Pn3LrzQ2CGJ6 JXFuWXsOg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQtBQ-00008M-Hb; Fri, 09 Oct 2020 14:15:44 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQtBN-00007i-Kl for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2020 14:15:42 +0000 Received: by mail-lf1-x143.google.com with SMTP id j30so8462626lfp.4 for ; Fri, 09 Oct 2020 07:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2SOjSVsZj4y5DllWpc73jGbnCekSH562sthD5ZVKuL4=; b=GhGWMmc+doqcyjTjpCfSu0AebZgoYmTfXEk4gY+gylj9m2LeO6LG6e5uwsD//C/axX sZFvefqvUgqQSZm/Q+E92hJj3yw2EHbWEDNR720Mj7TFKs1kDFYnDPz8yEul0B2qv1M5 J7W8OzLTn4w1K68D6gG80bk9zftKyov41p6Wk2OVTI4mXpBiTLpjrPDdx/kP5KhDaMGU B43TFh/cS5PhBX+hLH3ybJFS533nxEnX3Yb1CeIivfd+4azFbqcUXEWAinm21XjRHW6j KqpbSbtIVkodk/0tvHw9OHi6vjOmSh59r3lUW7c4KoNomRcCJqRDzgNZn+xe3yVwG7as 00UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2SOjSVsZj4y5DllWpc73jGbnCekSH562sthD5ZVKuL4=; b=HIgwD6cXsaUTlwh8+pacw1sUKbB+uyisfQx5ZAXbRQPX1r0SeUZdaREXIkO744FKzp HbQIC6iNiXWaBTjM3FeXEK/cCzlSFAb+Nj8wfYNeZFMCMHzk/cxYcNz/u6RESRDl75FC lxcb38h0mRkp6zu/Xo+wVmtSQKDdAA7BglGCrXYELpALdGTc2AMcTbr/h6FiCpc3tT1u VsQ5hbxD3xcQSuNuNuWY8m1o+BdyyGWPdALM/Bf/UB4SxtT62grd1AqTA3KuQjxA8OaD eOKn0GAVgdexMec3DZvjv+j+Gd71WokfvQKyqtdgv0NWSiCr+wtPjvNJiSaVlEC/yrEq A0Cw== X-Gm-Message-State: AOAM532/OGse3GqavLwuvwGU1eiISw2AiFpZRgezjykaB4CnU2b+FX3O ME+99SEez9HrX221u5Big6g= X-Google-Smtp-Source: ABdhPJx4WJSAOgpTvL/HLI8QeZfiDx/jSv+WN3zoqZRA+OQW49tulwRobM1KAxZK5kJlsS6rDtmrhw== X-Received: by 2002:a19:e342:: with SMTP id c2mr4676169lfk.519.1602252939969; Fri, 09 Oct 2020 07:15:39 -0700 (PDT) Received: from mobilestation ([95.79.141.114]) by smtp.gmail.com with ESMTPSA id g184sm555306lfd.257.2020.10.09.07.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 07:15:39 -0700 (PDT) Date: Fri, 9 Oct 2020 17:15:37 +0300 From: Serge Semin To: Thomas Bogendoerfer Subject: Re: [PATCH v2] MIPS: replace add_memory_region with memblock Message-ID: <20201009141537.ijj4cr45zqtkh4yz@mobilestation> References: <20201008084357.42780-1-tsbogend@alpha.franken.de> <20201008152006.4khkbzsxqmmz76rw@mobilestation> <20201009120752.GA10588@alpha.franken.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201009120752.GA10588@alpha.franken.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201009_101541_702638_6007DBF2 X-CRM114-Status: GOOD ( 30.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Hauke Mehrtens , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , linux-mips@vger.kernel.org, Jiaxun Yang , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, "Maciej W. Rozycki" , John Crispin , Keguang Zhang , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 09, 2020 at 02:07:52PM +0200, Thomas Bogendoerfer wrote: > On Thu, Oct 08, 2020 at 06:20:06PM +0300, Serge Semin wrote: > > > Signed-off-by: Thomas Bogendoerfer > > > --- > > > Changes in v2: > > > fixed missing memblock include in fw/sni/sniprom.c > > > tested on cobalt, IP22, IP28, IP30, IP32, JAZZ, SNI > > > > ... > > > > > diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c > > > index 9e50dc8df2f6..fab532cb5a11 100644 > > > --- a/arch/mips/kernel/prom.c > > > +++ b/arch/mips/kernel/prom.c > > > @@ -50,14 +50,18 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) > > > size = PHYS_ADDR_MAX - base; > > > } > > > > > > - add_memory_region(base, size, BOOT_MEM_RAM); > > > + memblock_add(base, size); > > > } > > > > > > int __init early_init_dt_reserve_memory_arch(phys_addr_t base, > > > phys_addr_t size, bool nomap) > > > { > > > - add_memory_region(base, size, > > > - nomap ? BOOT_MEM_NOMAP : BOOT_MEM_RESERVED); > > > + if (nomap) { > > > + memblock_remove(base, size); > > > + } else { > > > + memblock_add(base, size); > > > + memblock_reserve(base, size); > > > + } > > > > > > return 0; > > > } > > > > I guess originally the arch-specific early_init_dt_add_memory_arch() and > > early_init_dt_reserve_memory_arch() methods have been added since MIPS's got its > > own memory types declarations (BOOT_MEM_RAM, BOOT_MEM_RESERVED, etc) and had had > > a specific internal system memory regions mapping (add_memory_region(), > > boot_mem_map, etc). Since the leftover of that framework is going to be removed, > > we can freely use the standard early_init_dt_add_memory_arch() and > > early_init_dt_reserve_memory_arch() implementations from drivers/of/fdt.c:1102 > > drivers/of/fdt.c:1149 . > > perfect, I'll remove it in my next version. > > > > @@ -426,13 +387,14 @@ static int __init early_parse_memmap(char *p) > > > > > > if (*p == '@') { > > > start_at = memparse(p+1, &p); > > > - add_memory_region(start_at, mem_size, BOOT_MEM_RAM); > > > + memblock_add(start_at, mem_size); > > > } else if (*p == '#') { > > > pr_err("\"memmap=nn#ss\" (force ACPI data) invalid on MIPS\n"); > > > return -EINVAL; > > > } else if (*p == '$') { > > > start_at = memparse(p+1, &p); > > > > > - add_memory_region(start_at, mem_size, BOOT_MEM_RESERVED); > > > + memblock_add(start_at, mem_size); > > > + memblock_reserve(start_at, mem_size); > > > > I suppose we could remove the memory addition from here too. What do you think? > > I'm not sure about that, add_memory_region() did a memblock_add > and then memblock_reserve for BOOT_MEM_RESERVED, that's why I changed > it that way. The main question here whether we need to preserve the MIPS-specific semantics of the kernel 'memmap' parameter. Currently the memmap parameter passed with '$' specifier will be perceived as a reserved RAM region, while, for instance, the same parameter on x86 will be converted to a region, which won't be registered in memblock at all, so the system won't be able to reuse it if it's needed to be (see parse_memmap_one() and e820__memblock_setup() for details). I don't really know what approach is correct... Documentation/admin-guide/kernel-parameters.txt isn't certain about that. It says that the region must be reserved, but no words whether it is supposed to be mappable or non-mappable. -Sergey > > Thomas. > > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel