From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.41]) by mx.groups.io with SMTP id smtpd.web09.24054.1659958091024685886 for ; Mon, 08 Aug 2022 04:28:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=aAxfHT/L; spf=pass (domain: arm.com, ip: 40.107.21.41, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dhgTF12snaUVFJIx5Mju/hcc0VRoKVxfC1wP2yvOMyWtLp8Y8lmx8ROyauh0ueSP4t712kWR97HzbYdeEQ2c/rxFuTHSaSsG6Z1GdnTLa/Nu0nQLrYTmMlFoBvIX9/hXdKj3hPO0zRQOkYHWcPHfnw7NNbSdzy1jKfMCTAT8sd23WVMVg8dkWXewi8dhEqPYsq+3u5BZ/Z3KUjxHMiTHHeB7nqwHEzFXpVLn4FVKYK4efUpqF7vSDma76QXfMOmcgwx3MKQtYyUj3Bt/NpSUIgxT4vi4DxCxqH94ZbH9N0us/bEhysHfptM9eNFhU5I9n76PGho9hhauU2K+vAhJLw== ARC-Message-Signature: i=2; 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=xp61dAhI2R+UX2C12raBCckIKfZTgWcXzFaQky8CeK4=; b=b5y03ImB4wEEuho/B1T/CJaIWpv4699m9FLOd9D/wTW+2E3/N++iklQdxoUjM0srJxDHRQmURqTO34fnE/QN5a4pty+tgbnQj/vTaR0YtnFWMrngjPzvoTd1tLhvwAfxv7yCgKAJWMU8mTzTLfScMPvtueHPxLK/wlPOcKRYnvpun3Uccv/jwGD2eyWkfBDHwRn4knh8MbjKE5I0ZWgqmvtRcM8CfiSKWMT7hx6vT/wjH5c/nYTxuR++9rNIMGmyRUtNtOAStaRBbt0UbJ22QGTN9SjS3uZHe267OOGmaO5qYmzDbXgfKZwQhy3W7BLLlqRjdugUnF6AHqjCWL1qTQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=temperror (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=temperror action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xp61dAhI2R+UX2C12raBCckIKfZTgWcXzFaQky8CeK4=; b=aAxfHT/LqEyNm7J8tlFiWJuyex23gsqv1pa1fituaN+2nqmmzKp/W9n3pXzLJRFcM5rzORAAnNUkqBZlkK5SAbFfqBtj49Mna5TuzErR9Ha0zSGD8UFfSBEeItDF9iziPaBcVP0IhYpPSA/+jWA5m47kedLOd/hRGPtEg4sx3Pg= Received: from FR3P281CA0038.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::14) by AS8PR08MB7080.eurprd08.prod.outlook.com (2603:10a6:20b:401::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Mon, 8 Aug 2022 11:27:57 +0000 Received: from VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:4a:cafe::50) by FR3P281CA0038.outlook.office365.com (2603:10a6:d10:4a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.8 via Frontend Transport; Mon, 8 Aug 2022 11:27:57 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT006.mail.protection.outlook.com (10.152.18.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16 via Frontend Transport; Mon, 8 Aug 2022 11:27:55 +0000 Received: ("Tessian outbound 63c09d5d38ac:v123"); Mon, 08 Aug 2022 11:27:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 42f1a706d3e3af03 X-CR-MTA-TID: 64aa7808 Received: from b26132c38677.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0369F7FC-F745-4FFA-96CC-271583028CFE.1; Mon, 08 Aug 2022 11:27:49 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b26132c38677.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 08 Aug 2022 11:27:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPYgdvkSOgi5Tdr8HBsaBLa4Xq32mmH0N2+FP94xNeYgYcaW6rw8L/h9kCfg0P7Milp7/+OIS7ZhOcOVd63ep/B/Jivb7YZ0GovEOVgNAP9UVLFbA8oObQeOlIrRN+UaL1+xsVExJJG2cMFJ5GBR0JKd3QK+2LckC8CRO9HwomGPrGRAC75G5lCsn07ex0xdF59ouLQyfIgp/6uiVQ3kTbWihJbvGQ5IvbE44d3+9skYuW+c4J9ygq0e0xPuGd67VMrPuzLFX1SD1K2vEXa7+iT4SlYTkxrVErYtPgwUbvJaBlEvPJ2agWnmaFFecqmSFM62KVykIUb/CGpMnbAlWg== 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=xp61dAhI2R+UX2C12raBCckIKfZTgWcXzFaQky8CeK4=; b=WXzEHhGNn4XCL1KP+uOaj5m6rVAvAmBVXWKfLHZ8D1hUqnQ6UCgWdSS+qZbVITU5DI45ERu9TMwQ75i4hS8gwV5QcXj0plzQE1qWeSbo+pGNu1mfPOpDdAKGy9y4Ip9FN56sQLwbDn3bJ4bJyS3yPCxb6R8mUwn68JQqxU7vqBhb/loh16v4C/ASioP2USwVODlBMDKg9BgVaTjiMigkJu+gJprvR1ESJeB1xj3BQTsK4ceZjRKDQVXPD1M6doNKSxBdIjMYKuGwWhkggA/Zl9WB7rPwbWmLgt15bqk/d9xjwqUMNneCtxqdhsgCC1TZhmXnWeggNWxwt2RXah3zHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xp61dAhI2R+UX2C12raBCckIKfZTgWcXzFaQky8CeK4=; b=aAxfHT/LqEyNm7J8tlFiWJuyex23gsqv1pa1fituaN+2nqmmzKp/W9n3pXzLJRFcM5rzORAAnNUkqBZlkK5SAbFfqBtj49Mna5TuzErR9Ha0zSGD8UFfSBEeItDF9iziPaBcVP0IhYpPSA/+jWA5m47kedLOd/hRGPtEg4sx3Pg= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM4PR0802MB2337.eurprd08.prod.outlook.com (2603:10a6:200:5f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Mon, 8 Aug 2022 11:27:46 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::d562:5a52:f638:7fe9]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::d562:5a52:f638:7fe9%4]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 11:27:46 +0000 Message-ID: <9350dcba-b993-93d9-511a-baf46e1dd852@arm.com> Date: Mon, 8 Aug 2022 12:27:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/2] CloudHv/arm: add PeiMemInfoLib To: Jianyong Wu , devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, justin.he@arm.com, "nd@arm.com" References: <20220729072146.169750-1-jianyong.wu@arm.com> <20220729072146.169750-2-jianyong.wu@arm.com> From: "Sami Mujawar" In-Reply-To: <20220729072146.169750-2-jianyong.wu@arm.com> X-ClientProxiedBy: LO6P123CA0007.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:338::9) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 27d81814-125f-4d39-f899-08da79310a3f X-MS-TrafficTypeDiagnostic: AM4PR0802MB2337:EE_|VE1EUR03FT006:EE_|AS8PR08MB7080:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /wslOErvIhUoR4l/Gr7BxiahEkljxZDo43uce34WWMxEoSCOCk6giOpAa9uECxQhfgkyy0Kv06FJg6NMdqRCPD/RdjdX8gC2KmGJ5MhaCIMFSsjazPRnsL5V4qtok6YqAdn79JlbWRSvS4QqbmgzG32RV8zzKA+CxZeplqSI5zQiQxd2maqKK6dSrrdMPqEa1rB4t0zo/XiDd7TUihOf6I3WbUHtqS+tMrKKd6WHbHXS9mU9EiwME9+8Ldsp202JokPYO4quaONxhX5cHk255Yh3LGf5nOV2LPh8N50fOaBcHGCbbBJnzQ1BxcAC8ALPa7i66lRhQQwqx6nQLYRdWuOcPa5ZKl72XnVmqFrtx5E3M9rWKvuA1f5OrovwxPBaaVtQC7N8DP4QRcw6jDpbVxJSrXy//2S1Bav3Hqo966QmW0wginvRKCkegxETFONcWF7jaLNSBaYqLoRl25xFWkQBnDkc7AOBy+EDvDL/NdkeKEsX7m1+XACnbi/twMMJGtUG5TOEli2K8T6OCVF2ZVdh/AcjztW1OIQjKtURoxb4Ey+RWrnDm+jzr9c2yJtxA4SaR3+SZvDJbd9xzHwPObWxX3JMob0LbLXhfbQ0SP2Volc8bfVc07sd0YFkzpe+AeT6hj+3/RrGU+LpgOSFF41UBJZ8Mza2qrpIhRltClqEjiAnIOHYbrmOPd45H+12v8YuYgjX8I4mQpII1s6/qaTltor5HNpPsiNfZLqddZHxNtODrEfP46iBzIDxh9HlTwhQMeZixfRCLA9ifuxff3Zh/PrATdzs1pYbHD8Sn+giiVwTeT6avZ+1C2LjKghvJYaaiTezGX3Dl6urDCLsTVrUJ8ozfTqMkJoOyVx2MuGboR98QxZHxLRCVwCrbnJ6 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(366004)(376002)(136003)(346002)(966005)(8936002)(66476007)(8676002)(66556008)(36756003)(4326008)(186003)(478600001)(44832011)(316002)(31696002)(5660300002)(31686004)(66946007)(6486002)(86362001)(30864003)(41300700001)(6512007)(26005)(83380400001)(33964004)(6506007)(53546011)(166002)(2906002)(38100700002)(2616005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2337 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6f2935ba-7132-4ed0-8c91-08da79310484 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1NzXicxpzyu7O912+edp9UR/Gf7pEhn9zBqhbTS3/ULv3qY5r1tx7c9sSOYni42pC3j57pwoyLw3Ixw2GNjyPG13+foZtiG13TUr1B8ZHPbJe1Gs/KwbAXTmbI83ewNUQlT/yoIUwrL22/MzGhc3FKD6dn+M8pjrynqfh9P2SAd18wUTn5XJjgdPB3juP4YygruaeTWosw3LAsVY/ngFwpFrJFQacNv9yjkJe5AVj3p5bOYBi4SdhJWFLo98vy4otAMWOmabvTD/E7yKvxC2cdC6n5Y//8huHrrijIpEog4v93nSgKrcx5Mo0NCOJ7LwIkStqZ0D42O0iAcvaBuacHfafdCWbnJEcpkAul9/kh6M2hcvOUm7fsuv2E0y63qLAfCkYVh8tfHLE39hAdS+3VelcHN8fJgsW28mFNv2+aVdbLyGTV583m3WOujEDCmuO6dWeoFbhE46iWPAyZ6HQYQ6bJySp67w2aWK7wjeGnq3P4ixApyBGj9/z5LNWq3hBSAYwdiLMB5Fw9sd/cNUblcxrXKBYtaDpiVIqKpZMVHS7KgwyGCkdUt/5mn6Vv53Ejt/v4Dr/XXQnICVsZnVUC6wEHGbSwodmhsgyeswClGhC5ciuyh57HgFpMGGlyPGtxLVRVMl2+AB77jU+v8amjenYWpeA9uAgwCFeeUIFOkUQQFIwf0ryJULlB5b7j7N6pu0vhZEUiCmB4nP/cGmu+Y1GI6Rpio/5bn2uHH1fidEhyT+ViXjoZJFPwvtMsF3u59XZjS7y35DM+gWA4uqy5QxT+zVlfot6Pk84Ft371fIwSxUh83vUuBW9zapWxEvyhe9stfuljlJInhpM8fRa7UgR2LgM6Qgsi+zFeNxe5fiJpRmRkTNiD7qCqwKGUBEZzLv4LB30Ns32P3S37jP/g== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(376002)(39860400002)(136003)(36840700001)(46966006)(40470700004)(2616005)(81166007)(31696002)(53546011)(6506007)(41300700001)(26005)(33964004)(86362001)(6512007)(82740400003)(166002)(40460700003)(336012)(83380400001)(63350400001)(186003)(63370400001)(356005)(36860700001)(47076005)(70206006)(2906002)(316002)(8936002)(31686004)(5660300002)(70586007)(4326008)(8676002)(30864003)(44832011)(6486002)(966005)(40480700001)(36756003)(82310400005)(478600001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 11:27:55.7419 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27d81814-125f-4d39-f899-08da79310a3f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7080 Content-Type: multipart/alternative; boundary="------------nJAOxd0U0iwQtZl0peprB9Mz" --------------nJAOxd0U0iwQtZl0peprB9Mz Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Jianyong, Thank you for this patch. Please find my response inline marked [SAMI]. Regards, Sami Mujawar On 29/07/2022 08:21 am, Jianyong Wu wrote: > Memory layout in CLoud Hypervisor for arm is changed and is different > with Qemu, thus we should build its own PeiMemInfoLib. > The main change in the memory layout is that normal ram may not contiguous > under 4G. The top 64M under 4G is reserved for 32bit device. > > What this patch does: > 1. get all of the memory node from DT; > 2. Init page table for each memory node; > 3. Add all of the memory nodes to Hob; > > Signed-off-by: Jianyong Wu > --- > .../CloudHvVirtMemInfoLib.c | 251 ++++++++++++++++++ > .../CloudHvVirtMemInfoPeiLib.inf | 46 ++++ > 2 files changed, 297 insertions(+) > create mode 100755 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > create mode 100755 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > > diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > new file mode 100755 > index 0000000000..7ae24641d3 > --- /dev/null > +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > @@ -0,0 +1,251 @@ > +/** @file > + > + Copyright (c) 2022, Arm Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +// The first memnory node is the one whose base address is the lowest. > +UINT64 FirMemNodeBase = 0, FirMemNodeSize = 0; [SAMI] Is it possible to move the above variables within the scope of CloudHvVirtMemInfoPeiLibConstructor() ? > +// > +// Cloud Hypervisor may have more than one memory nodes. Even there is no limit for that, > +// I think 10 is enough in general. > +// > +#define CLOUDHV_MAX_MEM_NODE_NUM 10 > + > +// Record memory node info (base address and size) > +struct CloudHvMemNodeInfo { > + UINT64 Base; > + UINT64 Size; > +}; [SAMI] The edk2 coding guidelines require definition of a typedef for structures, see section 5.6.3.[1,2,3] at https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/56_declarations_and_types#5.6.3.1-structures-shall-not-be-directly-declared. > + > +struct CloudHvMemNodeInfo CloudHvMemNode[CLOUDHV_MAX_MEM_NODE_NUM]; > + > +RETURN_STATUS > +EFIAPI > +CloudHvVirtMemInfoPeiLibConstructor ( > + VOID > + ) > +{ > + VOID *DeviceTreeBase; > + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; > + INT32 Node, Prev; > + UINT64 CurBase, MemBase; > + UINT64 CurSize; > + CONST CHAR8 *Type; > + INT32 Len; > + CONST UINT64 *RegProp; > + RETURN_STATUS PcdStatus; > + UINT8 Index; > + > + ZeroMem (CloudHvMemNode, sizeof(CloudHvMemNode[0]) * CLOUDHV_MAX_MEM_NODE_NUM); [SAMI] Will sizeof (CloudHvMemNode) should be sufficient above? Also can you run uncrustify on your patches, please? > + > + Index = 0; > + MemBase = FixedPcdGet64 (PcdSystemMemoryBase); > + ResourceAttributes = ( > + EFI_RESOURCE_ATTRIBUTE_PRESENT | > + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | > + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | > + EFI_RESOURCE_ATTRIBUTE_TESTED > + ); > + DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); > + ASSERT (DeviceTreeBase != NULL); > + > + // > + // Make sure we have a valid device tree blob > + // > + ASSERT (fdt_check_header (DeviceTreeBase) == 0); [SAMI] I think the two ASSERTs above must return an error, otherwise they would result in a crash in release builds. > + > + // > + // Look for the lowest memory node > + // > + for (Prev = 0; ; Prev = Node) { > + Node = fdt_next_node (DeviceTreeBase, Prev, NULL); > + if (Node < 0) { > + break; > + } > + > + // > + // Check for memory node > + // > + Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len); > + if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) { > + // > + // Get the 'reg' property of this node. For now, we will assume > + // two 8 byte quantities for base and size, respectively. > + // > + RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len); > + if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) { > + CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp)); > + CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1)); > + > + DEBUG (( > + DEBUG_INFO, > + "%a: System RAM @ 0x%lx - 0x%lx\n", > + __FUNCTION__, > + CurBase, > + CurBase + CurSize - 1 > + )); > + > + if (CurBase == MemBase) { > + FirMemNodeBase = CurBase; > + FirMemNodeSize = CurSize; > + } > + > + CloudHvMemNode[Index].Base = CurBase; > + CloudHvMemNode[Index].Size = CurSize; > + Index++; > + // We should build Hob seperately for the memory node except the first one > + if (CurBase != MemBase) { [SAMI] Can this be made an else statement of the previous 'if (CurBase == MemBase)' statement  by reordeing the few statements above? > + BuildResourceDescriptorHob ( > + EFI_RESOURCE_SYSTEM_MEMORY, > + ResourceAttributes, > + CurBase, > + CurSize > + ); > + } > + if (Index >= CLOUDHV_MAX_MEM_NODE_NUM) { > + DEBUG (( > + DEBUG_WARN, > + "%a: memory node larger than %d will not be included into Memory System\n", > + __FUNCTION__, > + CLOUDHV_MAX_MEM_NODE_NUM > + )); > + break; > + } > + } else { > + DEBUG (( > + DEBUG_ERROR, > + "%a: Failed to parse FDT memory node\n", > + __FUNCTION__ > + )); > + } > + } > + } > + > + // > + // Make sure the start of DRAM matches our expectation > + // > + ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == FirMemNodeBase); [SAMI] This assert is checking that the a memory node with PcdSystemMemoryBasehas been found in the DT. If not found an error must be returned. > + PcdStatus = PcdSet64S (PcdSystemMemorySize, FirMemNodeSize); > + ASSERT_RETURN_ERROR (PcdStatus); > + ASSERT ( > + (((UINT64)PcdGet64 (PcdFdBaseAddress) + > + (UINT64)PcdGet32 (PcdFdSize)) <= FirMemNodeBase) || > + ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (FirMemNodeBase + FirMemNodeSize)) > + ); > + > + return RETURN_SUCCESS; > +} > + > +// Number of Virtual Memory Map Descriptors > +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS (4 + CLOUDHV_MAX_MEM_NODE_NUM) > + > +// > +// Core peripherals such as the UART, the GIC and the RTC are > +// all mapped in the 'miscellaneous device I/O' region, which we just map > +// in its entirety rather than device by device. Note that it does not > +// cover any of the NOR flash banks or PCI resource windows. > +// > +#define MACH_VIRT_PERIPH_BASE 0x00400000 > +#define MACH_VIRT_PERIPH_SIZE 0x0FC00000 > + > +// > +// The top of the 64M memory region under 4GB reserved for device > +// > +#define TOP_32BIT_DEVICE_BASE 0xFC000000 > +#define TOP_32BIT_DEVICE_SIZE 0x04000000 > + [SAMI] Is it possible to move the all the defines in this file and the structure definition to a separate header file, please? > +/** > + Return the Virtual Memory Map of your platform > + > + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU > + on your platform. > + > + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR > + describing a Physical-to-Virtual Memory > + mapping. This array must be ended by a > + zero-filled entry. The allocated memory > + will not be freed. > + > +**/ > +VOID > +ArmVirtGetMemoryMap ( > + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap > + ) > +{ > + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; > + UINT8 Index = 0, i = 0; [SAMI] Please change variable name 'i' to MemNodeIndex. > + > + ASSERT (VirtualMemoryMap != NULL); > + > + VirtualMemoryTable = AllocatePool ( > + sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * > + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS > + ); > + > + if (VirtualMemoryTable == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__)); > + return; > + } > + // System DRAM > + while (CloudHvMemNode[i].Size != 0) { > + VirtualMemoryTable[Index].PhysicalBase = CloudHvMemNode[i].Base; > + VirtualMemoryTable[Index].VirtualBase = CloudHvMemNode[i].Base; > + VirtualMemoryTable[Index].Length = CloudHvMemNode[i].Size; > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + > + DEBUG (( > + DEBUG_INFO, > + "%a: Dumping System DRAM Memory Node%d Map:\n" > + "\tPhysicalBase: 0x%lX\n" > + "\tVirtualBase: 0x%lX\n" > + "\tLength: 0x%lX\n", > + __FUNCTION__, > + i, > + VirtualMemoryTable[Index].PhysicalBase, > + VirtualMemoryTable[Index].VirtualBase, > + VirtualMemoryTable[Index].Length > + )); > + Index++; > + i++; > + } > + // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc) > + VirtualMemoryTable[Index].PhysicalBase = MACH_VIRT_PERIPH_BASE; > + VirtualMemoryTable[Index].VirtualBase = MACH_VIRT_PERIPH_BASE; > + VirtualMemoryTable[Index].Length = MACH_VIRT_PERIPH_SIZE; > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > + Index++; > + > + // Map the FV region as normal executable memory > + VirtualMemoryTable[Index].PhysicalBase = PcdGet64 (PcdFvBaseAddress); > + VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > + VirtualMemoryTable[Index].Length = FixedPcdGet32 (PcdFvSize); > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + Index++; > + > + // Memory mapped for 32bit device (like TPM) > + VirtualMemoryTable[Index].PhysicalBase = TOP_32BIT_DEVICE_BASE; > + VirtualMemoryTable[Index].VirtualBase = TOP_32BIT_DEVICE_BASE; > + VirtualMemoryTable[Index].Length = TOP_32BIT_DEVICE_SIZE; > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > + Index++; > + > + // End of Table > + ZeroMem (&VirtualMemoryTable[Index], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); > + > + *VirtualMemoryMap = VirtualMemoryTable; > +} > diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > new file mode 100755 > index 0000000000..5dd96faadd > --- /dev/null > +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > @@ -0,0 +1,46 @@ > +#/* @file > +# > +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. > +# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +#*/ > + > +[Defines] > + INF_VERSION = 0x0001001A [SAMI] Please set version as 0x0001001B. > + BASE_NAME = QemuVirtMemInfoPeiLib > + FILE_GUID = 0c4d10cf-d949-49b4-bd13-47a4ae22efce [SAMI] This GUID is conflicting with ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf. Please define a new GUID. > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = ArmVirtMemInfoLib|PEIM > + CONSTRUCTOR = CloudHvVirtMemInfoPeiLibConstructor > + > +[Sources] > + CloudHvVirtMemInfoLib.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + ArmVirtPkg/ArmVirtPkg.dec > + EmbeddedPkg/EmbeddedPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + ArmLib > + BaseMemoryLib > + DebugLib > + FdtLib > + PcdLib > + MemoryAllocationLib [SAMI] Please sort in alphabetical order. > + > +[Pcd] > + gArmTokenSpaceGuid.PcdFdBaseAddress > + gArmTokenSpaceGuid.PcdFvBaseAddress > + gArmTokenSpaceGuid.PcdSystemMemoryBase > + gArmTokenSpaceGuid.PcdSystemMemorySize > + > +[FixedPcd] > + gArmTokenSpaceGuid.PcdFdSize > + gArmTokenSpaceGuid.PcdFvSize > + gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress --------------nJAOxd0U0iwQtZl0peprB9Mz Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Jianyong,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 29/07/2022 08:21 am, Jianyong Wu wrote:
Memory layout in CLoud Hypervisor for arm is changed and is different
with Qemu, thus we should build its own PeiMemInfoLib.
The main change in the memory layout is that normal ram may not contiguous
under 4G. The top 64M under 4G is reserved for 32bit device.

What this patch does:
1. get all of the memory node from DT;
2. Init page table for each memory node;
3. Add all of the memory nodes to Hob;

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 .../CloudHvVirtMemInfoLib.c                   | 251 ++++++++++++++++++
 .../CloudHvVirtMemInfoPeiLib.inf              |  46 ++++
 2 files changed, 297 insertions(+)
 create mode 100755 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
 create mode 100755 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf

diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
new file mode 100755
index 0000000000..7ae24641d3
--- /dev/null
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
@@ -0,0 +1,251 @@
+/** @file
+
+  Copyright (c) 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+
+#include <Base.h>
+#include <libfdt.h>
+#include <Library/ArmLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+
+#include<Library/PrePiLib.h>
+
+// The first memnory node is the one whose base address is the lowest.
+UINT64 FirMemNodeBase = 0, FirMemNodeSize = 0;
[SAMI] Is it possible to move the above variables within the scope of CloudHvVirtMemInfoPeiLibConstructor() ?
+//
+// Cloud Hypervisor may have more than one memory nodes. Even there is no limit for that,
+// I think 10 is enough in general.
+//
+#define CLOUDHV_MAX_MEM_NODE_NUM 10
+
+// Record memory node info (base address and size)
+struct CloudHvMemNodeInfo {
+  UINT64 Base;
+  UINT64 Size;
+};

[SAMI] The edk2 coding guidelines require definition of a typedef for structures, see section 5.6.3.[1,2,3] at https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/56_declarations_and_types#5.6.3.1-structures-shall-not-be-directly-declared.

+
+struct CloudHvMemNodeInfo CloudHvMemNode[CLOUDHV_MAX_MEM_NODE_NUM];
+
+RETURN_STATUS
+EFIAPI
+CloudHvVirtMemInfoPeiLibConstructor (
+  VOID
+  )
+{
+  VOID           *DeviceTreeBase;
+  EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttributes;
+  INT32          Node, Prev;
+  UINT64         CurBase, MemBase;
+  UINT64         CurSize;
+  CONST CHAR8    *Type;
+  INT32          Len;
+  CONST UINT64   *RegProp;
+  RETURN_STATUS  PcdStatus;
+  UINT8          Index;
+
+  ZeroMem (CloudHvMemNode, sizeof(CloudHvMemNode[0]) * CLOUDHV_MAX_MEM_NODE_NUM);
[SAMI] Will sizeof (CloudHvMemNode) should be sufficient above? Also can you run uncrustify on your patches, please?
+
+  Index = 0;
+  MemBase = FixedPcdGet64 (PcdSystemMemoryBase);
+  ResourceAttributes = (
+                        EFI_RESOURCE_ATTRIBUTE_PRESENT |
+                        EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+                        EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+                        EFI_RESOURCE_ATTRIBUTE_TESTED
+                        );
+  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
+  ASSERT (DeviceTreeBase != NULL);
+
+  //
+  // Make sure we have a valid device tree blob
+  //
+  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
[SAMI] I think the two ASSERTs above must return an error, otherwise they would result in a crash in release builds.
+
+  //
+  // Look for the lowest memory node
+  //
+  for (Prev = 0; ; Prev = Node) {
+    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
+    if (Node < 0) {
+      break;
+    }
+
+    //
+    // Check for memory node
+    //
+    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
+    if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) {
+      //
+      // Get the 'reg' property of this node. For now, we will assume
+      // two 8 byte quantities for base and size, respectively.
+      //
+      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
+      if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
+        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
+        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+
+        DEBUG ((
+          DEBUG_INFO,
+          "%a: System RAM @ 0x%lx - 0x%lx\n",
+          __FUNCTION__,
+          CurBase,
+          CurBase + CurSize - 1
+          ));
+
+        if (CurBase == MemBase) {
+            FirMemNodeBase = CurBase;
+            FirMemNodeSize = CurSize;
+        }
+
+        CloudHvMemNode[Index].Base = CurBase;
+        CloudHvMemNode[Index].Size = CurSize;
+        Index++;
+        // We should build Hob seperately for the memory node except the first one
+        if (CurBase != MemBase) {
[SAMI] Can this be made an else statement of the previous 'if (CurBase == MemBase)' statement  by reordeing the few statements above?
+          BuildResourceDescriptorHob (
+            EFI_RESOURCE_SYSTEM_MEMORY,
+            ResourceAttributes,
+            CurBase,
+            CurSize
+            );
+        }
+        if (Index >= CLOUDHV_MAX_MEM_NODE_NUM) {
+          DEBUG ((
+            DEBUG_WARN,
+            "%a: memory node larger than %d will not be included into Memory System\n",
+            __FUNCTION__,
+            CLOUDHV_MAX_MEM_NODE_NUM
+            ));
+          break;
+        }
+      } else {
+        DEBUG ((
+          DEBUG_ERROR,
+          "%a: Failed to parse FDT memory node\n",
+          __FUNCTION__
+          ));
+      }
+    }
+  }
+
+  //
+  // Make sure the start of DRAM matches our expectation
+  //
+  ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == FirMemNodeBase);
[SAMI] This assert is checking that the a memory node with PcdSystemMemoryBasehas been found in the DT. If not found an error must be returned.
+  PcdStatus = PcdSet64S (PcdSystemMemorySize, FirMemNodeSize);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  ASSERT (
+    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
+      (UINT64)PcdGet32 (PcdFdSize)) <= FirMemNodeBase) ||
+    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (FirMemNodeBase + FirMemNodeSize))
+    );
+
+  return RETURN_SUCCESS;
+}
+
+// Number of Virtual Memory Map Descriptors
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  (4 + CLOUDHV_MAX_MEM_NODE_NUM)
+
+//
+// Core peripherals such as the UART, the GIC and the RTC are
+// all mapped in the 'miscellaneous device I/O' region, which we just map
+// in its entirety rather than device by device. Note that it does not
+// cover any of the NOR flash banks or PCI resource windows.
+//
+#define MACH_VIRT_PERIPH_BASE  0x00400000
+#define MACH_VIRT_PERIPH_SIZE  0x0FC00000
+
+//
+// The top of the 64M memory region under 4GB reserved for device
+//
+#define TOP_32BIT_DEVICE_BASE  0xFC000000
+#define TOP_32BIT_DEVICE_SIZE  0x04000000
+
[SAMI] Is it possible to move the all the defines in this file and the structure definition to a separate header file, please?
+/**
+  Return the Virtual Memory Map of your platform
+
+  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
+  on your platform.
+
+  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR
+                                    describing a Physical-to-Virtual Memory
+                                    mapping. This array must be ended by a
+                                    zero-filled entry. The allocated memory
+                                    will not be freed.
+
+**/
+VOID
+ArmVirtGetMemoryMap (
+  OUT ARM_MEMORY_REGION_DESCRIPTOR  **VirtualMemoryMap
+  )
+{
+  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
+  UINT8 Index = 0, i = 0;
[SAMI] Please change variable name 'i' to MemNodeIndex.
+
+  ASSERT (VirtualMemoryMap != NULL);
+
+  VirtualMemoryTable = AllocatePool (
+                         sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
+                         MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS
+                         );
+
+  if (VirtualMemoryTable == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
+    return;
+  }
+    // System DRAM
+  while (CloudHvMemNode[i].Size != 0) {
+    VirtualMemoryTable[Index].PhysicalBase = CloudHvMemNode[i].Base;
+    VirtualMemoryTable[Index].VirtualBase  = CloudHvMemNode[i].Base;
+    VirtualMemoryTable[Index].Length       = CloudHvMemNode[i].Size;
+    VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+
+    DEBUG ((
+      DEBUG_INFO,
+      "%a: Dumping System DRAM Memory Node%d Map:\n"
+      "\tPhysicalBase: 0x%lX\n"
+      "\tVirtualBase: 0x%lX\n"
+      "\tLength: 0x%lX\n",
+      __FUNCTION__,
+      i,
+      VirtualMemoryTable[Index].PhysicalBase,
+      VirtualMemoryTable[Index].VirtualBase,
+      VirtualMemoryTable[Index].Length
+      ));
+    Index++;
+    i++;
+  }
+  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
+  VirtualMemoryTable[Index].PhysicalBase = MACH_VIRT_PERIPH_BASE;
+  VirtualMemoryTable[Index].VirtualBase  = MACH_VIRT_PERIPH_BASE;
+  VirtualMemoryTable[Index].Length       = MACH_VIRT_PERIPH_SIZE;
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+  Index++;
+
+  // Map the FV region as normal executable memory
+  VirtualMemoryTable[Index].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
+  VirtualMemoryTable[Index].VirtualBase  = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length       = FixedPcdGet32 (PcdFvSize);
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+  Index++;
+
+  // Memory mapped for 32bit device (like TPM)
+  VirtualMemoryTable[Index].PhysicalBase = TOP_32BIT_DEVICE_BASE;
+  VirtualMemoryTable[Index].VirtualBase  = TOP_32BIT_DEVICE_BASE;
+  VirtualMemoryTable[Index].Length       = TOP_32BIT_DEVICE_SIZE;
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+  Index++;
+
+  // End of Table
+  ZeroMem (&VirtualMemoryTable[Index], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
+
+  *VirtualMemoryMap = VirtualMemoryTable;
+}
diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
new file mode 100755
index 0000000000..5dd96faadd
--- /dev/null
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
@@ -0,0 +1,46 @@
+#/* @file
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#*/
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
[SAMI] Please set version as 0x0001001B.
+  BASE_NAME                      = QemuVirtMemInfoPeiLib
+  FILE_GUID                      = 0c4d10cf-d949-49b4-bd13-47a4ae22efce
[SAMI] This GUID is conflicting with ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf. Please define a new GUID.
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
+  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
+
+[Sources]
+  CloudHvVirtMemInfoLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmVirtPkg/ArmVirtPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  ArmLib
+  BaseMemoryLib
+  DebugLib
+  FdtLib
+  PcdLib
+  MemoryAllocationLib
[SAMI] Please sort in alphabetical order.
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdFdBaseAddress
+  gArmTokenSpaceGuid.PcdFvBaseAddress
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdFdSize
+  gArmTokenSpaceGuid.PcdFvSize
+  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
--------------nJAOxd0U0iwQtZl0peprB9Mz--