Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2881448ybv; Sat, 15 Feb 2020 05:45:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzotA33EhN3RrEG+lPJx889aL3GdC8DD08PeA29GJbrSFQeO29v83VnO1qE04cfeZqQTnzl X-Received: by 2002:a9d:6c01:: with SMTP id f1mr5804577otq.133.1581774304482; Sat, 15 Feb 2020 05:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581774304; cv=none; d=google.com; s=arc-20160816; b=kPpVJ8JGQGiBKdRe4uT2BIdNDd5vBBFBY2Ryd4yXABuF3DcwFsQpch7zdl5Io9N688 Z5Ee6uZXjzOeFB60PQljJQIHX8oE2/JJmUwmviv6UspfMLKQ2m+wn74/q3l24OFfibgM RLHmdNOwKC8tV2jXzHGuVPwiAHG3xF4Zc+gIadg6q8HG8jFNFv0WU4xhXspsRjPnE1Is WB/912KOVA7rVVsmYNHtshvaTsY7G4D3uRju2dMeWQ0I0ZW8e0WlLH6efejju9wgJJSj 7DMi3qbYNFeweiZqKf7tsC9LEtuKN5JV4rbnideiSeY3AkiMRVhdOPGYB4n9pQf9o9Fc Y2SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=xcgilPdC29orR/6A/byw5AbS0Xlr424BFcusvcJZTac=; b=QVJQtoozip12vtqAWmTrEKbBXczUz/aUYAo7iJ+jgVY+DOSz6L6VbavygH0POweALN pSYbgubNKHRPv90c8k0rvOsxpfotAI66E6a6yKmqF7EL47fpvZgbuQWIDLWZSu/bGqPD nJZYpye2r/JbH7gLzX+fAfpPrmjFf9E8hGP0PemzMADefSc469lTdbLrfBjI1Tc/PKKU uvPDBl2SU/0g+eWTCbOtU4SW0wKw8y3RahX5LcM1M/khcVTtKctK/ckv8B/k6XBuEasr YseaXeY92V7wr5tDxwZSRKfE47s5G8EQcwcCBDjDg/tBInro4sCus8lbfevJ+gEhYCdH AS6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si4442136otp.27.2020.02.15.05.44.51; Sat, 15 Feb 2020 05:45:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726209AbgBONon (ORCPT + 99 others); Sat, 15 Feb 2020 08:44:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:39956 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbgBONom (ORCPT ); Sat, 15 Feb 2020 08:44:42 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 49C5BAED6; Sat, 15 Feb 2020 13:44:40 +0000 (UTC) Subject: Re: [PATCH v2 1/3] riscv: Add support for mem= To: Jan Kiszka , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org References: <617f75f4eaacb02cd9d0a7044434e3e9b65e9e8b.1581767384.git.jan.kiszka@web.de> From: Nikolay Borisov Autocrypt: addr=nborisov@suse.com; prefer-encrypt=mutual; keydata= xsFNBFiKBz4BEADNHZmqwhuN6EAzXj9SpPpH/nSSP8YgfwoOqwrP+JR4pIqRK0AWWeWCSwmZ T7g+R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IACQUC WIoHPgIbDAAKCRBxvoJG5T8oV1pyD/4zdXdOL0lhkSIjJWGqz7Idvo0wjVHSSQCbOwZDWNTN JBTP0BUxHpPu/Z8gRNNP9/k6i63T4eL1xjy4umTwJaej1X15H8Hsh+zakADyWHadbjcUXCkg OJK4NsfqhMuaIYIHbToi9K5pAKnV953xTrK6oYVyd/Rmkmb+wgsbYQJ0Ur1Ficwhp6qU1CaJ mJwFjaWaVgUERoxcejL4ruds66LM9Z1Qqgoer62ZneID6ovmzpCWbi2sfbz98+kW46aA/w8r 7sulgs1KXWhBSv5aWqKU8C4twKjlV2XsztUUsyrjHFj91j31pnHRklBgXHTD/pSRsN0UvM26 lPs0g3ryVlG5wiZ9+JbI3sKMfbdfdOeLxtL25ujs443rw1s/PVghphoeadVAKMPINeRCgoJH zZV/2Z/myWPRWWl/79amy/9MfxffZqO9rfugRBORY0ywPHLDdo9Kmzoxoxp9w3uTrTLZaT9M KIuxEcV8wcVjr+Wr9zRl06waOCkgrQbTPp631hToxo+4rA1jiQF2M80HAet65ytBVR2pFGZF zGYYLqiG+mpUZ+FPjxk9kpkRYz61mTLSY7tuFljExfJWMGfgSg1OxfLV631jV1TcdUnx+h3l Sqs2vMhAVt14zT8mpIuu2VNxcontxgVr1kzYA/tQg32fVRbGr449j1gw57BV9i0vww== Message-ID: <24bf6fae-27f4-dbdc-fcc5-6c3b65733ae6@suse.com> Date: Sat, 15 Feb 2020 15:44:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <617f75f4eaacb02cd9d0a7044434e3e9b65e9e8b.1581767384.git.jan.kiszka@web.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.02.20 г. 13:49 ч., Jan Kiszka wrote: > From: Jan Kiszka > > This sets a memory limit provided via mem=3D on the command line, > analogously to many other architectures. > > Signed-off-by: Jan Kiszka > =2D-- > arch/riscv/mm/init.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 965a8cf4829c..aec39a56d6cf 100644 > =2D-- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -118,6 +118,23 @@ static void __init setup_initrd(void) > } > #endif /* CONFIG_BLK_DEV_INITRD */ > > +static phys_addr_t memory_limit =3D PHYS_ADDR_MAX; 3d is the ascii code for =, meaning your client is somehow br0ken? > + > +/* > + * Limit the memory size that was specified via FDT. > + */ > +static int __init early_mem(char *p) > +{ > + if (!p) > + return 1; > + > + memory_limit =3D memparse(p, &p) & PAGE_MASK; ditto > + pr_notice("Memory limited to %lldMB\n", memory_limit >> 20); > + > + return 0; > +} > +early_param("mem", early_mem); > + > static phys_addr_t dtb_early_pa __initdata; > > void __init setup_bootmem(void) > @@ -127,6 +144,8 @@ void __init setup_bootmem(void) > phys_addr_t vmlinux_end =3D __pa_symbol(&_end); > phys_addr_t vmlinux_start =3D __pa_symbol(&_start); > > + memblock_enforce_memory_limit(memory_limit); > + > /* Find the memory region containing the kernel */ > for_each_memblock(memory, reg) { > phys_addr_t end =3D reg->base + reg->size; > =2D- > 2.16.4 > >