From patchwork Mon Dec 10 16:29:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10721733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B76A691E for ; Mon, 10 Dec 2018 16:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A41792860B for ; Mon, 10 Dec 2018 16:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9806A2ABE1; Mon, 10 Dec 2018 16:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 28A1C2860B for ; Mon, 10 Dec 2018 16:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZpzsOrwbVLrqxv0X+4D1aTdK+faNAcqw+LRWRGaEOjY=; b=m+wsqIn27PEsyu U/puLBCGJzAmWd6XrrRB/3Q0EpOQ+zo1WssNlzS8/68Itx92ZI9+r1IB8iCZVWpK05IW/OvztZjZd EU6KegytWFv5046rrFzCTitfwD4FFb93qjTXX4MAb2/XrTTklRaKyvKrXvizuxnFBxR0TzXbYe/MI hgqmSnRwumiY15hyudqfUgfJTrkmrygvy96ox91t8Xt1rithDrHfZUr+7R+1RUDepgYXWQkZm045Y fnOiv9WLtIEFWkSOrLODJT6V4sNCfAgIudmM0TVk5S2OxjmKLSOc8sIEtbkGIcuPNSC1GMBqER8Ga VorY4Z+HVsZ3SvPrJlEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWOWz-00081T-86; Mon, 10 Dec 2018 16:35:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWOWH-0005Qq-Ml for linux-arm-kernel@bombadil.infradead.org; Mon, 10 Dec 2018 16:34:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rtHyHcOig6NGGoyRVno2ZvIoTH+Q2JyvE0Yh0rKDZ/c=; b=ekXVIph3oNrAlR3q8IeXcptIy3 0iy3PbtHB5Nll5iWaepzUr0X4ji0fRemz4tQAwYql8x4KJhAe1yhBsZMdhTYWf1daGQE3GWD9gI66 3wrgal9Dr5LqkixfEfJ+OwPZkPFI46u5Yd/XlbqOV6tFu+Za5CToSrYz8RSs9059Lh3Eue0rOJKEP 1fS85oS7N0OM7LZXihOMjxVJ6O1bXfB7BT4aMGeUlhLjosAv4+xW2eYa/BnMUa76HJh2erCN69AaL g86cCHALj044fa5F+PlZdoCYzRygVcWHFQ90hDg9kljSW0G63vRm3whUve64Yi/b5awHSX3HywvrA xTFv6KEg==; Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORs-0007uh-BQ for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2018 16:30:27 +0000 Received: by mail-wm1-x344.google.com with SMTP id s14so11646331wmh.1 for ; Mon, 10 Dec 2018 08:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rtHyHcOig6NGGoyRVno2ZvIoTH+Q2JyvE0Yh0rKDZ/c=; b=RlpXGQI5zX+pO6mKB5La9GZAFqjWzWgwjAlgHxZ5eSGI+wJ88kL/AecM/tkArclxKX LTRsRVUhaZR7aFKVNAuUz0P9+iGPR0z0lKMu9SEerkOgCruQRtPMeIirUiWeA6pNzYCP py703Pqpvcni7aiyG5QThfwMYbiGrma/Q3sl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rtHyHcOig6NGGoyRVno2ZvIoTH+Q2JyvE0Yh0rKDZ/c=; b=LMu3//KQjxbwFxRJiMPvkJPr+ERjFzYOoNi7gKzKjJ0LdSlwPBOD0ryHIglWzskoQR QWWWNAAqbVVX0GrAc31hs2kDVetnv24DX22GE0pgwqZV90d2BUW1VYGt1Bpg72TXsfG2 tutrcPC9XpaSDZ/0u8W7jZlSoyDdLl4SMtLY5vnvDmalQeYzkGeIF/wdb5yqiPDR/wyM QRKILjvEuyBOOsYj57yXT27PQaGfBQxjsSMm4ir+PcNRyY0Xp58jOkQ/+htoM+9Y7et8 hOk6jqklTDCUSqMWv0BPBP/SAP4eMIrLLNzNGusfdZtCwzFl/NUzRO2cjuQ8R9mDoEu4 G4Mg== X-Gm-Message-State: AA+aEWaxGGJLl2N9/9iUngJ6FiPVGuQBOFFg1XsWhO0RvuC12wV/O0OH c4+J9exRf8KoLzXs+lB0+DY6SnybgOAq9g== X-Google-Smtp-Source: AFSGD/VWQ5pGT6C+8GWP67KTN+vmE5UJACgaGvLmqSWSmj9temyuP09VMLTgrZcbUUrEVzsqDx+LYA== X-Received: by 2002:a1c:de57:: with SMTP id v84mr10967763wmg.55.1544459412097; Mon, 10 Dec 2018 08:30:12 -0800 (PST) Received: from localhost.localdomain (astlambert-681-1-52-199.w90-86.abo.wanadoo.fr. [90.86.17.199]) by smtp.gmail.com with ESMTPSA id i186sm3480531wmd.19.2018.12.10.08.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:30:11 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] ARM: mm: permit memblock resizing right after mapping the linear region Date: Mon, 10 Dec 2018 17:29:46 +0100 Message-Id: <20181210162949.8597-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210162949.8597-1-ard.biesheuvel@linaro.org> References: <20181210162949.8597-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181210_163024_569853_CFD5BE0F X-CRM114-Status: GOOD ( 16.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-efi@vger.kernel.org, Russell King , Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The memblock arrays can be resized dynamically if needed, but this is only done after memblock_allow_resize() is called, since it is up to the architecture to decide at which point doing so is possible (i.e., when all the memory that memblock describes is actually mapped) ARM grants this permission in bootmem_init(), but in order for the EFI persistent memory reservation code (which may create memblock reservations that trigger such a dynamic resize) to be able to be called before shutting down early fixmap (upon which the EFI code depends due to its use of early_memremap()), we need to do this earlier. So let's move the call to memblock_allow_resize() to right after the point where low memory is mapped and declared as the memory limit for memblock allocation. Signed-off-by: Ard Biesheuvel --- arch/arm/mm/init.c | 1 - arch/arm/mm/mmu.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 32e4845af2b6..797fad2b16ee 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -304,7 +304,6 @@ void __init bootmem_init(void) { unsigned long min, max_low, max_high; - memblock_allow_resize(); max_low = max_high = 0; find_limits(&min, &max_low, &max_high); diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index f5cc1ccfea3d..f6bf6686559d 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1626,6 +1626,7 @@ void __init paging_init(const struct machine_desc *mdesc) prepare_page_table(); map_lowmem(); memblock_set_current_limit(arm_lowmem_limit); + memblock_allow_resize(); dma_contiguous_remap(); early_fixmap_shutdown(); devicemaps_init(mdesc); From patchwork Mon Dec 10 16:29:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10721725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4D0A112E for ; Mon, 10 Dec 2018 16:32:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B08D22AD32 for ; Mon, 10 Dec 2018 16:32:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4BD42AE79; Mon, 10 Dec 2018 16:32:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2DF992AD32 for ; Mon, 10 Dec 2018 16:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JS2DGn3Xb0YZBErO/XQUz1NIwtYtsrGzsTJNZFSy3qg=; b=grJCXKu0dviPN0 ihr5kUVRoGMCwD9ooq3TDmCqfOru5+Zut0XWM5FVzGxnr3VoV2BOaCvJKYO2TQ59vJNiESvD0sFCr 4fVALIgWnNLDeSH0KgLkVoEMIc/CnVipgeTR0cMyjramDK05Lss68qBF+UroWa9h7kwNOT46jIG1R CDriSsVEUJB9oHzQ1q0qG1hkp1TWQxHWnLoSrtJpkPzg7PI2O+PrE4yFo5h8Yj+RPT2QwmxnCZ7UB 73b4zEuZF2AKn+l67uCV0deqqJ834+uLC3kudIzw43TOUyRvFb56vdl8PhoOEwQR7udlp3gqzJvt2 52Y5BAyRMp5B2yvpiV6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWOU2-0004sA-Oo; Mon, 10 Dec 2018 16:32:38 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORz-0002sP-NR for linux-arm-kernel@bombadil.infradead.org; Mon, 10 Dec 2018 16:30:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=X+JtbB5kahpWRryGJEfPt2WL8lWHxPrmd07Wiq4JNWY=; b=ztUWd2iIa0oqaOKlMtbg2j9ElA 4svbylMENgzZUzMPn3Ej/Cqza2FnHN6JFfbQJokduDf3pEC6a9VZothF0dbVCyuc+ylVu1Dfj+iCb YaLKotiYo7Z8P1IUT+Ne+tJjwjTBWAOWK26Q96jgW3sRHTWm39sUG1F+cNf3nYyjC0n+Kuk2RcYEZ DWn8q9zn+vNAlx3/WKSZXPtlnrDAk6l/lxVHvSIz2V69kVuCJbS9tLsJcoXlKPgFD7ITjby1/SP13 BY43rTvyMGwfa0rSFEi+liBOYX4GQyW1V+4KC3W2bSe9QIkirGSNgzhJYq9d7ggaYDfXBxAgvkRF0 ibNG1UOg==; Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORw-00051W-6A for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2018 16:30:29 +0000 Received: by mail-wm1-x342.google.com with SMTP id c126so11905668wmh.0 for ; Mon, 10 Dec 2018 08:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X+JtbB5kahpWRryGJEfPt2WL8lWHxPrmd07Wiq4JNWY=; b=S7fxYO4I95AqKMJRglYTKwog5gT5deCDNaP3im9wvXzVYzx+jtwBSZ0o6fRxB7Jmc+ eB15AL+QD2DnvrJdsPhDUVsCsnLhI5DE4DzhTDAJYqJjL5gmbo36NvBBsDp2vt8MyP94 9HCPomB4VXkwH2Mey1GG7N+MBms4p+uehZIWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X+JtbB5kahpWRryGJEfPt2WL8lWHxPrmd07Wiq4JNWY=; b=Z7GjxzRPXnX49AL8aLG/W3S65IsQD5Zoku1SUfnN0pFP1q1qqf91EGGDWxbok5P469 NyemC9tVH5+uoHMC/K3dDSRiPFXaCWaV4MfOyvjW444Da8qYton6sTdIGoPn2jC1F3yz L46lkQi5gzEa0IRvRKoE6nJy+8AhfZJIn0tmVXENFyJ42achOnKpMb7HKFhtXplNjELI dlN/YWz1E7nyZiWzMT23zw/HClCHKwackfsUb1j5e+QAUaXBG+p1smG1yTbxyYMXajXi 9L5LUnrMIaZgzZdjFSMV7pOGGyafYutCy9qzTS3Rjx5uqRNZRnuoiDVnGXbr+QBuajpP h9jw== X-Gm-Message-State: AA+aEWaiabyz5v+CCGI8A2/aR4YBclfu+9R59as04oQ5cGDoYx9YO094 4HCABLyPutGdWM0KixH1cy4mugvW721JxA== X-Google-Smtp-Source: AFSGD/WdQIuPPfaJVnHmKm67tSzct0xhorn3RFQ9FLkFZWctQ0up7FDEPKIxIQpmXe9w6rLfNRtq7A== X-Received: by 2002:a1c:90d5:: with SMTP id s204mr11215222wmd.148.1544459413490; Mon, 10 Dec 2018 08:30:13 -0800 (PST) Received: from localhost.localdomain (astlambert-681-1-52-199.w90-86.abo.wanadoo.fr. [90.86.17.199]) by smtp.gmail.com with ESMTPSA id i186sm3480531wmd.19.2018.12.10.08.30.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:30:12 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] ARM: mm: permit early_memremap() to be used in paging_init() Date: Mon, 10 Dec 2018 17:29:47 +0100 Message-Id: <20181210162949.8597-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210162949.8597-1-ard.biesheuvel@linaro.org> References: <20181210162949.8597-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181210_113028_321150_E7368200 X-CRM114-Status: GOOD ( 15.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-efi@vger.kernel.org, Russell King , Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP early_memremap() and early_ioremap() rely on early fixmap support, which shares its virtual address space with kmap(), and so it is taken down in paging_init(). In order to permit the EFI persistent memory reservation code to use early_memremap() when called from paging_init(), move the call to early_ioremap_reset() into paging_init(), right before the call to early_fixmap_shutdown(), creating a window where we can add the call to efi_apply_persistent_mem_reservations() in a subsequent patch. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/setup.c | 2 -- arch/arm/mm/mmu.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 375b13f7e780..7e2a936a5ed0 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1124,8 +1124,6 @@ void __init setup_arch(char **cmdline_p) /* Memory may have been removed so recalculate the bounds. */ adjust_lowmem_bounds(); - early_ioremap_reset(); - paging_init(mdesc); request_standard_resources(mdesc); diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index f6bf6686559d..078f82f89fe5 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1628,6 +1629,7 @@ void __init paging_init(const struct machine_desc *mdesc) memblock_set_current_limit(arm_lowmem_limit); memblock_allow_resize(); dma_contiguous_remap(); + early_ioremap_reset(); early_fixmap_shutdown(); devicemaps_init(mdesc); kmap_init(); From patchwork Mon Dec 10 16:29:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10721721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D814A91E for ; Mon, 10 Dec 2018 16:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C135F2AD1E for ; Mon, 10 Dec 2018 16:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABF4C2AE79; Mon, 10 Dec 2018 16:32:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B48E72AD1E for ; Mon, 10 Dec 2018 16:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v/9lTC9drSkHB24REn6uWjBJQi4IofCTAmHTlRMBJr4=; b=qQXaHLlrlwU3Yh ICUYeNEmWzIltm/N7/Efo8nb4qVtVXNvYSJLZHOTU2tSUuehat9DKyqi/zMqno2ZbvU3WwAqp5MBK PIXw01i5GvphHgpHXrxLdb5CTQ0nG6q3QefbgSBjwnBvM0MRAdW1rRFLmVn5Hd4pKV93EEA7/XuUe SaZzdh4Kk+HQLnxfQ2ZLpeLXYKhciCs4SB5xY/o5UDobFeDZ6yzYNu0IB7J7fpobvnyuDwIJ7CRqQ F/iAz4m3g1ZE9BHzgRtJSCbr/6QlIIbxKNlIV00rBdR74gJUpRcLrN72RcZjyjro6WSBRMFgNBMMe YJbvJqhVg84uJ4sHmFow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWOTW-0004Mj-Kf; Mon, 10 Dec 2018 16:32:06 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORz-0002sP-5l for linux-arm-kernel@bombadil.infradead.org; Mon, 10 Dec 2018 16:30:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FZC+I94o2oQFpPWLrl1OyOn6ypfdxhQaD8xW0QYVrtU=; b=oa4spL2mcbQLpEy0K2vR/6FtCF L5jnjx4bYrntmP4tFlJobhvqpUdxpS9ShvPNhEHenFqvs9QDlKuxlMFrMmL/aFxjavatq2KSs1cbX CFQhXJWJlPhNbYgaV1lQ4Xh6kYmOInEqDdiqUi6WysbU4DYuAMIcXL4/oQM17+CxsZln62/yLEivD gkDDKPIJtcATPGnrHwZBh1K6+R1KPqrV40Zc6NuwD8QIe4vw/kl2MasvKaXVjIDPyEDfErF7d7yox a7UWhzuALuuJT/sykDqbfsZ15+pW+wAriIGTv14t2ib3JKrJBysrcS8kmJtFF3kXrsw47mx2ADSiR Hen/ncJA==; Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORw-00051X-T9 for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2018 16:30:29 +0000 Received: by mail-wr1-x444.google.com with SMTP id u3so11163285wrs.3 for ; Mon, 10 Dec 2018 08:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FZC+I94o2oQFpPWLrl1OyOn6ypfdxhQaD8xW0QYVrtU=; b=i4eCm5aUVP/p8ZtODkhqo9HY53XV5peD3zCDOZnbt5I5tRQHBEqxkIBW14+BsfLKEa 9Ey59SBko2jnCL+0y3R4TSzSGj/wtc5xeivVPUxkRf+kIJQVO9n28F1NpVxMzDxD8lPP IaPg9qQlNxQI0p/7fkLIopnwqigTKWRsvq7VE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FZC+I94o2oQFpPWLrl1OyOn6ypfdxhQaD8xW0QYVrtU=; b=esflZFoWG1B1J4E71KBj/SfEALj6Y0S7h2AU9TCMTplcFX2D+Fmc/AkQfkNrhc+iD5 c2po9M5eFvq8rBdQ/TP63P3bDmCxBcLZgmaUvZc+s/MOanJQXvFRSeWA8QuYiCC4pDaQ oU5MhfQ9MuGqc8BCfpbQjDT3+j9EF3tU2quSGhuLq4yRBWl0oRxG14ZPOf4VJkUFMbQ7 2YPF7oDLQonYUh+q9WOEzX5TBSX3+9sciE7oyTTK8jYQH62uXb0mlmUjTkHwSJDOUTIl j5K9uDFeQWQQbf5ndabxRKHYJ9EK9K4P9OsY2ryq+R1YbhbN1jkwr4YpH3RyJt8giTW/ EiXA== X-Gm-Message-State: AA+aEWaRzCWTpWYmYqYOZ8crB50i0D5k6J6uJDgQwPoutQ+aIawNF7Om XcQRwk9PHw5xLV9NPCi4A/FIZjTbn/eBcg== X-Google-Smtp-Source: AFSGD/UKX9zDsllvninVIdV5isW/249IxFqmb+p5xRc50uvZTFd+5lO09Euw6Qqa1Y5RwhTAX1i5dg== X-Received: by 2002:a5d:4a45:: with SMTP id v5mr9937015wrs.7.1544459414717; Mon, 10 Dec 2018 08:30:14 -0800 (PST) Received: from localhost.localdomain (astlambert-681-1-52-199.w90-86.abo.wanadoo.fr. [90.86.17.199]) by smtp.gmail.com with ESMTPSA id i186sm3480531wmd.19.2018.12.10.08.30.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:30:13 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] efi/arm: apply persistent memory reservations during paging_init() Date: Mon, 10 Dec 2018 17:29:48 +0100 Message-Id: <20181210162949.8597-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210162949.8597-1-ard.biesheuvel@linaro.org> References: <20181210162949.8597-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181210_113028_956125_100ED195 X-CRM114-Status: GOOD ( 13.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-efi@vger.kernel.org, Russell King , Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The new memory EFI reservation feature we introduced to allow memory reservations to persist across kexec may trigger an unbounded number of calls to memblock_reserve(). The memblock subsystem can deal with this fine, but not before memblock resizing is enabled, which we can only do after paging_init(), when the memory we reallocate the array into is actually mapped. So on ARM, call the broken out efi_apply_persistent_mem_reservations() after memblock resizing has been enabled but before the early memremap support that we rely on has been taken down. Signed-off-by: Ard Biesheuvel --- arch/arm/mm/mmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 078f82f89fe5..8ecffb8c0c0b 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -1629,6 +1630,7 @@ void __init paging_init(const struct machine_desc *mdesc) memblock_set_current_limit(arm_lowmem_limit); memblock_allow_resize(); dma_contiguous_remap(); + efi_apply_persistent_mem_reservations(); early_ioremap_reset(); early_fixmap_shutdown(); devicemaps_init(mdesc); From patchwork Mon Dec 10 16:29:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10721723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8066A91E for ; Mon, 10 Dec 2018 16:32:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F8612AD1E for ; Mon, 10 Dec 2018 16:32:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63A492AE79; Mon, 10 Dec 2018 16:32:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 173382AD1E for ; Mon, 10 Dec 2018 16:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FWF+sBomPRIXok+ZFtOtNGCwy9Y33ZG/y9xSMkdB/RM=; b=MA7o9QDeJvp9lX el9GwsYaGd3OYYvryCG1h24zvD+SAygR2eGB+r/7S6L6jEo4ZX+W8YY3pBwFI9jKgufisEtMT/kgw yQfi+oondAdXsR+oYoS1mxRmfws3nUqR/J2NulsLRGlJ04eKo1syJEco2MpBRyWhBJWoTRGTA3WZo qR3jZG7YM6WMsC6uYMafkhMhCZQUoAcj12UTp7zhR1Sw/NAT8OL28QBA2o4od5i52zSVZvwYstGA9 hvNC1KB9QFnfaOls8Sk/jclj39E5ibXNJt79A4AK7v6bkpmLpQyh+VfN8SJhLcXEdivuB8xpsDNbn xYwa4qO2tTx/jPHHFiwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWOTn-0004dX-LL; Mon, 10 Dec 2018 16:32:23 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORy-0002sP-I0 for linux-arm-kernel@bombadil.infradead.org; Mon, 10 Dec 2018 16:30:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lz9cl2063s35V8iKDCeCGlB15ecDD/QJENBVOnRhRaw=; b=yDImZfCI3tnby8cjvZy8vzbX5N bqn54vViz5ODgDzCb4WdkCGGPeASsPbItNFi9RszrKgcF4QZ1VxkUt1XcoCaLT5san/slgaOQvqId /Vl7rvu1FrVhJT24pT5rsTvFNKhCDMyOrgzI3etyotOWVGmHsvoxwrbaKlN1/VrFP9OFf1Q8W7z7v QVPlnklhwjO+nHfYrAh3gZhj2lLK84Ceg2rSMKXI74mgFrEzuRsO36t/MOSqC+EIi34Bhof8bzFhQ 7tShh3ZKhW2nzNT+uZtSGFbErXmcLFDcub5MdAtmhDw8CFc5muwz/qOA2rvdIBwAqE7WKQPR+zOLc VpovXX9w==; Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWORw-00051Y-F3 for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2018 16:30:29 +0000 Received: by mail-wr1-x441.google.com with SMTP id l9so11086244wrt.13 for ; Mon, 10 Dec 2018 08:30:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lz9cl2063s35V8iKDCeCGlB15ecDD/QJENBVOnRhRaw=; b=iKY3AgxNBVgdUBQYyW2FEBFqU10aU92NdgP+jq7/Q6tVFD7yMTboJvZ5KCTd6P40d5 VDzyKlyl/7lc5JBrRycE/il7YzRjaoAt7hB5IPlhe0VRn4D/rhS8OeRYmpu2wMWIIHKH cl/S/LQyyDr6ig3mdbCYgVzbAE1tmPXsTMWGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lz9cl2063s35V8iKDCeCGlB15ecDD/QJENBVOnRhRaw=; b=cpfj46QuDBmrM+CUjFHJejzxfGT7ZvBlEtAYQzHMFaU/zial8nlLk2zRtZys6CHy4R tsqjlTGrRy0t6HM+5o4e5sz43yhM9zrUyyCQShClPUV4hoklgzlCwejZzo26kfAVgaTe /gZCbJKM7ntaHBSluxUCRxQpEnAGEwN4QNchFCW+PIe2pQj5XsM5MrmhtqgGiZA5uNtK 5GsAwBrVYdp4qYFunp3HbLmdNf7IrJGu8hjKexBfDVxNWYKSsDCDgROokwxJLyN3N+NK yE8kDX+CgEMmNWwJip0i7Iutq9YM7Oagm5EdIFFJ/n0f+dBzB2XME3inX4rBRvwVTmXu 7FSA== X-Gm-Message-State: AA+aEWawz60NNZF5Ik3vtS7Bh8zXD5PaTUH6JUH6zMJIa55m0RY3SYHo WiDpVVcwGJeDrETMAgJr65OclbKBql07LQ== X-Google-Smtp-Source: AFSGD/VsdXJVVR7EkXzW8eu00TwcRMZ+tLuwkTqZVeqZ4AW1V8T9F9ftigoSjIA2Ln7QBlml5zI20Q== X-Received: by 2002:adf:b6a1:: with SMTP id j33mr10493657wre.55.1544459416126; Mon, 10 Dec 2018 08:30:16 -0800 (PST) Received: from localhost.localdomain (astlambert-681-1-52-199.w90-86.abo.wanadoo.fr. [90.86.17.199]) by smtp.gmail.com with ESMTPSA id i186sm3480531wmd.19.2018.12.10.08.30.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:30:15 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] efi/arm: re-enable the memreserve table for 32-bit ARM Date: Mon, 10 Dec 2018 17:29:49 +0100 Message-Id: <20181210162949.8597-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210162949.8597-1-ard.biesheuvel@linaro.org> References: <20181210162949.8597-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181210_113028_519672_BB2135E0 X-CRM114-Status: GOOD ( 12.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-efi@vger.kernel.org, Russell King , Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have readded the call to efi_apply_persistent_mem_reservations in the 32-bit ARM boot path in a place where potentially creating many memblock reservations is permissible, re-enable the MEMRESERVE table in the 32-bit ARM EFI stub. This brings ARM back in line with arm64 in terms of support for efi_mem_reserve_persistent(). Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 3d36142cf812..30ac0c975f8a 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -75,9 +75,6 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg) efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID; efi_status_t status; - if (IS_ENABLED(CONFIG_ARM)) - return; - status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv), (void **)&rsv); if (status != EFI_SUCCESS) {