Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp26105ybg; Mon, 27 Jul 2020 22:13:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlu/jk3uAD4PxZAQref1CBjiyL8cM77g/C6R/bTEqcTQDS3muEIA9Jb4oyBAfw1+BfNSLO X-Received: by 2002:a50:ba84:: with SMTP id x4mr8514642ede.282.1595913235331; Mon, 27 Jul 2020 22:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595913235; cv=none; d=google.com; s=arc-20160816; b=UMD1cEUVsk4iWl2gOXl5yBOU/H4PusppwLx3IA0PB6v9UJtMnFF9QdGoD7JcWfkMsp FlsyldDBxdGf02O4MPKqd4vFp1nOFsB320TWI9aabePJU504x7+aET0FhdwcD0F1DPNb sTH4+4+eg+6KSy1DCnEGo4jrV0CPD8kKrRYL6f5gnVRHGrFzGLyZlGDFf3Y+z+KzZf8l VtBnYhiWWBHiovOWExP+8xOiCKw+QBJurUw2APNgFNqhZCGPSaJbnVHpz0hNRnyiWco0 UK+JR6uJt5YsTY3fThad4E6Zz5cNB1cuLTAAfTxxxKP21/3ALk8R2xzF6c9U0yRKwN0C ug/Q== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KBvaHZ++NKnFy73AitMDXJ8lu9zcZFU+m9FIS2X65Xw=; b=I921ZbVdfoZm0MfL8L8KikSkScTeSwGtkRyYofh0n+Dnb2IzKFLjj6fkNiF0zyaIk+ Ks6ViOLK7OxLXPfnQW/FeYqqTCx35CaaEW1Esf9lYcbs8ST8udM861R5e7IgaZlaF6kJ 4QVEN5nmizffU7LloZQxBXPdiBVdXvy6UniRc1yLOE5mo+BwqWwhS6DGuA9QGFf1fkfp mNFPfuO1ENRWXF3NWBni1khIY3yViyFPDNtcP40OOpXVnetFCYYsvEVImTjBy4qrZaWU dn2YIPQi78k371AkTo5sGw+twE9fVYID/UjEYwqU9cQMPUCck4P99XI800Y62xSw1iAK +N9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Say3vh4Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si7582166edv.536.2020.07.27.22.13.33; Mon, 27 Jul 2020 22:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Say3vh4Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbgG1FNE (ORCPT + 99 others); Tue, 28 Jul 2020 01:13:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:35072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgG1FNE (ORCPT ); Tue, 28 Jul 2020 01:13:04 -0400 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF6522250E; Tue, 28 Jul 2020 05:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595913183; bh=gzwerAM5mue0P8mAb9RTcMcptKQskdlleSUQBoxuoyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Say3vh4QamTYtvnYNu+lnlZMJneUQqUnbMTX43a8WoTOrUYvMeKTwUVkw/DEqkPhG HnPJWpQTYZNG7fegwc0EKmJMGw2JgZY3KWzFmeYTl228nTa6vRBl5n108KojpP7OBY xf3ECXf8bK2qItN0xsPBA+mi/0GEjLhJvgIymxCA= From: Mike Rapoport To: Andrew Morton Cc: Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Dave Hansen , Ingo Molnar , Marek Szyprowski , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org Subject: [PATCH 05/15] h8300, nds32, openrisc: simplify detection of memory extents Date: Tue, 28 Jul 2020 08:11:43 +0300 Message-Id: <20200728051153.1590-6-rppt@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728051153.1590-1-rppt@kernel.org> References: <20200728051153.1590-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport Instead of traversing memblock.memory regions to find memory_start and memory_end, simply query memblock_{start,end}_of_DRAM(). Signed-off-by: Mike Rapoport --- arch/h8300/kernel/setup.c | 8 +++----- arch/nds32/kernel/setup.c | 8 ++------ arch/openrisc/kernel/setup.c | 9 ++------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c index 28ac88358a89..0281f92eea3d 100644 --- a/arch/h8300/kernel/setup.c +++ b/arch/h8300/kernel/setup.c @@ -74,17 +74,15 @@ static void __init bootmem_init(void) memory_end = memory_start = 0; /* Find main memory where is the kernel */ - for_each_memblock(memory, region) { - memory_start = region->base; - memory_end = region->base + region->size; - } + memory_start = memblock_start_of_DRAM(); + memory_end = memblock_end_of_DRAM(); if (!memory_end) panic("No memory!"); /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ min_low_pfn = PFN_UP(memory_start); - max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); + max_low_pfn = PFN_DOWN(memory_end); max_pfn = max_low_pfn; memblock_reserve(__pa(_stext), _end - _stext); diff --git a/arch/nds32/kernel/setup.c b/arch/nds32/kernel/setup.c index a066efbe53c0..c356e484dcab 100644 --- a/arch/nds32/kernel/setup.c +++ b/arch/nds32/kernel/setup.c @@ -249,12 +249,8 @@ static void __init setup_memory(void) memory_end = memory_start = 0; /* Find main memory where is the kernel */ - for_each_memblock(memory, region) { - memory_start = region->base; - memory_end = region->base + region->size; - pr_info("%s: Memory: 0x%x-0x%x\n", __func__, - memory_start, memory_end); - } + memory_start = memblock_start_of_DRAM(); + memory_end = memblock_end_of_DRAM(); if (!memory_end) { panic("No memory!"); diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index 8aa438e1f51f..c5706153d3b6 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -48,17 +48,12 @@ static void __init setup_memory(void) unsigned long ram_start_pfn; unsigned long ram_end_pfn; phys_addr_t memory_start, memory_end; - struct memblock_region *region; memory_end = memory_start = 0; /* Find main memory where is the kernel, we assume its the only one */ - for_each_memblock(memory, region) { - memory_start = region->base; - memory_end = region->base + region->size; - printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__, - memory_start, memory_end); - } + memory_start = memblock_start_of_DRAM(); + memory_end = memblock_end_of_DRAM(); if (!memory_end) { panic("No memory!"); -- 2.26.2