From patchwork Mon Jan 14 13:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 155486 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3658373jaa; Mon, 14 Jan 2019 05:28:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN6RjSi1MJsealZlvVb28FZWxkw/WLQIE/32Wmxyfbu6lqhinRuOkKuLZkTAFuNsvkB1PHEh X-Received: by 2002:a62:f247:: with SMTP id y7mr25410051pfl.25.1547472496889; Mon, 14 Jan 2019 05:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547472496; cv=none; d=google.com; s=arc-20160816; b=vA70ZgizuIhKEscagq2Ks+7UkiByFA+QMceMNvUbs9iAcagi+fVNNVNW97P/qxOdRC 1V86+CvITh18GDwT8Uve6G0w8pyn1CCK5bqDuJ7rC3VJMi2hjYmAdGkIq44eWQyUolI/ g9m+8m6CTxsdhHGLqwFApD1vyfOMpLggfO4kedZiG3wncBqcvAL16nbSZgL+xg+47+OJ lvHnVln8z8H5sNkiwy5jo30JIkHg50en0SsikHW0AoJ5jjK+qnN3LzmmrgmOyu3IGPAr MiDvcB2IHITJte/xde6IsLB5RiGVqGkgewFliVsZFcOikU6E2LGdWIone8nF6s4w3zS2 22mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=XMN+VwtFXBsP/c02Px4X3SNp1YvjEnl0TjCoLpS6OrU=; b=KW2wXfsgs2KOVxaLFqZoV2GiUj5IYolmcy7mL2zYEGaqr75xNE/Uw37MZhp9p4RvWy g6ws0juEuW+6oqFm5ca+/ZFXeMzCA4OHXlhsjT6XVxAqw8clCA8W20/MaFkN7vEuYKPk t0XM2Rj8/NEIyccWxAcCCdFTEGTQ5ZX4WUMQYkJ9BiZFDnoK1EQZL4FdxUhnENpyyJPa QOjT/2bVmc8nob1e73e0aem1jiqHx6gZ0UMlrOvtHJn6O3SSWuifFjUYHLBhSVbQHYDw O++16K4qftwA2DyRoOYI+4+1gZTAKjq7Bhxw4xG/Z8dMKzCtVMkSxh/E1e7VI9DSdeee zAow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OzyB3nf4; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 33si368634plu.169.2019.01.14.05.28.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 05:28:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OzyB3nf4; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E91E8211A1E3D; Mon, 14 Jan 2019 05:28:15 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::342; helo=mail-wm1-x342.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EBE0821197374 for ; Mon, 14 Jan 2019 05:28:13 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id m22so8876631wml.3 for ; Mon, 14 Jan 2019 05:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SVXrbIgKIAjL0it1fxQcArJ8q4Q1gzOf8nQZhnHwst8=; b=OzyB3nf4sqOp23kwdzS+Azdk3vFN7QzoDHdm5uaLjJvB81R4HBDw1PVS130/jm1oPE lJPerd3zjLzrlb7kHRH0PeyFr5NqZ6bFjiH8GbSYdthXyEHnlaUQyL1WZrTPHjrVbZU2 P2ZGXyfH63Kzv6gkydJ1LGfvpFtCULkH4uXic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SVXrbIgKIAjL0it1fxQcArJ8q4Q1gzOf8nQZhnHwst8=; b=bxZDEgW3PucB72P1XoGp5urtlUIFwkbhmIaQen+UtDCDwDLVGSbftkLIIWybtcBHjQ OWw0yJQJXE9EambxDyMnv7XEnvO7yfa3uxYW9Mm7ZwoyGL2Y0V5s3ZYGFXwpNl8DpsHr wTTOPW2V3qzGqzkSE5Inp7qAHPG0OJHWfQU65WM1mZ2rff+Q5EVaqzzBodDlEWTVqZpz 3zGZym+GZnmlc1K96iLyj7c2F0sfWgpHDZMIpPAQFwU0bEKB50caYoLQoFJxCRYAsjly yNYGMulTQhuBQ+xQz7kjAD6S7md7NB5RvBTkf8v388glydzYzfTyiORSoE2qsbupciBy j7MQ== X-Gm-Message-State: AJcUukds32SXeoNCFdM6AHV1PRcDIzZvO8ipQ71z8oH2gGHbP1pSoND7 vDnRG5AZor5GbjgDp21r6uXoiZj3Mwk= X-Received: by 2002:a7b:c76b:: with SMTP id x11mr11479096wmk.37.1547472491460; Mon, 14 Jan 2019 05:28:11 -0800 (PST) Received: from localhost.localdomain (aputeaux-684-1-19-62.w90-86.abo.wanadoo.fr. [90.86.222.62]) by smtp.gmail.com with ESMTPSA id 202sm33446560wmt.8.2019.01.14.05.28.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 05:28:10 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 14 Jan 2019 14:27:41 +0100 Message-Id: <20190114132758.24054-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [edk2] [PATCH v2 00/17] implement standalone MM versions of the variable runtime drivers 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: , Cc: Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek , Star Zeng Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This v2 series is a followup to [0], and updates the SMM implementations of the fault tolerant write and variable runtime drivers to provide standalone MM versions that share as much of the existing code as possible with the traditional SMM implementations. The meat is in patches #5 - #8, which were part of v1. I updated them according to the received feedback, and added tags that were given on list. Patches #1 - #4 add library class resolutions for MmServiceTableLib, which was introduced in v1 of the series, and has already been merged (at the request of Liming) so that downstream platforms can add the resolution as well. The remaining patches #9 - #17 are new, and have been added so that the new standalone MM drivers can be added to and built from MdeModulePkg.dsc, but for coverage only (the resulting binaries won't actually work) - patches #9 and #10 add a definition and implementation of StandaloneMmDriverEntryPoint, which is rather straight-forward and has no dependencies on the standalone MM core, so it is reasonable to add it to MdePkg directly. Note that this version contains the _gMmVersion check that is missing from the one in StandaloneMmPkg - patch #11 adds a standalone MM implementation of MmServicesTableLib to MdePkg, which -again- does not depend on the standalone MM core at all, so added here for simplicity - patches #12 and #13 add NULL implementations of MemoryAllocationLib and HobLib so that the FTW and variable MM_STANDALONE modules can be built without depending on StandaloneMmPkg - patch #14 is an unrelated fix so that MdeModulePkg.dsc can be built for AARCH64 - patches #15 and #16 add MM_STANDALONE support to a couple of libraries that the new modules depend on - patch #17 adds the FTW and variable standalone MM drivers to MdeModulePkg.dsc NOTE: the drivers added in patches #10 and #11 supersede the ones that reside in or have been proposed for StandaloneMmPkg Patches can be found here: https://github.com/ardbiesheuvel/edk2/tree/variable-ftw-standalone-mm-conversion Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao Wu Cc: Jagadeesh Ujja Cc: Achin Gupta Cc: Thomas Panakamattam Abraham Cc: Sami Mujawar Cc: Star Zeng [0] https://lists.01.org/pipermail/edk2-devel/2019-January/034608.html Ard Biesheuvel (17): MdeModulePkg/MdeModulePkg.dsc: add MmServicesTableLib resolution OvmfPkg: add MmServicesTableLib resolution QuarkPlatformPkg: add MmServicesTableLib resolution Vlv2TbltDevicePkg: add MmServicesTableLib resolution MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accesses MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM version MdeModulePkg/VariableRuntimeDxe: factor out boot service accesses MdeModulePkg/VariableRuntimeDxe: implement standalone MM version MdePkg: introduce standalone MM entry point library class MdePkg: introduce standalone MM entry point library implementation MdePkg: add MM_STANDALONE implementation of MmServicesTableLib MdeModulePkg: implement NULL instance of HobLib library class MdeModulePkg: implement NULL instance of MemoryAllocationLib library class MdeModulePkg/MdeModulePkg/dsc: move DxeDebugSupportDxe to x86 only section MdeModulePkg/AuthVariableLibNull: add MM_STANDALONE support MdeModulePkg/VarCheckLib: add MM_STANDALONE support MdeModulePkg/MdeModulePkg.dsc: add MM_STANDALONE FTW and variable modules MdePkg/MdePkg.dec | 3 + MdeModulePkg/MdeModulePkg.dsc | 12 +- MdePkg/MdePkg.dsc | 3 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + QuarkPlatformPkg/Quark.dsc | 1 + QuarkPlatformPkg/QuarkMin.dsc | 1 + Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 + Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 1 + Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 1 + MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf | 2 +- MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.inf | 38 ++ MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.inf | 38 ++ MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 2 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf | 5 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/{FaultTolerantWriteSmm.inf => FaultTolerantWriteStandaloneMm.inf} | 43 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf | 5 +- MdeModulePkg/Universal/Variable/RuntimeDxe/{VariableSmm.inf => VariableStandaloneMm.inf} | 43 +- MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf | 43 ++ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf | 39 ++ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h | 23 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCommon.h | 34 ++ MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h | 58 ++ MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h | 134 +++++ MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.c | 542 ++++++++++++++++++ MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.c | 575 ++++++++++++++++++++ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.c | 31 ++ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c | 53 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.c | 88 +++ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteTraditionalMm.c | 106 ++++ MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c | 10 +- MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c | 18 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 59 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.c | 89 +++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableTraditionalMm.c | 130 +++++ MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c | 90 +++ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c | 41 ++ MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.uni | 20 + MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.uni | 20 + MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni | 22 + MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni | 20 + 42 files changed, 2290 insertions(+), 157 deletions(-) create mode 100644 MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.inf create mode 100644 MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.inf copy MdeModulePkg/Universal/FaultTolerantWriteDxe/{FaultTolerantWriteSmm.inf => FaultTolerantWriteStandaloneMm.inf} (68%) copy MdeModulePkg/Universal/Variable/RuntimeDxe/{VariableSmm.inf => VariableStandaloneMm.inf} (82%) create mode 100644 MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf create mode 100644 MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf create mode 100644 MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h create mode 100644 MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.c create mode 100644 MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.c create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.c create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteTraditionalMm.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableTraditionalMm.c create mode 100644 MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c create mode 100644 MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c create mode 100644 MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.uni create mode 100644 MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.uni create mode 100644 MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni create mode 100644 MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Jian J Wang