From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id CBA6FD811DA for ; Wed, 31 Jan 2024 12:00:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vX2KiJ9sF0/Y8DxfEMsiok9ybmiDm5l6DFCCqsVv6so=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706702405; v=1; b=JU6DXVNie79Ok0hKHMkpYFKWBNiWjtjaBjCyAvUf5QHDzDB1pgNfEka2YrKeld6BAk7ZHYOj pCSJi7GkUEPYEP8DDHcm2QP3dl9/zWv0Ev/vfkvd36VE/1hZbm1rYW2FCt8P2BI9OJJcvsv3YYU MT0isFF6uVoaDwp3B3pRlO5s= X-Received: by 127.0.0.2 with SMTP id XhPKYY7687511xiHnjTI1mRO; Wed, 31 Jan 2024 04:00:05 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.12219.1706702404553524693 for ; Wed, 31 Jan 2024 04:00:04 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-n7Wb0FH_OsKt_qlgxViAUA-1; Wed, 31 Jan 2024 07:00:02 -0500 X-MC-Unique: n7Wb0FH_OsKt_qlgxViAUA-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C797F1064D81; Wed, 31 Jan 2024 12:00:01 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.243]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 915CF112131D; Wed, 31 Jan 2024 12:00:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 59FC31800DDE; Wed, 31 Jan 2024 13:00:00 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , Jiewen Yao , Laszlo Ersek , Ard Biesheuvel , Gerd Hoffmann Subject: [edk2-devel] [PATCH 1/3] OvmfPkg/PlatformPei: consider AP stacks for pei memory cap Date: Wed, 31 Jan 2024 12:59:58 +0100 Message-ID: <20240131120000.358090-2-kraxel@redhat.com> In-Reply-To: <20240131120000.358090-1-kraxel@redhat.com> References: <20240131120000.358090-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iou5ihm3iKzs6GN7CxBHaMHwx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=JU6DXVNi; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) Needed to avoid running out of memory when booting with a large (~2048) number of vcpus. Signed-off-by: Gerd Hoffmann --- OvmfPkg/PlatformPei/MemDetect.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 493cb1fbeb01..338798b54171 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -187,6 +187,8 @@ GetPeiMemoryCap ( UINT32 Pml4Entries; UINT32 PdpEntries; UINTN TotalPages; + UINTN ApStacks; + UINTN MemoryCap; // // If DXE is 32-bit, then just return the traditional 64 MB cap. @@ -234,12 +236,18 @@ GetPeiMemoryCap ( (PdpEntries + 1) * Pml4Entries + 1; ASSERT (TotalPages <= 0x40201); + ApStacks = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * PcdGet32 (PcdCpuApStackSize); + MemoryCap = EFI_PAGES_TO_SIZE (TotalPages) + ApStacks + SIZE_64MB; + if (MemoryCap > MAX_UINT32) { + MemoryCap = MAX_UINT32; + } + // // Add 64 MB for miscellaneous allocations. Note that for // PhysMemAddressWidth values close to 36, the cap will actually be // dominated by this increment. // - return (UINT32)(EFI_PAGES_TO_SIZE (TotalPages) + SIZE_64MB); + return (UINT32)(MemoryCap); } /** -- 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114881): https://edk2.groups.io/g/devel/message/114881 Mute This Topic: https://groups.io/mt/104073297/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-