On Fri, Jan 10, 2014 at 9:26 PM, Laszlo Ersek <[email protected]> wrote: > 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 > > 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. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek <[email protected]> > --- > OvmfPkg/OvmfPkgIa32.dsc | 2 +- > OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- > OvmfPkg/OvmfPkgX64.dsc | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc > index 2e13e0e..7dac0fa 100644 > --- a/OvmfPkg/OvmfPkgIa32.dsc > +++ b/OvmfPkg/OvmfPkgIa32.dsc > @@ -278,7 +278,7 @@ > !if $(SECURE_BOOT_ENABLE) == TRUE > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 > !else > - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400 > + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x488
If 0x2000 is reasonable when secure boot is enabled, then it should also be okay when it is disabled. So, I'd prefer to just get rid of the !if/!else. -Jordan > !endif > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000 > gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc > index 64404a6..4af61b7 100644 > --- a/OvmfPkg/OvmfPkgIa32X64.dsc > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc > @@ -283,7 +283,7 @@ > !if $(SECURE_BOOT_ENABLE) == TRUE > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 > !else > - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400 > + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x488 > !endif > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000 > gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc > index ab9cd16..16fedfe 100644 > --- a/OvmfPkg/OvmfPkgX64.dsc > +++ b/OvmfPkg/OvmfPkgX64.dsc > @@ -283,7 +283,7 @@ > !if $(SECURE_BOOT_ENABLE) == TRUE > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 > !else > - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400 > + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x488 > !endif > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000 > gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 > -- > 1.8.3.1 > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
