x86_64: add TSC leaf synthesis.

There have been two evolutions of providing the TSC cpuid leaf
(aka 0x15) to the guest.

a) For CrosVM on Windows, we have been providing the leaf
   unconditionally.  Furthermore, we've not been using the
   exact host leaf; instead, we calibrate the TSC frequency
   and provide that value in the leaf. This was done because
   the actual cpuid leaf values are not as accurate as
   we needed them to be to drive a guest clocksource.

b) In CrosVM mainline, 4080aaf9b33e0d16247a7a92e2c4a3b1eaeb8e08
   introduced the flag enable_pnp / enable_pnp_data, and
   provides the exact host 0x15 leaf to the guest if the
   flag is enabled.

This CL adds a new hypervisor capability (CalibratedTscLeafRequired) to control
whether or not the calibrated TSC leaf should be used, in addition to a new CLI
option to force it on hypervisors where it isn't enabled by default. The new
option is `--force_calibrated_tsc_leaf`.

BUG=b:213152505
TEST=builds upstream, battletested downstream on WHPX.

Change-Id: I611422808a9e10578c0ddcbd211ae902f937685f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3698993
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
12 files changed
tree: cd66208f95d668e8b324ff7201a3a3a6a509a916
  1. .cargo/
  2. .devcontainer/
  3. .github/
  4. aarch64/
  5. acpi_tables/
  6. arch/
  7. argh_helpers/
  8. base/
  9. bin/
  10. bit_field/
  11. broker_ipc/
  12. ci/
  13. common/
  14. cros_async/
  15. crosvm-fuzz/
  16. crosvm_control/
  17. crosvm_plugin/
  18. devices/
  19. disk/
  20. docs/
  21. fuse/
  22. gpu_display/
  23. hypervisor/
  24. infra/
  25. integration_tests/
  26. io_uring/
  27. kernel_cmdline/
  28. kernel_loader/
  29. kvm/
  30. kvm_sys/
  31. libcras_stub/
  32. linux_input_sys/
  33. logo/
  34. media/
  35. metrics/
  36. net_sys/
  37. net_util/
  38. power_monitor/
  39. protos/
  40. qcow_utils/
  41. resources/
  42. rutabaga_gfx/
  43. seccomp/
  44. serde_keyvalue/
  45. src/
  46. system_api_stub/
  47. tests/
  48. third_party/
  49. tools/
  50. tpm2/
  51. tpm2-sys/
  52. tracing/
  53. tube_transporter/
  54. usb_sys/
  55. usb_util/
  56. vfio_sys/
  57. vhost/
  58. virtio_sys/
  59. vm_control/
  60. vm_memory/
  61. win_audio/
  62. win_util/
  63. x86_64/
  64. .dockerignore
  65. .gitignore
  66. .gitmodules
  67. .rustfmt.toml
  68. ARCHITECTURE.md
  69. Cargo.toml
  70. CONTRIBUTING.md
  71. LICENSE
  72. navbar.md
  73. OWNERS
  74. PRESUBMIT.cfg
  75. README.chromeos.md
  76. README.md
  77. run_tests
  78. rust-toolchain
  79. setup_cros_cargo.sh
  80. test_all
  81. unblocked_terms.txt
README.md

crosvm - The Chrome OS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the Chrome OS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on Chrome OS devices.

Logo