From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Richard Kuo <rkuo@codeaurora.org>,
Ley Foon Tan <lftan@altera.com>,
Richard Weinberger <richard@nod.at>, Guan Xuetao <gxt@pku.edu.cn>,
Michal Hocko <mhocko@kernel.org>,
linux-hexagon@vger.kernel.org, nios2-dev@lists.rocketboards.org,
linux-um@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: [PATCH 6/7] um: switch to NO_BOOTMEM
Date: Fri, 3 Aug 2018 22:58:49 +0300 [thread overview]
Message-ID: <1533326330-31677-7-git-send-email-rppt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1533326330-31677-1-git-send-email-rppt@linux.vnet.ibm.com>
Replace bootmem initialization with memblock_add and memblock_reserve calls
and explicit initialization of {min,max}_low_pfn.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: Richard Weinberger <richard@nod.at>
---
arch/um/Kconfig.common | 2 ++
arch/um/kernel/physmem.c | 20 +++++++++-----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 07f84c8..1487957 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -8,6 +8,8 @@ config UML
select HAVE_UID16
select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_DEBUG_KMEMLEAK
+ select HAVE_MEMBLOCK
+ select NO_BOOTMEM
select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES
select GENERIC_CLOCKEVENTS
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 0eaec0e..296a91a 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -5,6 +5,7 @@
#include <linux/module.h>
#include <linux/bootmem.h>
+#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/pfn.h>
#include <asm/page.h>
@@ -80,23 +81,18 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
unsigned long len, unsigned long long highmem)
{
unsigned long reserve = reserve_end - start;
- unsigned long pfn = PFN_UP(__pa(reserve_end));
- unsigned long delta = (len - reserve) >> PAGE_SHIFT;
- unsigned long offset, bootmap_size;
- long map_size;
+ long map_size = len - reserve;
int err;
- offset = reserve_end - start;
- map_size = len - offset;
if(map_size <= 0) {
os_warn("Too few physical memory! Needed=%lu, given=%lu\n",
- offset, len);
+ reserve, len);
exit(1);
}
physmem_fd = create_mem_file(len + highmem);
- err = os_map_memory((void *) reserve_end, physmem_fd, offset,
+ err = os_map_memory((void *) reserve_end, physmem_fd, reserve,
map_size, 1, 1, 1);
if (err < 0) {
os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p "
@@ -113,9 +109,11 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
os_write_file(physmem_fd, __syscall_stub_start, PAGE_SIZE);
os_fsync_file(physmem_fd);
- bootmap_size = init_bootmem(pfn, pfn + delta);
- free_bootmem(__pa(reserve_end) + bootmap_size,
- len - bootmap_size - reserve);
+ memblock_add(__pa(start), len + highmem);
+ memblock_reserve(__pa(start), reserve);
+
+ min_low_pfn = PFN_UP(__pa(reserve_end));
+ max_low_pfn = min_low_pfn + (map_size >> PAGE_SHIFT);
}
int phys_mapping(unsigned long phys, unsigned long long *offset_out)
--
2.7.4
next prev parent reply other threads:[~2018-08-03 19:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 19:58 [PATCH RESEND 0/7] switch several architectures NO_BOOTMEM Mike Rapoport
2018-08-03 19:58 ` [PATCH 1/7] hexagon: switch to NO_BOOTMEM Mike Rapoport
2018-08-03 19:58 ` [PATCH 2/7] of: ignore sub-page memory regions Mike Rapoport
2018-08-03 19:58 ` [PATCH 3/7] nios2: use generic early_init_dt_add_memory_arch Mike Rapoport
2018-08-03 19:58 ` [PATCH 4/7] nios2: switch to NO_BOOTMEM Mike Rapoport
2018-08-03 19:58 ` [PATCH 5/7] um: setup_physmem: stop using global variables Mike Rapoport
2018-08-03 19:58 ` Mike Rapoport [this message]
2018-08-03 19:58 ` [PATCH 7/7] unicore32: switch to NO_BOOTMEM Mike Rapoport
2018-08-29 7:20 ` [PATCH RESEND 0/7] switch several architectures NO_BOOTMEM Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1533326330-31677-7-git-send-email-rppt@linux.vnet.ibm.com \
--to=rppt@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=gxt@pku.edu.cn \
--cc=lftan@altera.com \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-um@lists.infradead.org \
--cc=mhocko@kernel.org \
--cc=nios2-dev@lists.rocketboards.org \
--cc=richard@nod.at \
--cc=rkuo@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).