From patchwork Wed Mar 14 15:01:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 131597 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp977866ljb; Wed, 14 Mar 2018 08:01:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELtPG1V3fDONE68Kfvt1xrpKO3PKmsoJjFRqWxtDoOZezjZIRmPiiwTBdwiln/2yD92ni58N X-Received: by 10.101.68.82 with SMTP id e18mr3939508pgq.329.1521039702462; Wed, 14 Mar 2018 08:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521039702; cv=none; d=google.com; s=arc-20160816; b=h17Y2cxSBVX5feB9WbpWuz7X5+1Dm8dVksedLVxElpP3551ximZNYYFYG5JYVQuLlg PvznvIEMwRZtOcNlBv1Z7loKsNDD3/CkFSJnw19ko8GW77Ke20molJmdtM9aLxhSnzUz 6FE8ddNSYbleyI1RGGWLvVBiKcvJrUjq7/CQZrUs4FTDkXXVWYbR2qCaX+Eq4HnLwaV7 gDie5UR9WM1hIejEZVbLpeHupAUgIuf69SI1kJkK1lEZTuMIebnXTJuwkLzTVBSKGFLr ou4x7i6LDWsM9aIsX+dJO1q6mol7tcBaPo8BWJo+U7RTCV3Ny+IAKodLKfhrw/F09OH7 LJuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=UMhbBqZGlkz493w1YcJTKpa/DYAm4rMbeQqh0WpwJtI=; b=rugVBmFVr5vLy/FxXPWxmI3zC1t17LHEOCpLp2641JphevSOWh7rVSulpohDrsSfaW +RAW0Cdihz9xL369WSrHr4Bw07Xd7qc8IZUwB433sUMeFAEPs0tK+0NVt2zzvoB2vBis 5zTPw6V7iIN6CmXGirXLdP6vuh6kW9YVq6A0s7TWdUS3ejf2NRd+ViSbhjDACeazO6Im CNWO0N+NgJXdIBLvwj9Yla+tYBy9706kSpp3aQ0PcX9+8Hh1pj6v3y5+EPqDXKG9/jFu hiT4fptHp18vYJBG5cv9KquZ2HyVKMn9KtfRWpgGIyJ0nrDuGeiicUnaTE2BpRTV2RLi ZpjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=nVRfvXXB; 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 t75si2026486pgc.287.2018.03.14.08.01.41; Wed, 14 Mar 2018 08:01:42 -0700 (PDT) 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=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=nVRfvXXB; 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 S1752187AbeCNPBj (ORCPT + 28 others); Wed, 14 Mar 2018 11:01:39 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40188 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeCNPBi (ORCPT ); Wed, 14 Mar 2018 11:01:38 -0400 Received: by mail-wm0-f67.google.com with SMTP id t6so4681886wmt.5 for ; Wed, 14 Mar 2018 08:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=UMhbBqZGlkz493w1YcJTKpa/DYAm4rMbeQqh0WpwJtI=; b=nVRfvXXBgt7bXXpTnLevQd0K2vWbkfJYbklO8nZ1vsOvqzsSppX1rk+MsfTIK9Cvd6 +SnzzNZsSjq5vaUFcSknh315PILjneeh92LMnLBy8ERxCkvYFmfxE79yYp7tI9gKDDxI M8OutGEIlwEzriUmF83e0AvH1n8o5/fOO2HvHOk7DmRLAfXWEEzHHiLb1Tq5IlAHSP6b CUrIoXGnUXj82Mmxk0/+qNUyw97rpnhUHSq8ya7EAVC8CJwK4oNm/EkZmlzWifd5EvON 4PQzuj3zombQ68CSdqzLIItC0GxPoGgTV+Rxzbtu3hQIqjGzcP9yqtg4hWcWpp92Yrsb +uQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=UMhbBqZGlkz493w1YcJTKpa/DYAm4rMbeQqh0WpwJtI=; b=W8W/aQcoxJjfOcgk58Zds1poF5zfYEwUJeLpvD2t0mQwte+mg3QF4YEcfI5fiOxyQd Jbow2SgZSEAz5w0hc0pTWle6OJ9j0lxqx7vPl5Ylo+4WRdqx3VhU3bDTW0LCg2CQBVjf jKvP8rDQZWTXlQODJ6tc1iBRGT+ZIm4CTDOheqXODmQ/jXo0+HEvWteAOHbxJbxjv0f8 m6q5xyD2meqK1F2fWD+Gra32+eTsOCFYK0YFytVoemOYqOHh0zJOPRpmIP73yJrGzRIt xZuTAfxRq0V0i1Q1Q3QYdPO0oeXy5f2l+Q4UPQXN2Sak524ACeanImvMmgv+7air+opx ElwQ== X-Gm-Message-State: AElRT7GPT8JjixSZA91FgT2Wn3ltxxDm2/f9fdM/Hx0ujbp1K7as07JQ oAFOEPrVJlqVS8U9wbnUz2owIOBS X-Received: by 10.28.66.197 with SMTP id k66mr2080480wmi.58.1521039696697; Wed, 14 Mar 2018 08:01:36 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id v9sm2482519wre.96.2018.03.14.08.01.35 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 14 Mar 2018 08:01:36 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: Rob Herring Subject: [PATCH 1/2] microblaze: remove unused alloc_maybe_bootmem Date: Wed, 14 Mar 2018 16:01:34 +0100 Message-Id: <77785f26fa882362b5e72e71845bb607f2cec757.1521039689.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring alloc_maybe_bootmem is unused, so remove it. Signed-off-by: Rob Herring Signed-off-by: Michal Simek --- arch/microblaze/include/asm/setup.h | 1 - arch/microblaze/mm/init.c | 8 -------- 2 files changed, 9 deletions(-) -- 1.9.1 diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h index be84a4d3917f..7c968c1d1729 100644 --- a/arch/microblaze/include/asm/setup.h +++ b/arch/microblaze/include/asm/setup.h @@ -44,7 +44,6 @@ void machine_early_init(const char *cmdline, unsigned int ram, void machine_halt(void); void machine_power_off(void); -extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); # endif /* __ASSEMBLY__ */ diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index 434639f9a3a6..5bc9c7fbb541 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c @@ -414,14 +414,6 @@ void __init *early_get_page(void) #endif /* CONFIG_MMU */ -void * __ref alloc_maybe_bootmem(size_t size, gfp_t mask) -{ - if (mem_init_done) - return kmalloc(size, mask); - else - return alloc_bootmem(size); -} - void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask) { void *p; From patchwork Wed Mar 14 15:01:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 131598 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp978107ljb; Wed, 14 Mar 2018 08:01:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELv9dX8uFXMmW7mIfTsiFQyWFx6K/QaBptI2oMua2/qrXubiH+rrwX5NnWfH5bGl6KM94ILl X-Received: by 10.98.228.3 with SMTP id r3mr4596899pfh.77.1521039710742; Wed, 14 Mar 2018 08:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521039710; cv=none; d=google.com; s=arc-20160816; b=Dx+pHppE1dDDrbG1NEqmsXKwx5q5dFK7vLMKw4vNNOSo22bMSjKv+R834OB48b33t0 N/Mzbn+7XmF9w3E3EkREQrg4sIFU6Zx1OmGLfR/EByBQoDuSv9j7ZVt+QjuthkFwfqPj BIeN0+/fPq2im+lDjo334KOJSPCLkf5FdqolPPajcR+Z42HCL+UmBLcZbOIczrzxoUTx U9cPPJl92fnv8W6WUOE5+UYJ/bbUMvVjY90HjoBcq9kB0LuDx1bKTJPyn8VrQQQbcETt Ti/m/jodJWrq9DO704PFqohw5HhvKlXV00bT+tzInA7B1POYQdEvbofi9YsH9QbQC9Qg FypA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oxB0f3fGjdRtL6Ecb8Gg/YDMgl6HCoUqM1BS66Ly6Zg=; b=0I1UtqLAAIFdSSfOfhHpHMk6MIxsz2qSdg7Pc0gPq3bQs2OCJz1udgHUMpmUA2Ndaq Rgjkr7/yNwE2yuHQJYFH8upXtBctkVKKYOyeVKgfRNzrum4vUB+GKfq6O1uFgf9QdT+h +8f3EsMjE5IFFQ9uDh4G9gx77E1ccWPjNHftnLLNZrkTpGxoeJua2JThJ+01GFV72jps 7T/Mk5EnUIumEXtEzwYPGgDAHp6urWFKPImzYIP1kwRgFVTSKET0MkJCzRlXosoGy6GT Jyl2nXBDZUaEWbtm+Kipc+d8SlHmbOxhn/M3wmvih9IfUqFRcILyNX/shyxgVeTa8Lwi QuqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=bAlIzrcd; 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 7-v6si2098710pll.307.2018.03.14.08.01.49; Wed, 14 Mar 2018 08:01:50 -0700 (PDT) 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=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=bAlIzrcd; 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 S1752254AbeCNPBp (ORCPT + 28 others); Wed, 14 Mar 2018 11:01:45 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52162 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeCNPBl (ORCPT ); Wed, 14 Mar 2018 11:01:41 -0400 Received: by mail-wm0-f67.google.com with SMTP id h21so4668258wmd.1 for ; Wed, 14 Mar 2018 08:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oxB0f3fGjdRtL6Ecb8Gg/YDMgl6HCoUqM1BS66Ly6Zg=; b=bAlIzrcd+vXEulVwZJont4C31RTxIQZwaHQiP+zmJsr5mPEFloJt7vWVcs6IqZ+w3k NFW+8zqHXismVuwMk0IBS5n01cnwJD4kbRIrdQGHyT2YuhYkqDYZDVWGNiMxsdnixayV TuJnpTDL9h53HbgOV1gftbBPhnfZ2vXpeh/qZP+iqNyWXH5gO2mkQ0C+pU7uXqFAzsu0 eiKQTF0hiNd26hrWrQBDIHE0MB11/EK4sMaMgfPGgnmbm9OA1dLUqTdx+vEy26N+QgRe wKRGnppp9yl8z4wvYyIbqSuv9ayvg3AICIN+eruj/RxvHhJFr9UMqJxyIQCiBbuj9EDU DUjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=oxB0f3fGjdRtL6Ecb8Gg/YDMgl6HCoUqM1BS66Ly6Zg=; b=SVwz7e3tB5nn1AzQHjlPPN9f1yZtzZmKaAoLOi7L0FqsUBG48Sn27oecZjA398HU5k 3syAplvjdqhtqItlZXKhCKb9sdvDDPqnQOe5DhSm1zdtdJbloTnMb89shktJbvr3zjU0 PfYMtkqnsYdbTOJDsADu15KruS21gJr/gfBfEFliPq6cJnNlCf2bZbYX8ihIaXVgyr/b T4sYLP04olo/jc2IVgDrnm8W4E30lZA7u1kuBZHlI4gdxcQhsJNeBeCwF6u29v/bjTR0 nh8l47Ppv5qDRZnNnPAVjyPfk3w552kgbEaj3X7P/NvLZCLi0GiaJ959py7pPxw0DZG2 nf/g== X-Gm-Message-State: AElRT7F5SoUjkj7aa88fRauo8zbe6MiUIBAygFb0uNLbKqPgaTIjEY6+ hsGVENTDzXjBldvOHzjWGksC+n0n X-Received: by 10.28.224.135 with SMTP id x129mr2088045wmg.57.1521039698429; Wed, 14 Mar 2018 08:01:38 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b68sm1543144wmi.30.2018.03.14.08.01.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 14 Mar 2018 08:01:37 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: Rob Herring Subject: [PATCH 2/2] microblaze: switch to NO_BOOTMEM Date: Wed, 14 Mar 2018 16:01:35 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: <77785f26fa882362b5e72e71845bb607f2cec757.1521039689.git.michal.simek@xilinx.com> References: <77785f26fa882362b5e72e71845bb607f2cec757.1521039689.git.michal.simek@xilinx.com> In-Reply-To: <77785f26fa882362b5e72e71845bb607f2cec757.1521039689.git.michal.simek@xilinx.com> References: <77785f26fa882362b5e72e71845bb607f2cec757.1521039689.git.michal.simek@xilinx.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring Microblaze doesn't set CONFIG_NO_BOOTMEM and so memblock_virt_alloc() doesn't work for CONFIG_HAVE_MEMBLOCK && !CONFIG_NO_BOOTMEM. Similar change was already done by others architectures "ARM: mm: Remove bootmem code and switch to NO_BOOTMEM" (sha1: 84f452b1e8fc73ac0e31254c66e3e2260ce5263d) or "openrisc: Consolidate setup to use memblock instead of bootmem" (sha1: 266c7fad157265bb54d17db1c9545f2aaa488643) or "parisc: Drop bootmem and switch to memblock" (sha1: 4fe9e1d957e45ad8eba9885ee860a0e93d13a7c7) or "powerpc: Remove bootmem allocator" (sha1: 10239733ee8617bac3f1c1769af43a88ed979324) or "s390/mm: Convert bootmem to memblock" (sha1: 50be634507284eea38df78154d22615d21200b42) or "sparc64: Convert over to NO_BOOTMEM." (sha1: 625d693e9784f988371e69c2b41a2172c0be6c11) or "xtensa: drop sysmem and switch to memblock" (sha1: 0e46c1115f5816949220d62dd3ff04aa68e7ac6b) Issue was introduced by: "of/fdt: use memblock_virt_alloc for early alloc" (sha1: 0fa1c579349fdd90173381712ad78aa99c09d38b) Signed-off-by: Rob Herring Tested-by: Alvaro Gamez Machado Tested-by: Michal Simek Signed-off-by: Michal Simek --- arch/microblaze/Kconfig | 1 + arch/microblaze/mm/init.c | 55 ++++++----------------------------------------- 2 files changed, 7 insertions(+), 49 deletions(-) -- 1.9.1 diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 4f798aa671dd..3817a3e2146c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -24,6 +24,7 @@ config MICROBLAZE select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER + select NO_BOOTMEM select HAVE_MEMBLOCK select HAVE_MEMBLOCK_NODE_MAP select HAVE_OPROFILE diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index 5bc9c7fbb541..6ab1ef2daf1d 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c @@ -32,9 +32,6 @@ #ifndef CONFIG_MMU unsigned int __page_offset; EXPORT_SYMBOL(__page_offset); - -#else -static int init_bootmem_done; #endif /* CONFIG_MMU */ char *klimit = _end; @@ -174,17 +171,6 @@ void __init setup_memory(void) pr_info("%s: max_low_pfn: %#lx\n", __func__, max_low_pfn); pr_info("%s: max_pfn: %#lx\n", __func__, max_pfn); - /* - * Find an area to use for the bootmem bitmap. - * We look for the first area which is at least - * 128kB in length (128kB is enough for a bitmap - * for 4GB of memory, using 4kB pages), plus 1 page - * (in case the address isn't page-aligned). - */ - map_size = init_bootmem_node(NODE_DATA(0), - PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn); - memblock_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size); - /* Add active regions with valid PFNs */ for_each_memblock(memory, reg) { unsigned long start_pfn, end_pfn; @@ -196,32 +182,9 @@ void __init setup_memory(void) &memblock.memory, 0); } - /* free bootmem is whole main memory */ - free_bootmem_with_active_regions(0, max_low_pfn); - - /* reserve allocate blocks */ - for_each_memblock(reserved, reg) { - unsigned long top = reg->base + reg->size - 1; - - pr_debug("reserved - 0x%08x-0x%08x, %lx, %lx\n", - (u32) reg->base, (u32) reg->size, top, - memory_start + lowmem_size - 1); - - if (top <= (memory_start + lowmem_size - 1)) { - reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); - } else if (reg->base < (memory_start + lowmem_size - 1)) { - unsigned long trunc_size = memory_start + lowmem_size - - reg->base; - reserve_bootmem(reg->base, trunc_size, BOOTMEM_DEFAULT); - } - } - /* XXX need to clip this if using highmem? */ sparse_memory_present_with_active_regions(0); -#ifdef CONFIG_MMU - init_bootmem_done = 1; -#endif paging_init(); } @@ -398,18 +361,12 @@ asmlinkage void __init mmu_init(void) /* This is only called until mem_init is done. */ void __init *early_get_page(void) { - void *p; - if (init_bootmem_done) { - p = alloc_bootmem_pages(PAGE_SIZE); - } else { - /* - * Mem start + kernel_tlb -> here is limit - * because of mem mapping from head.S - */ - p = __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, - memory_start + kernel_tlb)); - } - return p; + /* + * Mem start + kernel_tlb -> here is limit + * because of mem mapping from head.S + */ + return __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, + memory_start + kernel_tlb)); } #endif /* CONFIG_MMU */