From nobody Sun May 5 12:15:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58531+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58531+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=nxp.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588427608673424.66966241960847; Sat, 2 May 2020 06:53:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WsmrYY1788612xDgtI9GQgcM; Sat, 02 May 2020 06:53:28 -0700 X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.51]) by mx.groups.io with SMTP id smtpd.web10.5340.1588427606393231996 for ; Sat, 02 May 2020 06:53:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTJhIlv9QfzLscav9t6yIE0Nb7Sm9tJWnep7bEpQso9RYtf9F4aqL6mGbXN1LDJ8YFL7WlUw/fWm0Z2v3etF1pKCcmHzjAZo3NooMvu2PwghjrrHtkUN7WK2S6DtvGt7m4x/FQVFGA+HXXP8L4yX9ujqO+MXozJt6uIbuZL3rQeuRuPUbygdVc9SQlNrYT/DP8htkJP0TLOhZdDcR4uZOd5PQak/6PvJUp+5t+EuDGt/kg3LVV5KrMprx3Nn1pb/8R5l5VA8qZmUhhq+R/p6zz+hg3QE9ze/xLX5cX5+MZjwwhhEP6RAG0iU/5r3id5hyEkSj6dz2Cm0kbJ/Q3OF6w== 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=t+Aw/Vh6m2jLjVI0CjQwPm0hFkzWHnFufiF40DrRmCo=; b=ZX+uceAWHzO76cZPXs/WSEseZLzn/uD6ADz+Z9CXSF+qjc4RS1KIVLb9ZFkJLYny7r7Uct14u4lDOHFGwrfAuIcMrVvAFWHWsICsxOA6/j+9zHWQba2BXJ8nw/4/ODSE1DeuAYuLqKWs+R4taVUJPnDeLq3WpzGBpqq6Og+uovyDU0CveDBBQbBEMzztXdi7O6v96gvw9sh0beDrwCZk4ihj093iR5DE5lG3f6inBxkgYaY756iYNRNMGxRgdAJ2dhrFZEk52/u3Kd3yD8fQfg8W69GCvT7eDCrrWlYOgu+8O5idFQpktEXpjiYLd944njm47rTJdX1msx9y+VMffA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none X-Received: from AM5PR04MB3074.eurprd04.prod.outlook.com (2603:10a6:206:4::16) by AM5PR04MB3107.eurprd04.prod.outlook.com (2603:10a6:206:c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Sat, 2 May 2020 13:53:23 +0000 X-Received: from AM5PR04MB3074.eurprd04.prod.outlook.com ([fe80::e50b:610e:7080:e559]) by AM5PR04MB3074.eurprd04.prod.outlook.com ([fe80::e50b:610e:7080:e559%7]) with mapi id 15.20.2958.027; Sat, 2 May 2020 13:53:23 +0000 From: "Gaurav Jain" To: devel@edk2.groups.io Cc: Eric Jin , Supreeth Venkatesh , Prasanth Pulla , Samer El-Haj-Mahmoud , G Edhaya Chandran , Ard Biesheuvel , Pankaj Bansal , Gaurav Jain Subject: [edk2-devel] [edk2-test PATCH v2] SctPkg: Updated Start Address Alignment code Date: Sat, 2 May 2020 19:23:04 +0530 Message-Id: <1588427584-31684-1-git-send-email-gaurav.jain@nxp.com> X-ClientProxiedBy: SG2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:3:17::16) To AM5PR04MB3074.eurprd04.prod.outlook.com (2603:10a6:206:4::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from lsv03032.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:3:17::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2958.26 via Frontend Transport; Sat, 2 May 2020 13:53:20 +0000 X-Originating-IP: [14.142.151.118] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e71a51d-880b-4154-02d2-08d7eea02e01 X-MS-TrafficTypeDiagnostic: AM5PR04MB3107:|AM5PR04MB3107: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: p1OWCFU1dtTUqtA9n5J2nrxFKJmScFj1sdRUhxVJbs6wKO62fqPl8bOIH6m+zEcA17shORd6eQIRL2fhkyee7KNkkX4bUdOiJdrWKUivEP2l+8T3ip3ech4f0piYQajnFqjb3zC38rHIMhd94qxHKjitGF8PVS9MOTIcomABZcQkiZhAfqxsQZGLTd4dnMwL70DeYDAwWcbRrqJtGNPF8Ju0BJvYLU84fO5fraEUPrzUXsw/NiTgb499Rw+tw86MVdGkzDWVBmkX3aB5uVs3URx+rryNEfMjoRlzJvtPD9haFZbbk+M3DBycWUgThMFFPNm9/f/hdgVyAnW52HGUplyS4D6rPVdN5BowiHnCB88SuaepU5VWmJrFZyCOZVtNWEQnqrxvPRAXGe9Kqh/exG6JywQ+sNNlfOkGhqex0XJKrU0zuItDFNmtubN48eXpIJqFZMlZO0l0G2+C1lexQao6KL4KIMDRMJi734+3mNJQK0IUki87TJTi9zddbZhXaF3nTTo9Dk42T83OhSmIDnizT4ZruL96TbIa+cxXkytQpOYkdRBXzq3nPnxxrvmwvRy/GOvp81cXnVRd+toJwQ== X-MS-Exchange-AntiSpam-MessageData: 68k0rJmSdRJ48BsMXycGpcNRTgQTZywUr9ZOF6vJds0Jst1D/wTR95rhJZRx5YBCGTwTyk79Xurj7/q9bg43C6eglJKWfvjzhc+XlpcD6IrVFjpbLCS7pxn8kuV1y+DSXoLhvPYFVgQVlJnsKgIeEgWhlKogMAC56NfvreuJBm8nncV9vtI00QpnoEQW8pp9mB4xrvf6D/OC/QfmCxtr2+Ea2y8IJHN+bMVM0Y7K8kUvVyi9fOt2rC28n2A0rmeGWYRfhtXqLlq5FAI114neXYhW+RSmtYbfo5r1ZDYLSTkrcchR3bRebsNX2MWyZNcRJT4A5aArBeVrTFH26NnLkI/dZaa7pdtBOtc8W/pVCNGdFWcwH7ihbLe0nPo8FRvtJPb6y6EMrFNJVq++a7ulNrDND/ufIC2Ez4qcNdshYNLw6qamMTUo2LGVMjZbK9fR/xak/ICqdnixRRDK7KKWtbnw2TVn6i7TAT+LZW1AyvPamSMg/oKDNeib26CUhGgxnm4inwKO2z6Q348HCeqXa+STgNpHS+OBh6PsfhNQ76JWdTs01EFSISFTcOsl0X9U9u99VhXF65H3kPhUpNeOlICYaE4bDf47oxg5jK4vFAjg75S9pmvpWQ4ePdqMd1tdCgiSLDXg5NWiAB65XK8WqotI31scul8DU/BC27XbwCIWesiLiZmHl5MWLIVCqgZg910+QWrPVAeLwdU5D2w076wSZfiNEikKpPu2TrRSjVCwwQWJEcJQFwG8Ixk7bC5ooNEAmvnu2zxeCPzm/w/55d3TT4T5dsvhYy9B77vlzCI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e71a51d-880b-4154-02d2-08d7eea02e01 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2020 13:53:23.4898 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ugC7mHMWCsX0eUJTJ2yWEnw7dA0THKJ0unQY1fMaIN9iuWS8yF/EpCx+KkS1ZESB6CReVAr3EZ1okxjGnDZrng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR04MB3107 Precedence: Bulk List-Unsubscribe: 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,gaurav.jain@nxp.com X-Gm-Message-State: xnOqgefsqQawlryKo27WaTqHx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588427608; bh=EGm9LZKHLmJB+I4Wq79cGfwZGUFcNYmW40Wi3ak3SoU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=F/uEQIuCNhq/8M5GRR43jrb+z+hoGc0AR9GYh268eKE34Fpnm6K9CJccCzmSingoPKN vBN9sSml7xhlch2NEUjv3o5iadLTBNjDp+pcL7oQ0JCnie2c02y9fcBNI5g9fsMI8UvGE oY7YpyCdyuCEqRwiWsfrW8yzWqXfqDOqA0k= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2671 AllocatePages Functionality test. Existing Code Increase Start address by 64k, even if Start is already aligned to 64k. Suggested Change will not modify Start, if Start is already aligned to 64k For Eg. Available Memory(Start is aligned to 64k): Start End PageNum(Free Pages) 80000000 EBD6EFFF 6BD6F(Number of Free pages are not 64k Aligned) edk2-test code: Start is increased & aligned by 64k(Equal to 16 pages of size 4k each). Request for Pagenum is minus by 16 Pages. Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000 Start =3D (0x80000000 + 0x10000) & 0xFFFFFFFFFFFF0000 =3D 0x80010000 PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000) =3D 0x6BD6F - 0x10 =3D 0x6= BD5F edk2 memory allocation code to Align the requested pages to 64k boundary: Reviewed-by: G Edhaya Chandran ------------------------------------------------------------------------ NumberOfPages +=3D EFI_SIZE_TO_PAGES(Alignment) - 1 =3D 0x6BD5F + 0xF =3D 0= x6BD6E NumberOfPages &=3D ~(EFI_SIZE_TO_PAGES(Alignment) - 1) =3D 0x6BD6E & 0xFFFF= FFF0 =3D 0x6BD60 We can observe that requested pages is incraesed by 1 page, which results in below error. ConvertPages: range 80010000 - EBD6FFFF covers multiple entries. Signed-off-by: Gaurav Jain --- Notes: v2 Updated Commit Message with an Example .../BlackBoxTest/MemoryAllocationServicesBBTestFunction.c | 14 +++++++---= ---- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocatio= nServices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c b/uefi-sct/= SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/BlackBoxTest= /MemoryAllocationServicesBBTestFunction.c index d18fe1f..a42cd9a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServic= es/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServic= es/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c @@ -706,7 +706,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start; @@ -836,7 +836,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start; @@ -959,7 +959,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start + (SctLShiftU64 (PageNum/3, EFI_PAGE_SHIFT) & 0xF= FFFFFFFFFFF0000); @@ -1082,7 +1082,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start + (SctLShiftU64 (PageNum * 2 / 3, EFI_PAGE_SHIFT= ) & 0xFFFFFFFFFFFF0000); @@ -1212,7 +1212,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start; @@ -1335,7 +1335,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start; @@ -1474,7 +1474,7 @@ BBTestAllocatePagesInterfaceTest ( if (PageNum <=3D 0x10) { break; } - Start =3D (Start + 0x10000) & 0xFFFFFFFFFFFF0000; + Start =3D (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000; PageNum =3D PageNum - EFI_SIZE_TO_PAGES(0x10000); =20 Memory =3D Start; --=20 2.7.4 -=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 (#58531): https://edk2.groups.io/g/devel/message/58531 Mute This Topic: https://groups.io/mt/73935158/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-