public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Brijesh Singh <brijesh.singh@amd.com>
To: Laszlo Ersek <lersek@redhat.com>, edk2-devel@lists.01.org
Cc: brijesh.singh@amd.com, Tom Lendacky <Thomas.Lendacky@amd.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Michael Kinney <michael.d.kinney@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/2] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Clear C-bit when SEV is active
Date: Tue, 27 Feb 2018 14:37:09 -0600	[thread overview]
Message-ID: <0d4dcddc-d417-e4b9-961d-73fed7647cbe@amd.com> (raw)
In-Reply-To: <da7f2401-ccd0-ab4c-82c0-8e18c70c6cd3@redhat.com>

Hi Laszlo,


On 2/27/18 11:17 AM, Laszlo Ersek wrote:
> Hi Brijesh,
>
> you provided a lot of information (and it seems like your analysis was
> advancing in parallel with your email -- I too do that sometimes :) ),
> so it's not easy for me to write a concise response.
>
> * Regarding the C-bit that covers the relocated save state area (esp.
> considering that the area is not page aligned and/or contains executable
> code):
>
> I think (a) adding any code (under OvmfPkg, or under the core) that sets
> the C-bit "correctly", and in turn, (b) lacking any code in edk2 that
> actually *exercises* the "correct" C-bit setting, is counter-productive.
> Unless the C-bit is actively exercised, we're just adding *dead* code,
> which is a bad thing -- it's very easy to regress (without anyone
> noticing), and it leads to developer confusion.
>
> On the other hand, I wouldn't want your analysis to be lost (remember: I
> asked for the explanation because I didn't understand the behavior). So
> I'm thinking your analysis should be captured in both a commit message,
> and a large comment *somewhere*. Possibly near the code (wherever it may
> end up, AmdSevDxe or SmmCpuFeaturesLib) where you manage the C-bit for
> the *initial* save state map.
>
> I mean, wherever you manage the C-bit for the initial save state map
> (which is required), you can also make a large comment on the *future*
> location and behavior.
>
> IMO it's OK if we don't guarantee the guest with functional access into
> the relocated save state map -- there is no actual code relying on that!
> -- as long as we document this gap.
>
> Does this suggestion make sense to you?

I am good with this approach. I will add my analysis detail in commit
message and also put the similar thing in AmdSevDxe. In future if EDKII
makes use to SmmSavedArea after the SMBASE relocation then we can
revisit it.

>
> * Regarding mapping all the NonExistent and MMIO GCD entries in the SMM
> page table as plaintext: I think we should really be on par with
> AmdSevDxe here. This is code that *will* be exercised, and if we cut
> corners here, next time we add another MMIO range or device that needs
> to be accessed from SMM too (for whatever reason), we'll go crazy otherwise.

Sounds good, I will make the necessary changes and send the update
patch. thanks for your help.

>
> * In general, regarding how and when SmmCpuFeaturesLib APIs are hooked
> into PiSmmCpuDxeSmm: please ask questions -- and ask them to Mike :)
> OVMF's instance of this lib class is Paolo's work (thanks again for
> that!), so I always defer to Mike and Paolo whenever this lib class and
> instance come up. SmmCpuFeaturesInitializeProcessor() looked suitable to
> me, for implementing the previous bullet, but it's really just my
> "shopping" for a good pre-existent hook point. If we need something
> better, let's discuss it with Mike.
>
> I'm sorry if the above is a bit too vague; please post some new patches,
> even if only RFCs :)

I think your explanation is very clear to me and I am in agreement. Let
me work on patches.

>
> Thanks!
> Laszlo



  reply	other threads:[~2018-02-27 20:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 16:52 [PATCH 0/2] Add SMM support when SEV is active Brijesh Singh
2018-02-21 16:52 ` [PATCH 1/2] OvmfPkg/AmdSevDxe: Clear the C-bit from SMM Saved State Brijesh Singh
2018-02-22 11:20   ` Laszlo Ersek
2018-02-22 11:21     ` Laszlo Ersek
2018-02-27 12:17     ` Brijesh Singh
2018-02-21 16:52 ` [PATCH 2/2] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Clear C-bit when SEV is active Brijesh Singh
2018-02-22 12:08   ` Laszlo Ersek
2018-02-27 12:23     ` Brijesh Singh
2018-02-27 17:17       ` Laszlo Ersek
2018-02-27 20:37         ` Brijesh Singh [this message]
2018-02-28 15:21           ` Brijesh Singh

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=0d4dcddc-d417-e4b9-961d-73fed7647cbe@amd.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