From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.32; helo=mail-in22.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in22.apple.com (mail-out22.apple.com [17.171.2.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 896F320971741 for ; Sun, 27 May 2018 13:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1527453856; x=2391367456; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xrbJ1p39+fuwAo5FIlSoLtU55xte9E9maSIFTh9fT+0=; b=GXLxpM8ZCUNi3S73uQtVveY3pzpOhHq/hzBKlox6c0T6fvoBevF9Ox+rSWF8SP8h Td5aqqVIGh0zP61se6WjnWLgp32dKBGja7hes7IdI4pGklcNjpUT+3NTNH4AUJ8R rKmfTdTlascx4opQNpoNhAONgFMchsPhbAU+IOxcMAL2xi1C2WjoTp1fHPartp25 w5ZDkd4bRQjr+RiDuGsjJBH3D2S89HM8fp9PfSaiGgZr9rvT959EPwW1tAnNIY6d QndqYdsELsdaD6Bfl6iyhbBUrNbHM+pQogw9fWg9Iev5/cXB05Hdn15flX1mETPi kYF2oyLtx8ORMpHdow102w==; X-AuditID: 11ab0216-e0dff70000002e83-3a-5b0b189fd37e Received: from ma1-mtap-s01.corp.apple.com (ma1-mtap-s01.corp.apple.com [17.40.76.5]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail-in22.apple.com (Apple Secure Mail Relay) with SMTP id 6D.7B.11907.0A81B0B5; Sun, 27 May 2018 13:44:16 -0700 (PDT) MIME-version: 1.0 Received: from ma1-mmpp-sz10.apple.com (ma1-mmpp-sz10.apple.com [17.171.128.150]) by ma1-mtap-s01.corp.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180329 64bit (built Mar 29 2018)) with ESMTPS id <0P9E001BAMXROB50@ma1-mtap-s01.corp.apple.com>; Sun, 27 May 2018 13:44:15 -0700 (PDT) Received: from [17.234.177.43] (unknown [17.234.177.43]) by ma1-mmpp-sz10.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180403 64bit (built Apr 3 2018)) with ESMTPSA id <0P9E00IXNMXOTN10@ma1-mmpp-sz10.apple.com>; Sun, 27 May 2018 13:44:15 -0700 (PDT) X-Va-A: X-Va-T-CD: 1aca8e1c60e7b90bb50f7ec4cabe7d31 X-Va-E-CD: 180a5a6e85d6c831d5b48afa05384183 X-Va-R-CD: 4bb4db1280b847e4cbdc5a90350b1a38 X-Va-CD: 0 X-Va-ID: a74e414e-445b-4b1f-9606-75e65cee7cc9 X-V-A: X-V-T-CD: 4a30a624aacf26b334adcf21321ddbc3 X-V-E-CD: 180a5a6e85d6c831d5b48afa05384183 X-V-R-CD: 4bb4db1280b847e4cbdc5a90350b1a38 X-V-CD: 0 X-V-ID: d89e71e4-4a47-4634-b09d-1436852dd4a2 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-27_11:,, signatures=0 Sender: afish@apple.com From: Andrew Fish In-reply-to: Date: Sun, 27 May 2018 13:44:11 -0700 Cc: "edk2-devel@lists.01.org" , Abhishek Singh , "ruiyu.ni@intel.com" , Laszlo Ersek , "eric.dong@intel.com" , "star.zeng@intel.com" Message-id: <0C4E04D0-E863-4779-AFFA-44A0E6F8FB20@apple.com> References: To: Marvin H?user X-Mailer: Apple Mail (2.3445.6.18) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsUiqOHDqrtAgjvaoP8jr8X17xMYLfYcOsps sflFsMWyYztYLN7+v8pu8bJnNbvFvl5rB3aPQ7+usXgs3vOSyaN79j8Wj82vXzB7vN93lS2A NYrLJiU1J7MstUjfLoEr4/Ccj0wFW2QrGq4dZG5g/C7excjJISFgItG3+AlzFyMXh5DAfiaJ lo7N7CAJXgFBiR+T77F0MXJwMAvISxw8LwsSZhbQkvj+qJUFon4jUP3JXqjmiUwSr08+YIGY yi7x59cOKFtbYsulDiYYe/nyWWww9s9d09khbC6JBVtPs0LYuhK9vf+ZIWw2ifUnlkD1aknM 2HyKEcZ+e+kmG4zdueUtVC+nxPkvE6Fm6kj0fJgKVZMtsWnzCrAaYQFxiXdnNjFD2EoSV44/ A5vJJqAssWL+B7BeToFkieVTj4L1sgioSux+/pMd5ElmgVYmiWMvb7FBQshGYsum+WwQ369k lDj77y1Yt4iAnsSyp++gvleS+L/rCPMERrlZSKE6CxGqs5BCdQEj8ypG4dzEzBzdzDwjI73E goKcVL3k/NxNjKCUsZpJbAfjvdeGhxgFOBiVeHgbfnNFC7EmlhVX5h5ilOZgURLnXRzEES0k kJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qB0eH18cvq9Yt2LjwW/bt2ZXrKM2m1DYZFFsYn3r14 6XQgwbZxp13JGZcpSqmfj96z8LA/fvF/2axdGZnPe6aUKZzIkf2p8YoruVHQeN1vU0Pz3/cz Is4l+ik7eXp7yvU33xL5OFO1LkjMcWNoXuTsyafnpyy3UTJ48zfNKJKl99LTE1trBGrWKrEU ZyQaajEXFScCANN+bfH6AgAA Subject: Re: smm lock query X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 20:44:18 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > On May 27, 2018, at 9:47 AM, Marvin H?user wrote: > > Good day Abhishek, > > I CC'd the MdeModulePkg maintainers, Ruiyu for the Platform BDS aspect (exposes the ReadyToLock protocol) and Laszlo for his high-quality answers. > > Strictly speaking you are, right, because of the description for the MM protocol: > "Indicates that MM resources and services that should not be used by the third party code are about[Marvin: (!)] to be locked." > Practically however, I don't see any issue with the current implementation. Code inside MMRAM is not affected directly by the lock, it is just notified. > However, either the code or the specification should be slightly updated to be in sync. A code update might require review of the caller assumptions, just to be sure. > > I have a different concern though and hope I'm actually overlooking something. > If I understand the code correctly, it is the Platform BDS that exposes the (S)MmReadyToLock protocol. PiSmmIpl seems to consume that event and lock SMM resources based on the event. > Because of latter being an event however, I don't think it is, or can be, guaranteed to be the last event group member executing. > When it is not the last, the "about to be locked" part is not true for any subsequent callbacks, that could actually be a risky break of the specification - if it is. > If it is a break of the specification, I can only think of letting Platform BDS expose an "internal" event group, which is only caught by PiSmmIpl, which then drives the actual SmmReadyToLock flow. > This would require updates to all platform trees and hence I would propose a temporary backwards-compatibility. > > Any comments? Did I overlook something (I hope)? > Mavvin, You are correct there is no guarantee of order in events. Thanks for cc'ing the right folks, as I don't remember all the low level details... In general the idea behind the MM code is it only comes from the platform, then by definition that code should be aware when the platform was going to lock MM. In a practical sense any MM module that had a depex evaluate to true would have dispatched in DXE prior to BDS being launched. In general BDS is the code that enumerates PCI and connects devices, thus there is no chance for 3rd party software to run before that point in the boot. So in an abstract sense that lock represents the end of DXE dispatch. We probably need to reread the PI spec and make sure the spec is following the letter of the law, but I'd guess locking earlier is likely OK. Thanks, Andrew Fish > Thanks and regards, > Marvin > >> -----Original Message----- >> From: edk2-devel On Behalf Of >> Abhishek Singh >> Sent: Saturday, May 26, 2018 5:05 PM >> To: edk2-devel@lists.01.org >> Subject: [edk2] smm lock query >> >> Hi, >> >> This is the first time I am mailing to this list. If this is not the right place for the >> kind of questions I am asking please let me know where to direct my queries. >> >> I have been looking at the SMM IPL code and a portion of the code is a little >> confusing to me. In the function SmmIplReadyToLockEventNotify, smram is >> locked (mSmmAccess->Lock) before the ready to lock notifications are sent >> through SmmIplGuidedEventNotify. Shouldn't the lock be placed after the >> ready to lock notifications? >> >> Best regards, >> Abhishek >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel