mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 06:13:53 -06:00

For each TDVF sections, QEMU needs to copy the content to guest private memory via KVM API (KVM_TDX_INIT_MEM_REGION). Introduce a field @mem_ptr for TdxFirmwareEntry to track the memory pointer of each TDVF sections. So that QEMU can add/copy them to guest private memory later. TDVF sections can be classified into two groups: - Firmware itself, e.g., TDVF BFV and CFV, that located separately from guest RAM. Its memory pointer is the bios pointer. - Sections located at guest RAM, e.g., TEMP_MEM and TD_HOB. mmap a new memory range for them. Register a machine_init_done callback to do the stuff. Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250508150002.689633-21-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/*
|
|
* Copyright (c) 2025 Intel Corporation
|
|
* Author: Isaku Yamahata <isaku.yamahata at gmail.com>
|
|
* <isaku.yamahata at intel.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef HW_I386_TDVF_H
|
|
#define HW_I386_TDVF_H
|
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#define TDVF_SECTION_TYPE_BFV 0
|
|
#define TDVF_SECTION_TYPE_CFV 1
|
|
#define TDVF_SECTION_TYPE_TD_HOB 2
|
|
#define TDVF_SECTION_TYPE_TEMP_MEM 3
|
|
|
|
#define TDVF_SECTION_ATTRIBUTES_MR_EXTEND (1U << 0)
|
|
#define TDVF_SECTION_ATTRIBUTES_PAGE_AUG (1U << 1)
|
|
|
|
typedef struct TdxFirmwareEntry {
|
|
uint32_t data_offset;
|
|
uint32_t data_len;
|
|
uint64_t address;
|
|
uint64_t size;
|
|
uint32_t type;
|
|
uint32_t attributes;
|
|
|
|
void *mem_ptr;
|
|
} TdxFirmwareEntry;
|
|
|
|
typedef struct TdxFirmware {
|
|
void *mem_ptr;
|
|
|
|
uint32_t nr_entries;
|
|
TdxFirmwareEntry *entries;
|
|
} TdxFirmware;
|
|
|
|
#define for_each_tdx_fw_entry(fw, e) \
|
|
for (e = (fw)->entries; e != (fw)->entries + (fw)->nr_entries; e++)
|
|
|
|
int tdvf_parse_metadata(TdxFirmware *fw, void *flash_ptr, int size);
|
|
|
|
#endif /* HW_I386_TDVF_H */
|