[LinuxBIOS] SMM in LinuxBIOS

Arvind Seshadri arvinds+ at cs.cmu.edu
Sat Dec 30 05:13:09 CET 2006


I was going to say the same thing: SMM code is meant to the OS
independent since it emulates hardware functionality. But I agree with the
requirement for the code being reentrant since the trend is towards
multicore CPUs.

BTW, I was looking over the datasheet for the AMD8111 southbridge and
found that several sources can generate an SMI. There are enable bits for
the individual SMI sources as well as a global SMI enable/disable bit.
Given that LinuxBIOS does not currently handle SMI, where is SMI disabled
in the code? I did some grepping around in the code and could not find
anything for the AMD K8. Is it the case that SMI is disabled after reset
and has to explicitly enabled by the BIOS?

Arvind

On Fri, 29 Dec 2006, Segher Boessenkool wrote:

> >> I would like to implement a piece of code as an SMM handler in
> >> LinuxBIOS.
> >
> > I think the sensible way to do this is write an SMI handler that is
> > controlled by Linux (or other OS). BIOS code should not run once the
> > OS is up.
>
> But SMM code isn't BIOS code -- it is "virtual hardware".
>
> > There are lots of OS-dependent issues that a BIOS just can
> > not know about. To pick a simple example: Are you going to ensure that
> > your SMI handler is SMP-safe? If so, how, and for which OS?
>
> SMM is not reentrant, and the SMM hardware takes care of that
> (modulo some hardware bugs, heh).  The SMM code has to go to
> great pains to ensure following the proper ordering rules for
> the real and the virtual hardware (most implementations fail
> miserably here) -- this is really hard to do, the whole SMM
> concept is such a bad design.
>
> > I know of
> > one vendor BIOS (EFI on the LLNL Thunder cluster, an itanium-based
> > machine, from several years ago) that was not re-entrant or SMP-safe,
> > and it was not fun when two CPUs tried to enter this BIOS at once.
>
> Fun eh.
>
> > Once the OS is up, the CPU should always be under control of the OS.
> > So, build an SMI handler for linux -- if you really need to do this.
>
> If you're going to implement SMM in the OS, you can just as well
> simply implement the necessary code in some device drivers.  Much
> easier.
>
>
> Segher
>
>
>





More information about the coreboot mailing list