From nobody Thu Dec 26 01:22:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1507066129321278.5798269304652; Tue, 3 Oct 2017 14:28:49 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B955621E7821D; Tue, 3 Oct 2017 14:25:26 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 95FEE21E7820D for ; Tue, 3 Oct 2017 14:25:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E57E95D5F4; Tue, 3 Oct 2017 21:28:45 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-122-192.rdu2.redhat.com [10.10.122.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57A1460E3A; Tue, 3 Oct 2017 21:28:44 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E57E95D5F4 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 3 Oct 2017 23:28:31 +0200 Message-Id: <20171003212834.25740-4-lersek@redhat.com> In-Reply-To: <20171003212834.25740-1-lersek@redhat.com> References: <20171003212834.25740-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 03 Oct 2017 21:28:46 +0000 (UTC) Subject: [edk2] [PATCH 3/6] MdeModulePkg/Variable/RuntimeDxe: introduce MorLockInitAtEndOfDxe() hook 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: , Cc: Jiewen Yao , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce the MorLockInitAtEndOfDxe() hook, in order to allow MorLockInit() to delay / queue operations until EndOfDxe. (Or, if the platform never signals EndOfDxe, until ReadyToBoot.) Call MorLockInitAtEndOfDxe() whenever we set "mEndOfDxe" to TRUE: - in VariableRuntimeDxe: - in the OnReadyToBoot() function, - in the OnEndOfDxe() function; - in VariableSmm: - on the SMM_VARIABLE_FUNCTION_READY_TO_BOOT SMI request, - in the SmmEndOfDxeCallback() function. For now, implement MorLockInitAtEndOfDxe() as a no-op in both VariableRuntimeDxe and VariableSmm. Cc: Eric Dong Cc: Jiewen Yao Cc: Ladi Prosek Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h | 10 +++= +++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c | 15 +++= ++++++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c | 15 +++= ++++++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 2 ++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 2 ++ 5 files changed, 44 insertions(+) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphi= c.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h index 1118f4b52e49..759e47db7f29 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h @@ -46,6 +46,16 @@ MorLockInit ( VOID ); =20 +/** + Delayed initialization for MOR Control Lock at EndOfDxe. + + This function performs any operations queued by MorLockInit(). +**/ +VOID +MorLockInitAtEndOfDxe ( + VOID + ); + /** This service is an MOR/MorLock checker handler for the SetVariable(). =20 diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c b/M= deModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c index ab3e5d416cd4..a91fc42ff465 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c @@ -91,3 +91,18 @@ MorLockInit ( VariableLockRequestToLock (&mVariableLock, MEMORY_OVERWRITE_REQUEST_CONT= ROL_LOCK_NAME, &gEfiMemoryOverwriteRequestControlLockGuid); return EFI_SUCCESS; } + +/** + Delayed initialization for MOR Control Lock at EndOfDxe. + + This function performs any operations queued by MorLockInit(). +**/ +VOID +MorLockInitAtEndOfDxe ( + VOID + ) +{ + // + // Do nothing. + // +} diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c b/M= deModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c index 390c8fde4bd4..24b7ffb84ce7 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c @@ -396,3 +396,18 @@ MorLockInit ( // return SetMorLockVariable (0); } + +/** + Delayed initialization for MOR Control Lock at EndOfDxe. + + This function performs any operations queued by MorLockInit(). +**/ +VOID +MorLockInitAtEndOfDxe ( + VOID + ) +{ + // + // Do nothing. + // +} diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/Mde= ModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c index fe1b2b588cb9..b2a373cf98aa 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c @@ -291,6 +291,7 @@ OnReadyToBoot ( ) { if (!mEndOfDxe) { + MorLockInitAtEndOfDxe (); // // Set the End Of DXE bit in case the EFI_END_OF_DXE_EVENT_GROUP_GUID = event is not signaled. // @@ -330,6 +331,7 @@ OnEndOfDxe ( ) { DEBUG ((EFI_D_INFO, "[Variable]END_OF_DXE is signaled\n")); + MorLockInitAtEndOfDxe (); mEndOfDxe =3D TRUE; mVarCheckAddressPointer =3D VarCheckLibInitializeAtEndOfDxe (&mVarCheckA= ddressPointerCount); // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/Mde= ModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c index 2184634f3544..8d73b6edee51 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c @@ -679,6 +679,7 @@ SmmVariableHandler ( break; } if (!mEndOfDxe) { + MorLockInitAtEndOfDxe (); mEndOfDxe =3D TRUE; VarCheckLibInitializeAtEndOfDxe (NULL); // @@ -811,6 +812,7 @@ SmmEndOfDxeCallback ( ) { DEBUG ((EFI_D_INFO, "[Variable]SMM_END_OF_DXE is signaled\n")); + MorLockInitAtEndOfDxe (); mEndOfDxe =3D TRUE; VarCheckLibInitializeAtEndOfDxe (NULL); // --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel