From patchwork Mon Jun 5 08:04:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 101377 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp801087qgd; Mon, 5 Jun 2017 01:04:46 -0700 (PDT) X-Received: by 10.99.117.65 with SMTP id f1mr19999478pgn.58.1496649886572; Mon, 05 Jun 2017 01:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496649886; cv=none; d=google.com; s=arc-20160816; b=i2XXajB48oTpeasCGymjf2wfQ/RnEPsETx+EWIBcciGvYSXIEN3OfR45UrtFb+Zcb+ 5QwY9PJ6a8SJhXnEaFQ8KiRj15VFcDalWkMm55x2uIrWWkKhboIz1pnYmyHLGtOQjHUc faSLAygUQ4e0qeGZn0pQ+Jl3uKJOu0mDHUO+tI5zNN6SxA2PZB4Nk60KXLChdZPRGtds yUBWakYHQnO/DkPvB8d+NsqcTnzbYe04Hy7mz6Z4fwqEpljdAmU8togskG5bzo53fXyB UG0LSIT5JdSsw1ilfmoGoh+e49d9CBkcDzYH8EksPW10pG36F7Al1FRYORpHvQOTeoSl XWWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=h/1Mb1lnft9qO2NkWCVca2edVsGRKQi30vBibdbcr6U=; b=xACTVypWVj7RxEWC9m4IGfQBHFrvFqVheF9HcQpzd6Gjx6N+hu1NOmzCqZyxSBUp1X gbcFqwn2lEXkiTck50iDFu/ujzO4dkCeeCaJsmObFBTSHwFH9BDxiHLFXOwXEJT0KTTR OezocKCkQB0za4cEkTTSKnOVMQR0aV2/oTbOHGdgkuqIqA1io1yHprtCezmOUN4aj6if kBbUvwTaVV3hs2gPpPzdKozcj9Qh8s0DkU49bl2018wVur05/GAAoRB1QVSKrgOpl9R7 0DE0Z4ovB+aejaMli6toPMJSTwO0jAzBII7gmXt12rjqGiyisMUeOXfsq8Ty4HNICk2i 9ZDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (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 o186si30273676pga.24.2017.06.05.01.04.46; Mon, 05 Jun 2017 01:04:46 -0700 (PDT) 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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352AbdFEIEq (ORCPT + 2 others); Mon, 5 Jun 2017 04:04:46 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:34872 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdFEIEp (ORCPT ); Mon, 5 Jun 2017 04:04:45 -0400 Received: by mail-wr0-f174.google.com with SMTP id q97so33775504wrb.2 for ; Mon, 05 Jun 2017 01:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pTkJdzIbPnnq9aVj4ErIYKB1BQllFOl/hZTaxB9vVwc=; b=cFuZafSxJ6VZGR33i29W3HU+oUCB1mGaSHWY6V7gd+YtebDEf7UnBmOq7hXuUXaTUv skoI3Jcl5OtWHKjrScCe+sfhsG2Kd72N00XBZ203A+jJH2ohkWN/unqaKI3J2J/+sRyC YWoWVNAr5iuiYXoh4v/PqOpsJ+MniP211svHM= 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; bh=pTkJdzIbPnnq9aVj4ErIYKB1BQllFOl/hZTaxB9vVwc=; b=YWuTG5DVNokvmbrc6Wk56zn2PRH2ixGL8tNEWNj7e0Gf1K4zib94LDHOSWa4YjLVd9 UvAeBdZdzLIJ+jN+2LTbomSGSq6kvYseuiv8ZRE/4C32XufcyT1DSctRZYJytw+djCIN 83P34JblMOscrpT5VpMsl4i2ftmCUMGbCSjpoSTNAeDo9iAgGtjS+g1f7haW1SBIeSLt mnJRPO5hYA+owE3ugFICC2/EEWwUQh/ik5IWlze1zGsBaGgImIu5gkmKcP2+jyp5qgTt R159rndlzBsojoapyjKbsD54nYsxxxdiSPEavctUM78ns9AMhk5GV0dGe7yoEWEOXSB9 RLKA== X-Gm-Message-State: AODbwcAaXiC09qA7F5Ax4QB092Q+qnRhIguxxs7FyGAzrS2Da1OmeMDo APp0vBV5C0bOXMlm2oi9aQ== X-Received: by 10.223.150.237 with SMTP id u100mr13039553wrb.184.1496649884036; Mon, 05 Jun 2017 01:04:44 -0700 (PDT) Received: from localhost.localdomain ([160.162.216.209]) by smtp.gmail.com with ESMTPSA id u19sm28789385wrb.27.2017.06.05.01.04.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 01:04:43 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk, mark.rutland@arm.com, leif.lindholm@linaro.org, james.morse@arm.com, Ard Biesheuvel Subject: [PATCH] efi: arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP Date: Mon, 5 Jun 2017 08:04:35 +0000 Message-Id: <20170605080435.2498-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On ARM, regions of memory that are described by UEFI as having special significance to the firmware itself are omitted from the linear mapping. This is necessary since we cannot guarantee that alternate mappings of the same physical region will use attributes that are compatible with the ones we use for the linear mapping, and aliases with mismatched attributes are prohibited by the architecture. The above does not apply to ACPI reclaim regions: such regions have no special significance to the firmware, and it is up to the OS to decide whether or not to preserve them after it has consumed their contents, and for how long, after which time the OS can use the memory in any way it likes. In the Linux case, such regions are preserved indefinitely, and are simply treated the same way as other 'reserved' memory types. Punching holes into the linear mapping causes page table fragmentation, which increases TLB pressure, and so we should avoid doing so if we can. So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and memblock_reserve() them instead of marking them MEMBLOCK_NOMAP. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Mark Rutland diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 1027d7b44358..0aa4ce7b4fbb 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -159,6 +159,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md) switch (md->type) { case EFI_LOADER_CODE: case EFI_LOADER_DATA: + case EFI_ACPI_RECLAIM_MEMORY: case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: @@ -211,6 +212,10 @@ static __init void reserve_regions(void) if (!is_usable_memory(md)) memblock_mark_nomap(paddr, size); + + /* keep ACPI reclaim memory intact for kexec etc. */ + if (md->type == EFI_ACPI_RECLAIM_MEMORY) + memblock_reserve(paddr, size); } } }