On Tue, Apr 01, 2025 at 09:01:27AM -0400, Xiaoyao Li wrote: > Date: Tue, 1 Apr 2025 09:01:27 -0400 > From: Xiaoyao Li <xiaoyao...@intel.com> > Subject: [PATCH v8 17/55] i386/tdvf: Introduce function to parse TDVF > metadata > X-Mailer: git-send-email 2.34.1 > > From: Isaku Yamahata <isaku.yamah...@intel.com> > > TDX VM needs to boot with its specialized firmware, Trusted Domain > Virtual Firmware (TDVF). QEMU needs to parse TDVF and map it in TD > guest memory prior to running the TDX VM. > > A TDVF Metadata in TDVF image describes the structure of firmware. > QEMU refers to it to setup memory for TDVF. Introduce function > tdvf_parse_metadata() to parse the metadata from TDVF image and store > the info of each TDVF section. > > TDX metadata is located by a TDX metadata offset block, which is a > GUID-ed structure. The data portion of the GUID structure contains > only an 4-byte field that is the offset of TDX metadata to the end > of firmware file. > > Select X86_FW_OVMF when TDX is enable to leverage existing functions > to parse and search OVMF's GUID-ed structures. > > Signed-off-by: Isaku Yamahata <isaku.yamah...@intel.com> > Co-developed-by: Xiaoyao Li <xiaoyao...@intel.com> > Signed-off-by: Xiaoyao Li <xiaoyao...@intel.com> > Acked-by: Gerd Hoffmann <kra...@redhat.com> > --- > Changes in v8: > - Drop the failure handling of memcpy() since it cannot fail; > > Changes in v7: > - Update license info to only use SPDX tag; > - use g_autofree to avoid manually free; > > Changes in v6: > - Drop the the data endianness change for metadata->Length; > > Changes in v1: > - rename tdvf_parse_section_entry() to > tdvf_parse_and_check_section_entry() > > Changes in RFC v4: > - rename TDX_METADATA_GUID to TDX_METADATA_OFFSET_GUID > --- > hw/i386/Kconfig | 1 + > hw/i386/meson.build | 1 + > hw/i386/tdvf.c | 183 +++++++++++++++++++++++++++++++++++++++++ > include/hw/i386/tdvf.h | 38 +++++++++ > 4 files changed, 223 insertions(+) > create mode 100644 hw/i386/tdvf.c > create mode 100644 include/hw/i386/tdvf.h
Reviewed-by: Zhao Liu <zhao1....@intel.com>