]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: unify PcdMaxVariableSize at 0x2000 bytes
authorLaszlo Ersek <lersek@redhat.com>
Mon, 20 Jan 2014 08:50:06 +0000 (08:50 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 20 Jan 2014 08:50:06 +0000 (08:50 +0000)
The Linux persistent store (pstore) feature serves, among other things,
for saving the trailing portion of the dmesg in case of a kernel oops. One
backend for the pstore facility is "efivars", ie. non-volatile UEFI
variables.

Linux splits the tail of the dmesg that is to be dumped in 1KB chunks, and
tries to save each chunk as a specially (and differently) named
non-volatile variable. The 1KB chunk size accounts for the variable data
only; Linux expects this size to be available per variable *without*
accounting for the variable name or any firmware-internal overhead.

For non-authenticated (ie. non-secure-boot) variables, OvmfPkg currently
sets the per-variable limit to 0x400 (1KB) through PcdMaxVariableSize.
However this PCD determines the size *before* subtracting the internal
overhead (which is sizeof(VARIABLE_HEADER) == 0x20 bytes for
non-authenticated variables, see
"MdeModulePkg/Include/Guid/VariableFormat.h"), and also before subtracting
the given variable's UCS-2 encoded name (including the trailing 0x0000).

Linux maximizes these special variable names in DUMP_NAME_LEN==52 code
points (including the trailing NUL). Hence we must provide at least

  0x020 == sizeof(VARIABLE_HEADER), for the internal overhead
  0x068 == 2 * 52, for the UCS-2 encoded name, including trailing 0x0000
  0x400 for the variable body
  -----
  0x488 == 1160

bytes in PcdMaxVariableSize, so that Linux's efivars-backed pstore can
work even on non-secure-boot builds of OVMF.

However, as PcdMaxVariableSize=0x2000 has proven reasonable when secure
boot is enabled, it should also be okay when secure boot is disabled; so
for simplicity's sake set PcdMaxVariableSize to 0x2000 unconditionally.

Tested-by: Seiji Aguchi <seiji.aguchi@hds.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15142 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

index c7c90fb3dc4a9ca456c6d2f3a3f2730344ed8d6b..88d479db231fd9c41d8a0666b24ae6aac5631ea5 100644 (file)
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32\r
-!if $(SECURE_BOOT_ENABLE) == TRUE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000\r
-!else\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400\r
-!endif\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000\r
 \r
index b8c569a1497ab7c1be7e44c26561222be4e93342..f19b658428ca3a839f91287d9f75e4de65bc3aeb 100644 (file)
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32\r
-!if $(SECURE_BOOT_ENABLE) == TRUE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000\r
-!else\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400\r
-!endif\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000\r
 \r
index 7b1fa521744f0fa4f485736a314a66eac21fd815..c4799791b41f159784bf638bec01bee139d440d9 100644 (file)
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32\r
-!if $(SECURE_BOOT_ENABLE) == TRUE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000\r
-!else\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400\r
-!endif\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000\r
 \r