[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 18/52] i386/tdx: Don't initialize pc.rom for TDX VMs
From: |
Xiaoyao Li |
Subject: |
[PATCH v7 18/52] i386/tdx: Don't initialize pc.rom for TDX VMs |
Date: |
Fri, 24 Jan 2025 08:20:14 -0500 |
For TDX, the address below 1MB are entirely general RAM. No need to
initialize pc.rom memory region for TDs.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
This is more as a workaround of the issue that for q35 machine type, the
real memslot update (which requires memslot deletion )for pc.rom happens
after tdx_init_memory_region. It leads to the private memory ADD'ed
before get lost. I haven't work out a good solution to resolve the
order issue. So just skip the pc.rom setup to avoid memslot deletion.
---
hw/i386/pc.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b46975c8a4db..44ccc82e2472 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -43,6 +43,7 @@
#include "system/xen.h"
#include "system/reset.h"
#include "kvm/kvm_i386.h"
+#include "kvm/tdx.h"
#include "hw/xen/xen.h"
#include "qapi/qmp/qlist.h"
#include "qemu/error-report.h"
@@ -972,21 +973,23 @@ void pc_memory_init(PCMachineState *pcms,
/* Initialize PC system firmware */
pc_system_firmware_init(pcms, rom_memory);
- option_rom_mr = g_malloc(sizeof(*option_rom_mr));
- if (machine_require_guest_memfd(machine)) {
- memory_region_init_ram_guest_memfd(option_rom_mr, NULL, "pc.rom",
- PC_ROM_SIZE, &error_fatal);
- } else {
- memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
- &error_fatal);
- if (pcmc->pci_enabled) {
- memory_region_set_readonly(option_rom_mr, true);
+ if (!is_tdx_vm()) {
+ option_rom_mr = g_malloc(sizeof(*option_rom_mr));
+ if (machine_require_guest_memfd(machine)) {
+ memory_region_init_ram_guest_memfd(option_rom_mr, NULL, "pc.rom",
+ PC_ROM_SIZE, &error_fatal);
+ } else {
+ memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
+ &error_fatal);
+ if (pcmc->pci_enabled) {
+ memory_region_set_readonly(option_rom_mr, true);
+ }
}
+ memory_region_add_subregion_overlap(rom_memory,
+ PC_ROM_MIN_VGA,
+ option_rom_mr,
+ 1);
}
- memory_region_add_subregion_overlap(rom_memory,
- PC_ROM_MIN_VGA,
- option_rom_mr,
- 1);
fw_cfg = fw_cfg_arch_create(machine,
x86ms->boot_cpus, x86ms->apic_id_limit);
--
2.34.1
- [PATCH v7 09/52] i386/tdx: Add property sept-ve-disable for tdx-guest object, (continued)
- [PATCH v7 09/52] i386/tdx: Add property sept-ve-disable for tdx-guest object, Xiaoyao Li, 2025/01/24
- [PATCH v7 08/52] i386/tdx: Initialize TDX before creating TD vcpus, Xiaoyao Li, 2025/01/24
- [PATCH v7 10/52] i386/tdx: Make sept_ve_disable set by default, Xiaoyao Li, 2025/01/24
- [PATCH v7 11/52] i386/tdx: Wire CPU features up with attributes of TD guest, Xiaoyao Li, 2025/01/24
- [PATCH v7 12/52] i386/tdx: Validate TD attributes, Xiaoyao Li, 2025/01/24
- [PATCH v7 13/52] i386/tdx: Set APIC bus rate to match with what TDX module enforces, Xiaoyao Li, 2025/01/24
- [PATCH v7 14/52] i386/tdx: Implement user specified tsc frequency, Xiaoyao Li, 2025/01/24
- [PATCH v7 15/52] i386/tdx: load TDVF for TD guest, Xiaoyao Li, 2025/01/24
- [PATCH v7 16/52] i386/tdvf: Introduce function to parse TDVF metadata, Xiaoyao Li, 2025/01/24
- [PATCH v7 17/52] i386/tdx: Parse TDVF metadata for TDX VM, Xiaoyao Li, 2025/01/24
- [PATCH v7 18/52] i386/tdx: Don't initialize pc.rom for TDX VMs,
Xiaoyao Li <=
- [PATCH v7 19/52] i386/tdx: Track mem_ptr for each firmware entry of TDVF, Xiaoyao Li, 2025/01/24
- [PATCH v7 20/52] i386/tdx: Track RAM entries for TDX VM, Xiaoyao Li, 2025/01/24
- [PATCH v7 21/52] headers: Add definitions from UEFI spec for volumes, resources, etc..., Xiaoyao Li, 2025/01/24
- [PATCH v7 22/52] i386/tdx: Setup the TD HOB list, Xiaoyao Li, 2025/01/24
- [PATCH v7 23/52] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION, Xiaoyao Li, 2025/01/24
- [PATCH v7 24/52] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu, Xiaoyao Li, 2025/01/24
- [PATCH v7 26/52] i386/tdx: Enable user exit on KVM_HC_MAP_GPA_RANGE, Xiaoyao Li, 2025/01/24
- [PATCH v7 29/52] i386/cpu: introduce x86_confidential_guest_cpu_instance_init(), Xiaoyao Li, 2025/01/24
- [PATCH v7 33/52] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM, Xiaoyao Li, 2025/01/24
- [PATCH v7 30/52] i386/tdx: implement tdx_cpu_instance_init(), Xiaoyao Li, 2025/01/24