From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: edk2-devel-groups-io <devel@edk2.groups.io>,
Laszlo Ersek <lersek@redhat.com>
Subject: Re: [edk2-devel] [PATCH 3/4] ArmVirtPkg/PlatformPeiLib: implement Reset2 PPI based on PSCI
Date: Tue, 7 Jan 2020 17:55:32 +0100 [thread overview]
Message-ID: <CAKv+Gu-r3czOhCS49pERYrFPh3=_xE8RFFpE8Le9cWEWgd6qEA@mail.gmail.com> (raw)
In-Reply-To: <913896f6-bd27-3942-1f79-20e347b48573@redhat.com>
On Tue, 7 Jan 2020 at 17:50, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 01/07/20 10:47, Ard Biesheuvel wrote:
> > Extend the existing DT traversal routine in PlatformPeiLib with
> > discovery of the PSCI method, and expose an implementation of the
> > Reset2 PPI based on the method found.
> >
> > This satisfies a dependency of Tcg2Pei, which needs to reset the
> > platform in some cases. Since there are no other uses for system
> > reset in PEI on ArmVirtQemu, simply expose the PPI directly rather
> > than using the generic ResetSystemPei and the associated plumbing.
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf | 3 +
> > ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 123 ++++++++++++++++++++
> > 2 files changed, 126 insertions(+)
>
> Tcg2Pei uses ResetCold() from ResetSystemLib.
>
> ArmVirtPkg's existent ResetSystemLib instance
> (ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf) is only
> suitable for DXE_DRIVER and DXE_RUNTIME_DRIVER instances. It uses our
> FDT Client protocol for looking up (I think) more or less the same
> things that you parse here.
>
> As a PEI phase replacement, this patch produces gEfiPeiReset2PpiGuid,
> and then in patch#4, we resolve ResetSystemLib, for PEIMs, to the
>
> MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.inf
>
> instance, which depends on the PPI installed here.
>
> I'm not too happy about installing the gEfiPeiReset2PpiGuid from
> PlatformPeiLib.
>
> As replacement, it's not ResetSystemPei what I'd recommend (which
> depends on a PEI-phase ResetSystemLib instance anyway, which we don't
> have, in the first place).
>
> (1) Instead, I'd recommend implementing a PEI-phase ResetSystemLib for
> ArmVirtQemu. (Under ArmVirtPkg/Library/ArmVirtPsciResetSystemLib -- new
> INF file.)
>
> Would that be a large burden? I think we'd need a helper function in
> that lib instance, for returning HVC versus SMC (from the FDT), and then
> we'd have to call the proper interface for the actual reset. Not fast,
> but resets don't need to be fast I think.
>
That is what I started out with. The problem is that I am not 100%
convinced that it is safe to dereference the initial FDT base address
at arbitrary times during PEI, and so it would be better to consume
the FDT from the GUIDed HOB. That, however, creates another ordering
issue, and so we should install a PPI that signals the availability of
the FDT GUIDed HOB.
At this point, I decided it would be better to just produce the PPI in
the PlatformPeiLib, but I agree it is not the cleanest approach.
> BTW I think the following modules are never meant to be used together:
>
> MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.inf
> MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
>
> because they seem to depend mutually on each other's abstract interface
> (PPI vs. lib class). So I think a given platform should include *at most
> one* of these, on top of the "other" facility that it already exposes.
> In ArmVirtQemu's case, I'd suggest implementing the lib class for PEI,
> and then we can include "ResetSystemPei" whenever the need arises.
>
The idea is that other PEIMs use the library, which is backed by the
PEIM, so that any hooks and notifications that occur at reset time can
be dispatched correctly. If every PEIM that needs to reset the system
calls into a library directly, this no longer works.
next prev parent reply other threads:[~2020-01-07 16:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 9:47 [PATCH 0/4] ArmVirtPkg: implement measured boot for ArmVirtQemu Ard Biesheuvel
2020-01-07 9:47 ` [PATCH 1/4] OvmfPkg/Tcg2ConfigPei: introduce a signalling PPI to depex on Ard Biesheuvel
2020-01-07 11:58 ` Laszlo Ersek
2020-01-07 9:47 ` [PATCH 2/4] ArmVirtPkg/PlatformPeiLib: discover the TPM base address from the DT Ard Biesheuvel
2020-01-07 15:42 ` Laszlo Ersek
2020-01-08 14:41 ` Ard Biesheuvel
2020-01-09 13:04 ` Laszlo Ersek
2020-01-07 9:47 ` [PATCH 3/4] ArmVirtPkg/PlatformPeiLib: implement Reset2 PPI based on PSCI Ard Biesheuvel
2020-01-07 16:50 ` Laszlo Ersek
2020-01-07 16:55 ` Ard Biesheuvel [this message]
2020-01-07 18:47 ` [edk2-devel] " Laszlo Ersek
2020-01-08 9:59 ` Ard Biesheuvel
2020-01-07 9:48 ` [PATCH 4/4] ArmVirtPkg/ArmVirtQemu: add optional support for TPM2 measured boot Ard Biesheuvel
2020-01-07 17:37 ` Laszlo Ersek
2020-01-08 14:13 ` Ard Biesheuvel
2020-01-08 14:45 ` Laszlo Ersek
2020-01-09 0:51 ` Yao, Jiewen
2020-01-09 13:07 ` Laszlo Ersek
2020-01-10 0:32 ` Yao, Jiewen
2020-01-13 1:55 ` [edk2-devel] " Gary Lin
2020-01-13 15:56 ` Laszlo Ersek
2020-01-07 11:55 ` [PATCH 0/4] ArmVirtPkg: implement measured boot for ArmVirtQemu Laszlo Ersek
2020-01-07 12:04 ` Ard Biesheuvel
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='CAKv+Gu-r3czOhCS49pERYrFPh3=_xE8RFFpE8Le9cWEWgd6qEA@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