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); 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: 153293 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3750898ljp; Mon, 10 Dec 2018 08:30:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xi1HIHXwZZRmdLYwFmkarfRJ9mjdQtVAFiOuiT8w/oHZOuX6Da0J0ScTcGbUZtM1Hgkh0H X-Received: by 2002:a17:902:b090:: with SMTP id p16mr12696589plr.190.1544459415907; 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=Yy6heGlopH1Q6BrdPw09YRxyFWd1rU9pc0Rcu0uiIQON2vZl8Vu/phxA7Z4yqFFLjG 4jhJrJXJoJBYqNVUFmuzqD0sCKZKEaIqTSRot3L1fo6CkDF6IlxnOVy6yvLEnLcKIjIR QLAXLbk1kkb31CcbYExarNzTXRMa5A+xjZraqDnD/MqjxNELD3RhFvoiR5oxGuRZTi4+ V2p+HWW+sfecD+zMBBp2odYpW89oicLUrQKnaf4gSLPKX7lDjoXPsREEl2l6j2T6TMac DQtbgOnhni/7tVYvQlAsgt4wBUlsq4VWTlX4lTBOhoKs6Aam/4banFV4eRT4lrzDEiR0 BtQg== 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=X+JtbB5kahpWRryGJEfPt2WL8lWHxPrmd07Wiq4JNWY=; b=LOBcYVsWh3CSUUT58P0xd24qZKxU5hjwx4boi/FSx3FXs7cjYlQk5ZqKa9pHDSiB6c Iv4hR3SMoJyAjCiMKXOuxtB85fVhAbtYSG7tx37RQRYbd7RptQUwiCALQSa7rx/6fIoe UvpbmWGwMANnj3YQOKkqBOuHWzQpxgjl9ij6m+oVe6GcmW+yOEH2pfVMYLQRd74bF6UK yaQx1FgWPzzcmCupdNpSUfk+IznKwB/s8QEc1TDbmz9V5NecoDQB5NeJQm8pBgWPr0a4 xNaAsR6OzCCLlRSzDYvP5UOFOQ/09M+bjU21u4y4N05zN8im3rlNA4gPvNohc8KQ5wih ETDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S7fxYO4I; 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.15; 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=S7fxYO4I; 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 S1728351AbeLJQaP (ORCPT + 3 others); Mon, 10 Dec 2018 11:30:15 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33620 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728350AbeLJQaP (ORCPT ); Mon, 10 Dec 2018 11:30:15 -0500 Received: by mail-wm1-f67.google.com with SMTP id r24so7012696wmh.0 for ; Mon, 10 Dec 2018 08:30:14 -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=PDbTKDAcuReitBAIAf0ZJ2iMC4uHylKt1Md2WPxCCj/tcR7siox1BRViy17JpR6QX+ ZcKqIAV+1DKKRB4sSoxYmXhgt/egfQlAlNYDr6QrKPRQQWrmsaRSZpE9z3PIp/BxfWjc MPfFPQmqz5M8T+kExbPdpEuL6HesCQy9Ur+JfmHxpOerZGBcMDq2aafMC3/RnC9GdSgw DfKmWp19ksHA1rx4l45Or1FTLh67l4bx3SysoBUf08dqOiomxGr1rgYpenDrhq4kfycq 8Y2mOufbTlmjB9lt6LE9amQkMa10fEIgSsy+BiN21PJB9ypYqViCBcHvoNQgwCbEZNM3 09Iw== X-Gm-Message-State: AA+aEWbt3bwYZ0YITRhEH8uAVSlt6p3Qiiy36vXhRbpKdXgTfJSzYErw g+uY1aKF4NH2x4QFJ2obdHmoxQ== 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 Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Russell King , Marc Zyngier 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 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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(-) -- 2.19.2 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: 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); 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: 153295 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3751347ljp; Mon, 10 Dec 2018 08:30:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/X4rlHpGnenQNB7g7VuFqqqRLclhvP6mGG7240yu6kH4c7GDxlJmdQKr4EcwDJTvDd/oRp5 X-Received: by 2002:a63:ff62:: with SMTP id s34mr11488227pgk.325.1544459440625; Mon, 10 Dec 2018 08:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544459440; cv=none; d=google.com; s=arc-20160816; b=udUN2LTKpa38FfzgEhsc9NSrj0aEvPGDJjNW3cQeh35MUI5hfB+tj+J+E98i/zTaJh XI2APBQtCljXkDnM6/0r9ri1wgQ35EH1gjKtaeUxGB0CerYvgKU7AgMxeVDl/mSu3CoP bjd5sdMB7Ui6+ljWR0pYWkDnF02M+wt9V4YMLvyJoss5TXD0fl2kVcP4+4i/nmp/hqOl tFOboHtxf4Dmrkp/OG3zK8hKnv5oKMc9j/thjNxbcKar14tW1t/27k7CbPevwfV+CI0I hkgw0btSV+YXVGlH+OaKtvPFmg3FiA4bnNLrKXnKLj61dxp6KuJV5mPTLnMeN5wMhVhf xtuQ== 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=lz9cl2063s35V8iKDCeCGlB15ecDD/QJENBVOnRhRaw=; b=Zx5bH3v4v6XMXaLdundKtiKB2oq3/CCkreN0qVHfeIzhbKMmT28jmQR3lt70o1tA/v JJ4UXVkmdsecgem7wKBL0QHGo85wic4N9amh7zUl2UNP3VkxTFBNp0A2q9pHil/DNiqX KpECx5oZVlbNGEcHHkl2eIdf37efk5EhneuugZ7mUfCAGenu+pKg3CIOlBVWiYlWQENq /bvqCP8vh+cKdxhXFRAl2TIvfp8lNkez0HUgMT7IFIJ17bsB2uZ65iUfe5gU/EyKKBye FtFCWEGgBRoaez7NFYV7+Ixx2D69hoHzdBCpS1iqt2fX8KJ4GZBGqGho0Pp17ushVZxC CdhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iKY3AgxN; 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 i6si9670663pgq.207.2018.12.10.08.30.40; Mon, 10 Dec 2018 08:30:40 -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=iKY3AgxN; 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 S1728445AbeLJQaj (ORCPT + 3 others); Mon, 10 Dec 2018 11:30:39 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37723 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728320AbeLJQaR (ORCPT ); Mon, 10 Dec 2018 11:30:17 -0500 Received: by mail-wr1-f66.google.com with SMTP id j10so11134629wru.4 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=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=eSVtr4mF7QmQY7XTRf+9TWwsyJ/3v8xbBrP8eDBUBKBOT5iDbZZ+4mavhYChQLoQuA 68+eT/7KtJSqpHRTLm++VzFAeFhccdv5fZUpuMp5fqiihXwcknlTZroWEqs2qrzP48OP crKTQ65Rq6wI+Z2+11oMYbumOkza5M7SC8WTEobmTS/uquQ5WVTDgJjsh0Q24Sd2cNGW FmkVBWG5O3VVXSmN56V0bfJv3vMZZ+QkptxLrUhBIFEpf6ISKrSLF0+6mlrlpQMcEQPl UtT7Mti03nMQMKcnS6ujjG7XX/dlsZb2VCWMlz2LgSUvc0ZFcteByzN68lh7x3EfT1XU Y5Ig== X-Gm-Message-State: AA+aEWYGMPFSgaeh5nEUSGYjqiUR3j7KVQGGKaP+6wQabIYMMCdkGIWj rHLOzyyL0LdlVGaUhXDJ1I68KQ== 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 Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Russell King , Marc Zyngier 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 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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(-) -- 2.19.2 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) {