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 0AD74AC0A19 for ; Tue, 29 Aug 2023 02:49:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lEKgR0K3u87ca/L6aJHAtjh2Q4ALFtIYcshmcQjxGH8=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Message-ID:Date:User-Agent:Subject:To:CC:References:From:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1693277360; v=1; b=Isa8hFwr13q02KTVLf4IGDzZB1bZt82Exz4hzxMcCLZCJyPCQrCBQgWU8pe5BMr9zrdGxnRe ReMFtfYW79K95qQXGq0O06eF89BvfH9kFRKW2ITc0KVBoIICiLQRpUqCUhR8iKkASxHFBS4lY6P /BGhqY5/KNDGJLgtFljbW/UQ= X-Received: by 127.0.0.2 with SMTP id B2sRYY7687511xdm49UR7l5t; Mon, 28 Aug 2023 19:49:20 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.100]) by mx.groups.io with SMTP id smtpd.web11.9505.1693277359370873794 for ; Mon, 28 Aug 2023 19:49:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A4hLP6LO19vLGpkRjU6LHrPxyvQCe6wetl2LKELzcNhn7y1rwexcCcwwJbqPiQclh2eHWg5kplhLt218RuHxpGDhv8Xfluc4gPS6J9EDVZ+KI0eItbgJmgfkPU4O3gJow0fVDZkv0KkfQ+rTfxfdGwo3GFKO/aysVcZh2qh9SwMEot/4DkJGAhfI/jGsnkMGhPDxLNwQGEX/fbhhEEq9wnyT+HZkMff7ZHdS7Tj+wGGPO7zaJnvjSEU5pz907YHjTeu84FWxQDnlCqyhY1IbwemRFSrKWnq4dP4ent/cZZ4hQllRt9TAlBImfc78vCt+cXgku1u5+qDMuDhFS1vSgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+z+kNnv6P6xt7YvuuJV1h9ZYV/cM39ZadKoUU7PdyqY=; b=Oo179lOTzieDAdXBhZ4OhQ5Kk8/VGSQRE0KFkqevCsjQjTksmvgoYdPu55Qzz5xtQLmz0KCTNtv7OU76/PMW4DDSSocQIvWYnOewHfiwFgQsFk1Ad3WAoIsFuDSjX+WWNmWQ+v/V59Zt2mGlk44P58Jnhr6Lbgl9j2igdERJWQGAUiwbYrnA3X67ReBE48JoGAUdf7P6XvGrdSJQct7Y99/fe1bUig/2kzb00brNEaygXyho1nTcSx9SghXM564/elPvWQ4fYZW5I9nmlQg465WQzdO1hni6wsYVKbY2J3Fdk4D6aXiEzUB63XK0bb+/w28sB6tv30itokU6UBn4tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6118.prod.exchangelabs.com (2603:10b6:510:16::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 02:49:13 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::47db:e2da:2ade:2e19]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::47db:e2da:2ade:2e19%5]) with mapi id 15.20.6699.035; Tue, 29 Aug 2023 02:49:08 +0000 Message-ID: <70e408ea-85e4-2670-aeb5-4a72aa57d9a0@amperemail.onmicrosoft.com> Date: Tue, 29 Aug 2023 09:48:52 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [edk2-devel] [PATCH v1 2/2] StandaloneMmPkg: Fix HOB space and heap space conflicted issue To: devel@edk2.groups.io, nhi@os.amperecomputing.com, huangming@linux.alibaba.com, ming.huang-@outlook.com, ardb@kernel.org, Ard Biesheuvel , Sami Mujawar CC: Jiewen Yao , Supreeth Venkatesh References: <20220209122558.60329-1-huangming@linux.alibaba.com> <20220209122558.60329-3-huangming@linux.alibaba.com> <14f25a95-7153-4eec-8804-a3da768ccb11@linux.alibaba.com> <177BD141FD103BE4.8497@groups.io> From: "Nhi Pham via groups.io" In-Reply-To: <177BD141FD103BE4.8497@groups.io> X-ClientProxiedBy: SI1PR02CA0047.apcprd02.prod.outlook.com (2603:1096:4:1f5::15) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|PH0PR01MB6118:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a3c5d6b-2cf8-4f64-e9d7-08dba83a81fb X-LD-Processed: 3bc2b170-fd94-476d-b0ce-4229bdc904a7,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: PRPuuKqP8y5HZtK+e5uCcLRY5JvARt+cVCq18bxtXzdSEj74E3E1NULnZIvF1OLDKzWhivTEcPAV6Fmd8//12jfwfE1uoNnyYUQ7pnFtFV8QQjdX4+580uC/aCJxaB+VTYsCt8eaeWCoOh89Sz5sbQlErmS7RyhQZZ+91Z4M3pt+Fu1ZoJfR6puutLgeGgEoGAdu0BTSFjD+taN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tMa2JQR1VncllxRk9UYlBwYlkreUxPeEpIYWJsZ0dUZnpG?= =?utf-8?B?QTF3bWx3bWlRd0Jpd3MwNWEzYzNqLzlaaTVnVGtxa0JqOEZtc285RVNBRUM0?= =?utf-8?B?bEdtWVlIai8vVDBGeGtEWjFnb2dpZVVUYyt3NUxQRmFVNTdlY3dCS2YwYmNL?= =?utf-8?B?MXZETy85RkZOUDluT3RUZzVrRkxkVWFpWTdENEs3L1NWNlVBT3RkWWR4VVF5?= =?utf-8?B?UzUycHVTbkxWQ3JwbjUraml5WkNHQWlFdjFrZDBSTGNuZm9NTzF5U0pQa1c2?= =?utf-8?B?UWo4dFlmWVI2ai9pTWRkUDdKVnpKQzFnTHhaV2NxRm5lRUF1dUpscktsVHZT?= =?utf-8?B?Mmd6aURObXprNW1UbEZRc3J6WCtWeitOQkgvVUd5aC9NdWlmMEtzVW4rMm9E?= =?utf-8?B?ZlFidnBPa1FBMXlUY3NFbEJ6VGZKOFhqSmJML2hJa21SSzFTZUxWL2xSeUwv?= =?utf-8?B?b3RqUXNweDArOTVOalI2MzVOc2x6WXlZbFpuTm9QcG9peHFZSHk0UmdNcUsr?= =?utf-8?B?b3JVVEQ0SkUvTEhwclNuRTd1OTJTcFVYamZQWXZMeWZPUzNFeitPTi9ZbTFE?= =?utf-8?B?NlVybXJObWRnOXpWUEZ0T1VRZlVVbmdMWDBkQ1EyVXVUZWhQelI0TU9GTVhT?= =?utf-8?B?QllIeFd0RkhnanNCbSswTi9uSzFmdW1jc0NiNXNpS0Q0MmR5eCtmMnZoUWRQ?= =?utf-8?B?TFk4ZDMrTjhKRnF1STRHRGxyZ3JmTVpOSnVROGxHVUJVK3JJeFIxR3lXTmwr?= =?utf-8?Q?ly2Gn0VmBS3ITxNWaPHvJn8=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a3c5d6b-2cf8-4f64-e9d7-08dba83a81fb X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 02:49:07.7368 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zq3CkvT4skqtvVE6emXCYvsMmt+61IYEc7mvRJOG5hkbd558GJImNiWAK40+eY9VfXy0Js7ZVEKXjPwq5ZnuBNl88zlTE1e/UsQwjMsqSbA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6118 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,nhi@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: QY4Sqy9het5eYM39oQb3z0dgx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Isa8hFwr; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Just a gentle ping! Hi Ard, can you provide your feedback on this patch? Thanks, -Nhi On 8/16/2023 3:55 PM, Nhi Pham via groups.io wrote: > Hi Ard and Ming, > > I have been seeing an issue with StandaloneMM HobLib that can be fixed=20 > by this patch as well. > > The function CreateHob() in the HobLib instance=20 > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf= =20 > does not work at all. The HobList is early created by the=20 > StandaloneMmCoreEntryPoint then it is relocated on the heap memory by=20 > StandaloneMmCore. But the FreeMemoryTop and FreeMemoryBottom are not=20 > updated accordingly and the HOB free memory top is overlapped with the=20 > heap space. This causes the CreateHob() function to not work as=20 > expected. Introducing the PcdMemoryHobSize is reasonable to fix this=20 > issue. > > I tested this patch in my end. > > Tested-by: Nhi Pham > > Thanks, > > -Nhi > > On 5/12/2022 5:09 PM, Ming Huang via groups.io wrote: >> >> =E5=9C=A8 5/3/22 5:10 PM, Ard Biesheuvel =E5=86=99=E9=81=93: >>> On Wed, 9 Feb 2022 at 13:26, Ming Huang=20 >>> wrote: >>>> The heap space will be rewrote if a StandloneMmPkg module create HOB >>>> by BuildGuidHob() interface and write data to HOB space. >>> Can you elaborate? What is supposed to happen and why, and what is >>> happening instead? >> I tried my best to explain the issue: >> >> -----------------------------<--HandOffHob->EfiFreeMemoryTop >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mMmMemoryMap=C2= =A0=C2=A0=C2=A0=C2=A0 | >> |---------------------------|<--HandOffHob->EfiFreeMemoryBottom >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HobEnd=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | >> |---------------------------|<--HandOffHob->EfiEndOfHobList >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Hob #1=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | >> -----------------------------<--MmHobStart >> 1 The mMmMemoryMap which use for free page is on above the HobEnd. >> 2 Create a hob by BuildGuidHob(), the HobEnd will move up and cover >> =C2=A0=C2=A0 the structure or list using by free page. >> >> After this patch, there is a pre-allocation space for creating hob. >> >> -----------------------------<--HandOffHob->EfiFreeMemoryTop >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mMmMemoryMap=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 | >> |---------------------------|<--HandOffHob->EfiFreeMemoryBottom >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Hob free space= =C2=A0=C2=A0 | by PcdMemoryHobSize >> |---------------------------| >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HobEnd=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | >> |---------------------------|<--HandOffHob->EfiEndOfHobList >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | >> |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Hob #1=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | >> -----------------------------<--MmHobStart >> >>>> Add a PCD PcdMemoryHobSize for pre-allocation a space to create HOB to >>>> fix this issue. >>>> >>>> Signed-off-by: Ming Huang >>>> --- >>>> =C2=A0 StandaloneMmPkg/Core/StandaloneMmCore.c=C2=A0=C2=A0 | 17 ++++++= ++++++++++- >>>> =C2=A0 StandaloneMmPkg/Core/StandaloneMmCore.inf |=C2=A0 3 +++ >>>> =C2=A0 StandaloneMmPkg/StandaloneMmPkg.dec=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0 2 ++ >>>> =C2=A0 3 files changed, 21 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c=20 >>>> b/StandaloneMmPkg/Core/StandaloneMmCore.c >>>> index d221f1d111..1cf259d946 100644 >>>> --- a/StandaloneMmPkg/Core/StandaloneMmCore.c >>>> +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c >>>> @@ -512,6 +512,9 @@ StandaloneMmMain ( >>>> =C2=A0=C2=A0=C2=A0 EFI_MMRAM_DESCRIPTOR=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *MmramRanges; >>>> =C2=A0=C2=A0=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MmramRangeCount; >>>> =C2=A0=C2=A0=C2=A0 EFI_HOB_FIRMWARE_VOLUME=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 *BfvHob; >>>> +=C2=A0 EFI_HOB_HANDOFF_INFO_TABLE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *Hand= OffHobNew; >>>> +=C2=A0 EFI_HOB_HANDOFF_INFO_TABLE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *Hand= OffHobOrg; >>>> +=C2=A0 UINT64=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 MaxHobSize =3D PcdGet64=20 >>>> (PcdMemoryHobSize); >>>> >>>> =C2=A0=C2=A0=C2=A0 ProcessLibraryConstructorList (HobStart, &gMmCoreMm= st); >>>> >>>> @@ -619,10 +622,22 @@ StandaloneMmMain ( >>>> =C2=A0=C2=A0=C2=A0 // >>>> =C2=A0=C2=A0=C2=A0 HobSize =3D GetHobListSize (HobStart); >>>> =C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_INFO, "HobSize - 0x%x\n", HobSize)); >>>> -=C2=A0 MmHobStart =3D AllocatePool (HobSize); >>>> +=C2=A0 ASSERT (HobSize <=3D MaxHobSize); >>>> +=C2=A0 MmHobStart =3D AllocatePool (MaxHobSize); >>>> =C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_INFO, "MmHobStart - 0x%x\n", MmHobSta= rt)); >>>> =C2=A0=C2=A0=C2=A0 ASSERT (MmHobStart !=3D NULL); >>>> =C2=A0=C2=A0=C2=A0 CopyMem (MmHobStart, HobStart, HobSize); >>>> +=C2=A0 // >>>> +=C2=A0 // Initlialize the new HOB table >>>> +=C2=A0 // >>>> +=C2=A0 HandOffHobOrg =3D (EFI_HOB_HANDOFF_INFO_TABLE *)HobStart; >>>> +=C2=A0 HandOffHobNew =3D (EFI_HOB_HANDOFF_INFO_TABLE *)MmHobStart; >>>> +=C2=A0 HandOffHobNew->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS)MmHob= Start + >>>> +=C2=A0=C2=A0=C2=A0 (HandOffHobOrg->EfiEndOfHobList -=20 >>>> (EFI_PHYSICAL_ADDRESS)HobStart); >>>> +=C2=A0 HandOffHobNew->EfiFreeMemoryBottom =3D=20 >>>> HandOffHobNew->EfiEndOfHobList + >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 sizeof=20 >>>> (EFI_HOB_GENERIC_HEADER); >>>> +=C2=A0 HandOffHobNew->EfiFreeMemoryTop =3D=20 >>>> (EFI_PHYSICAL_ADDRESS)MmHobStart + MaxHobSize; >>>> + >>>> =C2=A0=C2=A0=C2=A0 Status =3D MmInstallConfigurationTable (&gMmCoreMms= t,=20 >>>> &gEfiHobListGuid, MmHobStart, HobSize); >>>> =C2=A0=C2=A0=C2=A0 ASSERT_EFI_ERROR (Status); >>>> >>>> diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf=20 >>>> b/StandaloneMmPkg/Core/StandaloneMmCore.inf >>>> index c44b9ff333..37e6135d73 100644 >>>> --- a/StandaloneMmPkg/Core/StandaloneMmCore.inf >>>> +++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf >>>> @@ -76,6 +76,9 @@ >>>> =C2=A0=C2=A0=C2=A0 gEfiEventExitBootServicesGuid >>>> =C2=A0=C2=A0=C2=A0 gEfiEventReadyToBootGuid >>>> >>>> +[FixedPcd] >>>> +=C2=A0 gStandaloneMmPkgTokenSpaceGuid.PcdMemoryHobSize >>>> + >>>> =C2=A0 # >>>> =C2=A0 # This configuration fails for CLANGPDB, which does not support= =20 >>>> PIE in the GCC >>>> =C2=A0 # sense. Such however is required for ARM family StandaloneMmCo= re >>>> diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec=20 >>>> b/StandaloneMmPkg/StandaloneMmPkg.dec >>>> index 46784d94e4..cf554676e2 100644 >>>> --- a/StandaloneMmPkg/StandaloneMmPkg.dec >>>> +++ b/StandaloneMmPkg/StandaloneMmPkg.dec >>>> @@ -48,3 +48,5 @@ >>>> =C2=A0=C2=A0=C2=A0 gEfiStandaloneMmNonSecureBufferGuid=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 =3D { 0xf00497e3,=20 >>>> 0xbfa2, 0x41a1, { 0x9d, 0x29, 0x54, 0xc2, 0xe9, 0x37, 0x21, 0xc5 }} >>>> =C2=A0=C2=A0=C2=A0 gEfiArmTfCpuDriverEpDescriptorGuid=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 =3D { 0x6ecbd5a1,=20 >>>> 0xc0f8, 0x4702, { 0x83, 0x01, 0x4f, 0xc2, 0xc5, 0x47, 0x0a, 0x51 }} >>>> >>>> +[PcdsFixedAtBuild] >>>> +=20 >>>> gStandaloneMmPkgTokenSpaceGuid.PcdMemoryHobSize|0x00000000|UINT64|0x00= 000004 >>>> --=20 >>>> 2.17.1 >>>> >>> >>> >>> >> >> >> >> > > >=20 > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108075): https://edk2.groups.io/g/devel/message/108075 Mute This Topic: https://groups.io/mt/89020085/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-