From patchwork Wed Dec 19 20:56:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154298 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381485ljp; Wed, 19 Dec 2018 12:56:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/VRq/2DVR0L11raZ6JlqHb0OzIqaboNr3IAhO5eTGTuDN61p8s8GxB4DQlLq3EVyI+fsQDx X-Received: by 2002:a63:d40a:: with SMTP id a10mr20368715pgh.394.1545253014281; Wed, 19 Dec 2018 12:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253014; cv=none; d=google.com; s=arc-20160816; b=ojuIj2q4KWRiRGa5vY/Z+nvOuV48DgyTnWd6ga41jk7qriJHPzReoGHUlse8Isn7Td YHn2W+EeEcuJSJXeszgz3h/tCjjED5n6Xx8gHaEFmBRR/mEW7jq6iDlyQNZsAm3FH4ee RC3oGm+C36yQGTuRyhf+qLdzV9lyRCCqOUnPRqbA0T9xchoxipwqJm6F6M5r4DaBVSiH mZdSJoeUO2g+Zv1ZB7IAasj1SBnBozQcFN0SPHjHFSHMe8gPxOKAOEQ5e9Vu6cuvivq1 MFI5udzb3qyifTJAJgE5Z951SaBC6UuYhQaF4VhNQJKBHgPiE0Co7xCy0HXFVRAzHQ4+ hBiw== 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=TqRHdm2wMW7GvYG4Kg/xiNLyaWzk97so4EUTo4lVZlQ=; b=ZL8+qDq9j41NpTw+ReDLyPtyYIh6lDyvrSe2ilsfv+awftVRmUB63l+ycGnhnUcB/w vQfCqGoblLIujaRDrMToou/Vgp+S//t0y93ckoFfo9ZIMF7XUNoY6AVqbBxiFoZL3pr3 hJPtyWH+zSBkrxvK//M9yeFW7TUHX72+G3tgdriQO3duB+Lt7AEhlFhqA1sDnhhMbe6Q Uulc8gAogqYK5XEq8jeBun9OtqGSOGuZTSsGrMMcP5AoWBddNtKFuguDOSzPa0DClN3a n1w8OI62btM+JQmoMLGXLsefu8c3yOtJSujzNPQuGtrxyyAQzForbvS405uhmX3+tNP6 2CWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kNOn0hWP; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id a9si16175701plp.323.2018.12.19.12.56.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kNOn0hWP; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 3C3E9211A2D80; Wed, 19 Dec 2018 12:56:53 -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::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-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 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: [edk2] [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: , 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 (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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel