public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: "Oliver Steffen" <osteffen@redhat.com>,
	"László Érsek" <lersek@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [edk2-devel] [PATCH 3/7] OvmfPkg/OvmfPkgX64: add QEMU_VARS option
Date: Thu, 23 Nov 2023 16:02:30 +0100	[thread overview]
Message-ID: <20231123150234.117835-4-kraxel@redhat.com> (raw)
In-Reply-To: <20231123150234.117835-1-kraxel@redhat.com>

Add config option to use qemu variable service,
via VirtMmCommunicationDxe.  Default is FALSE,
build using '-D QEMU_VARS=TRUE' to enable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/OvmfPkgX64.dsc                            | 15 ++++++++++++++-
 OvmfPkg/OvmfPkgX64.fdf                            | 12 +++++++++++-
 .../VirtMmCommunication.inf                       |  1 +
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index dc1a0942aa8b..4b044321e31b 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -378,7 +378,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
   VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
-!if $(SMM_REQUIRE) == TRUE
+!if $(SMM_REQUIRE) == TRUE || $(QEMU_VARS) == TRUE
   MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
 !endif
 
@@ -504,6 +504,9 @@ [PcdsFeatureFlag]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
 !endif
+!if $(QEMU_VARS) == TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
+!endif
 !if $(SECURE_BOOT_ENABLE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootSupported|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdRequireSelfSignedPk|TRUE
@@ -1095,6 +1098,15 @@ [Components]
   }
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
 
+!else
+!if $(QEMU_VARS) == TRUE
+
+  #
+  # Variable driver stack (qemu -device uefi-vars)
+  #
+  OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
+
 !else
 
   #
@@ -1110,6 +1122,7 @@ [Components]
     <LibraryClasses>
       NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
   }
+!endif
 !endif
 
   #
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 9c35b6e848a2..20cc6a49c72f 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -223,7 +223,7 @@ [FV.DXEFV]
   # encrypted region (Since the range has not been marked shared/unencrypted).
   INF  OvmfPkg/AmdSevDxe/AmdSevDxe.inf
   INF  OvmfPkg/TdxDxe/TdxDxe.inf
-!if $(SMM_REQUIRE) == FALSE
+!if $(SMM_REQUIRE) == FALSE && $(QEMU_VARS) == FALSE
   INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
 !endif
 }
@@ -392,6 +392,15 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
 
+!else
+!if $(QEMU_VARS) == TRUE
+
+  #
+  # Variable driver stack (qemu -device uefi-vars)
+  #
+INF  OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf
+INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
+
 !else
 
 #
@@ -402,6 +411,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 !endif
+!endif
 
 #
 # EFI_CC_MEASUREMENT_PROTOCOL
diff --git a/OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf b/OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf
index a9998f3db8cd..1403e92e1d6d 100644
--- a/OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf
+++ b/OvmfPkg/VirtMmCommunicationDxe/VirtMmCommunication.inf
@@ -23,6 +23,7 @@ [Sources.X64]
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
+  OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
-- 
2.42.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111678): https://edk2.groups.io/g/devel/message/111678
Mute This Topic: https://groups.io/mt/102767935/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-11-23 15:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 15:02 [edk2-devel] [PATCH 0/7] Add VirtMmCommunication driver, enable for OVMF and ArmVirt Gerd Hoffmann
2023-11-23 15:02 ` [edk2-devel] [PATCH 1/7] OvmfPkg: add IndustryStandard/QemuUefiVars.h Gerd Hoffmann
2023-11-23 15:02 ` [edk2-devel] [PATCH 2/7] OvmfPkg: add new VirtMmCommunicationDxe driver Gerd Hoffmann
2023-11-23 15:02 ` Gerd Hoffmann [this message]
2023-11-23 15:02 ` [edk2-devel] [PATCH 4/7] OvmfPkg: add PcdQemuVarsRequire Gerd Hoffmann
2023-11-23 15:02 ` [edk2-devel] [PATCH 5/7] OvmfPkg/VirtMmCommunicationDxe: stop on init failure Gerd Hoffmann
2023-11-23 15:02 ` [edk2-devel] [PATCH 6/7] OvmfPkg/VirtMmCommunicationDxe: add arm support Gerd Hoffmann
2023-11-23 15:02 ` [edk2-devel] [PATCH 7/7] ArmVirtPkg/ArmVirtQemu: add QEMU_VARS option Gerd Hoffmann
2023-11-28  8:33 ` [edk2-devel] [PATCH 0/7] Add VirtMmCommunication driver, enable for OVMF and ArmVirt Ard Biesheuvel

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=20231123150234.117835-4-kraxel@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