qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/60] QEMU TDX support
@ 2024-11-05  6:23 Xiaoyao Li
  2024-11-05  6:23 ` [PATCH v6 01/60] *** HACK *** linux-headers: Update headers to pull in TDX API changes Xiaoyao Li
                   ` (59 more replies)
  0 siblings, 60 replies; 125+ messages in thread
From: Xiaoyao Li @ 2024-11-05  6:23 UTC (permalink / raw)
  To: Paolo Bonzini, Riku Voipio, Richard Henderson, Zhao Liu,
	Michael S. Tsirkin, Marcel Apfelbaum, Igor Mammedov, Ani Sinha
  Cc: Philippe Mathieu-Daudé, Yanan Wang, Cornelia Huck,
	Daniel P. Berrangé, Eric Blake, Markus Armbruster,
	Marcelo Tosatti, rick.p.edgecombe, kvm, qemu-devel, xiaoyao.li

This is the v6 series of TDX QEMU enabling. The matching KVM is
https://github.com/intel/tdx/tree/tdx_kvm_dev-2024-10-30

This series is also available in github:
https://github.com/intel-staging/qemu-tdx/tree/tdx-qemu-upstream-v6.1

Note, to boot a TD, it requires 1)TDX module 1.5.06.00.0744[0], or later.
This is due to removal of the workarounds for the lack of NO_RBP_MOD in
KVM. 2) OVMF with commit 3a3b12cbdae2 "UefiCpuPkg/MtrrLib:
MtrrLibIsMtrrSupported always return FALSE in TD-Guest" because KVM
drops the MTRR related MSR emulation.

Patches 52 to 59 are new added in this version. They are aimed to check
and guarantee the CPU model determined by user input can be satisfied.

=== future work ===
- CPU model

  It now only supports booting TD VM with "-cpu host". It is the only
  case that not supposed to hit any warning/error.

  When using named CPU model, even the same model as host, it likely
  hits warning like some feature not supported or some feature enforced
  on. It's a future work to decide if needs to introduce TDX specific
  named CPU models.

- Attestation support

  Attestation support is dropped in this version becuase KVM side remove
  the support of the related user exit. Atttestation support will be
  submitted separately when KVM regain the support.

- gdb support

  gdb support to debug a TD in off-debug mode is left as future work.

[0] https://github.com/intel/tdx-module/releases/tag/TDX_1.5.06

===
Changes in v6:
 - Remove the guest memfd patches and some i386 patches because they are
   already merged;
 - Drop the attestation support since current KVM doesn't support it;
 - Update to use the latest TDX API of KVM;
 - Change to use adjust_cpuid_features() to adjust the supported CPUID
   features for TDX;
 - Introduce x86_confidential_guest_check_features() to do additinoal
   feature check;

v5:
https://lore.kernel.org/qemu-devel/20240229063726.610065-1-xiaoyao.li@intel.com/

Chao Peng (1):
  i386/tdx: load TDVF for TD guest

Isaku Yamahata (6):
  i386/tdx: Make sept_ve_disable set by default
  i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig
  i386/tdvf: Introduce function to parse TDVF metadata
  i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION
  hw/i386: add option to forcibly report edge trigger in acpi tables
  i386/tdx: Don't synchronize guest tsc for TDs

Sean Christopherson (1):
  i386/tdx: Don't get/put guest state for TDX VMs

Xiaoyao Li (52):
  *** HACK *** linux-headers: Update headers to pull in TDX API changes
  i386: Introduce tdx-guest object
  i386/tdx: Implement tdx_kvm_type() for TDX
  i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context
  i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES
  i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object
  kvm: Introduce kvm_arch_pre_create_vcpu()
  i386/kvm: Export cpuid_entry_get_reg() and cpuid_find_entry()
  i386/tdx: Initialize TDX before creating TD vcpus
  i386/tdx: Add property sept-ve-disable for tdx-guest object
  i386/tdx: Wire CPU features up with attributes of TD guest
  i386/tdx: Validate TD attributes
  i386/tdx: Set APIC bus rate to match with what TDX module enforces
  i386/tdx: Implement user specified tsc frequency
  i386/tdx: Parse TDVF metadata for TDX VM
  i386/tdx: Don't initialize pc.rom for TDX VMs
  i386/tdx: Track mem_ptr for each firmware entry of TDVF
  i386/tdx: Track RAM entries for TDX VM
  headers: Add definitions from UEFI spec for volumes, resources, etc...
  i386/tdx: Setup the TD HOB list
  i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu
  i386/tdx: Finalize TDX VM
  i386/tdx: Enable user exit on KVM_HC_MAP_GPA_RANGE
  i386/tdx: Handle KVM_SYSTEM_EVENT_TDX_FATAL
  i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility
  i386/cpu: introduce x86_confidential_guest_cpu_instance_init()
  i386/tdx: implement tdx_cpu_instance_init()
  i386/cpu: introduce x86_confidenetial_guest_cpu_realizefn()
  i386/tdx: implement tdx_cpu_realizefn()
  i386/cpu: Introduce enable_cpuid_0x1f to force exposing CPUID 0x1f
  i386/tdx: Force exposing CPUID 0x1f
  i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM
  i386/tdx: Disable SMM for TDX VMs
  i386/tdx: Disable PIC for TDX VMs
  hw/i386: add eoi_intercept_unsupported member to X86MachineState
  i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs
  i386/tdx: Skip kvm_put_apicbase() for TDs
  i386/cgs: Rename *mask_cpuid_features() to *adjust_cpuid_features()
  i386/tdx: Implement adjust_cpuid_features() for TDX
  i386/tdx: Apply TDX fixed0 and fixed1 information to supported CPUIDs
  i386/tdx: Mask off CPUID bits by unsupported TD Attributes
  i386/cpu: Move CPUID_XSTATE_XSS_MASK to header file and introduce
    CPUID_XSTATE_MASK
  i386/tdx: Mask off CPUID bits by unsupported XFAM
  i386/cpu: Expose mark_unavailable_features() for TDX
  i386/cpu: introduce mark_forced_on_features()
  i386/cgs: Introduce x86_confidential_guest_check_features()
  i386/tdx: Fetch and validate CPUID of TD guest
  i386/tdx: Don't treat SYSCALL as unavailable
  i386/tdx: Make invtsc default on
  cpu: Introduce qemu_early_init_vcpu()
  i386/cpu: Set up CPUID_HT in x86_cpu_realizefn() instead of
    cpu_x86_cpuid()
  docs: Add TDX documentation

 accel/kvm/kvm-all.c                        |   18 +
 accel/tcg/user-exec-stub.c                 |    4 +
 configs/devices/i386-softmmu/default.mak   |    1 +
 docs/system/confidential-guest-support.rst |    1 +
 docs/system/i386/tdx.rst                   |  155 +++
 docs/system/target-i386.rst                |    1 +
 hw/i386/Kconfig                            |    6 +
 hw/i386/acpi-build.c                       |   99 +-
 hw/i386/acpi-common.c                      |   45 +-
 hw/i386/meson.build                        |    1 +
 hw/i386/pc.c                               |   29 +-
 hw/i386/pc_sysfw.c                         |    7 +
 hw/i386/tdvf-hob.c                         |  147 +++
 hw/i386/tdvf-hob.h                         |   24 +
 hw/i386/tdvf.c                             |  201 ++++
 hw/i386/x86-common.c                       |    6 +-
 hw/i386/x86.c                              |    1 +
 include/hw/core/cpu.h                      |    8 +
 include/hw/i386/tdvf.h                     |   58 +
 include/hw/i386/x86.h                      |    1 +
 include/standard-headers/uefi/uefi.h       |  198 ++++
 include/sysemu/kvm.h                       |    1 +
 linux-headers/asm-x86/kvm.h                |   70 ++
 linux-headers/linux/kvm.h                  |    1 +
 qapi/qom.json                              |   35 +
 qapi/run-state.json                        |   31 +-
 system/cpus.c                              |    8 +
 system/runstate.c                          |   58 +
 target/i386/confidential-guest.h           |   56 +-
 target/i386/cpu.c                          |   74 +-
 target/i386/cpu.h                          |   27 +
 target/i386/host-cpu.c                     |    2 +-
 target/i386/host-cpu.h                     |    1 +
 target/i386/kvm/kvm.c                      |  130 ++-
 target/i386/kvm/kvm_i386.h                 |   15 +
 target/i386/kvm/meson.build                |    2 +
 target/i386/kvm/tdx-stub.c                 |   18 +
 target/i386/kvm/tdx.c                      | 1113 ++++++++++++++++++++
 target/i386/kvm/tdx.h                      |   63 ++
 target/i386/sev.c                          |    9 +-
 40 files changed, 2596 insertions(+), 129 deletions(-)
 create mode 100644 docs/system/i386/tdx.rst
 create mode 100644 hw/i386/tdvf-hob.c
 create mode 100644 hw/i386/tdvf-hob.h
 create mode 100644 hw/i386/tdvf.c
 create mode 100644 include/hw/i386/tdvf.h
 create mode 100644 include/standard-headers/uefi/uefi.h
 create mode 100644 target/i386/kvm/tdx-stub.c
 create mode 100644 target/i386/kvm/tdx.c
 create mode 100644 target/i386/kvm/tdx.h

-- 
2.34.1



^ permalink raw reply	[flat|nested] 125+ messages in thread

end of thread, other threads:[~2025-01-24 13:53 UTC | newest]

Thread overview: 125+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05  6:23 [PATCH v6 00/60] QEMU TDX support Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 01/60] *** HACK *** linux-headers: Update headers to pull in TDX API changes Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 02/60] i386: Introduce tdx-guest object Xiaoyao Li
2024-11-05 10:18   ` Daniel P. Berrangé
2024-11-05 11:42     ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 03/60] i386/tdx: Implement tdx_kvm_type() for TDX Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 04/60] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 05/60] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES Xiaoyao Li
2024-11-05 10:30   ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 06/60] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 07/60] kvm: Introduce kvm_arch_pre_create_vcpu() Xiaoyao Li
2024-11-13  6:28   ` Philippe Mathieu-Daudé
2024-11-25  7:27     ` Xiaoyao Li
2024-11-26  9:46       ` Philippe Mathieu-Daudé
2024-11-05  6:23 ` [PATCH v6 08/60] i386/kvm: Export cpuid_entry_get_reg() and cpuid_find_entry() Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 09/60] i386/tdx: Initialize TDX before creating TD vcpus Xiaoyao Li
2024-11-05 10:34   ` Daniel P. Berrangé
2024-11-05 11:51     ` Xiaoyao Li
2024-11-05 11:53       ` Daniel P. Berrangé
2024-11-05 20:51   ` Edgecombe, Rick P
2024-11-06  2:01     ` Xiaoyao Li
2024-11-06  5:13       ` Tony Lindgren
2024-12-12 17:24         ` Ira Weiny
2024-12-17 13:10           ` Tony Lindgren
2025-01-14 12:39             ` Xiaoyao Li
2025-01-15 12:12               ` Tony Lindgren
2024-11-05  6:23 ` [PATCH v6 10/60] i386/tdx: Add property sept-ve-disable for tdx-guest object Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 11/60] i386/tdx: Make sept_ve_disable set by default Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 12/60] i386/tdx: Wire CPU features up with attributes of TD guest Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 13/60] i386/tdx: Validate TD attributes Xiaoyao Li
2024-11-05 10:36   ` Daniel P. Berrangé
2024-11-05 11:53     ` Xiaoyao Li
2024-11-05 11:54       ` Daniel P. Berrangé
2024-11-05 20:56   ` Edgecombe, Rick P
2024-11-06  1:38     ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 14/60] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig Xiaoyao Li
2024-11-05 10:38   ` Daniel P. Berrangé
2024-11-05 11:54     ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 15/60] i386/tdx: Set APIC bus rate to match with what TDX module enforces Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 16/60] i386/tdx: Implement user specified tsc frequency Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 17/60] i386/tdx: load TDVF for TD guest Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 18/60] i386/tdvf: Introduce function to parse TDVF metadata Xiaoyao Li
2024-11-05 10:42   ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 19/60] i386/tdx: Parse TDVF metadata for TDX VM Xiaoyao Li
2024-12-12 17:55   ` Ira Weiny
2024-11-05  6:23 ` [PATCH v6 20/60] i386/tdx: Don't initialize pc.rom for TDX VMs Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 21/60] i386/tdx: Track mem_ptr for each firmware entry of TDVF Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 22/60] i386/tdx: Track RAM entries for TDX VM Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 23/60] headers: Add definitions from UEFI spec for volumes, resources, etc Xiaoyao Li
2024-11-05 10:45   ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 24/60] i386/tdx: Setup the TD HOB list Xiaoyao Li
2024-11-05 10:46   ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 25/60] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 26/60] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 27/60] i386/tdx: Finalize TDX VM Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 28/60] i386/tdx: Enable user exit on KVM_HC_MAP_GPA_RANGE Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 29/60] i386/tdx: Handle KVM_SYSTEM_EVENT_TDX_FATAL Xiaoyao Li
2024-11-05 20:55   ` Edgecombe, Rick P
2024-11-06 14:28     ` Edgecombe, Rick P
2024-11-05  6:23 ` [PATCH v6 30/60] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility Xiaoyao Li
2024-11-05 10:53   ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 31/60] i386/cpu: introduce x86_confidential_guest_cpu_instance_init() Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 32/60] i386/tdx: implement tdx_cpu_instance_init() Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 33/60] i386/cpu: introduce x86_confidenetial_guest_cpu_realizefn() Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 34/60] i386/tdx: implement tdx_cpu_realizefn() Xiaoyao Li
2024-11-05 10:06   ` Paolo Bonzini
2024-11-05 11:38     ` Xiaoyao Li
2024-11-05 11:53       ` Paolo Bonzini
2024-12-12 22:04         ` Ira Weiny
2025-01-14  8:52           ` Xiaoyao Li
2025-01-14 13:10             ` Daniel P. Berrangé
2024-11-05  6:23 ` [PATCH v6 35/60] i386/cpu: Introduce enable_cpuid_0x1f to force exposing CPUID 0x1f Xiaoyao Li
2024-12-12 22:16   ` Ira Weiny
2025-01-14 12:51     ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 36/60] i386/tdx: Force " Xiaoyao Li
2024-12-12 22:17   ` Ira Weiny
2025-01-14 12:55     ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 37/60] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 38/60] i386/tdx: Disable SMM for TDX VMs Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 39/60] i386/tdx: Disable PIC " Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 40/60] hw/i386: add eoi_intercept_unsupported member to X86MachineState Xiaoyao Li
2025-01-23 12:41   ` Igor Mammedov
2025-01-23 16:45     ` Xiaoyao Li
2025-01-24 13:00       ` Igor Mammedov
2024-11-05  6:23 ` [PATCH v6 41/60] hw/i386: add option to forcibly report edge trigger in acpi tables Xiaoyao Li
2024-12-12 22:39   ` Ira Weiny
2025-01-14 13:01     ` Xiaoyao Li
2025-01-23 12:53       ` Igor Mammedov
2025-01-24 13:53         ` Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 42/60] i386/tdx: Don't synchronize guest tsc for TDs Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 43/60] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() " Xiaoyao Li
2024-12-13 14:42   ` Ira Weiny
2024-12-17  9:41     ` Paolo Bonzini
2024-11-05  6:23 ` [PATCH v6 44/60] i386/tdx: Skip kvm_put_apicbase() " Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 45/60] i386/tdx: Don't get/put guest state for TDX VMs Xiaoyao Li
2024-11-05  9:55   ` Paolo Bonzini
2024-11-05 11:25     ` Xiaoyao Li
2024-11-05 14:23       ` Paolo Bonzini
2024-11-06 13:57         ` Xiaoyao Li
2024-11-06 19:56           ` Paolo Bonzini
2024-11-05  6:23 ` [PATCH v6 46/60] i386/cgs: Rename *mask_cpuid_features() to *adjust_cpuid_features() Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 47/60] i386/tdx: Implement adjust_cpuid_features() for TDX Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 48/60] i386/tdx: Apply TDX fixed0 and fixed1 information to supported CPUIDs Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 49/60] i386/tdx: Mask off CPUID bits by unsupported TD Attributes Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 50/60] i386/cpu: Move CPUID_XSTATE_XSS_MASK to header file and introduce CPUID_XSTATE_MASK Xiaoyao Li
2024-11-05  6:23 ` [PATCH v6 51/60] i386/tdx: Mask off CPUID bits by unsupported XFAM Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 52/60] i386/cpu: Expose mark_unavailable_features() for TDX Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 53/60] i386/cpu: introduce mark_forced_on_features() Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 54/60] i386/cgs: Introduce x86_confidential_guest_check_features() Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 55/60] i386/tdx: Fetch and validate CPUID of TD guest Xiaoyao Li
2024-12-12 17:52   ` Ira Weiny
2025-01-14 13:03     ` Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 56/60] i386/tdx: Don't treat SYSCALL as unavailable Xiaoyao Li
2024-11-05  9:59   ` Paolo Bonzini
2025-01-16  8:53     ` Xiaoyao Li
2024-11-05 11:07   ` Daniel P. Berrangé
2024-11-05  6:24 ` [PATCH v6 57/60] i386/tdx: Make invtsc default on Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 58/60] cpu: Introduce qemu_early_init_vcpu() Xiaoyao Li
2024-11-05  6:24 ` [PATCH v6 59/60] i386/cpu: Set up CPUID_HT in x86_cpu_realizefn() instead of cpu_x86_cpuid() Xiaoyao Li
2024-11-05  9:12   ` Paolo Bonzini
2024-11-05  9:33     ` Xiaoyao Li
2024-11-05  9:53       ` Paolo Bonzini
2024-11-05  6:24 ` [PATCH v6 60/60] docs: Add TDX documentation Xiaoyao Li
2024-11-05 11:14   ` Daniel P. Berrangé
2024-11-12 10:17   ` Francesco Lavra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).