I am using a qemu version based on the device-passthrough branch. It contains [PATCH 26/62] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION. I expose the OVMF via -bios. Built OVMF with OvmfPkg/IntelTdx/IntelTdxX64.dsc (and measurements are included properly).
I added some variables to the OVMF blob and they don't appear inside the guest. According to the tdx firmware specification it should be picked up (https://cdrdv2-public.intel.com/733585/tdx-virtual-firmware-design-guide-rev-004-20231206.pdf):
TDVF may also include a configuration firmware volume (CFV) that is separated from the boot firmware volume. The reason to do this is because the CFV is measured in RTMR, while the boot FV is measured in MRTD. Configuration Firmware Volume includes all the provisioned data. This region is read only. One possible usage is to provide UEFI Secure Boot Variable content in this region, such as PK, KEK, db, dbx. This region may include additional configuration variables. The file system GUID must be EFI_SYSTEM_NV_DATA_FV_GUID, which is defined in https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Include/Guid/SystemNvDataGuid.h.
The variable storage header must be VARIABLE_STORE_HEADER, and the variable header must be VARIABLE_HEADER. Both are defined in https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Include/Guid/VariableFormat.h.
Here the varstore output of the all-in-one blob:
image=OVMF.fd
volume=guid:NvData offset=0x0 size=0x84000 hlen=0x48 xoff=0x0 rev=2 blocks=132*4096 used=48.5%
nvdata=guid:AuthVars size=0x3ffb8 format=0x5a state=0xfe
variable=guid:EfiCustomModeEnable nsize=0x16 dsize=0x1 attr=0x3 name=CustomMode (ok)
bool: off
variable=guid:EfiGlobalVariable nsize=0x8 dsize=0xfca attr=0x27 name=KEK (ok)
blob: 4042 bytes
variable=guid:EfiGlobalVariable nsize=0x6 dsize=0x3d0 attr=0x27 name=PK (ok)
blob: 976 bytes
variable=cd7cc258-31db-22e6-9f22-63b0b8eed6b5 nsize=0x12 dsize=0x4 attr=0x7 name=TestThis (ok)
dword: 0x00000000
variable=guid:EfiSecureBootEnableDisable nsize=0x22 dsize=0x1 attr=0x3 name=SecureBootEnable (ok)
bool: ON
variable=guid:EfiGlobalVariable nsize=0xa dsize=0x1 attr=0x3 name=blub (ok)
byte: 0x00
variable=guid:EfiImageSecurityDatabase nsize=0x6 dsize=0x11ee attr=0x27 name=db (ok)
blob: 4590 bytes
variable=guid:EfiImageSecurityDatabase nsize=0x8 dsize=0x4c attr=0x27 name=dbx (ok)
blob: 76 bytes
end of variable list at offset 0x283c
volume=guid:Ffs offset=0x84000 size=0x348000 hlen=0x48 xoff=0x60 rev=2 blocks=840*4096 used=30.5% name=guid:OvmfMainFv
[...]
I would expect taht I see blub or TestThis exposed inside the guest, but nothing shows up:
localhost:/sys/firmware/efi/efivars# ls
Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0003-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0004-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
Key0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
Key0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c
LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
MTC-eb704011-1402-11d3-8e77-00a0c969723b
NvVars-964e5b22-6459-11d2-8e39-00a0c969723b
OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformRecovery0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c
VarErrorFlag-04b37fe8-f6ae-480b-bdd5-37d98c5e89aa
Do I handle things wrong or is there a potential issue?
I am using a qemu version based on the
device-passthroughbranch. It contains[PATCH 26/62] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION. I expose the OVMF via-bios. Built OVMF withOvmfPkg/IntelTdx/IntelTdxX64.dsc(and measurements are included properly).I added some variables to the OVMF blob and they don't appear inside the guest. According to the tdx firmware specification it should be picked up (https://cdrdv2-public.intel.com/733585/tdx-virtual-firmware-design-guide-rev-004-20231206.pdf):
Here the varstore output of the all-in-one blob:
I would expect taht I see
bluborTestThisexposed inside the guest, but nothing shows up:Do I handle things wrong or is there a potential issue?