From patchwork Fri Dec 7 11:22:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153135 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376125ljp; Fri, 7 Dec 2018 03:23:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/VRPva8y8uDXuc25c59BIrhAa8n4TXsRHlTjBzNbaF3CFyGk/tW+BZXTzFQRJ/ddBWcPIT1 X-Received: by 2002:a63:6704:: with SMTP id b4mr1611413pgc.100.1544181794015; Fri, 07 Dec 2018 03:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181794; cv=none; d=google.com; s=arc-20160816; b=kYYsF4fEF8YnZVHgLEOW2H99/mG71tPoxXqNQKs4p5deVhVHjpGjZBCqwyo10BzNlF kj0WSVwGqfEHK6EC1pZO7LeYV/fgHucO0ER/Qc7FdP7pPogYd2TUSEAIoAQRI1fOX4Rq xQ53Tnfss4CrqYYoLEaF2FrTFv5VOWdSnsfOtQQk0IWW2oToQ7GvYYQ+T4xJF8oLi9k1 Y6oC92y/6d1zlsgGcBxOt34Zo0Z0HGxuiNIC4FAVy1Z3WC2gajC350qraeWIrkrX2r6F LpjN14OGrb8qihy1kHZeBos5MR5UsNjG+tMe+oe3lF/A3xvSDytLLNiiyy7tI3/qdQO0 c4UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=th7FGLxQHJzuibGih2oSCUFKvRTEIdFyCMsaIPEoFSg=; b=yG/yoSPJUFlw8aQFkKn2M+FyrqwI4YAHFUpoLyxmhUUH+RaTaWFoAd41KsgSURx4tz MOaABS0SCWr0YIFKgt7robdAU7WJHgV3iux7S+xh/l9kSI8yFpForQuwRhJBxyo+ZDhe VZj0ThU4QkGC6GYIlrqltxpQ6WwCOQfaYOcHsQkWVRVWA7ZkF3yq53ZbWSTquXlueVyn 459MfL5T9nbvEGpyCKSS/y6Is4zg7bHvMkcdbz1wlhqptWgmdt+uODAbro2VFagoSOEP +uSmus3ktQVob2kmxd3DBE+FMEKrPw/7Wy8OODFklU/DrFhsahaeBwSDeJdGsT5nB4O9 wuNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gPUEPC7Y; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id s2si2633286pgj.60.2018.12.07.03.23.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gPUEPC7Y; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 584B92119739C; Fri, 7 Dec 2018 03:23:13 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D1B3021962301 for ; Fri, 7 Dec 2018 03:23:10 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id l9so3400279wrt.13 for ; Fri, 07 Dec 2018 03:23:10 -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:mime-version :content-transfer-encoding; bh=NYAMtw0bfGzvnjCX/on7/HqCd4I/jneswJE0INXYTOk=; b=gPUEPC7Y2xAD6QfMBMDhdj9vGXi553PzMLu5r5MtoNreJohW/I9b4+0VrSrjUP3eru KSvAeU6opfIRhk5nU5kgaw2w/USjnD6TK6PsWB4e1RnHQJIXtZXW0Tem4t+im5Khnno8 7sTvsxz8qTo5vLCXM1O4JgA3LKXdibG1b86Jg= 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:mime-version :content-transfer-encoding; bh=NYAMtw0bfGzvnjCX/on7/HqCd4I/jneswJE0INXYTOk=; b=Aq9yYDGGsZ7s1QJU0JpwZK77ZbnjbOKRjUhQN9pPvt0Xc1s4TmPGeyhAgsn2g1GM3r 0jb114Dih0lhKWf2E1AyiBuS7moIiNBksD/ZuldHtztjrj7KywW88fiWFTDw+Rbh9ifI szWRVxSl5SCz+LiKlEpzIJKZ80Lu3UXoVMN2Nf0PWs4A02uCbtLl9WxMGUZdid+UTbTA 6S+Sxpu8G1PaLhpIRyvlbPWy8W0qe6Cf2l61cMIPavPlIAdK87z7EGTfswBsQNri0AX4 ZCNyqDlKCGfCa03J8zx+HZNaTiW+hu9n7YgMiEFVnGDr0UF2nYSSoBPlURIoQYcigsSR MOAg== X-Gm-Message-State: AA+aEWZWDFDc59FdfXesZXAokYhRqlnmZiM1MK7C8vF+VjYeWunH1BNl WlxYjvjwcJxlF5fsCzy7QXu4se1VAW0i3g== X-Received: by 2002:adf:a211:: with SMTP id p17mr1459666wra.179.1544181788773; Fri, 07 Dec 2018 03:23:08 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:07 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:22:57 +0100 Message-Id: <20181207112304.19765-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 0/7] introduce MAX_ALLOC_ADDRESS to limit boot time allocations X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Since modifying MAX_ADDRESS to limit the memory used at boot time has turned out to be intractible, this series proposes another approach to do the same, by introducing MAX_ALLOC_ADDRESS for firmware internal use. I tested these patches with ArmVirtQemu in the following way: - limit MAX_ALLOC_ADDRESS to 0xFFFFFFFF (4 GB) - build QEMU_EFI.fd - run it under mach-virt with 4 GB of DRAM and highmem=off This runs as expected, and produces a memory map ending in the following lines BS_Data 00000000FFFFD000-00000000FFFFFFFF 0000000000000003 0000000000000008 Available 0000000100000000-000000013FFFFFFF 0000000000040000 0000000000000008 which proves that the memory above the limit is recorded and reported by the OS, but left untouched by the firmware memory allocation routines. Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao Wu Cc: Leif Lindholm Cc: Laszlo Ersek Cc: Eric Auger Cc: Andrew Jones Cc: Philippe Mathieu-Daude Ard Biesheuvel (7): MdePkg/Base: introduce MAX_ALLOC_ADDRESS MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account ArmPkg/ArmMmuLib: take MAX_ALLOC_ADDRESS into account ArmPlatformPkg/MemoryInitPeim: take MAX_ALLOC_ADDRESS into account ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS MdePkg/ProcessorBind AARCH64: limit MAX_ALLOC_ADDRESS to 48 bits MdePkg/Include/AArch64/ProcessorBind.h | 5 ++ MdePkg/Include/Base.h | 4 ++ .../Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 2 +- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 4 +- .../ArmVirtMemoryInitPeiLib.c | 8 +-- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 8 +-- MdeModulePkg/Core/Dxe/Mem/Page.c | 52 +++++++++---------- 7 files changed, 46 insertions(+), 37 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel