public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nhi Pham via groups.io" <nhi=os.amperecomputing.com@groups.io>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"nhi@os.amperecomputing.com" <nhi@os.amperecomputing.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	"osde@linux.microsoft.com" <osde@linux.microsoft.com>
Cc: "huangming@linux.alibaba.com" <huangming@linux.alibaba.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	"ming.huang-@outlook.com" <ming.huang-@outlook.com>
Subject: Re: [edk2-devel] [PATCH v1 2/2] StandaloneMmPkg: Fix HOB space and heap space conflicted issue
Date: Wed, 6 Sep 2023 14:55:55 +0700	[thread overview]
Message-ID: <2485a946-3cab-9b9e-feb9-47084074c35c@amperemail.onmicrosoft.com> (raw)
In-Reply-To: <MN6PR11MB82448EDBAF6AEF4E4D1288D78CEFA@MN6PR11MB8244.namprd11.prod.outlook.com>

On 9/6/2023 1:33 PM, Ni, Ray wrote:
> [EXTERNAL EMAIL NOTICE: This email originated from an external sender. 
> Please be mindful of safe email handling and proprietary information 
> protection practices.]
> 
> I am a bit confused.
> 
> The HOB list in standalone MM is read-only. Why could any module call 
> BuildGuidHob() to modify the HOB.
> 
> I saw Oliver mentioned something about StMM. I don't know what that is. 
> But it seems that's ARM specific. Then, I don't think it's proper to 
> modify code here for a specific arch ARM.

The HOB creation is available in the 
StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf. If 
other architectures also use that instance, I think the issue is not 
specific to ARM.

Regards,
-Nhi
> 
> Thanks,
> Ray
> ------------------------------------------------------------------------
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Oliver 
> Smith-Denny <osde@linux.microsoft.com>
> *Sent:* Wednesday, September 6, 2023 5:29 AM
> *To:* Nhi Pham <nhi@amperemail.onmicrosoft.com>; devel@edk2.groups.io 
> <devel@edk2.groups.io>; nhi@os.amperecomputing.com 
> <nhi@os.amperecomputing.com>; Ard Biesheuvel <ardb@kernel.org>
> *Cc:* huangming@linux.alibaba.com <huangming@linux.alibaba.com>; Sami 
> Mujawar <sami.mujawar@arm.com>; Ard Biesheuvel 
> <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; 
> Supreeth Venkatesh <supreeth.venkatesh@arm.com>; ming.huang-@outlook.com 
> <ming.huang-@outlook.com>
> *Subject:* Re: [edk2-devel] [PATCH v1 2/2] StandaloneMmPkg: Fix HOB 
> space and heap space conflicted issue
> On 9/4/2023 7:20 PM, Nhi Pham wrote:
>> On 9/2/2023 3:43 AM, Oliver Smith-Denny wrote:
>>> On 8/31/2023 1:20 AM, Nhi Pham via groups.io wrote:
>>>
>>> If I am understanding this correctly, this is only an issue when
>>> HOBs are created in StMM, i.e. not from HOBs that are passed in. Is this
>>> correct?
>> Yes, the issue only occurs when HOB are created in StandaloneMM by the 
>> HOB library instance 
>> StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
>>>
>>> If so, is HOB creation in StMM and supported use case? The only instance
>> I think it is intended to work as the CreateHob() function is implemented.
> 
> Well, that may just be a copy/paste sort of thing :).
> 
>>> a quick search turns up is the ARM StMM Core entry, where some
>>> information from TF-A is converted to HOB format. Do we have any other
>>> use cases (and curious more on this use case). My thought process would
>>> be that StMM would not create any HOBs. Depending on FW configuration,
>>> it may receive HOBs from PEI.
>> 
>> I have a use case when enabling the UEFI Variable driver running in 
>> StandaloneMM. Instead of using the PCDs, the in-memory NVRAM region is 
>> allocated **dynamically** at boot time in the StMM secure memory. Then, 
>> they will be passed into the gVariableFlashInfoHobGuid for being 
>> consumed by other variable MM drivers.
>> 
> 
> I do believe that per the PI spec, we should have HOB producer and HOB
> consumer phases, where in this case PEI (if it was the launching entity
> for StMM) is the HOB producer and StMM is the HOB producer. This is the
> same pattern the PI spec details for PEI and DXE, where DXE is not
> intended to create new HOBs, but just to consume information from the
> previous phase.
> 
> As I mentioned, there are other interfaces for passing information
> within a phase, such as protocols, dynamic PCDs, variables, etc. that
> are built for this application. I think it is useful to adhere to the
> model for HOBs (which are hand off blocks, one phase handing information
> to another phase) and that we will create more issues if we rely on
> HOB consumer phases producing HOBs.
> 
> My proposal would be to remove the HOB creation code from StMM
> completely. I believe in your use case that you are describing a dynamic
> PCD or a protocol could work to pass the information.
> 
> If we are saying that prior to your patch that HOB creation in StMM was
> completely broken, anyway, it seems that folks were not relying on this
> code?
> 
> Thanks,
> Oliver
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108311): https://edk2.groups.io/g/devel/message/108311
Mute This Topic: https://groups.io/mt/89020085/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-09-06  7:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 12:25 [PATCH v1 0/2] Fix StandaloneMmPkg HOB issue Ming Huang
2022-02-09 12:25 ` [PATCH v1 1/2] StandaloneMmPkg/Hob: Assert or return NULL for create hob failed Ming Huang
2022-02-09 12:25 ` [PATCH v1 2/2] StandaloneMmPkg: Fix HOB space and heap space conflicted issue Ming Huang
2022-05-03  9:10   ` Ard Biesheuvel
2022-05-12 10:09     ` [edk2-devel] " Ming Huang
2023-08-16  8:55       ` Nhi Pham via groups.io
2023-08-30 13:10         ` Ard Biesheuvel
2023-08-31  8:20           ` Nhi Pham via groups.io
2023-09-01 20:43             ` Oliver Smith-Denny
2023-09-05  2:20               ` Nhi Pham via groups.io
2023-09-05 21:29                 ` Oliver Smith-Denny
2023-09-06  6:33                   ` Ni, Ray
2023-09-06  6:56                     ` Ard Biesheuvel
2023-09-06  7:55                     ` Nhi Pham via groups.io [this message]
2023-09-06  8:50                       ` Ard Biesheuvel
2023-09-06 16:22                         ` Oliver Smith-Denny
2023-09-07 15:38                           ` Nhi Pham via groups.io
2023-11-30 13:59                             ` Nhi Pham via groups.io
2023-12-01  5:29                               ` Ni, Ray
2023-09-06  7:35                   ` Nhi Pham via groups.io
     [not found]       ` <177BD141FD103BE4.8497@groups.io>
2023-08-29  2:48         ` Nhi Pham via groups.io
2022-03-30  9:35 ` [PATCH v1 0/2] Fix StandaloneMmPkg HOB issue Ming Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2485a946-3cab-9b9e-feb9-47084074c35c@amperemail.onmicrosoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox