public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Rebecca Cran <rebecca@bsdio.com>
Cc: devel@edk2.groups.io, Jordan Justen <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Peter Grehan <grehan@freebsd.org>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH] OvmfPkg/Bhyve: Update Bhyve following changes to OVMF
Date: Wed, 11 Nov 2020 20:57:31 +0100	[thread overview]
Message-ID: <28151b00-7744-ff98-ddd0-52ec527c6f1c@redhat.com> (raw)
In-Reply-To: <20201111031006.33564-1-rebecca@bsdio.com>

+Tom

On 11/11/20 04:10, Rebecca Cran wrote:
> Fix BhyveX64.dsc and BhyveX64.fdf to follow breaking
> changes in OVMF.
>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>  OvmfPkg/Bhyve/BhyveX64.dsc | 1 +
>  OvmfPkg/Bhyve/BhyveX64.fdf | 6 ++++++
>  2 files changed, 7 insertions(+)

Ouch, I'm sorry.

>
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 16d2233d77..868338b460 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -225,6 +225,7 @@
>
>  [LibraryClasses.common]
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> +  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
>
>  [LibraryClasses.common.SEC]
>  !ifdef $(DEBUG_ON_SERIAL_PORT)

Yep, makes sense.

> diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
> index 5d2586ae14..8776aaf7ac 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.fdf
> +++ b/OvmfPkg/Bhyve/BhyveX64.fdf
> @@ -76,6 +76,12 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.
>  0x007000|0x001000
>  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
>
> +0x008000|0x001000
> +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbPageTableBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbPageTableSize
> +
> +0x009000|0x002000
> +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbSize
> +
>  0x010000|0x010000
>  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
>
>

Hmm, this, on the other hand, makes me wonder. All four PCDs are
[PcdsFixedAtBuild], from "OvmfPkg.dec", so the platform DSC/FDF files
*should not* be required to override defaults.

....

Ah, wait, you're hitting the exact PCD value checks (%error directives)
in "OvmfPkg/ResetVector/ResetVector.nasmb".

During the SEV-ES review, I completely lost track of Bhyve consuming
"OvmfPkg/ResetVector/ResetVector.inf". Sorry about that.

So the following list of commits:

(1) 6995a1b79bab OvmfPkg: Create a GHCB page for use during Sec phase
(2) 8a2732186a53 OvmfPkg/ResetVector: Add support for a 32-bit SEV check
(3) 30937f2f98c4 OvmfPkg: Use the SEV-ES work area for the SEV-ES AP
                 reset vector

causes a problem for the Bhyve platform.

I don't like the "OvmfPkg/Bhyve/BhyveX64.fdf" hack as presented above,
because, while it makes the symptom go away, it causes "BhyveX64.fdf"
appear as if it had anything to do with SEV-ES -- which it doesn't.

Here's what I suggest:


* patch#1:

Subject:

  OvmfPkg/Bhyve: detach ResetVector from before the SEV-ES changes

Commit message:

  Commits 6995a1b79bab, 8a2732186a53 and 30937f2f98c4 modified all four
  regular files under "OvmfPkg/ResetVector" with SEV-ES dependencies.
  These are not relevant for Bhyve. Detach the pre-SEV-ES version of
  ResetVector for Bhyve.

Composing the patch:

  $ git checkout -b bhyve_reset_vector master
  $ rm -r OvmfPkg/ResetVector/
  $ git checkout 6995a1b79bab^ -- OvmfPkg/ResetVector/
  $ mv OvmfPkg/ResetVector/ OvmfPkg/Bhyve/
  $ git checkout master -- OvmfPkg/ResetVector/

  # add your (C) notices to all files under OvmfPkg/Bhyve/ResetVector/
  # namely "PageTables64.asm", "ResetVector.inf", "ResetVector.nasmb"

  # do *not* re-generate the FILE_GUID in the new INF file (this is a
  # well-known GUID, namely "gEfiFirmwareVolumeTopFileGuid")

  $ git add OvmfPkg/Bhyve/ResetVector/
  $ git commit


* patch#2:

Subject:

  OvmfPkg/Bhyve: fix build breakage after SEV-ES changes

Commit message:

  Consume the SEV-ES-independent reset vector restored in the previous
  patch. Use the Null instance of VmgExitLib.

Body:

> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 16d2233d7788..ba79ceef5563 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -225,6 +225,7 @@ [LibraryClasses]
>
>  [LibraryClasses.common]
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> +  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
>
>  [LibraryClasses.common.SEC]
>  !ifdef $(DEBUG_ON_SERIAL_PORT)
> @@ -571,7 +572,7 @@ [PcdsDynamicHii]
>  #
>  ################################################################################
>  [Components]
> -  OvmfPkg/ResetVector/ResetVector.inf
> +  OvmfPkg/Bhyve/ResetVector/ResetVector.inf
>
>    #
>    # SEC Phase modules
> diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
> index 5d2586ae141a..f4050c4934b7 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.fdf
> +++ b/OvmfPkg/Bhyve/BhyveX64.fdf
> @@ -117,7 +117,7 @@ [FV.SECFV]
>  #
>  INF  OvmfPkg/Sec/SecMain.inf
>
> -INF  RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf
> +INF  RuleOverride=RESET_VECTOR OvmfPkg/Bhyve/ResetVector/ResetVector.inf
>
>  ################################################################################
>  [FV.PEIFV]

Optimally, these changes should have been part of the SEV-ES feature
series, but we didn't realize. Sorry about the regression!

Thanks
Laszlo


  reply	other threads:[~2020-11-11 19:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  3:10 [PATCH] OvmfPkg/Bhyve: Update Bhyve following changes to OVMF Rebecca Cran
2020-11-11 19:57 ` Laszlo Ersek [this message]
2020-11-11 20:51   ` Lendacky, Thomas
2020-11-12  5:41   ` Rebecca Cran
2020-11-13 19:39     ` Laszlo Ersek

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=28151b00-7744-ff98-ddd0-52ec527c6f1c@redhat.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