From patchwork Thu Jan 3 18:28:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154735 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp950223ljp; Thu, 3 Jan 2019 10:28:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yvkXjUUZTFLKoSrJ0cWcpnsrvZbaCDxAbkbbwJv7DfSc3Sczuud2I8630F8elQFQfiozs X-Received: by 2002:a25:2389:: with SMTP id j131mr41512568ybj.20.1546540134312; Thu, 03 Jan 2019 10:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546540134; cv=none; d=google.com; s=arc-20160816; b=Zx/TTdQdiqaohnjEY1G8xr5HIa5n66ZcZEbp+be6eG+SMbdByaPByCw3ogQ8V4ujC1 StmeI+Bdt9cU0q8L4SztyMNOYWGlEiCy8vH1/uyhs6paiar9crdQYt89FFr2XUVOTFyj a4Xt2xOl0rdBwlxZ1rEsoNZZX/iIrIUiabw9OSS2FH5Jcp8xyWRh016wjLaAGGxGVzfH MvGozB//il39xynd/3XEOEc/FFpMgpF4Ok87MdBA6GXAvAYGhGXqSMpci7OEyyoFssLi jln31hn0HGp651zJhxn9okEAEvZSW6CvOlIED4TARxKeFcbwaKRYZSjHIpxihb7ZMzc2 aIMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=vBbYDcLWrvP/5A3m0poQfMPO7C8qkQ8qVHusJEzYoUY=; b=dhfwzxcI4bnR9nEN5xio19GahMppnBxiKO13d3vlyQ8W+kTRNNwmuDToNQ+9Pb0SFb VUcb1ULF2FDfXpbt+RQ4PK+bAQqiVpKp5ulkxdfbgd2nSUp6RwZyt9OXUhJetvZXXQBn wUOl0hvhc6sPJgTWPTlOC0Rx83amUR4JI+6UY4uc6q4hbYpEteawxwU13UlaKFRNT1LU ZLkJT7Cbbuf7qIuKSwiAl2VIG4emnPp+kfEG2+GkMefKw/pZG/qnnqruSIyVhE+xBf+O Ptwf31XW3YPUft5IFdIIjiONygPxNwjFSuYc6KYKWSLb+wtn3JbIy3GI2Wd849K1IiBk kH7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ATU3uCHi; 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 k189si23571514ywg.81.2019.01.03.10.28.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 10:28:54 -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=ATU3uCHi; 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 A1CDA211ADA36; Thu, 3 Jan 2019 10:28:52 -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::542; helo=mail-ed1-x542.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (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 0D1A12119FF5E for ; Thu, 3 Jan 2019 10:28:50 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id d39so29769552edb.12 for ; Thu, 03 Jan 2019 10:28:50 -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; bh=CubxXDvEJc6rp4nHxHA+4wRQW0hwe7y565WkdgXTCJ0=; b=ATU3uCHiRwLBuwKfrrJtEh57Jy/wFH0+uTZVGIdBeb3FmaEk5Cd37XyKXzktNn6ziA BcbZv2uEObJxIgTKG8cVCDJ0jAepo4K/nBhAEd0zxcGWSqJG0ez2DuDkI1ZU5ggjFt8I kNuNJGajY1I8l5K49Z56P9ulrnvU9s5h8OBeY= 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; bh=CubxXDvEJc6rp4nHxHA+4wRQW0hwe7y565WkdgXTCJ0=; b=T5qTjE1fnXwpDIENzB0tt2JiYraCYIBKUz2RkuyB5rcJspRANMZHWyEvVG+UCGHUYl rl6G/ruUdyzdboY6ZELkZSk/G4dGd51QpO7o588nabv1CTSO33f8HABD5GK8Y/67SuAg EbrLt04wah3cF4GFW+ljQrx3OmANyWvvMHUrQ1VJOrkmEsHeYDwz1Gax5QSWPimMa3Bq HhYlcWxLFR/gQh12/FJpwfj4XBjhhduEPExOb2xy8dbvJaOWf0zpbKn6vuJju+JD4JO3 rLnAxU79pVexaNLkkB+R5ueVG+tutxKXbT+xJ60ZLtaXJ44E3g0vGg9wbXeAQ/mGq/3t geBg== X-Gm-Message-State: AA+aEWZYbrjNiWgIYbXfI5WGLjFVQOFE0AbHxcO630RbWEXDWS8p1bkA ZWxYm5VvmtIUxPmupjwDyYaqEOSJcRUEBw== X-Received: by 2002:a50:9977:: with SMTP id l52mr41453673edb.277.1546540127497; Thu, 03 Jan 2019 10:28:47 -0800 (PST) Received: from dogfood.home ([2a01:cb1d:112:6f00:704e:c241:dc88:597d]) by smtp.gmail.com with ESMTPSA id a11sm25707206edc.28.2019.01.03.10.28.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 10:28:46 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 3 Jan 2019 19:28:18 +0100 Message-Id: <20190103182825.32231-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [edk2] [PATCH 0/6] 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 MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This series proposed an alternative approach to the series sent out by Jagadeesh [0]. In particular, it gets rid of the InMm() calls and the special PCD, as well as some other if() conditionals. The primary difference is that this series defines and implements MmServicesTableLib in such a way that the traditional SMM drivers can use it as well. This is appropriate, considering that the PI spec has rebranded traditional SMM as one implementation of the generic MM framework. Patch #1 is based on Jagadeesh's patch, and introduces the MmServicesTableLib library class, but for all SMM flavours, not only for standalone MM. Patch #2 implements MmServicesTableLib for traditional SMM implementations. Patch #3 refactors FaultTolerantWriteDxe so that the parts of the SMM driver that invoke boot services are separated from the core SMM pieces. Patch #4 implements FaultTolerantWriteSmm for the standalone MM environment. Patches #5 and #6 do the same, respectively, for the variable runtime driver. This approach minimizes the delta, and thus the maintenance burden, between the traditional SMM and standalone MM drivers, while not resorting to runtime checks or other conditionals in the code to implement logic that should be decided at build time. Note that this series only covers part of the work contributed by Jagadeesh. This series focuses on the MdePkg and MdeModulePkg changes that affect shared code. 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 Ard Biesheuvel (5): MdePkg: implement MmServicesTableLib based on traditional SMM 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 Jagadeesh Ujja (1): MdePkg/Include: add MmServicesTableLib header file MdeModulePkg/MdeModulePkg.dsc | 1 + .../FaultTolerantWrite.h | 22 ++- .../FaultTolerantWriteDxe.c | 31 ++++ .../FaultTolerantWriteSmm.c | 54 +++---- .../FaultTolerantWriteSmm.inf | 5 +- .../FaultTolerantWriteSmmCommon.h | 31 ++++ .../FaultTolerantWriteSmmDxe.c | 1 + .../FaultTolerantWriteStandaloneMm.c | 70 +++++++++ .../FaultTolerantWriteStandaloneMm.inf | 90 ++++++++++++ .../FaultTolerantWriteTraditionalMm.c | 94 ++++++++++++ .../UpdateWorkingBlock.c | 10 +- .../Variable/RuntimeDxe/TcgMorLockSmm.c | 18 +-- .../Universal/Variable/RuntimeDxe/Variable.h | 50 +++++++ .../Variable/RuntimeDxe/VariableSmm.c | 59 +++----- .../Variable/RuntimeDxe/VariableSmm.inf | 5 +- .../RuntimeDxe/VariableStandaloneMm.c | 69 +++++++++ .../RuntimeDxe/VariableStandaloneMm.inf | 135 ++++++++++++++++++ .../RuntimeDxe/VariableTraditionalMm.c | 114 +++++++++++++++ MdePkg/Include/Library/MmServicesTableLib.h | 25 ++++ .../MmServicesTableLib/MmServicesTableLib.c | 63 ++++++++ .../MmServicesTableLib/MmServicesTableLib.inf | 45 ++++++ .../MmServicesTableLib/MmServicesTableLib.uni | 22 +++ MdePkg/MdePkg.dec | 4 + MdePkg/MdePkg.dsc | 1 + 24 files changed, 916 insertions(+), 103 deletions(-) create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.c create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf create mode 100644 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteTraditionalMm.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableTraditionalMm.c create mode 100644 MdePkg/Include/Library/MmServicesTableLib.h create mode 100644 MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c create mode 100644 MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf create mode 100644 MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel