diff --git a/ocaml/xapi/vm_platform.ml b/ocaml/xapi/vm_platform.ml index e87efae2825..bfa2378dde6 100644 --- a/ocaml/xapi/vm_platform.ml +++ b/ocaml/xapi/vm_platform.ml @@ -63,6 +63,8 @@ let nested_virt = "nested-virt" let vcpu_unrestricted = "vcpu-unrestricted" +let tpm_version = "tpm_version" + (* The default value of device model should be set as 'qemu-trad', 'qemu-upstream-compat', 'qemu-upstream' according to QEMU-upstream feature release stages *) let fallback_device_model_stage_1 = "qemu-trad" diff --git a/ocaml/xapi/xapi_xenops.ml b/ocaml/xapi/xapi_xenops.ml index 72cf25a8b46..d79f77538b7 100644 --- a/ocaml/xapi/xapi_xenops.ml +++ b/ocaml/xapi/xapi_xenops.ml @@ -1261,6 +1261,15 @@ module MD = struct else platformdata in + (* Add TPM version 2 iff there's a tpm attached to the VM, this allows + hvmloader to load the TPM 2.0 ACPI table while maintaing the current + ACPI table for other guests *) + let platformdata = + if vm.API.vM_VTPMs <> [] || bool vm.API.vM_platform false "vtpm" then + (Vm_platform.tpm_version, "2") :: platformdata + else + platformdata + in let pci_msitranslate = true in (* default setting *) (* CA-55754: allow VM.other_config:msitranslate to override the bus-wide setting *)