From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id F100BD80D0C for ; Tue, 23 Apr 2024 15:59:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+4rR5LA5ovx1OgWefmLRr/YobqHXc9zSUOmaaz+YY9A=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1713887950; v=1; b=2H6YjqjAuv0KgYhaTWnLEfbd2wdVRflPndhO5CX7X3t9foiwqVUjD5yrhN209Yqgey6NhaTp 6QMWf2+6pp5NgJvQ06YbXz1BqE2Tq46KSLdXHNEOckspuOztjaE5ICP8BQcQ5cHGpCJhzT32F+e 4KxzVraQl17jpnfIu4GxUnDmkMHCOgT51zta4fSPJGcGn9SWVizzVSPV9GZ0qME2/3xkS1qM5V7 ipksZIbAXNtS4Y1pHfR7JZ6aWrVw5nHXVKNxfFTXwa9sPizRKI09c6SbqO7FrbEHQlqQOzjA270 T819qtmTK3cZsr14tm5545Yl2ZLDIZyE8lUT6U2Xov7gQ== X-Received: by 127.0.0.2 with SMTP id 7VCSYY7687511xXAKOoZJRuL; Tue, 23 Apr 2024 08:59:10 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mx.groups.io with SMTP id smtpd.web11.22448.1713887949396215102 for ; Tue, 23 Apr 2024 08:59:09 -0700 X-CSE-ConnectionGUID: e0NdrNwOSSCvKVV9LB9eoA== X-CSE-MsgGUID: I6/WdI0FT2KKTdt60U/4Qg== X-IronPort-AV: E=McAfee;i="6600,9927,11053"; a="20175728" X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="20175728" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2024 08:59:09 -0700 X-CSE-ConnectionGUID: RwwvSE03SL+EVEPtCXvVQg== X-CSE-MsgGUID: /d/nWUfzSt+gYcjm9LroFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="29207075" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 23 Apr 2024 08:59:09 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 23 Apr 2024 08:59:08 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 23 Apr 2024 08:59:08 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 23 Apr 2024 08:59:07 -0700 X-Received: from MN0PR11MB6158.namprd11.prod.outlook.com (2603:10b6:208:3ca::18) by MW3PR11MB4569.namprd11.prod.outlook.com (2603:10b6:303:54::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.22; Tue, 23 Apr 2024 15:59:05 +0000 X-Received: from MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::b0c8:dcaf:59ea:9e99]) by MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::b0c8:dcaf:59ea:9e99%6]) with mapi id 15.20.7519.018; Tue, 23 Apr 2024 15:59:05 +0000 From: "Wu, Jiaxin" To: Gerd Hoffmann CC: "devel@edk2.groups.io" , Ard Biesheuvel , "Yao, Jiewen" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v3 08/13] OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid Thread-Topic: [PATCH v3 08/13] OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid Thread-Index: AQHalWA1zBvqODpvrE2R+k29oKYKFLF1xUuwgAAQorCAACn88A== Date: Tue, 23 Apr 2024 15:59:04 +0000 Message-ID: References: <20240418065556.5696-1-jiaxin.wu@intel.com> <20240418065556.5696-9-jiaxin.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6158:EE_|MW3PR11MB4569:EE_ x-ms-office365-filtering-correlation-id: 9cc71b1a-7e44-42b7-c75b-08dc63ae4d2b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?MkZmZq9N3kkqNE8rTiQOu++Y2ZZ9IoLUQsWTwR9oVgVC+IOm6MK0yNcKQ0gu?= =?us-ascii?Q?mQimtQQ8JVL5j50jYwYBEVwZsoC0cHPttEwuzzZFbYtFNBl1PAeCPrXipms2?= =?us-ascii?Q?FEdz1GP5tIN0o9H43fKn+BrPE+xPIMt9tgyevdhKtrRN+FBwqSrmGdrs5SgM?= =?us-ascii?Q?f2RBU6ygQtdf2mC/IviWUPzSQJlorGIA2UhuULjillcVbVjEwwhCJ2c1FTrF?= =?us-ascii?Q?CjvV6iNqxQDGqwcKB6xB7m1Mkebu471rL1wPnubiKrTob0VaCGt6m31G9Wvs?= =?us-ascii?Q?7yB9Q8OoxikeXglRA/Ui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?= =?us-ascii?Q?t+Plu9+RboIYrjkLXE9EDTcfS91xeBeZA8ALmt8VstelUG+BkOASxr1FcuBN?= =?us-ascii?Q?Hgijs+0chCmddglb50KTrQluF/sMj06HY2uhrlhuLgxjv3P3NZh7nTRUKA5h?= =?us-ascii?Q?Nh/bxDtjIlCOmk/jYsV30y2gIKP9ERw431gLOhU2TFjGBQ=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WE/JaMLVMAsffq1T+9SpxzD+8sWJj18MIx/h/HQeBGeOMkv2qnQOy7Y0fGVo?= =?us-ascii?Q?eUFm8M1GpkRtJweV5cdRUPc5R1pfn6q9sC/h43OqfJ5hvmldPw1iHGsnJVB1?= =?us-ascii?Q?SXoZ4z8QNL6VF8rrkGNJIpacsWWUIzgtvXsFfpE/as9Gld7eID9IxO/YKRI+?= =?us-ascii?Q?r17tfcLZJCoT570EsYFAUQdbnoCKSZkHeS8W1uw9PxNI+9BuCZHQ8vf6oeaj?= =?us-ascii?Q?5FhlhCHVPCgyc1hySieNhfAdLJxn3o0pMjx7ICNTq1WooPWzvEx4+8aiVUAQ?= =?us-ascii?Q?6Ovgaze2VwKnnRkmhooFg97YqMsJxMH35+8l//VcIj7MsEpXFp5THECoiju8?= =?us-ascii?Q?H77EhtHyws9x6Kw64k74NUjpXY7Qs1BUzZ0b4AEwx1IOG/mOSPa8n2KiH2ks?= =?us-ascii?Q?XG2Y7cttt+4nbSnYDvQ48BQH8G9o23R2RHlPuwN7xfijZdMxQs2K0BuO1wM5?= =?us-ascii?Q?Zm4qcRfVyts8bjaJvMhUBKVG+wizal7NCDjXrxSFOUOTwSto3QS+b8M9OGIE?= =?us-ascii?Q?6EoUem4Evo2ApaqDzAjJSDxldI05wNDCC+G1ZR5AB5MliaUMpJMSqbChJQzF?= =?us-ascii?Q?wAj1Q5XxklH9cbPks0ijXdv4M+pKWq6cI3sv9R35okRmVUUlwj+mrdBQA/X/?= =?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dT8dasZj9bmmus+uKMvBV?= =?us-ascii?Q?3SDgYnptKP9xqoU0lHJRzl/0Nz3LX0yOBT60ETlR?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6158.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc71b1a-7e44-42b7-c75b-08dc63ae4d2b X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2024 15:59:04.9836 (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: 73waMBBQLVoWMK5A9egaALom20gH8JAhP82kHMDLZxfMyTav81xhu+uJUEIo/U+la2az2VBgtsMwSYSRjaaNEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4569 X-OriginatorOrg: intel.com 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 Resent-Date: Tue, 23 Apr 2024 08:59:09 -0700 Resent-From: jiaxin.wu@intel.com Reply-To: devel@edk2.groups.io,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Jmw6sC2KTEc5ZiR4az9wrQ4ix7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=2H6YjqjA; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) Hi Gerd, There was the issue in my patch to change the smm access driver: SmmAccessP= eiOpen(), I removed below code due to the comment in original code that ind= icate the DescriptorIndex is not considered at all: ... if (DescriptorIndex >=3D DescIdxCount) { return EFI_INVALID_PARAMETER; } // // According to current practice, *DescriptorIndex is not considered at a= ll*, // beyond validating it. // ... But it's important for smmlockboxpeilib to check the return status of SmmAc= cessPeiOpen (EFI_INVALID_PARAMETER) to continue the RestoreLockBox(): for (Index =3D 0; !EFI_ERROR (Status); Index++) { Status =3D SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTableP= ointer (), SmmAccess, Index); } So, it hangs at for() loop once I removed above code in the SmmAccessPeiOpe= n!!! After that fix, I still found S3 doesn't work, I checked the master code wi= thout my patch. It also can't work for S3, which means S3 broken on latest = master code. You can also double confirm the log that stop as below: ... S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE S3BootScriptDone - Success Call AsmDisablePaging64() to return to S3 Resume in PEI Phase Install PPI: 88C9D306-0900-4EB5-8260-3E2DBEDA1F89 Install PPI: 605EA650-C65C-42E1-BA80-91A52AB618C6 Notify: PPI Guid: 605EA650-C65C-42E1-BA80-91A52AB618C6, Peim notify entry p= oint: 82B5B0 Signal EndOfS3Resume Signal 96F5296D-05F7-4F3C-8467-E456890E0CB5 to SMM - Enter Locate Smm Communicate Ppi failed (Not Found)! Transfer to 16bit OS waking vector - 991F0 ----> hang here!!! Thanks, Jiaxin=20 > -----Original Message----- > From: Wu, Jiaxin > Sent: Tuesday, April 23, 2024 9:20 PM > To: Gerd Hoffmann > Cc: devel@edk2.groups.io; Ard Biesheuvel ; Yao= , > Jiewen ; Ni, Ray > Subject: RE: [PATCH v3 08/13] OvmfPkg/PlatformInitLib: Create > gEfiSmmSmramMemoryGuid >=20 > More info: > I quick dump the SMRAM info with original SmmAccess implementation, it's > same as I produced in the gEfiSmmSmramMemoryGuid HOB. >=20 > SmmAccess: > SmmAccessPeiEntryPoint: SMRAM map follows, 2 entries > SmmAccessPeiEntryPoint: 7F000000 1000 = 7F000000 > 1A ---> for the S3 Resume in gEfiAcpiVariableGuid > SmmAccessPeiEntryPoint: 7F001000 FFF000 = 7F001000 > A >=20 > Smram map in the gEfiSmmSmramMemoryGuid: > PlatformQemuInitializeRam: 7F000000 1000 = 7F000000 > 1A --> ---> for the S3 Resume in gEfiAcpiVariableGuid > PlatformQemuInitializeRam: 7F001000 FFF000 = 7F001000 > A >=20 >=20 > Thanks, > Jiaxin >=20 > > -----Original Message----- > > From: Wu, Jiaxin > > Sent: Tuesday, April 23, 2024 8:19 PM > > To: Gerd Hoffmann > > Cc: devel@edk2.groups.io; Ard Biesheuvel ; > Yao, > > Jiewen ; Ni, Ray > > Subject: RE: [PATCH v3 08/13] OvmfPkg/PlatformInitLib: Create > > gEfiSmmSmramMemoryGuid > > > > > > > > > + SmramHobDescriptorBlock =3D > > > (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)(Hob.Raw); > > > > > > > + SmramHobDescriptorBlock->Descriptor[0].PhysicalStart =3D > > > PlatformInfoHob->LowMemory - TsegSize; > > > > + SmramHobDescriptorBlock->Descriptor[0].CpuStart =3D > > > PlatformInfoHob->LowMemory - TsegSize; > > > > + SmramHobDescriptorBlock->Descriptor[0].PhysicalSize =3D > > EFI_PAGE_SIZE; > > > > + SmramHobDescriptorBlock->Descriptor[0].RegionState =3D > > > EFI_SMRAM_CLOSED | EFI_CACHEABLE | EFI_ALLOCATED; > > > > > > > + SmramHobDescriptorBlock->Descriptor[1].PhysicalStart =3D > > > SmramHobDescriptorBlock->Descriptor[0].PhysicalStart + EFI_PAGE_SIZE; > > > > + SmramHobDescriptorBlock->Descriptor[1].CpuStart =3D > > > SmramHobDescriptorBlock->Descriptor[0].CpuStart + EFI_PAGE_SIZE; > > > > + SmramHobDescriptorBlock->Descriptor[1].PhysicalSize =3D TsegS= ize - > > > EFI_PAGE_SIZE; > > > > + SmramHobDescriptorBlock->Descriptor[1].RegionState =3D > > > EFI_SMRAM_CLOSED | EFI_CACHEABLE; > > > > > > This is not going to fly. > > > > > > First, smram allocation doesn't work that way. Have a look at > > > OvmfPkg/SmmAccess. I guess that easily explains why this series > > > breaks S3 suspend. > > > > > > > Oh? Could you explain a bit more for 1) how smram allocation works? 2) > > what's the possible reason break the S3? I haven't check yet. > > > > > Second, storing these descriptors in a HOB (which is PEI memory) > > > is questionable from a security point of view. > > > > > > > HOB is only to expose the SMRAM address and size, not the contents in > > smram, what's the security concern? > > > > > > Thanks, > > Jiaxin -=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 (#118174): https://edk2.groups.io/g/devel/message/118174 Mute This Topic: https://groups.io/mt/105593577/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-