public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ajay Iyengar (QUIC)" <quic_aiyengar@quicinc.com>
To: "'devel@edk2.groups.io'" <devel@edk2.groups.io>,
	'Andrew Fish' <afish@apple.com>,
	"Leif Lindholm (QUIC)" <quic_llindhol@quicinc.com>,
	'Michael D Kinney' <michael.d.kinney@intel.com>
Cc: 'Ruiyu Ni' <ruiyu.ni@intel.com>,
	'Star Zeng' <star.zeng@intel.com>,
	"'michael.a.rothman@intel.com'" <michael.a.rothman@intel.com>,
	"'felixp@ami.com'" <felixp@ami.com>
Subject: Managing boot order dependencies with ResetNotification Protocol
Date: Thu, 29 Jun 2023 00:23:42 +0000	[thread overview]
Message-ID: <7795152053a34b42ac9ffa2327eed287@quicinc.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

Hello,

This is a comment and query on the Reset Notification Protocol defined by the UEFI specification.

The specification requires clients to be notified for ResetSystem() without imposing any specific ordering on how these notifications are dispatched: https://uefi.org/specs/UEFI/2.10/39_Micellaneous_Protocols.html#reset-notification-protocol.
For example, this is used for gracefully shutting off NVMe and TPM through their respective spec defined power off notifications:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c#L950
https://github.com/tianocore/edk2/blob/master/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c#L2597

If we assume a platform implementing fTPM using NVMe-RPMB,  the boot order would require NVMe as a dependency for TPM, but that might result in an issue with the reset notification path. The default EDK2 implementation dispatches these notifications in boot order: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c#L78.  Here NVMe would power off, before TPM commits to NVMe-RPMB within its reset notification callback. Reversing the order of dispatch (i.e. reverse-boot order) would help with this situation.

We have several similar situations on our platform -- drivers with a Depex ordering registering for ResetNotify which would benefit from being signaled in reverse-boot order. Are there any provisions that could be made with regards to ensuring the ordering requirement?  Could we mimic the behavior of the ExitBootServices event dispatch for ResetNotify:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Event/Event.c#L492 ?
[The proposal would be to use InsertHeadList() instead of InsertTailList() in RegisterResetNotify()]

Thanks,
Ajay

[-- Attachment #2: Type: text/html, Size: 7289 bytes --]

             reply	other threads:[~2023-06-29  0:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  0:23 Ajay Iyengar (QUIC) [this message]
2023-07-11 23:37 ` Managing boot order dependencies with ResetNotification Protocol Andrew Fish

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=7795152053a34b42ac9ffa2327eed287@quicinc.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