From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.78]) by mx.groups.io with SMTP id smtpd.web08.2199.1621369269428576609 for ; Tue, 18 May 2021 13:21:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=3Edwew9K; spf=pass (domain: arm.com, ip: 40.107.1.78, mailfrom: sami.mujawar@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=kCJeuZpSQ0Mc9sngQ98lFQ5XJr5/8LcwqKbLCbwSDfc=; b=3Edwew9KF8vv72qI72IgQjGFX4xkddaUG13TtJOpKyAsseQQtwOjC8sIkb6m8n99YMqSX/1nU1q+PwLa+IegwfG/jMfApkiDEii0OXwI6SFXRU+0IrGWD9Kf806c4mPT3bKozY0LXeWWqhIZbu/0eyAM94cxkmB/mcweSD441ac= Received: from AM6PR10CA0007.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::20) by VI1PR0801MB1629.eurprd08.prod.outlook.com (2603:10a6:800:4f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 18 May 2021 20:21:04 +0000 Received: from VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::a) by AM6PR10CA0007.outlook.office365.com (2603:10a6:209:89::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Tue, 18 May 2021 20:21:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT052.mail.protection.outlook.com (10.152.19.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Tue, 18 May 2021 20:21:04 +0000 Received: ("Tessian outbound 504317ef584c:v92"); Tue, 18 May 2021 20:21:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 78a9697c40d8b7dd X-CR-MTA-TID: 64aa7808 Received: from 528012ee4491.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D214CBC4-8394-4297-8BDE-AC1EF853FAA9.1; Tue, 18 May 2021 20:20:52 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 528012ee4491.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 18 May 2021 20:20:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3+Em+4wUG1f5bjeS2NYjEcCv14KW0knSJgDKV9FOvAon92XC8Gdv2QuNQfqLMjAbzpWve/Sm3VuUlbc1QBND8D4qzM08wUoaC32NuiIMqprV+xtNNGaOStaCL5QGiLCVv1DjWiALLOPaA9fp75ZPJMRSTilpDZg6j4NC2J5JrRRcuM835aSgbTOCUqC6EQSFt0F4Il3i1LBKWT0XgHQkhJOuEVhRvh9g2aNDojIMQEECxn4Vp6JxKkS1U5o9CYqQVcn1N7TVVj2amIxgZ1B+qMp9EUsOrausZgE/yu9GpBZrHMYJFrqTqq9yH8QAWRpzHWr2NxmY+H9cdzQ+1hNhQ== 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-SenderADCheck; bh=kCJeuZpSQ0Mc9sngQ98lFQ5XJr5/8LcwqKbLCbwSDfc=; b=iSf1ZQFHLd5zyFvahGf6+pw2cFDyyIsEz9/DkAooYXpNf1o711n4cLtt7/94HbQ28afBQL0qjfm9tNRb1xMFAWbBkAaE+6IbN7NU0Fq/yXnZbZ1PDnkVNdzo3TcBUJDZObGzWX1XfvASWsDG3mY8RLiMTBgHgsR8HV/gbmJRKs5GFonu/kqkfJ7cuyLd5dRrD0j9CyFSB5aoQOcaEaDi6/iX8uV4P9zmu5KE5mnjBkms3SIVJs8R1PSM49Ii2Xd7s9WySkaEpq3pvufqTU1YubYdVTo15PkqH1xTkYvOSztuIhL5PocmDiLc3sF5fz8fKmcyUAEu9napXL0SFalJyg== 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=kCJeuZpSQ0Mc9sngQ98lFQ5XJr5/8LcwqKbLCbwSDfc=; b=3Edwew9KF8vv72qI72IgQjGFX4xkddaUG13TtJOpKyAsseQQtwOjC8sIkb6m8n99YMqSX/1nU1q+PwLa+IegwfG/jMfApkiDEii0OXwI6SFXRU+0IrGWD9Kf806c4mPT3bKozY0LXeWWqhIZbu/0eyAM94cxkmB/mcweSD441ac= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AS8PR08MB6166.eurprd08.prod.outlook.com (2603:10a6:20b:296::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Tue, 18 May 2021 20:20:45 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::80cb:878d:c8f1:2688]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::80cb:878d:c8f1:2688%7]) with mapi id 15.20.4129.033; Tue, 18 May 2021 20:20:45 +0000 Subject: Re: [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor To: Jianyong Wu , devel@edk2.groups.io, lersek@redhat.com, ardb+tianocore@kernel.org Cc: hao.a.wu@intel.com, justin.he@arm.com, Leif Lindholm , nd@arm.com References: <20210517065032.82423-1-jianyong.wu@arm.com> <20210517065032.82423-2-jianyong.wu@arm.com> From: "Sami Mujawar" Message-ID: Date: Tue, 18 May 2021 21:20:44 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20210517065032.82423-2-jianyong.wu@arm.com> X-Originating-IP: [217.140.106.52] X-ClientProxiedBy: LO4P123CA0377.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::22) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.1.196.43] (217.140.106.52) by LO4P123CA0377.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Tue, 18 May 2021 20:20:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a332b36e-eead-436f-6633-08d91a3a7621 X-MS-TrafficTypeDiagnostic: AS8PR08MB6166:|VI1PR0801MB1629: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: DJwtT7JpCrFJLmxZAqvVmIrRteNFoVwzDD9DIGlc+edfyS60vIadKc35vJ2nvxYCpeCWkhh0fR8wIfStlObPVe97n5XlgvwBSU4HDtqJkwdBpK+nnjaz7bhzYdxOvUKV4HEAU29/DmTiLDW79tOSb9qtp7ZZPqljRfVLRWkgg3RGOcyjBpjzfezFmcmv2M7jNmrcw1iyRJh+oQvKVJOjebe5eaC1kdMLYR3kEHbnRmG1AvJVN/GTqRBDtisNIGyBp6F/+25iMQHySpTGruJaHKxLsMPynvSBhdn5GVUgJU/EgCs7KhjHCUTN+RwpPUftI3v6QMn9Mc9TIo0rshd4M8f3/XT/foTT9Y74ILNwjzdzvb3TcSPA+2Y/7RXWAszjhH3hQOy5OLGQcxAEypNs4jsGhUy2Bfd/LOUMZrGfDX6WaEYv6GvQNCwsuVBS37eVF4syID7YMFwpjzhNV7hMu23QLcTLqomMQ+F5DrBCk35RcRO+FDmap5s7gFXhU6ykOtplXd4/ilLBxRtPg1peM11PKTXoS3V1mJwxS5uS45X5Wqb5eyA1lRuPyLlUVoFM/9hGgIcSIlQoaPSm6KHoDMffB8YUDyeCxmPqZ8CqoMYj0xlTEq99j+IHzQOcgUrcOBlKhkX/0YYoiYWArFNtjCIMbHR4JoyZ/sE5B1LK97rT0THHRSVaV0neWEgBjPzsW7s5DFvoKmXyiR1PCmODig== 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:(4636009)(366004)(346002)(136003)(376002)(396003)(39850400004)(36756003)(478600001)(83380400001)(26005)(31686004)(52116002)(86362001)(66556008)(5660300002)(66946007)(66476007)(31696002)(16526019)(53546011)(186003)(8936002)(8676002)(16576012)(316002)(44832011)(4326008)(38350700002)(38100700002)(956004)(2616005)(2906002)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?MEZQbWlJU1pPVjBPbE9xc2trMWk0ckFoTmJaMFBRUzNmSjVtdUZzUmU0U3BN?= =?utf-8?B?Z0FzdFQxc0oxa3JGakFWWkNsd0FhTk1xWlRJNjQ1RVhjNFFnQ25MSVVXMFV0?= =?utf-8?B?dEEzdWZQbmUwWW1ZdDAyYU1hUXFGc2tZSHJCdnM0WVhnM3did1QybDFMSmVM?= =?utf-8?B?cXQ0K1QwOUV6WWlxdVVqSFVZeCtseW1uNUsrT0l1azFnNkx5cmxMb3h2cGEr?= =?utf-8?B?QUVEako4dHlMSUNwZHFuaVdCS09FVW9NTjBIZzFHSVkrOGw3eGcwYnRQL0NP?= =?utf-8?B?QnpNV1pYOXJLMVVNT1RVQjF4YmwvRkhCTGNGMzVCOEhZOVZDRzJvTmFhS0Fx?= =?utf-8?B?TUR1Mm12ajYrcVkvN3JoRjc1cVpDbTNlVmVaTjJoUG5BTnplUzRjMXlmbzNF?= =?utf-8?B?cDMzbldYbHpReGxpZ2tJWTdSS3BMK3hhTzFwWnJGUGdURnhyci9JMHR0ZW5Y?= =?utf-8?B?bGp2N2RUZURVQWNmZHc2V1JEQ29XUkhJcGdyaWhZMDZrMDFDUVJtekpJUFFh?= =?utf-8?B?ME1ReFVyWkd6OWIwMUJyZkxUa2FSVEh3ZnBIaFBhN2MwOVZ2QklxTzhtb1NI?= =?utf-8?B?SG9UamtTc05CK2s3K2hGUGwxbGUwY05DVHkyZmthelY4R05STEVrMGszRmN3?= =?utf-8?B?WFp5WVdzU3RtQ0FPbGplNElhQ1pzV04zV0ZKVGpGTGhlM3VCcDlZdTdPaWxs?= =?utf-8?B?c3d5cHJCK2twVW9uWkVKVWlJWXJ3ODVhMG5HT3F5OVgwQnVJRmtFS1JlaXR2?= =?utf-8?B?Q0tVMlFJSVNTR2FoU0xhZ3l0a0JaSi9RRFQwekRTcjVyRmRTVGZ2U3hNWlNY?= =?utf-8?B?azRTOVFYK1F2RjVzMXduZk5OeXVjUFA1YzRqaVhNOE85U2dDVURVRmZ6bmRx?= =?utf-8?B?ekFHenMwVmE3U1JlQU9lNGNBMi9VeUVXdmJOVTlnaGM3K3RmZTF1LzErLzJn?= =?utf-8?B?dVhuRWRzK0tNZFFwN0J2aFNpTGRIZ0hDNVpsbXdVZmMvWGo4WGVNKysvNUVK?= =?utf-8?B?VThZUE5abmRoR1N5SXQxaC9nVHlIdm5iUFJqWUw0a0RsYWRObTY2V0J5dGsz?= =?utf-8?B?dGloM3loQmF1Z01lVCtYV0ttV3hDMmdMNlRjaytwWHNBWmNCWFdKUW1kSlBP?= =?utf-8?B?aEVldDM4NzRYWTduWDV3aXZxaWtLc1k1cVVVTi8wWTFtczNjcC9vakJ5Rmlh?= =?utf-8?B?dFZXS0M5d21RZzNGT0UrUlg5WlpneDhPNTI3M0dUTHBFRUQ2T2FtKzVzRmJD?= =?utf-8?B?Y1hxQzVKdHVYVElCSzYrdVE3RmM1bjBJSnhLMnlzVVVNeENRV3UxMXRyVDFj?= =?utf-8?B?UTJrSnV2WUR6b0E1aE1mTk83UGc5dTNBYUZjcUlISVhHdklIVndNRmNtbVRS?= =?utf-8?B?bElnTFB5NzN3VWo1cjBQeGpvZWsySitqZUIxN3FUVENyeEZFQmhGeVhCTUFp?= =?utf-8?B?V296YnVYcnRZOWVTdC9paitBcHkvbDdpdy9jbHQ3cXZIMGRxOTRIZ2RjRGN6?= =?utf-8?B?N2tiVGJEL2JYU2d1czFkMjBJRGZZdFFPdlp3SzhIL3NuZXZIbG13QTJJWGtm?= =?utf-8?B?NEIzZjhCSndaSVYwdnp0QWs2azk2K1p2Qko4SW4xcHdXQUw1MDR6cUxjUE5a?= =?utf-8?B?NDZBVDZiR1lHOEJaczJjaXBHcndVMldwQ2ZvdDNQVFhvVHdDRFBydmhuVHpY?= =?utf-8?B?MTVBYnRITXcxSWxFdHE1cUU3akwzUDBqcEFEU2xuSE9McjRvYlVKMWxMSkQr?= =?utf-8?Q?Uz3mwtnjuPjf0zr7CgqrGSux8JIe3O0EakrPx8y?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6166 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 01532860-77bf-4480-f05f-08d91a3a6abd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YQiJ2WbMm153CG7F5wEneT+8G56f1nARfkQOCctUe9E/ELMpXPskp/Zz/Tfo1BAmn+rOF6/Cx8mr8CZB2aJaBkwXmCkCprVYkUEt6HJuknfjWDZdRNuT/5T7NZ64maDET9TxK000egmPFzgRwQIspV6HS8j6dmH0WF3itbOtD4AU4895ZD2f+b0ZZOxTIB1lNTlgfCIW7L0mrf4i3hmyPY6VjtvQpFcgWlWtNrcFaOZDQ0NsbX1KOsLKpYEVRzHaRZ6zCdUVwIx7bJ6mGL6GX+jjFOf9NntwJs2+HB6a3dA+rIczUn7zcIMBLIeaXdl8+93llbdbq64bGaqqjZfkoScMhytPxiArJdPiaJ7EFoLcTMZOQQuKYJ427X+UX0LH7HV3XMeqp22TYaSde+55JbfZy6rMihVV96Lq6cTmw1l0mtgxThQvtb+eM8e8AQRokTAggTUDCWe0E3BvB3X5msVw9Wq/gLF2S2nH54A7ABMu5HYgHgHslE+qOPrW31cjlM0adRYXiEWGrDVhJQ5kvAkLmn6D9vVI/hGjNnzYrInTFsXoARdB480F2hO4bzI8kpytCcJTk6Uevrd0CIP2bANdGX4uy/AoM5gECfKgMIPaaUSACg9kKCK5RgU/9AwoiXQbi90pc11PZhqegOtCFPmxSUnPqfoeueswrnPRBCT0dJ9c4iQa5OvrRJhXjgQo 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:(4636009)(39850400004)(346002)(396003)(136003)(376002)(36840700001)(46966006)(31696002)(5660300002)(2906002)(26005)(86362001)(81166007)(83380400001)(44832011)(478600001)(70206006)(47076005)(82310400003)(186003)(53546011)(36756003)(70586007)(356005)(8676002)(4326008)(336012)(36860700001)(956004)(2616005)(16526019)(31686004)(82740400003)(316002)(8936002)(16576012)(6486002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2021 20:21:04.0212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a332b36e-eead-436f-6633-08d91a3a7621 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: VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1629 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Hi Jianyon, Thank you for this patch. Please find my response inline marked [SAMI]. Regards, Sami Mujawar On 17/05/2021 07:50 AM, Jianyong Wu wrote: > Cloud Hypervisor is kvm based VMM implemented in rust. > > This library populates the system memory map for the > Cloud Hypervisor virtual platform. > > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Signed-off-by: Jianyong Wu > --- > .../CloudHvVirtMemInfoPeiLib.inf | 47 ++++++++ > .../CloudHvVirtMemInfoLib.c | 94 ++++++++++++++++ > .../CloudHvVirtMemInfoPeiLibConstructor.c | 100 ++++++++++++++++++ > 3 files changed, 241 insertions(+) > create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c > > diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > new file mode 100644 > index 000000000000..71dbf9c06ccc > --- /dev/null > +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf > @@ -0,0 +1,47 @@ > +#/* @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 > + BASE_NAME = ClhVirtMemInfoPeiLib > + FILE_GUID = 3E29D940-0591-EE6A-CAD4-223A9CF55E75 > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = ArmVirtMemInfoLib|PEIM > + CONSTRUCTOR = CloudHvVirtMemInfoPeiLibConstructor > + > +[Sources] > + CloudHvVirtMemInfoLib.c > + CloudHvVirtMemInfoPeiLibConstructor.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + ArmVirtPkg/ArmVirtPkg.dec > + EmbeddedPkg/EmbeddedPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + ArmLib > + BaseMemoryLib > + DebugLib > + FdtLib > + PcdLib > + MemoryAllocationLib > + > +[Pcd] > + gArmTokenSpaceGuid.PcdFdBaseAddress > + gArmTokenSpaceGuid.PcdFvBaseAddress > + gArmTokenSpaceGuid.PcdSystemMemoryBase > + gArmTokenSpaceGuid.PcdSystemMemorySize > + > +[FixedPcd] > + gArmTokenSpaceGuid.PcdFdSize > + gArmTokenSpaceGuid.PcdFvSize > + gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress > diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > new file mode 100644 > index 000000000000..69f4e6ab6cc4 > --- /dev/null > +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c > @@ -0,0 +1,94 @@ > +/** @file > + > + Copyright (c) 2014-2017, Linaro Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > + > +// Number of Virtual Memory Map Descriptors > +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5 > + > +// > +// mach-virt's 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 0x08000000 > +#define MACH_VIRT_PERIPH_SIZE SIZE_128MB > + > +// > +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory for UEFI > +// > +#define CLOUDHV_UEFI_MEM_BASE 0x0 > +#define CLOUDHV_UEFI_MEM_SIZE 0x08000000 [SAMI] The above macros are not used anywhere. Can these be removed? If so, the code in this patch would be very similar to ArmVirtPkg\Library\QemuVirtMemInfoLib. To avoid code duplication, would it be possible to use QemuVirtMemInfoPeiLib.inf instead? [/SAMI] > + > +/** > + 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; > + > + 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 > + VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase); > + VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase; > + VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize); > + VirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + > + DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n" > + "\tPhysicalBase: 0x%lX\n" > + "\tVirtualBase: 0x%lX\n" > + "\tLength: 0x%lX\n", > + __FUNCTION__, > + VirtualMemoryTable[0].PhysicalBase, > + VirtualMemoryTable[0].VirtualBase, > + VirtualMemoryTable[0].Length)); > + > + // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc) > + VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE; > + VirtualMemoryTable[1].VirtualBase = MACH_VIRT_PERIPH_BASE; > + VirtualMemoryTable[1].Length = MACH_VIRT_PERIPH_SIZE; > + VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > + > + // Map the FV region as normal executable memory > + VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress); > + VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase; > + VirtualMemoryTable[2].Length = FixedPcdGet32 (PcdFvSize); > + VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + > + // End of Table > + ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); > + > + *VirtualMemoryMap = VirtualMemoryTable; > +} > diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c > new file mode 100644 > index 000000000000..062dfcee1d66 > --- /dev/null > +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c > @@ -0,0 +1,100 @@ > +/** @file > + > + Copyright (c) 2014-2017, Linaro Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > + > +RETURN_STATUS > +EFIAPI > +CloudHvVirtMemInfoPeiLibConstructor ( > + VOID > + ) > +{ > + VOID *DeviceTreeBase; > + INT32 Node, Prev; > + UINT64 NewBase, CurBase; > + UINT64 NewSize, CurSize; > + CONST CHAR8 *Type; > + INT32 Len; > + CONST UINT64 *RegProp; > + RETURN_STATUS PcdStatus; > + > + NewBase = 0; > + NewSize = 0; > + > + DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); > + ASSERT (DeviceTreeBase != NULL); > + > + // > + // Make sure we have a valid device tree blob > + // > + ASSERT (fdt_check_header (DeviceTreeBase) == 0); > + > + // > + // 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 (NewBase > CurBase || NewBase == 0) { > + NewBase = CurBase; > + NewSize = CurSize; > + } > + } 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) == NewBase); > + PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize); > + ASSERT_RETURN_ERROR (PcdStatus); > + > + // > + // We need to make sure that the machine we are running on has at least > + // 128 MB of memory configured, and is currently executing this binary from > + // NOR flash. This prevents a device tree image in DRAM from getting > + // clobbered when our caller installs permanent PEI RAM, before we have a > + // chance of marking its location as reserved or copy it to a freshly > + // allocated block in the permanent PEI RAM in the platform PEIM. > + // > + ASSERT (NewSize >= SIZE_128MB); > + ASSERT ( > + (((UINT64)PcdGet64 (PcdFdBaseAddress) + > + (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) || > + ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize))); > + > + return RETURN_SUCCESS; > +}