From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 A02EC211DDA3F for ; Thu, 14 Mar 2019 19:17:59 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2019 19:17:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,480,1544515200"; d="scan'208";a="134202227" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 14 Mar 2019 19:17:58 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Mar 2019 19:17:58 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Mar 2019 19:17:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.223]) with mapi id 14.03.0415.000; Fri, 15 Mar 2019 10:15:24 +0800 From: "Wu, Hao A" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Zeng, Star" , "Kinney, Michael D" , "Gao, Liming" , Achin Gupta , "Yao, Jiewen" , Supreeth Venkatesh , Jagadeesh Ujja Thread-Topic: [PATCH 0/4] MdeModulePkg, StandaloneMmPkg: work around VA vs PA ambiguity Thread-Index: AQHU2CAwo2qcQP2mykeSJAJbLrT2c6YL9z6w Date: Fri, 15 Mar 2019 02:15:23 +0000 Message-ID: References: <20190311153608.3251-1-ard.biesheuvel@linaro.org> In-Reply-To: <20190311153608.3251-1-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 0/4] MdeModulePkg, StandaloneMmPkg: work around VA vs PA ambiguity 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: Fri, 15 Mar 2019 02:17:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Monday, March 11, 2019 11:36 PM > To: edk2-devel@lists.01.org > Cc: Ard Biesheuvel; Wang, Jian J; Wu, Hao A; Zeng, Star; Kinney, Michael = D; > Gao, Liming; Achin Gupta; Yao, Jiewen; Supreeth Venkatesh; Jagadeesh Ujja > Subject: [PATCH 0/4] MdeModulePkg, StandaloneMmPkg: work around VA > vs PA ambiguity >=20 > This series proposes one possible approach to work around the issue that = the > traditional MM and standalone MM implement versions of the communicate > protocol > that are fundamentally incompatible from the point of view of the caller. >=20 > In traditional MM, the MM communicate protocol takes a physical pointer f= or > the buffer, so that the SMM execution context can access the memory > directly > without having to translate it according to the translation regime of the > caller. >=20 > In standalone MM, the buffer that is shared with the MM context is > preallocated, > and so it is up to the implementation of the MM communicate protocol to > copy the > data from the caller allocated buffer into the preallocated shared buffer= . In > order to be able to do so, the DXE driver needs to copy the contents, and= for > this it needs to know the virtual address not the physical address. >=20 > So this means we have two incompatible versions of the same protocol, and > given > that we have even re-used the EFI_SMM_COMMUNICATE_PROTOCOL GUID > for the new > EFI_MM_COMMUNICATE_PROTOCOL, we cannot distinguish > programmatically between a > MM context that takes physical addresses vs one that takes virtual ones. >=20 > Since this is known at build time, one way to deal with this is to have t= wo > different implementations of a library that defines an abstract > MmCommunicate() > function, allowing the correct implementation to be selected at integrati= on > time. Hello Ard, It seems to me that for platforms that include the VariableSmmRuntimeDxe driver, they need to add the 'MmCommunicateLib' dependency. Please grant us some time to evaluate this proposal and its impact. We will inform you as soon as there is a result. Thanks. Best Regards, Hao Wu >=20 > Cc: Jian J Wang > Cc: Hao Wu > Cc: Star Zeng > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Achin Gupta > Cc: Jiewen Yao > Cc: Supreeth Venkatesh > Cc: Jagadeesh Ujja >=20 > Ard Biesheuvel (4): > MdeModulePkg: introduce MmCommunicationLib library class > MdeModulePkg: add implementation of MmCommunicateLib > StandaloneMmPkg: add implementation of MmCommunicateLib > MdeModulePkg/VariableSmmRuntimeDxe: switch to MmCommunicateLib > library >=20 > MdeModulePkg/MdeModulePkg.dec = | 4 + > MdeModulePkg/MdeModulePkg.dsc = | 2 + >=20 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.inf | 51 +++++++++ >=20 > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.i > nf | 4 +- >=20 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.inf | 51 +++++++++ > MdeModulePkg/Include/Library/MmCommunicateLib.h = | > 50 +++++++++ >=20 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.c | 114 ++++++++++++++++++++ >=20 > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe. > c | 10 +- >=20 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.c | 113 +++++++++++++++++++ >=20 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.uni | 19 ++++ >=20 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.uni | 19 ++++ > 11 files changed, 428 insertions(+), 9 deletions(-) > create mode 100644 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.inf > create mode 100644 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.inf > create mode 100644 > MdeModulePkg/Include/Library/MmCommunicateLib.h > create mode 100644 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.c > create mode 100644 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.c > create mode 100644 > MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmC > ommunicateLib.uni > create mode 100644 > StandaloneMmPkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeM > mCommunicateLib.uni >=20 > -- > 2.20.1