Re: [edk2] Comparison between SMM code and Efi Shell

Subject: Re: [edk2] Comparison between SMM code and Efi Shell

From: Laszlo Ersek <lersek@redhat.com>

To: edk2-devel@lists.sourceforge.net

Date: 2014-04-03 00:07:20

On 04/02/14 11:44, Lethom Legrand wrote:
> Thanks Andrew!
> =

> Another question: do you think it will be painful to add to OVMF an SMM
> support?
> As far as I know, QEMU supports SMM, so it may be possible... The
> question is: what is the cost?

We considered pulling in SMM modules earlier. The reason was unrelated
(SMM seemed a prerequisite, not something we wanted), and ultimately we
managed to implement S3 (the LockBox interface specifically) without SMM.

You might find some hints about SMM in this (obsolete) patch series:

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/5684

Note that this series fakes SMRAM from normal guest RAM, and that it
doesn't use SMM/SMI at all.

If you want the real thing, then:
- you need to implement the two lowest level SMM drivers for real (see
the PI spec and the commit messages under the link above for details),
ie. programming qemu's emulated hardware;
- only QEMU-TCG emulates SMM/SMI, KVM doesn't (--> full emulation, no hw
acceleration).

Laszlo

> =

> Thomas
> =

> =

> 2014-04-02 10:25 GMT+02:00 Andrew Fish  >:
> =

> =

>     On Apr 1, 2014, at 11:47 PM, Lethom Legrand      > wrote:
> =

>     > Hello everyone,
>     >
>     > I have to work on the SMM code of UEFI, in order to add some
>     properties. However, I do not have any hardware platform for an easy
>     debug of my modifications. At least, not for now.
>     >
>     > I am wondering if it could be a good idea to modify the Efi Shell
>     first, for some test, because it is much more easier to debug. As I
>     understood it, the SMM Drivers in UEFI are executed in a
>     flat-protected mode, and it is the same when UEFI boot on Efi Shell
>     and the UEFI Applications it loads and executes. Of course, there
>     are differences (one is access to the SMRAM) but as I said it's just
>     to start.
>     >
>     > So, my question is: am I right? SMM code context and Efi Shell
>     context are similar?
>     >
> =

>     In general it is all C code and things are similar. The issue you
>     have is the Shell runs at boot services time. So your code as access
>     to lots of things that are not safe to use at SMM time. Also the
>     entry point is quite different for an SMM module. But as long as you
>     don=92t use gBS and only use library classes that have an instance
>     that works in SMM you could make some progress.
> =

>     Thanks,
> =

>     Andrew Fish
> =

>     > Thomas
>     >
>     ---------------------------------------------------------------------=
---------
>     > _______________________________________________
>     > edk2-devel mailing list
>     > edk2-devel@lists.sourceforge.net
>     
>     > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> =

> =

>     ---------------------------------------------------------------------=
---------
>     _______________________________________________
>     edk2-devel mailing list
>     edk2-devel@lists.sourceforge.net
>     
>     https://lists.sourceforge.net/lists/listinfo/edk2-devel
> =

> =

> =

> =

> -------------------------------------------------------------------------=
-----
> =

> =

> =

> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> =



---------------------------------------------------------------------------=
---
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel