From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=jagadeesh.ujja@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 053112117FD47 for ; Wed, 31 Oct 2018 04:10:05 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8852780D for ; Wed, 31 Oct 2018 04:10:05 -0700 (PDT) Received: from usa.arm.com (a75556-lin.blr.arm.com [10.162.2.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BA9123F71D for ; Wed, 31 Oct 2018 04:10:04 -0700 (PDT) From: Jagadeesh Ujja To: edk2-devel@lists.01.org Date: Wed, 31 Oct 2018 16:39:38 +0530 Message-Id: <20181031110947.6305-1-jagadeesh.ujja@arm.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [RFC PATCH 0/9] Extend secure variable service to be usable from Standalone MM X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 X-List-Received-Date: Wed, 31 Oct 2018 11:10:06 -0000 Content-Transfer-Encoding: 8bit This RFC patch series extends the existing secure variable service support for use with Standalone MM. This is applicable to paltforms that use Standalone Management Mode to protect access to non-volatile memory (NOR flash in case of these patches) used to store the secure EFI variables. The first patch pulls in additional libraries from the staging branch of StandaloneMmPkg into the edk2's StandaloneMmPkg. The existing secure variable service implementation supports only the traditional MM mode and so the rest of the patches extends the existing secure variable service support to be useable with Standalone MM mode as well. This patch series is being posted as an RFC to get feedback on the approach taken in these patches. Jagadeesh Ujja (9): StandaloneMmPkg: Pull in additonal libraries from staging branch ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM Standalone MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver CryptoPkg/BaseCryptLib: Hack to get time in MM Standalone mode SecurityPkg/AuthVariableLib:allow reusability as MM_STANDALONE MdeModulePkg VarCheckLib: allow reusability as MM_STANDALONE CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this library .../Drivers/NorFlashDxe/NorFlashBlockIoDxe.c | 5 +- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 116 ++- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h | 15 +- .../Drivers/NorFlashDxe/NorFlashFvbDxe.c | 26 +- .../Drivers/NorFlashDxe/NorFlashMmStandalone.inf | 76 ++ .../BaseCryptLib/BaseCryptLibMmStandalone.inf | 106 +++ .../Library/BaseCryptLib/SysCall/TimerWrapper.c | 19 +- MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +- .../FaultTolerantWriteMmStandalone.inf | 100 +++ .../FaultTolerantWriteDxe/FaultTolerantWriteSmm.c | 72 +- .../FaultTolerantWriteDxe/UpdateWorkingBlock.c | 8 +- .../Universal/Variable/RuntimeDxe/Variable.c | 16 +- .../Universal/Variable/RuntimeDxe/Variable.h | 8 + .../Variable/RuntimeDxe/VariableMmStandalone.inf | 134 ++++ .../Universal/Variable/RuntimeDxe/VariableSmm.c | 73 +- .../Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 20 +- .../Library/AuthVariableLib/AuthVariableLib.inf | 5 +- .../StandaloneMmCoreHobLib.inf | 2 +- .../AArch64/StandaloneMmCoreHobLibInternal.c | 64 ++ .../StandaloneMmHobLib/StandaloneMmHobLib.c | 655 ++++++++++++++++ .../StandaloneMmHobLib/StandaloneMmHobLib.inf | 48 ++ .../StandaloneMmMemoryAllocationLib.c | 824 +++++++++++++++++++++ .../StandaloneMmMemoryAllocationLib.inf | 45 ++ .../StandaloneMmServicesTableLib.c | 40 + .../StandaloneMmServicesTableLib.inf | 36 + 25 files changed, 2470 insertions(+), 48 deletions(-) create mode 100644 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashMmStandalone.inf create mode 100644 CryptoPkg/Library/BaseCryptLib/BaseCryptLibMmStandalone.inf create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteMmStandalone.inf create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableMmStandalone.inf create mode 100644 StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c create mode 100644 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c create mode 100644 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf create mode 100644 StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c create mode 100644 StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf create mode 100644 StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c create mode 100644 StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf -- 1.9.1