From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.4135.1623826958653033503 for ; Wed, 16 Jun 2021 00:02:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=ZqHx7Jjy; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 16B6324002A for ; Wed, 16 Jun 2021 09:02:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1623826957; bh=RAxaR7WDad3U9klCOOZxQkBWqpDsqS56twwqIZbSCUQ=; h=Subject:To:Cc:From:Date:From; b=ZqHx7JjyiYNIs7ZqreQb29qJU0NGdwn3zPRxbm+FXklqksl4fOFNPI9WFBbxIuosE IxLLX7uVWVkjfiES/WBRfeJlsK0gCCZD4eARQNSlHLJnPxxZer6jZEqqMRQowmc1GK SE//D7GWy+edtyZ25fOgcfMf4dP1oQ6ELp3hvL2oFFpmxAt9CDCi0ccK+zi0mBi69N xCme88vXqhKmRRAkB/7XIzhrsl4AmHvJZlW7D8+UYMK+y8X+yuFH6GLcg6LfQlqkg6 Hcdh2yc5J4nGLg3KxnZSwm+8WWyJjd3D6vIPpr36gAF7WZrRv5hQKBQ9Zrt56fY/XD g6OySHgmkRldQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4G4bjP2KBVz9rxp; Wed, 16 Jun 2021 09:02:33 +0200 (CEST) Subject: Re: [edk2-devel] [PATCH v1 0/5] EDK2 Code First: PI Specification: Update EFI_MM_COMMUNICATE_HEADER To: devel@edk2.groups.io, kuqin12@gmail.com Cc: Jian J Wang , Hao A Wu , Eric Dong , Ray Ni , Michael D Kinney , Liming Gao , Zhiguang Liu , Andrew Fish , Laszlo Ersek , Leif Lindholm References: <20210610014259.1151-1-kuqin12@gmail.com> From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Message-ID: <93fd191e-e62f-f02e-11d0-403173fcdf42@posteo.de> Date: Wed, 16 Jun 2021 07:02:32 +0000 MIME-Version: 1.0 In-Reply-To: <20210610014259.1151-1-kuqin12@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Good day, May I ask about two small things? 1) Was there any rationale as to e.g. code compatibility with choosing UINT64 for the data length? I understand that this is the maximum of the two as of currently, but I wonder whether a message length that exceeds the UINT32 range (4 GB!) can possibly be considered sane or a good idea. 2) Is it feasible yet with the current set of supported compilers to support flexible arrays? Thank you for your work! Best regards, Marvin On 10.06.21 03:42, Kun Qin wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3430 > > In PI Spec v1.7 Errata A, Vol.4, Sec 5.7 MM Communication Protocol, the > MessageLength field of EFI_MM_COMMUNICATE_HEADER (also derived as > EFI_SMM_COMMUNICATE_HEADER) is currently defined as type UINTN. > > But this structure, as a generic definition, could be used for both PEI > and DXE MM communication. Thus for a system that supports PEI MM launch, > but operates PEI in 32bit mode and MM foundation in 64bit, the current > EFI_MM_COMMUNICATE_HEADER definition will cause structure parse error due > to UINTN being used. > > The suggested change is to make the MessageLength field defined with > definitive size as below: > ``` > typedef struct { > EFI_GUID HeaderGuid; > UINT64 MessageLength; > UINT8 Data[ANYSIZE_ARRAY]; > } EFI_MM_COMMUNICATE_HEADER; > ``` > > Patch v1 branch: https://github.com/kuqin12/edk2/tree/BZ3398-MmCommunicate-Length > > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong > Cc: Ray Ni > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > Cc: Andrew Fish > Cc: Laszlo Ersek > Cc: Leif Lindholm > > Kun Qin (5): > EDK2 Code First: PI Specification: EFI_MM_COMMUNICATE_HEADER Update > MdeModulePkg: PiSmmIpl: Update MessageLength calculation for > MmCommunicate > MdeModulePkg: MemoryProfileInfo: Updated MessageLength calculation > MdeModulePkg: SmiHandlerProfileInfo: Updated MessageLength calculation > MdePkg: MmCommunication: Extend MessageLength field size to UINT64 > > MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c | 20 +++-- > MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 8 +- > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 13 ++- > BZ3430-SpecChange.md | 88 ++++++++++++++++++++ > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 1 + > MdePkg/Include/Protocol/MmCommunication.h | 3 +- > 6 files changed, 124 insertions(+), 9 deletions(-) > create mode 100644 BZ3430-SpecChange.md >