From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.1165.1628205332181037342 for ; Thu, 05 Aug 2021 16:15:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=gH3tyLh9; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10067"; a="299861863" X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="299861863" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 16:15:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="459191005" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga007.jf.intel.com with ESMTP; 05 Aug 2021 16:15:31 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 5 Aug 2021 16:15:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Thu, 5 Aug 2021 16:15:31 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.46) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 5 Aug 2021 16:15:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mu0d7K1KaYgtme0VudQHpg9c01af92GeU/XZduhzthVcq1MgbBemEbm/WS6o8OoPrjft3eMfWyNdipi2QxvLNhH8kH9mJ4++wwqPEqWNSlzepiNZeaTXg7jaTFH0UlmuFpbYXbqA1uXwzjYCZEWIsUAdg7izAimC9LbmfI7MKZ0SDjexvH8ZQnQ7W7uEteks3S/mrnwdkqkP+sTQ7gyzrnnVX4o3tiDmXQiJX6TNUHPeSByo/x+ytqwgwAcYSvesNJCQoFERFziysPsnX29ePMxLl0K2XWtfL8Z0kNBd2zfZFhb+q3pUNKao8pWs/5AdFg/zjdOd1Uqtc8gNqS6Bqw== 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=guiWkbhVbbgJNU3Fv4weEoZTmqtp4lqGacIqspdqhj4=; b=eMZ7CYmwviMLigrq20AUJdcGZ3fU5XTMp2FtIyKuT8sk49fLR0yoB7YOWzGYCTv+6+ukZ6fSwVBWKKVHgk4l0nFzmXvAeOaj4Honcf4JzHOWYesBtIc/Uy29B8McgFYysf2XN3GMYz4+vo/0R+F5jd8dcXQbNLXwEeX5JGvD5SHwjx34cU8X4sPXUvqBx/OD5WXXuHDKo5cUG8gZffPa9uZEoAtjSlviBVm08+AVHp+APRAhnCxQ/Og/q6axs7NYzzL7a5zseAuXTLTWRlVyqRjprklhWN/9GRbPEEYWifMjFHdHI0UacNVcUdabUP16msSnA5OMeTm1bB0oUy0tlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=guiWkbhVbbgJNU3Fv4weEoZTmqtp4lqGacIqspdqhj4=; b=gH3tyLh9jCZbUPRzh8prBrdJoQeweZCKO9dNnSKMl1HsKR9J+wNyBORXUNhQ14uvb/7/7afqpshBLqgZgv6bggujwyQzBTY4vvsrF8DktnAKufxrjece82TyR65lshJTw+QdEG+E3aCIgIfIck9G2FUW5MVbobZ2PXX7oEdNVsI= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:6e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15; Thu, 5 Aug 2021 23:15:29 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7%5]) with mapi id 15.20.4394.017; Thu, 5 Aug 2021 23:15:29 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "mikuback@linux.microsoft.com" CC: "Chiu, Chasel" , Liming Gao , "Dong, Eric" Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 4/5] MinPlatformPkg/TestPointCheckLib: Improve adjacent region checking Thread-Topic: [edk2-devel] [edk2-platforms][PATCH v1 4/5] MinPlatformPkg/TestPointCheckLib: Improve adjacent region checking Thread-Index: AQHXigpCEdVox5YX9UGIGkSSIxbbuqtli0Xg Date: Thu, 5 Aug 2021 23:15:29 +0000 Message-ID: References: <20210805145706.2470-1-mikuback@linux.microsoft.com> <20210805145706.2470-5-mikuback@linux.microsoft.com> In-Reply-To: <20210805145706.2470-5-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 76d6a8fe-cb76-462a-54ee-08d95866eac6 x-ms-traffictypediagnostic: CO1PR11MB4787: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: l12gatkaeNPF89YIC3mj7eByK7HzGdUD5QGjCr7CAquDZigKN2J+lFL7xL0OLVjRusxXQwQwEVurVFs5NdjUF6kd9p9UI7FPaHW14ythlbej4ZmdTvHa6/22zRqNPW4ImNXsX5FfWA9402N1d0fGMYIShf7NPscG/EQ2ljSkaNq8lbr3AVjH0zdFKfdOgKpjucT7ayKt6JlYFvGFpI5cr4TJ9agHvybgXA4lxGa6Jr22ycMp3OVMmPqId/kW/N//+yo2J9M/ZDE4etvUX2I7a8FZACBN2rQpVhNZqbFFe6LX1LSQ7f+svj+EZzewEK7a88IqnYJE907hOg0o+dgVZt+fi000xKczUIYNuXG39gMGBfS+WhZgwMVvrqGPVLGnU61YUPyqRnc3UAl+9CujR7yKtFdOhfM/3cGZkL1YzRfGQG7KgljHh+8wET0cCc6T3TfYF7KzaaKtHBswvnLoxT4BOBM4mCfc0tTbk9bmw6OkZUP4lvaA7LUx1Ddbh536jJ/uEk+wVQiDZfqvPy3E6N4ToMSkRZ20r0oS5qOcaxu9vUyCJclmWh4zplFDk2ckQ5+LKuBemzqhvWcPxvn2JcU5I1g9bG0OyqJZrsVPj+3iFbT2uPnfWCD1Pq/rNIvXNxsB8h42svOMx/TFBCDGhAWE69c6adSWNrxB4CTc7YLxM+A6BhDgD/TPEkjQsFZ8vOBArWBJembLmrj1FC0QECWDmlY+sy39f6Wg6JatY3Z00zGAQBaPOVghRtRMmbWY0gkNihbT/XrTFtoGh5erMKurnYRY3/a76qMN0G0oRJ7j7vUfQMuYVkzS9dDJsboKocKSz5dZDpbxRvBEYDZT7A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(71200400001)(186003)(38070700005)(83380400001)(33656002)(38100700002)(66946007)(86362001)(966005)(26005)(2906002)(8676002)(122000001)(8936002)(4326008)(6506007)(53546011)(52536014)(107886003)(7696005)(9686003)(110136005)(316002)(54906003)(5660300002)(76116006)(508600001)(64756008)(55016002)(66476007)(66556008)(66446008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FG1cL8ZIqQesg5w3cy9l86zTbXNF+/mnXSQIt6vb/kG20GPJ393riHmUNQsu?= =?us-ascii?Q?AS8Bnyx4RYWEZOVvsbzhhSG9+uaCsjCxmSkmYbR6xCVI+SVbrFyNvErh0D/1?= =?us-ascii?Q?jyi7h4DjiQkvYxEDWFwMs6mzEVUjZtq28zVxQwLAKorFV+yVf4qwBmGsBKT4?= =?us-ascii?Q?vsLGqUihpGyCZMfCfz7dSc39IpbT1dQgMU3Zb1Td62hKkv3NW2T4gn21ZiHh?= =?us-ascii?Q?mfqeb5W5NiYdBP+1CatAn0eJIR7kh9jvBY7bLRfFUZeXC5jnfL+cR16IDZgw?= =?us-ascii?Q?AkbWkQbZDf1WO1J5GhoXj47b+6kTTryQbMGkwdYsjOfSph1Z/a7DNpWize2a?= =?us-ascii?Q?dRH8zhn4fSIod6uUsFxmTDfVTDUFN5F4GrKqGRNvvp6dGUthgeRIRbiLBDIn?= =?us-ascii?Q?vS5GpZ3pQFKcyPURhMIheFpyPKfwQ7jTsDiMV8X7FNJn7dG53q7gMUxCTK7D?= =?us-ascii?Q?RaoDXZ5P6SlEC2DaRkK6qVOl/nzFSJJXRhE2bayb7y0mhik6cloG7ZA9Qjgc?= =?us-ascii?Q?1CsHwvzYY8f7u3MM5a8S3mSvZ5CN2kc3Fzf0YMFWhdL/B7V/K/bTBCODw6bk?= =?us-ascii?Q?QZF4sCjkqC/8P9GZpRJmxBzSJJVrEBXcvEWKQtZI0OcPznlyGVaLIwFMEBpg?= =?us-ascii?Q?FtUWUukklOYmsEwRW6bJYxQJq5sPp863IhKcQQr5eoQ3H1ip+MpDhn8cY4hP?= =?us-ascii?Q?sFbNg69ox4gD84XZOQ4gqhT4vR84c4FDicgspSP7Y2tuhVHOy4ndrOGBpkbp?= =?us-ascii?Q?igZTtCzFUxFTMOKtcsZvY59IQ4Mtni3AkRBm+VE3m+qISkSeq8Ss2v4++D4O?= =?us-ascii?Q?AaI3BDGpTTQHDOzGStm0sxtfehTpGMomuG7E2QsninbjvchD0hTRHaBA4VVw?= =?us-ascii?Q?v6VccC6uWBI4bUj6FzsLbP7bIs1PvmwMVikafajwmj6UhrA+Z7TFvR6C2KMs?= =?us-ascii?Q?bSMrG3h+DJGrdfA90ED1dCrnkxQuud6MzhTWX9wOA6XAY6cpURP/kCLC7ybh?= =?us-ascii?Q?k78TjCZf13x6QrSE9zATEGjv0DSeabKeRvr0CuJhF3DmzMSQ84Y9EwAXnmii?= =?us-ascii?Q?JkKRjU58LDVZS1SJBXKLR1FMFuX12CdR39qfWfzDyvwMWpJdz6dc0xnG6YbS?= =?us-ascii?Q?6MBbceHnPmB8ar7MiuGZClx4mYNBzeO3CpSFna005oHhU4FsAEFEUm+WVawp?= =?us-ascii?Q?urLfWesdmsD+7cBbfLU0pkPl7qkUhA5GNHYrUndrLmLMRuimkzHaVRdkHBbH?= =?us-ascii?Q?mqwkMicokLX4cDBYABZJWv0gWGYkRQ54h4KY+2Msda8Bfc0Qt1pwIokeFqy3?= =?us-ascii?Q?dAF9ivs4qSLEZ7H9mgzqkakv?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76d6a8fe-cb76-462a-54ee-08d95866eac6 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Aug 2021 23:15:29.7631 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: J+vV9ZtDwoggWQULhCDD8XVFpbFHx/5Mn2lxt78Yay9RadJUKL8uvVPKsPBM21KQ+YsfM3lxiGYxt6d2u6V5kCo9uFZGdAp9n4ObhWWMb7c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4787 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Michael > Kubacki > Sent: Thursday, August 5, 2021 7:57 AM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L > ; Liming Gao > ; Dong, Eric > Subject: [edk2-devel] [edk2-platforms][PATCH v1 4/5] > MinPlatformPkg/TestPointCheckLib: Improve adjacent region checking >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3521 >=20 > The current logic depends on a particular order in which the descriptors = for > three or more regions are placed in the array to perform proper adjacency > checking. When three or more regions are all adjacent, but neighboring > descriptors are not adjacent, the logic can improperly report a failure. = Adjust > the logic so that all descriptors are checked for adjacency. >=20 > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Cc: Eric Dong > Signed-off-by: Michael Kubacki > --- >=20 > Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckS > mmInfo.c | 56 ++++++++++---------- > 1 file changed, 29 insertions(+), 27 deletions(-) >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > SmmInfo.c > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > SmmInfo.c > index c493750a27e6..f15f76eab574 100644 > --- > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > SmmInfo.c > +++ > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh > +++ eckSmmInfo.c > @@ -59,34 +59,36 @@ CheckSmramDescriptor ( > ) > { > UINTN Index; > - UINT64 Base; > + UINTN Index2; > UINT64 Length; > + BOOLEAN AdjacentRegion; >=20 > - Base =3D 0; > Length =3D 0; > for (Index =3D 0; Index < NumberOfSmmReservedRegions; Index++) { > - if (Base =3D=3D 0) { > - Base =3D Descriptor[Index].PhysicalStart; > - Length =3D Descriptor[Index].PhysicalSize; > + AdjacentRegion =3D FALSE; > + for (Index2 =3D 0; Index2 < NumberOfSmmReservedRegions; Index2++) { > + if ((NumberOfSmmReservedRegions =3D=3D 1) > + || (Descriptor[Index].PhysicalStart + Descriptor[Index].Physic= alSize =3D=3D > Descriptor[Index2].PhysicalStart) > + || (Descriptor[Index2].PhysicalStart + Descriptor[Index2].Phys= icalSize > =3D=3D Descriptor[Index].PhysicalStart)) { > + AdjacentRegion =3D TRUE; > + break; > + } > + } > + > + if (AdjacentRegion =3D=3D TRUE) { > + Length +=3D Descriptor[Index].PhysicalSize; > } else { > - if (Base + Length =3D=3D Descriptor[Index].PhysicalStart) { > - Length =3D Length + Descriptor[Index].PhysicalSize; > - } else if (Descriptor[Index].PhysicalStart + Descriptor[Index].Phy= sicalSize > =3D=3D Base) { > - Base =3D Descriptor[Index].PhysicalStart; > - Length =3D Length + Descriptor[Index].PhysicalSize; > - } else { > - DEBUG ((DEBUG_ERROR, "Smram is not adjacent\n")); > - TestPointLibAppendErrorString ( > - PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, > - NULL, > - > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_CODE \ > - TEST_POINT_DXE_SMM_READY_TO_LOCK > - > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_STRING > - ); > - return EFI_INVALID_PARAMETER; > - } > + DEBUG ((DEBUG_ERROR, "Smram is not adjacent\n")); > + TestPointLibAppendErrorString ( > + PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, > + NULL, > + > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_CODE \ > + TEST_POINT_DXE_SMM_READY_TO_LOCK > + > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_STRING > + ); > + return EFI_INVALID_PARAMETER; > } > - } > + } >=20 > if (Length !=3D GetPowerOfTwo64 (Length)) { > DEBUG ((DEBUG_ERROR, "Smram is not aligned\n")); @@ -94,7 +96,7 @@ > CheckSmramDescriptor ( > PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, > NULL, >=20 > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_CODE \ > - TEST_POINT_DXE_SMM_READY_TO_LOCK > + TEST_POINT_DXE_SMM_READY_TO_LOCK >=20 > TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERRO > R_STRING > ); > return EFI_INVALID_PARAMETER; > @@ -111,14 +113,14 @@ TestPointCheckSmmInfo ( > EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; > UINTN Size; > EFI_SMRAM_DESCRIPTOR *SmramRanges; > - > + > DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckSmmInfo - Enter\n")); > - > + > Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VO= ID > **)&SmmAccess); > if (EFI_ERROR (Status)) { > goto Done ; > } > - > + > Size =3D 0; > Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, NULL); > ASSERT (Status =3D=3D EFI_BUFFER_TOO_SMALL); @@ -128,7 +130,7 @@ > TestPointCheckSmmInfo ( >=20 > Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, SmramRanges); > ASSERT_EFI_ERROR (Status); > - > + > DEBUG ((DEBUG_INFO, "SMRAM Info\n")); > DumpSmramDescriptor (Size / sizeof (EFI_SMRAM_DESCRIPTOR), > SmramRanges); >=20 > -- > 2.28.0.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#78714): https://edk2.groups.io/g/devel/message/78714 > Mute This Topic: https://groups.io/mt/84686308/1767664 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [nathaniel.l.desimone@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20