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: 9765697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 837E9602B6 for ; Mon, 5 Jun 2017 08:05:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7379527D4A for ; Mon, 5 Jun 2017 08:05:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6656727E71; Mon, 5 Jun 2017 08:05:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3EB827D4A for ; Mon, 5 Jun 2017 08:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=7KA5W5EOhWVCpSvO49x3RAl7na7eJvr4ljCSlwcDM64=; b=suz 9uBmkNLAUIbFmgSmRsJwoZ0au++Ka0oiJOVbk00ijturYPKfz1pUHPjUarhYZY3ufy7jm8dGooTeQ 1WK6X27Xpgq+Wynde+3Jvym0FzO5uI+4T/6kDwYcIozdgydIVtrE2MtKLd1+mABfvfzQlnvoCJ618 pQRavuBczKNVekcsUaw2/wOSulgUi72Iq5q0R0e2pmfkiB0M0oI7kNELAr6AYb36YF4HCkegDh2NP /ydmizohMi22tL+3o24toc2W4qlcdYeOkP/wDqISyTnWzyxjOuK6g3UFrGGn8tJoyi/MImFRygYNx mpcgFba2F0m3Cbk+f3YVLVsd9kNDVkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHn0g-0002Uc-0Y; Mon, 05 Jun 2017 08:05:10 +0000 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dHn0c-0001Hr-CW for linux-arm-kernel@lists.infradead.org; Mon, 05 Jun 2017 08:05:08 +0000 Received: by mail-wr0-x22c.google.com with SMTP id v104so33830312wrb.0 for ; Mon, 05 Jun 2017 01:04:45 -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=J4qiEo3Agcyn6+rTwC1iiD6MR14dhjxxr0l2yTGmsmJn5IRH/0SrjpMUngbTO92/QA Jbm2RPx2qwuPwes+88Iv23frfRI5XfV+c3HdW1sypvp0elNgAXMRf7RhZN7EeIDkEpCs kQQkp+V4bAXAHlJx/2/DAnFSyvZTaICMPbdmo/OV5vcerpvZvHRA0mt1UapdQQ0Pxzfv c4Qom8E0h/FkMN3UggSXijALXBcl/YQlrGO/6yT+aBaOf9XfybeGjaZyW9rs+N0O4vod 5tTIE+e2snQx8QhANFmLXc/kwV+lXNGr9gJCqSbYMEKGxDP0dWELwOAJ7Qe896B+RCYg ohCg== X-Gm-Message-State: AODbwcAn8eht7paELvWeK1qPPu+UCnY5k7liBbUpQ3Jrjh02flQA8n36 RY0NyFILG2GTX79fZtEnlg== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170605_010506_718429_B469AE2C X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matt@codeblueprint.co.uk, mark.rutland@arm.com, james.morse@arm.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Mark Rutland --- drivers/firmware/efi/arm-init.c | 5 +++++ 1 file changed, 5 insertions(+) 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); } } }