From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 3E2F82095BB74 for ; Fri, 29 Sep 2017 06:23:24 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2017 06:26:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,452,1500966000"; d="scan'208,217";a="317680872" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 29 Sep 2017 06:26:39 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 29 Sep 2017 06:26:39 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 29 Sep 2017 06:26:38 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Fri, 29 Sep 2017 21:26:36 +0800 From: "Yao, Jiewen" To: Laszlo Ersek CC: edk2-devel-01 Thread-Topic: [edk2] multiple levels of support for MOR / MORLock Thread-Index: AQHTOFkQdWjN5VpEtUydh2Cd6XgU/KLLGEVggAAWqYCAAKqDwA== Date: Fri, 29 Sep 2017 13:26:36 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A9C9E00@shsmsx102.ccr.corp.intel.com> References: <039cf353-80fb-9f20-6ad2-f52517ab4de7@redhat.com> <74D8A39837DF1E4DA445A8C0B3885C503A9C9497@shsmsx102.ccr.corp.intel.com> <1aa05a42-a7a7-410b-c123-8face8be9f78@redhat.com> In-Reply-To: <1aa05a42-a7a7-410b-c123-8face8be9f78@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: multiple levels of support for MOR / MORLock X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Sep 2017 13:23:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sure. Feel free to submit patch. For the fix, I suggest we keep all MORL related code into TcgMorLockXXX.c. I do not suggest we mix the MORL stuff into VariableXXX.c. A reminder that, the PRC team will have the PRC national holiday in next we= ek. As such, we won't have too much activity in next week. If you submit the patch, I will try to review in next week to unblock the L= inux work. In the patch, if you can add the detailed test result, that will be very he= lpful for us. For example, test SMM/non-SMM version, test with MOR present/absent, etc. Thank you Yao Jiewen From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Lasz= lo Ersek Sent: Friday, September 29, 2017 7:06 PM To: Yao, Jiewen Cc: edk2-devel-01 Subject: Re: [edk2] multiple levels of support for MOR / MORLock On 09/29/17 03:52, Yao, Jiewen wrote: > Thanks Laszlo. > > Yes, I agree it is bug. Would you please help to file a bugzilar in EDKII= ? > > For the fix, I think we have a way to resolve it without PCD. (I do not w= ant to bother a platform developer to set a new PCD.) > > The only invalid case we need handle is: MOR is absent, but MORL is prese= nt. > > My thought is to let Variable driver check if MOR is present. Variable dr= iver can defer the MORL setting at EndOfDxe event based upon the presence o= f MOR. If MOR driver is present, it sets MOR at entrypoint. EndOfDxe is goo= d enough to know the state. > > Also, because EndOfDxe is PI event, the UEFI OS is not aware of that. Sounds great; thanks a lot! I've filed: https://bugzilla.tianocore.org/show_bug.cgi?id=3D727 If possible I'd like the fix to be committed sometime next week. Is it OK if I try and submit a patch soon? My plan is the following: - In MorLockInit() [TcgMorLockSmm.c], call gSmst->SmmRegisterProtocolNotify() in order to register a callback for gEfiSmmEndOfDxeProtocolGuid - In the callback function, call VariableServiceGetVariable(), with size 0, to see if MOR is present -- if EFI_BUFFER_TOO_SMALL is returned, MOR is present; otherwise MOR is absent. - If MOR is present, then call SetMorLockVariable(0) from the callback function; like MorLockInit() does now. Otherwise, do nothing. - It looks like there are no circumstances under which I should de-register the callback. (I.e. call SmmRegisterProtocolNotify() with a NULL Function argument.) Now, I can see that VariableSmm.c already installs such a callback -- SmmEndOfDxeCallback(). Should I hook into that callback function through a new BOOLEAN variable, such as "mDelayedMorLockInit" (and then MorLockInit() would only set this variable to TRUE), or should I install a separate callback? Either way, I don't think that I should do the MOR/MORL stuff in the current SmmEndOfDxeCallback() function *unconditionally*, because that callback is set up when the *read* half of the variable services is initialized, but MORL only becomes relevant when the *write* half of the variable services is initialized (which occurs in the SmmFtwNotificationEvent() callback, i.e. when the FaultTolerantWrite SMM protocol becomes available). Hence I think we need either a separate callback registration, or a new boolean for the existent callback. Thanks! Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel