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::344; helo=mail-wm1-x344.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (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 9A453211A2098 for ; Wed, 19 Dec 2018 12:56:51 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id n190so7441455wmd.0 for ; Wed, 19 Dec 2018 12:56:51 -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=03j8OI1dayouwS7UIC0l1xBHBVpfjc8OP6//3pLwr5w=; b=kNOn0hWPThZ/miQLBdPOlTVquvYmkKnCP89DmPZ14qs42OOIcn1krpADXrGQ02c2M5 +MGu/npCLAi0C3Ra11dTbi9g1OUnf7huptEl5H0sDQS8QU9+IW7VeT2lUt8G9EPHokeT oETYXH93BuH+41hKRP3WocodP83jp6evL0WVw= 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=03j8OI1dayouwS7UIC0l1xBHBVpfjc8OP6//3pLwr5w=; b=gBAjYNcic06UZF9jiUWJ9xfydtwbmZf+nSGNyp+i4KZmqBNOhYfPi0iSl/QTvlKfx0 W4rp3X7JI+xI+99y3tywWSOOW+OQm+ZlffBagQCPv1a3hXYTD0cPEkIBIIJX3xJcMwq9 XRNJqYtQjBiqFnRRaWU07w32tmECbT/2xBmwUNzzZmO8WoK5oVGRAX0ZpF0+psUApWrI PBbJovdfmKjO7II/fxIbG0XI+MFBwOCZyEyA1tSp5rcye/qypAlzdHKFV6Co5A/PIaS4 ig5WvIoO8mpw6V9PM8HELkhsA7CCx2vAKZTE/eIWOm+vmyHFG6v2Tai1FNQ9W8evF00b 6x0w== X-Gm-Message-State: AA+aEWYioa5MoVcRgsblDYEVmjMvRX16kvHC5I7BDhKGSs0Cz3v+XOUY vtzirXczfG9RoVZYpJYEnU4uexufv/7C4w== X-Google-Smtp-Source: AFSGD/XjDgOMKsK4+N4Q3ehGTf7nqKDySZYq3Jfab8Kye/pWTFePhVEbLPMEbtiRoq33Lu7bBoFcqw== X-Received: by 2002:a1c:b9d0:: with SMTP id j199mr8514675wmf.114.1545253009696; Wed, 19 Dec 2018 12:56:49 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:48 -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: Wed, 19 Dec 2018 21:56:34 +0100 Message-Id: <20181219205640.4704-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [PATCH v2 0/6] 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: Wed, 19 Dec 2018 20:56:52 -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 (6): 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/Include/AArch64/ProcessorBind.h | 5 ++ MdePkg/Include/Arm/ProcessorBind.h | 5 ++ MdePkg/Include/Ebc/ProcessorBind.h | 5 ++ MdePkg/Include/Ia32/ProcessorBind.h | 5 ++ MdePkg/Include/X64/ProcessorBind.h | 5 ++ .../Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 2 +- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 6 +-- .../ArmVirtMemoryInitPeiLib.c | 8 +-- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 8 +-- MdeModulePkg/Core/Dxe/Mem/Page.c | 52 +++++++++---------- 10 files changed, 63 insertions(+), 38 deletions(-) -- 2.19.2