Skip to content

RFC TDX support

[email protected] kvm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest44 patches 47 repliesIn review

Changes in v2 from the cover letter

- suppress level trigger/SMI/INIT/SIPI related to IOAPIC.
- add VM attribute sha384 to TD measurement.
- guest TSC Hz specification.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/44target/i386: Expose x86_cpu_get_supported_feature_word() for TDXtarget/i386/cpu.c target/i386/cpu.h+5 -21 reply
2/44kvm: Switch KVM_CAP_READONLY_MEM to a per-VM ioctl()accel/kvm/kvm-all.c+1 -11 reply
3/44i386/kvm: Move architectural CPUID leaf generation to separarte helpertarget/i386/kvm/kvm.c target/i386/kvm/kvm_i386.h+102 -880 replies
4/44vl: Introduce machine_init_done_late notifierhw/core/machine.c include/sysemu/sysemu.h+28 -02 replies
5/44linux-headers: Update headers to pull in TDX API changeslinux-headers/asm-x86/kvm.h linux-headers/linux/kvm.h+62 -00 replies
6/44hw/i386: Introduce kvm-type for TDX guestdefault-configs/devices/i386-softmmu.mak hw/i386/Kconfig hw/i386/x86.c +8 more+124 -06 replies
7/44i386/kvm: Squash getting/putting guest state for TDX VMstarget/i386/kvm/kvm.c+15 -32 replies
8/44i386/kvm: Skip KVM_X86_SETUP_MCE for TDX gueststarget/i386/kvm/kvm.c+2 -10 replies
9/44target/i386: kvm: don't synchronize guest tsc for TD guesttarget/i386/kvm/kvm.c+1 -11 reply
10/44hw/i386: Initialize TDX via KVM ioctl() when kvm_type is TDXaccel/kvm/kvm-all.c include/sysemu/tdx.h qapi/qom.json +3 more+172 -02 replies
11/44i386/tdx: Implement user specified tsc frequencytarget/i386/kvm/kvm.c target/i386/kvm/tdx.c+24 -02 replies
12/44target/i386/tdx: Finalize the TD's measurement when machine is donetarget/i386/kvm/kvm.c target/i386/kvm/tdx.c target/i386/kvm/tdx.h+31 -01 reply
13/44i386/tdx: Frame in tdx_get_supported_cpuid with KVM_TDX_CAPABILITIEStarget/i386/kvm/kvm.c target/i386/kvm/tdx.c target/i386/kvm/tdx.h+78 -50 replies
14/44i386/tdx: Frame in the call for KVM_TDX_INIT_VCPUinclude/sysemu/tdx.h target/i386/kvm/kvm.c target/i386/kvm/tdx-stub.c +1 more+29 -40 replies
15/44i386/tdx: Add hook to require generic device loaderhw/i386/pc_sysfw.c include/sysemu/tdx.h target/i386/kvm/tdx-stub.c +1 more+38 -01 reply
16/44hw/i386: Add definitions from UEFI spec for volumes, resources, etc...hw/i386/uefi.h+496 -01 reply
17/44i386/tdx: Add definitions for TDVF metadatainclude/hw/i386/tdvf.h+55 -00 replies
18/44hw/i386: refactor e820_add_entry()hw/i386/e820_memory_layout.c+28 -141 reply
19/44hw/i386/e820: introduce a helper function to change type of e820hw/i386/e820_memory_layout.c hw/i386/e820_memory_layout.h+73 -01 reply
20/44i386/tdx: Parse tdx metadata and store the result into TdxGuestStatehw/core/generic-loader.c hw/core/meson.build hw/core/tdvf-stub.c +4 more+359 -011 replies
21/44i386/tdx: Create the TD HOB list upon machine init donehw/i386/meson.build hw/i386/tdvf-hob.c hw/i386/tdvf-hob.h +1 more+206 -11 reply
22/44i386/tdx: Add TDVF memory via INIT_MEM_REGIONtarget/i386/kvm/tdx.c+16 -10 replies
23/44i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVFtarget/i386/kvm/tdx.c+10 -30 replies
24/44i386/tdx: Add MMIO HOB entrieshw/i386/tdvf-hob.c hw/i386/tdvf-hob.h+74 -01 reply
25/44q35: Move PCIe BAR check above PAM check in mch_write_config()hw/pci-host/q35.c+5 -50 replies
26/44pci-host/q35: Move PAM initialization above SMRAM initializationhw/pci-host/q35.c+10 -90 replies
27/44q35: Introduce smm_ranges property for q35-pci-hosthw/i386/pc_q35.c hw/pci-host/q35.c include/hw/i386/pc.h +1 more+33 -131 reply
28/44i386/tdx: Force x2apic mode and routing for TDshw/intc/apic_common.c include/hw/i386/apic.h include/hw/i386/apic_internal.h +1 more+21 -01 reply
29/44target/i386: Add machine option to disable PIC/8259hw/i386/pc.c hw/i386/pc_piix.c hw/i386/pc_q35.c +1 more+26 -21 reply
30/44qom: implement property helper for sha384include/qom/object.h qom/object.c+93 -00 replies
31/44target/i386/tdx: Allows mrconfigid/mrowner/mrownerconfig for TDX_INIT_VMqapi/qom.json target/i386/kvm/tdx.c target/i386/kvm/tdx.h+30 -11 reply
32/44tdx: add kvm_tdx_enabled() accessor for later useinclude/sysemu/tdx.h target/i386/kvm/kvm.c+6 -02 replies
33/44qmp: add query-tdx-capabilities query-tdx commandinclude/sysemu/tdx.h qapi/misc-target.json target/i386/kvm/tdx-stub.c +2 more+117 -02 replies
34/44target/i386/tdx: set reboot action to shutdown when tdxtarget/i386/kvm/tdx.c+14 -03 replies
35/44ioapic: add property to disable level interrupthw/intc/ioapic.c hw/intc/ioapic_common.c include/hw/i386/ioapic_internal.h+48 -00 replies
36/44hw/i386: add eoi_intercept_unsupported member to X86MachineStatehw/i386/x86.c include/hw/i386/x86.h+2 -00 replies
37/44hw/i386: add option to forcibly report edge trigger in acpi tableshw/i386/acpi-build.c hw/i386/acpi-common.c+124 -530 replies
38/44hw/i386: plug eoi_intercept_unsupported to ioapichw/i386/microvm.c hw/i386/pc_piix.c hw/i386/pc_q35.c +2 more+17 -80 replies
39/44ioapic: add property to disallow SMI delivery modehw/intc/ioapic.c hw/intc/ioapic_common.c include/hw/i386/ioapic_internal.h+39 -00 replies
40/44hw/i386: add a flag to disallow SMIhw/i386/microvm.c hw/i386/pc_piix.c hw/i386/pc_q35.c +2 more+22 -80 replies
41/44ioapic: add property to disallow INIT/SIPI delivery modehw/intc/ioapic.c hw/intc/ioapic_common.c include/hw/i386/ioapic_internal.h+41 -00 replies
42/44hw/i386: add a flag to disable init/sipi delivery mode of interrupthw/i386/microvm.c hw/i386/pc_piix.c hw/i386/pc_q35.c +2 more+18 -81 reply
43/44i386/tdx: disallow level interrupt and SMI/INIT/SIPI delivery modehw/i386/x86.c+3 -00 replies
44/44i386/tdx: disable S3/S4 unconditionallytarget/i386/kvm/tdx.c+20 -00 replies

Reviews trailers per patch

4 of 44 patches have a Reviewed-by or Acked-by.

PatchConnor Kuehl
1/44R-b
2/44R-b
3/44
4/44
5/44
6/44
7/44
8/44
9/44R-b
10/44
11/44
12/44R-b
13/44
14/44
15/44
16/44
17/44
18/44
19/44
20/44
21/44
22/44
23/44
24/44
25/44
26/44
27/44
28/44
29/44
30/44
31/44
32/44
33/44
34/44
35/44
36/44
37/44
38/44
39/44
40/44
41/44
42/44
43/44
44/44

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC PATCH v2 00/44] TDX support

From: Isaku Yamahata <[email protected]>

This patch series is to enable TDX support. This needs corresponding KVM patch for TDX [1]. The patch [1] requires more patches to be function. So this patch series is RFC. For those who want to try github repo is available at [2].

Patch series is organized as follows.
1- 5 code refactoring and simple hooks that will be used later 6- 9 introduce kvm type and tdx type. disallow non-usable operations
10-15 wire up necessary TDX kvm ioctl to initialize TD guest 16-24 load TDVF and setup necessary info for TDVF
25-26 prohibit unsupported operations related to SMM
28-29 force x2apic and disable PIC
30-31 allows user to specify sha384 value for TD guest 32-33 add qmp operation to query KVM capability and TD info
34 make reboot action shutdown
35-43 suppress level-trigger/SMI/INIT/SIPI
44 suppress S3/S4

TODO:
- gdb support
- sanity check of CPUID

Changes from v1:
- suppress level trigger/SMI/INIT/SIPI related to IOAPIC.
- add VM attribute sha384 to TD measurement.
- guest TSC Hz specification.

Links:
[1] KVM TDX patch series v2

    https://patchwork.kernel.org/project/kvm/list/?series=510271

[2] intel public github
kvm TDX branch: https://github.com/intel/tdx/tree/kvm
TDX guest branch: https://github.com/intel/tdx/tree/guest
qemu TDX https://github.com/intel/qemu-tdx
[3] TDVF
https://github.com/tianocore/edk2-staging/tree/TDVF
[4] TDX specs
https://software.intel.com/content/www/us/en/develop/articles/intel-trust-domain-extensions.html

Chenyi Qiang (1):
qmp: add query-tdx-capabilities query-tdx command

Isaku Yamahata (29):
kvm: Switch KVM_CAP_READONLY_MEM to a per-VM ioctl()
vl: Introduce machine_init_done_late notifier
i386/kvm: Skip KVM_X86_SETUP_MCE for TDX guests target/i386: kvm: don't synchronize guest tsc for TD guest i386/tdx: Frame in the call for KVM_TDX_INIT_VCPU
hw/i386: Add definitions from UEFI spec for volumes, resources, etc... i386/tdx: Add definitions for TDVF metadata
hw/i386: refactor e820_add_entry()
hw/i386/e820: introduce a helper function to change type of e820 i386/tdx: Parse tdx metadata and store the result into TdxGuestState i386/tdx: Create the TD HOB list upon machine init done i386/tdx: Add TDVF memory via INIT_MEM_REGION
i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVF pci-host/q35: Move PAM initialization above SMRAM initialization
q35: Introduce smm_ranges property for q35-pci-host
qom: implement property helper for sha384
target/i386/tdx: Allows mrconfigid/mrowner/mrownerconfig for
TDX_INIT_VM
tdx: add kvm_tdx_enabled() accessor for later use target/i386/tdx: set reboot action to shutdown when tdx
ioapic: add property to disable level interrupt
hw/i386: add eoi_intercept_unsupported member to X86MachineState hw/i386: add option to forcibly report edge trigger in acpi tables hw/i386: plug eoi_intercept_unsupported to ioapic
ioapic: add property to disallow SMI delivery mode hw/i386: add a flag to disallow SMI
ioapic: add property to disallow INIT/SIPI delivery mode hw/i386: add a flag to disable init/sipi delivery mode of interrupt i386/tdx: disallow level interrupt and SMI/INIT/SIPI delivery mode i386/tdx: disable S3/S4 unconditionally

Sean Christopherson (9):
target/i386: Expose x86_cpu_get_supported_feature_word() for TDX i386/kvm: Move architectural CPUID leaf generation to separarte helper i386/kvm: Squash getting/putting guest state for TDX VMs i386/tdx: Frame in tdx_get_supported_cpuid with KVM_TDX_CAPABILITIES i386/tdx: Add hook to require generic device loader i386/tdx: Add MMIO HOB entries
q35: Move PCIe BAR check above PAM check in mch_write_config() i386/tdx: Force x2apic mode and routing for TDs target/i386: Add machine option to disable PIC/8259

Xiaoyao Li (5):
linux-headers: Update headers to pull in TDX API changes hw/i386: Introduce kvm-type for TDX guest
hw/i386: Initialize TDX via KVM ioctl() when kvm_type is TDX i386/tdx: Implement user specified tsc frequency target/i386/tdx: Finalize the TD's measurement when machine is done

 accel/kvm/kvm-all.c                      |   4 +-
 default-configs/devices/i386-softmmu.mak |   1 +
 hw/core/generic-loader.c                 |   5 +
 hw/core/machine.c                        |  26 ++
 hw/core/meson.build                      |   3 +
 hw/core/tdvf-stub.c                      |   6 +
 hw/i386/Kconfig                          |   5 +
 hw/i386/acpi-build.c                     | 103 +++--
 hw/i386/acpi-common.c                    |  74 +++-
 hw/i386/e820_memory_layout.c             | 114 +++++-
 hw/i386/e820_memory_layout.h             |   1 +
 hw/i386/meson.build                      |   1 +
 hw/i386/microvm.c                        |   7 +-
 hw/i386/pc.c                             |  18 +
 hw/i386/pc_piix.c                        |   7 +-
 hw/i386/pc_q35.c                         |   9 +-
 hw/i386/pc_sysfw.c                       |   6 +
 hw/i386/tdvf-hob.c                       | 235 +++++++++++
 hw/i386/tdvf-hob.h                       |  25 ++
 hw/i386/tdvf.c                           | 312 ++++++++++++++
 hw/i386/uefi.h                           | 496 +++++++++++++++++++++++
 hw/i386/x86.c                            |  72 +++-
 hw/intc/apic_common.c                    |  12 +
 hw/intc/ioapic.c                         |  57 +++
 hw/intc/ioapic_common.c                  |  68 ++++
 hw/pci-host/q35.c                        |  67 +--
 include/hw/i386/apic.h                   |   1 +
 include/hw/i386/apic_internal.h          |   1 +
 include/hw/i386/ioapic_internal.h        |   3 +
 include/hw/i386/pc.h                     |   3 +
 include/hw/i386/tdvf.h                   |  55 +++
 include/hw/i386/x86.h                    |  14 +-
 include/hw/pci-host/q35.h                |   1 +
 include/qom/object.h                     |  17 +
 include/sysemu/sysemu.h                  |   2 +
 include/sysemu/tdvf.h                    |   6 +
 include/sysemu/tdx.h                     |  22 +
 linux-headers/asm-x86/kvm.h              |  60 +++
 linux-headers/linux/kvm.h                |   2 +
 qapi/misc-target.json                    |  59 +++
 qapi/qom.json                            |  23 ++
 qom/object.c                             |  76 ++++
 target/i386/cpu.c                        |   4 +-
 target/i386/cpu.h                        |   3 +
 target/i386/kvm/kvm-stub.c               |   5 +
 target/i386/kvm/kvm.c                    | 255 +++++++-----
 target/i386/kvm/kvm_i386.h               |   5 +
 target/i386/kvm/meson.build              |   1 +
 target/i386/kvm/tdx-stub.c               |  33 ++
 target/i386/kvm/tdx.c                    | 417 +++++++++++++++++++
 target/i386/kvm/tdx.h                    |  58 +++
 target/i386/monitor.c                    |  23 ++
 52 files changed, 2685 insertions(+), 198 deletions(-)
 create mode 100644 hw/core/tdvf-stub.c
 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 hw/i386/uefi.h
 create mode 100644 include/hw/i386/tdvf.h
 create mode 100644 include/sysemu/tdvf.h
 create mode 100644 include/sysemu/tdx.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
Signature · 1 line
2.25.1