Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2878911ybv; Sat, 15 Feb 2020 05:41:33 -0800 (PST) X-Google-Smtp-Source: APXvYqyQxDXcaO0+c23UgxSuMhsOVGpYx7hK90FkAg3hRO4+jIV5KtqlA9qL+MxeZvPOo9lI27Rj X-Received: by 2002:a9d:6653:: with SMTP id q19mr6170542otm.94.1581774093266; Sat, 15 Feb 2020 05:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581774093; cv=none; d=google.com; s=arc-20160816; b=jhqwj5rYuZMArCmKC127msDRz7S7u67X+fHH0moI4S76yGKgHWL5bINwEOXiYN9WvX W4dWuWE3E6dJHlSlmqHV7KQrkioQoyls9weW/wHxvHzKaIlbKlMQLSbIHzawdGHq43qX Etspwk5zSqVD3IYoiD+Z3oL5IiR2/xSlJfbZOgVD/iWQzpBv5jPIxmC+gF8NhpkRGxjS S2L0oODyudNQAXlcZusNru3kcobjfIKmArZDaBzcvk3XtnEQdgfeZV4yAh3vmm4cU49e 0ocUcvSCvlWfdXunRp34i5yrHr2dclvY9wooZaHo7y1bFKhSsW00T9G9HoWPYOMNPUsg qlDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Bvbp7c5toLr2Yh1pvx/xh6i9s0n9bxm1bo8lfDqxtVg=; b=Gq+2jEw0nK434vZQW6wkOkBlW2GJDx/hyrqbg281f612al7WTCzCYPR4k9G2k8Zle0 ZrIJM0e2ABVB9dKL1mxNS0eOoz9d4uJhlw0gJz72VfVNxRU46ReU27lv6e48pf8yBDbF cP9ySq3IfeQb0B9AjFty/YKFyOslHbLqICMqeclGGQ4G3g3/4HZZOA9NGYKVbREaFdJl 1dKZQftAMMB5lnYhpUxm6nWr1SKTEyYIoBSUsZY5hEIzJJft1Ub3Nbxw1nGrVmmR+CaQ eQkniqNefO6F5KLFdYBRd0N+Fgwnu5Gc9h4uh7wxw822jAXLihNcjNavFqGWYwkR+i7a f89A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=AETsr1wM; 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 l4si4270024oib.170.2020.02.15.05.41.19; Sat, 15 Feb 2020 05:41:33 -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; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=AETsr1wM; 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 S1726143AbgBONlM (ORCPT + 99 others); Sat, 15 Feb 2020 08:41:12 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42000 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgBONlM (ORCPT ); Sat, 15 Feb 2020 08:41:12 -0500 Received: by mail-wr1-f67.google.com with SMTP id k11so14284167wrd.9 for ; Sat, 15 Feb 2020 05:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Bvbp7c5toLr2Yh1pvx/xh6i9s0n9bxm1bo8lfDqxtVg=; b=AETsr1wM3uuQ+zyCzeyH+iS5CfSEbaVtJHCOcch65tFOAVWr4TGnzk1ZhgqX/P00Hi vV8236IAJ3MKxyHTeriZo2Cvf0Z6Tu/TU4J5Gc4ncmOv045e9zBFxTueGJcAECE93JMW 9VtsNdbTT/nyOqGnz7uYxbZZQxgg5eO9b/QF1BZNzBmIhgG+FDX9tRHJuyK1EmBZrDSv hqMhhd9/HjU9Hl0UgLOIZ6cde/VjQ3PSBzqwLNwbS+TxqSD/eYWtxW18RXuZOwjnxS6S 4rXHNIQ7xh/AKVqHmLAsRLEgnEcmxeUr7jrFO+p9GQkDAGNVE5J8o629uaMQH7DxjFZN 5Cig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Bvbp7c5toLr2Yh1pvx/xh6i9s0n9bxm1bo8lfDqxtVg=; b=O1wdodwepTJiPRUP01gog7Ml3C+9Ry6/pjurAGg15C/RoQatQ/iK5JRhELlfH03TnH B85vG2tuoXFfSow91QTp9fK+KZwGEls5j1HDEVDOxj8lqIFeplUwVwlhdsIMiu6i32OX MSRx4u0MCflfTeryCALcpVgbSlAbdJom1Qu4AYXvM+AqvkZxID0GgnU6YBpAoRkTTQ7A rPB4083xr2E2vsczEEaIjoVX26vAv4DZb6VaXYuB/gn8HhqsqNx98AQUEIQQlK79yyRn sCqU7ciLfWJOF1DjvreUFdVBnHiyyp5fEh6WKbzINPX5sVULej7VzlMPoj574Bg93f0A 3DLw== X-Gm-Message-State: APjAAAVX/62dDRxnlMu8bWAaS51dT6a2yMWOFL3ydwvOKRznQhWzOiaZ zNVmj+ovoz/YUl5a3FhF5+DIhKFvD4hHb8Rhu0U1HA== X-Received: by 2002:adf:ec84:: with SMTP id z4mr10326398wrn.61.1581774069508; Sat, 15 Feb 2020 05:41:09 -0800 (PST) MIME-Version: 1.0 References: <617f75f4eaacb02cd9d0a7044434e3e9b65e9e8b.1581767384.git.jan.kiszka@web.de> In-Reply-To: <617f75f4eaacb02cd9d0a7044434e3e9b65e9e8b.1581767384.git.jan.kiszka@web.de> From: Anup Patel Date: Sat, 15 Feb 2020 19:10:57 +0530 Message-ID: Subject: Re: [PATCH v2 1/3] riscv: Add support for mem= To: Jan Kiszka Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 15, 2020 at 5:20 PM Jan Kiszka wrote: > > From: Jan Kiszka > > This sets a memory limit provided via mem= on the command line, > analogously to many other architectures. > > Signed-off-by: Jan Kiszka > --- > 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 > --- 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 = PHYS_ADDR_MAX; > + > +/* > + * Limit the memory size that was specified via FDT. > + */ > +static int __init early_mem(char *p) > +{ > + if (!p) > + return 1; > + > + memory_limit = memparse(p, &p) & PAGE_MASK; > + 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 = __pa_symbol(&_end); > phys_addr_t vmlinux_start = __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 = reg->base + reg->size; > -- > 2.16.4 > > This is a good addition for Linux RISC-V. Looks good to me. Reviewed-by: Anup Patel Regards, Anup