public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: wei6.xu@intel.com, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	 Sami Mujawar <sami.mujawar@arm.com>, Ray Ni <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/1] StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered
Date: Wed, 22 Nov 2023 16:11:35 +0100	[thread overview]
Message-ID: <CAMj1kXH70fyb1Rr18wbuV_=mTBUCtMcY0KwtQArekYKZ9DYWVQ@mail.gmail.com> (raw)
In-Reply-To: <7614875b-fb11-8b2c-1411-da0b5c1224b3@redhat.com>

On Wed, 22 Nov 2023 at 12:45, Laszlo Ersek <lersek@redhat.com> wrote:
>
...
> (3) Most importantly, speaking to a larger context, I don't understand
> how this patch can work *at all*.
>
> Namely, I can find no MM IPL inside edk2!
>
> The DXE and MM dispatcher are supposed to work together in the following
> way:
>
> (3.1) Whenever the DXE Core signals the PI-defined event group
> EFI_EVENT_GROUP_DXE_DISPATCH_GUID, the MM IPL takes notice. (The MM IPL
> learns that the DXE Dispatcher has completed one round of dispatching,
> and new DXE/UEFI protocols may have become available.)
>
> (3.2) The MM IPL notifies the MM Core to run one round of MM dispatch.
> This gives another chance to those MM drivers that failed to launch
> previously due to missing DXE/UEFI protocols (which they might want to
> consume in their entry points). The notification happens via an MMI / a
> particular communication buffer carrying
> EFI_EVENT_GROUP_DXE_DISPATCH_GUID in the header.
>
> (3.3) The MM Core runs said one round of dispatch, and then *informs*
> the MM IPL about the result. The result can be one of three cases:
> success, error, and "restart".
>
> (3.4) As long as the result is "restart" (for *whatever* reason), the MM
> IPL doesn't complete the notification function for
> EFI_EVENT_GROUP_DXE_DISPATCH_GUID, but jumps back to step (3.2).
>
> In practice, this is used for handling the situation described in the
> commit message -- namely, if the MM Core notices that the MM Entry Point
> was installed in the last round of MM dispatch, then it exits early back
> to the MM IPL with status "restart". The subsequent MM Dispatch run
> gives a chance to those MM drivers that needed access to Management Mode
> (or perhaps MM RAM). So in effect this is an "inner" re-iteration that
> aims at noticing the MM Entry Point, instead of new DXE/UEFI protocols.
>

The above describes traditional MM but not standalone MM. I would have
to refer to the PI spec for details, but the primary difference is
that SMM drivers have no access to the DXE protocol database or boot
services at all (hence the name 'standalone'). The standalone MM is a
separate execution context that comes into existence magically (i.e.,
in a way not defined by PI/UEFI) and can be invoked only via special
traps or instructions. Notably, the SMM model where the initial
context is unified and only separated later in the boot (at EndOfDxe?)
does not apply here. This also means that dispatching FVs into
standalone MM and retaining other SMM legacy is meaningless, which is
why I removed all that code.


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



  reply	other threads:[~2023-11-22 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  8:30 [edk2-devel] [PATCH 0/1] StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered Xu, Wei6
2023-11-20  8:30 ` [edk2-devel] [PATCH 1/1] " Xu, Wei6
2023-11-22 11:45   ` Laszlo Ersek
2023-11-22 15:11     ` Ard Biesheuvel [this message]
2023-11-24 11:06       ` Laszlo Ersek
2023-11-23 16:20     ` Xu, Wei6
2023-11-24 11:13       ` Laszlo Ersek
2023-11-23  1:48   ` Ni, Ray
2023-11-27 12:15   ` Wu, Jiaxin

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='CAMj1kXH70fyb1Rr18wbuV_=mTBUCtMcY0KwtQArekYKZ9DYWVQ@mail.gmail.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