From patchwork Fri Aug 18 19:49:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110431 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343521qge; Fri, 18 Aug 2017 12:50:09 -0700 (PDT) X-Received: by 10.84.141.1 with SMTP id 1mr11190190plu.141.1503085808952; Fri, 18 Aug 2017 12:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085808; cv=none; d=google.com; s=arc-20160816; b=qLml3fjhiMcnk360ps+eLxfljUpR5po/uMVJnQHdl9XdURJ7tWCt2XfgLJ2gjOg2aD GYGJWOoWaFyt6VTLjik7LLNUN5jv20gwBsrVk1hqbm4gUI3QYHivjEXT37IXlummT0+L s9tpAX+EPvXHjyO2HwiN4//Qv0GcWzy29PloFu51DOoRm7SsJta6mWoNjZRRronxWvP9 vdR7j3OToSjT89zESvszLx1EiDTeZ2z5mAg1kUiPR3+owb6+eCnJYpdI+D6CLIF19CY4 c5QWsfdHk3TGU6Kjd0hmqiLdCCUzaUUvpUtkkToyHdA2a4YCJUCXD95yhiezLQpytv5h mqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=fpRcnDbko2a66/kRjcQ5vYOFw/EyTvewb2msXgPhikIDqhySs1mS0t+PYQqovFSAd5 8b2ynI59M6Z6BrY2+g/qUgtS+zq6HuwCg0GLOrE5n8ZeEkqp+7e/9LATLsHh15YaBx8H YiROjG9z83KPTLAzOwCDm93ikpeB6HbAmURI4yvvTFAmIN91lq251yjh6r4kiJ1rUeI7 Dn0nxomSpk37Z7fsEPFwAvmkRR9w0Jp02IaP3C9bK7qoZXhe7GV0r1hTRH6Z7b29wd/P tGt7zpFfeXRHLiFJ4WRhc8cBJIWTRYt6dbPA0MRLD2z7KCBaszUFFkGxZw7MaLXgme4G OODg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHSg76qf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 83si4009025pga.778.2017.08.18.12.50.08; Fri, 18 Aug 2017 12:50:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=GHSg76qf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1752227AbdHRTuF (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:05 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:35207 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbdHRTuC (ORCPT ); Fri, 18 Aug 2017 15:50:02 -0400 Received: by mail-wr0-f170.google.com with SMTP id 49so64623128wrw.2 for ; Fri, 18 Aug 2017 12:50:02 -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:in-reply-to:references; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=GHSg76qfYVOKKDF2jYdqHqUalPS8u8ioIYH+BjTyGm1wwe0l20Csitwvmeh2FyuoYl tgUErlj05+DcbWHczKQCBTh7JeeoN8hb6/CsOdGk3/W8bP7iC8AMTJdHGq9ZO8Ydirl3 1C53/cBJWCsIv23LhpGdPMlbd+3lMlaSLrE4M= 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; bh=IPR9NEkicUA/SccOezMbnMeR4TgpVTvkvCrq2bdASoA=; b=eZJa7O2522vvBblBQASmsyiFWTR1VWsiKjNg8S5SoJAGOOzvrvRsFhrAw6wZyjDv4i Nv1CCMYv/LvXQ3cyPzk7bOHZPKJuK/8N/VLFX0dZA+9suMuxkL4UPjcFbdVTNEx9fh76 ubxGFLNFPajcHS3iRBVR71uRe8/wkX1czkL3yqsiZY9yd3gbOzgVRhAtXmGWcGZjJnJf yjK6L6FyQyclruV54Ja3pbmf0scIN4CC6MK8pe5DnL35lsC65UaLYBOsmHHZew3uOIN/ MszX27zUGMa+vnC/bi0hjkE5Q/X7yLbsfUoFnJSaheUdXAX8A7oWnUAMVl/F9ZxtL9Ks N8MQ== X-Gm-Message-State: AHYfb5h8FDxsDPAzZYK85XgCSfw7uTi1idVbf2OJAd9hOo6yQPKHGP1E yBK/CMz3wNEybaB4 X-Received: by 10.223.184.50 with SMTP id h47mr6446215wrf.163.1503085801682; Fri, 18 Aug 2017 12:50:01 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.49.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:00 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 01/14] efi: arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP Date: Fri, 18 Aug 2017 20:49:34 +0100 Message-Id: <20170818194947.19347-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Acked-by: Mark Rutland Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.11.0 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); } } }