From patchwork Wed Nov 7 14:16:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150392 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5221016ljp; Wed, 7 Nov 2018 06:16:28 -0800 (PST) X-Google-Smtp-Source: AJdET5dE0hUTVD51JPeM5yhtaYjdkaYobCUvIUFuXNUovsc9q/rHHS5rReEvig9KimQy6e90eigk X-Received: by 2002:a17:902:be0f:: with SMTP id r15-v6mr400678pls.170.1541600188212; Wed, 07 Nov 2018 06:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541600188; cv=none; d=google.com; s=arc-20160816; b=JeRIyg6GEeoicBTEzp3w+b5NwDZtS9HRAdqc1+91+ozUnZzPXi70AqU50PJEu8JyPS YRXQd0S4bo5zMk72gs+kfL4Emte5XKwoL0qkN4BMs/V4PqHmZnx/tZPKZ7un4ArcvCGa NTruoRXjURGIARkgrWgMU/T9/cOsb6cGxeNKiw6Au+LA/Lrwj9wnM4N4DPN36iCNS1GN ILnSp2vMZdsFo5PjP6aT0gRuqHxOPsGB3c178mRrRC1Tn3Q4foYubsgTLxZ6Lq4sr/r3 F4YRqdk8NKHUWTxEBBL5X58a4BGK9ZuMMoDtZZSSBmEANc8TQMcfyElmNmrhnpHshxEF SKwQ== 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=xibZMrmFRctwfUHc2hleZblnVgrd6pCGef3nafzcBOw=; b=X15FAE14R8aPguLVhpXgoFeFuDd1CHl9ui/s1nw7XEt9tUsVkX8ouaEz45MpUhODIR lbXBSsloEGqQiHman7xaUnLGfc1hu7yAKbuL6cd8Ijc6L04uaRtnsT9csHUJbaZpJR+w kYs3eXgWPOjgPjAKbdQrE1Q40u1M244jNkpzYLxvHJ6zBPNQBCAlVjxQQUNFM29uHXGp bw+ejjliT21HIaKsjua4qKDSVp5AgQ2gExxj8baWEBW3Ky3fvGaXZSk/iFtlDJNuZvTO 7VVQDpPSSIpkmUJ0rqxcq5iMxD/pXWotV1p/Nhm2sHn/L4nRYZ17ykVUSO31nlLAa30r wtTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ca3ikalc; 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 r3-v6si703022pgn.313.2018.11.07.06.16.28; Wed, 07 Nov 2018 06:16:28 -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=Ca3ikalc; 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 S1727802AbeKGXrA (ORCPT + 3 others); Wed, 7 Nov 2018 18:47:00 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33676 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbeKGXrA (ORCPT ); Wed, 7 Nov 2018 18:47:00 -0500 Received: by mail-wr1-f67.google.com with SMTP id u9-v6so7233497wrr.0 for ; Wed, 07 Nov 2018 06:16:26 -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=xibZMrmFRctwfUHc2hleZblnVgrd6pCGef3nafzcBOw=; b=Ca3ikalcJ4PFfl/YWKML3wH7An+aRYGvHom/p22TX+Ge6UCG3MUlQVdsLqTEawTNVX agxul/mMLTBcVxFtkB5QVgNfocTePvKivQwPcLembY+1hRLs5FQBBP7qDyt1CXWQ1wYM rLNeemsh6blTxpgl3YAloDvRJfPyl3FX2vHMc= 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=xibZMrmFRctwfUHc2hleZblnVgrd6pCGef3nafzcBOw=; b=pJJTboRmGE1qWU7S9Xp8pWdzWMl8Zqew6UBeSUXdZDT6l/VQ7wkxa77OUskUCHtUiJ 8AnNWJfnoQHLjVK38NEJTz2rl4n8awyEObFuJjFXRmGcNZCqCMswc9mYaGxd0VCN/wNe FdP8YfFzLvb9zDraMOc5KMX8RAL6GINjyzmysISAcDefCGVPZUP3oEi1BLePfuXd/qrN Sr4CzI1QH1ROh23OP2D4Je2kTzOYEoH3OH1SOpwZk0SPLD2QOLVQsdsYm7z0XXrIzTwQ eP5Gq0LzHGVG9s3d2Kc27sBMLSKSmRw3o2DFjhHMbFyfjgV0E0NSz17TvsPO/gUZgGOj Ao2Q== X-Gm-Message-State: AGRZ1gKZ832BXQNjWHZK8Bcgsi7B7WUpaiANyPIlbNiKsWexJEtF6uZB Xeior7Cq7dexPdxdXOY03QTTwg== X-Received: by 2002:adf:fa04:: with SMTP id m4-v6mr368859wrr.155.1541600185560; Wed, 07 Nov 2018 06:16:25 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id q2sm948447wrx.77.2018.11.07.06.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 06:16:24 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: marc.zyngier@arm.com, will.deacon@arm.com, bhsharma@redhat.com, linux-efi@vger.kernel.org, Ard Biesheuvel Subject: [PATCH v2 2/6] ARM: mm: permit memblock resizing right after mapping the linear region Date: Wed, 7 Nov 2018 15:16:07 +0100 Message-Id: <20181107141611.12076-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107141611.12076-1-ard.biesheuvel@linaro.org> References: <20181107141611.12076-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.1 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);