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: 153294 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3750962ljp; Mon, 10 Dec 2018 08:30:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2Q0WSQUgvgHmHjy8FtDBx7VunduVariu80yc7LGjNlZO8V7o8495wpLrZjIDrVPXimqnd X-Received: by 2002:a63:b4c:: with SMTP id a12mr11567104pgl.131.1544459418921; Mon, 10 Dec 2018 08:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544459418; cv=none; d=google.com; s=arc-20160816; b=k4qzKMfLJ4jB8NP0ndXnKu/cdsEtRRKmWwfMPWp3HU11GikshLuFWBD50KxBvpC9Kj Y5NFnS8qufkjBSmFDVjKTuTvLWNeqW68u1wjBUc6SzSYUHlNuketQxIK3P2sa9856HKY n5VCtVbhDE8Y8WEt6TN9zsAXW0pctrPcKcsp6ae8sya+Jjv4H/jCxcN7LgtJr+d2JYcg i+CWQSY/lGI3oHFF66umSVnc5B9NFTtzd74nAjtNocZ5ozqUEaproRLe++HL2ehuRSWA gFmV8s0TjDsaXuvDJDowRRlJNwSu1DZrXq4ffPhJzssMP6dJcnc1nSZ61JNBkxw9sfUw CdlA== 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=FZC+I94o2oQFpPWLrl1OyOn6ypfdxhQaD8xW0QYVrtU=; b=i06Dvf+CHder4HH4pB/0TjZPuejspgrV32M61NVdJBzofBqSdvL1Fk3uXVIqJjYnkO HtvcrJtnup9cXmHIxnQX3vHQEW8VBqWs+xsuByk9fln9hZdbcSrYurJrzfDSC3mxnhw9 sS/fwM+p4vm/BDV/eKo+89NaCbwI4Hu6kdcmNqgF+5pTrGeZrnhO+hiea9NeGzx5kd5k M4dvZx6N3nz5dVYbFDnKIZipP2j2HwJXdkvuIZq2+BcGz1WuwijRqRuO7QCVDCMOLYqJ xiF5Wjgr/kjLyoq3jWq1AxVCCjb2OFEJgSX+/MoYbCOmvTIPAO6XJ25KnYJjQpXrg91H bLDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i4eCm5aU; 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 u4si10081984pga.91.2018.12.10.08.30.18; Mon, 10 Dec 2018 08:30:18 -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=i4eCm5aU; 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 S1728390AbeLJQaR (ORCPT + 3 others); Mon, 10 Dec 2018 11:30:17 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38908 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728359AbeLJQaQ (ORCPT ); Mon, 10 Dec 2018 11:30:16 -0500 Received: by mail-wr1-f67.google.com with SMTP id v13so11149188wrw.5 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=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=WAitecBGfduMFqGmA6WmBeQHmQr4nFFf/6XLz9Nf24eexG/atY8hygV2eCq382pE+S Rx6kmAwMh9TszFb/vydJzklH4nXfWLpnWR1MYiHbcwhmGBeDEWK6dzi9hJkHV+wwkb/W DSc8oLWyLmRM9GdGi4ZE71DOSqFIpN3oVeALTGa1y9SUol+mxxS8u/YTX6IS/Rav0Uy6 9ytWvUQJwe/t7guGFiiCbTiv1H8BGleEaWO/PBzCC80pB64FC71ahYFJ4sqov0QN/6a4 Y0I0QTWT5oaQWNSFaZs1sYWaclBSVWc3/MHbKn28BoDiiE+Ia/WyqDAKgiI344zOTZNV T0jg== X-Gm-Message-State: AA+aEWaoiuxFTHyGGceb2a9wQn/IIaeadwl8bAMIgYgdf9mPqvz5/wyJ GSWwNV7SGWMLtNrZWriOGYEBlA== 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 Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Russell King , Marc Zyngier 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 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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(+) -- 2.19.2 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);