Re: [PATCH v7 19/52] i386/tdx: Track mem_ptr for each firmware entry of TDVF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/19/2025 7:26 PM, Francesco Lavra wrote:
On Fri, 2025-01-24 at 08:20 -0500, Xiaoyao Li wrote:
+static void tdx_finalize_vm(Notifier *notifier, void *unused)
+{
+    TdxFirmware *tdvf = &tdx_guest->tdvf;
+    TdxFirmwareEntry *entry;
+
+    for_each_tdx_fw_entry(tdvf, entry) {
+        switch (entry->type) {
+        case TDVF_SECTION_TYPE_BFV:
+        case TDVF_SECTION_TYPE_CFV:
+            entry->mem_ptr = tdvf->mem_ptr + entry->data_offset;
+            break;
+        case TDVF_SECTION_TYPE_TD_HOB:
+        case TDVF_SECTION_TYPE_TEMP_MEM:
+            entry->mem_ptr = qemu_ram_mmap(-1, entry->size,
+
qemu_real_host_page_size(), 0, 0);
+            break;

Should check for MAP_FAILED return value.

will add the check for it.

+        default:
+            error_report("Unsupported TDVF section %d", entry-
type);
+            exit(1);

Section entry types have already been checked against valid types in
tdvf_parse_and_check_section_entry(), no need to check them again here.

I would rather keep it. It does no harm and I help catch issue when people adds new type in tdvf_parse_and_check_section_entry but miss this place.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux