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: 153292 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3750880ljp; Mon, 10 Dec 2018 08:30:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/WoOODVKQNt01MZnMtPZIFay+dCQPH71Da4d4wzn0sCc4sgmZXBtVB/j/nnLHo67x34iG5+ X-Received: by 2002:a17:902:714c:: with SMTP id u12mr12552244plm.234.1544459415128; Mon, 10 Dec 2018 08:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544459415; cv=none; d=google.com; s=arc-20160816; b=rzp5rVvYtcxO+rAe6gqp9Ka1qSJzBnreK/Iyvf/TFSs3ktTceVyXVZ2vdPiRCkqEfR b2Iv7eXgduGbLw5s54OxviNrA6b8KVL1idhNPu9Sg4gcRcinTxWt6BMkY3Fp1cJwRtIP pO7ydQTxj3WDpIU4Tpyt7N1Ewn6KWiEnrMpAePCp7Ss9blFvj2euKMXuEdvz/tZg6Rgz H4nKG4D5WJoPwG6xkki1zKJsA53CFHoXh8Ad414yLx/pcfMBLnPDknf6vBEjpsC/RN+I k4nSYUYCuz0xD3Lq5/rWkDvcEn/iJz9dSnlD7O563daIF6yXNqQjKcMt65hyLf6j7kXt wfyw== 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=rtHyHcOig6NGGoyRVno2ZvIoTH+Q2JyvE0Yh0rKDZ/c=; b=HIlpUy7nmmkQYLF5CPIbM/HHiYeQ9iyaIooS8l2Ex6nTGUBVd+DTuRIxm3Vk+nvG4m 16GgZvmItztGRnd8W6+tZabLyQ/3m9f7OAggLskeYv1DJmGw7R28JY/wBpXu76Q2MUin KTCnN+wybCLddE/fjn3WmvhrNyFjzxmSY5VuZqHNLVjAfDqMUxoE7GATOAP60T/23dOS Kh/pwjKNK99frPrBWMiCN/cSYuz0f/GixybyA/DMrs1HQ2msW4MpvG5MWcncRiTowbHB d2TmTuZtcAxHaycEGEhXTddgRXq1O9vUWFgm34s/Ho43QVLemMUqAQlxzWqyuois4jPS +7cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RlpXGQI5; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si10433973pls.32.2018.12.10.08.30.14; Mon, 10 Dec 2018 08:30:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-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=@linaro.org header.s=google header.b=RlpXGQI5; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728370AbeLJQaO (ORCPT + 3 others); Mon, 10 Dec 2018 11:30:14 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50612 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728351AbeLJQaO (ORCPT ); Mon, 10 Dec 2018 11:30:14 -0500 Received: by mail-wm1-f66.google.com with SMTP id n190so11673109wmd.0 for ; Mon, 10 Dec 2018 08:30:12 -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=QFN36Hp+KO6gUuiKwd/kR0ZPKwO6MEfToolGVDyjOiXJdv9o+pHDQ4Fyf8kQG5jnbc I7vA3MmLapO4qm9girOkPuXcvjldIRHepXRxELmqNNdqOQv2DSsZ2FryPge889d1rOrL N0STRuipK0rNyX/Ymz3dlaxGr4JJvSM/L12QwnGMrU5d2eIyC5JXCCo49pcS5uvSpTMw pKqnOAV3n8yllzc21ZUq98QBJgbowyeEehbHYlKhPPy+8Q6og0tMBzcLNs9JPPZAkYpw KFRe+JDPtFEgnv/+BWc0s+TNIhtxeQb7hxzQN7aVyfz2jZgtC2h9GATkKViDyqeq/QjW IZug== X-Gm-Message-State: AA+aEWbVwRqiAyIYvhs2afmOX5TxZxWGQw+UyaYh3bTfP6zlzlaPKPlS 25bxrmm3zK8wzbFCoe37ZdNuvw== 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 Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Russell King , Marc Zyngier 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 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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(-) -- 2.19.2 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);