From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/U8L+qKMLvtDmee/U93eUtyDvlQn20Us6WxvLuoO4Z/pYL34JXk1GBPVWOHNsRSraAaTvN87A== 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 Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Jian J Wang , Hao Wu , Leif Lindholm , Laszlo Ersek , Eric Auger , Andrew Jones , Philippe Mathieu-Daude 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: [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: , X-List-Received-Date: Fri, 07 Dec 2018 11:23:11 -0000 Content-Transfer-Encoding: 8bit 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