From: Gerd Hoffmann <kraxel@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] q35: implement SMRAM.D_LCK
Date: Wed, 15 Apr 2015 15:58:57 +0200 [thread overview]
Message-ID: <1429106337.6219.5.camel@nilsson.home.kraxel.org> (raw)
In-Reply-To: <552D259E.405@redhat.com>
On Di, 2015-04-14 at 16:35 +0200, Paolo Bonzini wrote:
>
> On 14/04/2015 15:12, Gerd Hoffmann wrote:
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> > hw/pci-host/q35.c | 17 ++++++++++++++++-
> > 1 file changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> > index 79bab15..9227489 100644
> > --- a/hw/pci-host/q35.c
> > +++ b/hw/pci-host/q35.c
> > @@ -268,6 +268,20 @@ static void mch_update_smram(MCHPCIState *mch)
> > PCIDevice *pd = PCI_DEVICE(mch);
> > bool h_smrame = (pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_H_SMRAME);
> >
> > + /* implement SMRAM.D_LCK */
> > + if (pd->config[MCH_HOST_BRIDGE_SMRAM] & MCH_HOST_BRIDGE_SMRAM_D_LCK) {
> > + pd->config[MCH_HOST_BRIDGE_SMRAM] &= ~MCH_HOST_BRIDGE_SMRAM_D_OPEN;
> > +
> > + pd->wmask[MCH_HOST_BRIDGE_SMRAM] &= ~MCH_HOST_BRIDGE_SMRAM_D_OPEN;
> > + pd->wmask[MCH_HOST_BRIDGE_SMRAM] &= ~MCH_HOST_BRIDGE_SMRAM_D_LCK;
> > + pd->wmask[MCH_HOST_BRIDGE_SMRAM] &= ~MCH_HOST_BRIDGE_SMRAM_G_SMRAME;
> > + pd->wmask[MCH_HOST_BRIDGE_SMRAM] &= ~MCH_HOST_BRIDGE_SMRAM_C_BASE_SEG_MASK;
> > +
> > + pd->wmask[MCH_HOST_BRIDGE_ESMRAMC] &= ~MCH_HOST_BRIDGE_ESMRAMC_H_SMRAME;
> > + pd->wmask[MCH_HOST_BRIDGE_ESMRAMC] &= ~MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_MASK;
> > + pd->wmask[MCH_HOST_BRIDGE_ESMRAMC] &= ~MCH_HOST_BRIDGE_ESMRAMC_T_EN;
> > + }
> > +
> > memory_region_transaction_begin();
> >
> > if (pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_D_OPEN) {
> > @@ -297,7 +311,6 @@ static void mch_write_config(PCIDevice *d,
> > {
> > MCHPCIState *mch = MCH_PCI_DEVICE(d);
> >
> > - /* XXX: implement SMRAM.D_LOCK */
> > pci_default_write_config(d, address, val, len);
> >
> > if (ranges_overlap(address, len, MCH_HOST_BRIDGE_PAM0,
> > @@ -351,6 +364,8 @@ static void mch_reset(DeviceState *qdev)
> > MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT);
> >
> > d->config[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_DEFAULT;
> > + d->wmask[MCH_HOST_BRIDGE_SMRAM] = 0xff;
> > + d->wmask[MCH_HOST_BRIDGE_ESMRAMC] = 0xff;
>
> S3, if I remember correctly, should not be able to reset D_LCK.
The "A Tour Beyond BIOS Implementing S3 Resume with EDKII" white paper
lists "Lock SMM. This must be done to maintain SMM integrity." as todo
list item for the edk2 resume code path (page 18).
So it seems to me it is the job of the firmware to re-lock smm after S3
(and before handing control back to the OS, obviously).
> Does
> this do the right thing?
I think so ...
cheers,
Gerd
next prev parent reply other threads:[~2015-04-15 13:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 13:12 [Qemu-devel] [PATCH 1/2] q35: implement SMRAM.D_LCK Gerd Hoffmann
2015-04-14 13:12 ` [Qemu-devel] [PATCH 2/2] q35: add test for SMRAM.D_LCK Gerd Hoffmann
2015-04-14 14:35 ` [Qemu-devel] [PATCH 1/2] q35: implement SMRAM.D_LCK Paolo Bonzini
2015-04-15 13:58 ` Gerd Hoffmann [this message]
2015-04-16 8:12 ` Paolo Bonzini
2015-04-18 21:08 ` Laszlo Ersek
2015-04-14 15:41 ` Michael S. Tsirkin
2015-04-14 15:51 ` Michael S. Tsirkin
2015-04-15 14:12 ` Gerd Hoffmann
2015-04-16 8:05 ` Michael S. Tsirkin
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-all 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=1429106337.6219.5.camel@nilsson.home.kraxel.org \
--to=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).