qemu/hw/i386
David Woodhouse 3634039b93 hw/acpi: Add vmclock device
The vmclock device addresses the problem of live migration with
precision clocks. The tolerances of a hardware counter (e.g. TSC) are
typically around ±50PPM. A guest will use NTP/PTP/PPS to discipline that
counter against an external source of 'real' time, and track the precise
frequency of the counter as it changes with environmental conditions.

When a guest is live migrated, anything it knows about the frequency of
the underlying counter becomes invalid. It may move from a host where
the counter running at -50PPM of its nominal frequency, to a host where
it runs at +50PPM. There will also be a step change in the value of the
counter, as the correctness of its absolute value at migration is
limited by the accuracy of the source and destination host's time
synchronization.

The device exposes a shared memory region to guests, which can be mapped
all the way to userspace. In the first phase, this merely advertises a
'disruption_marker', which indicates that the guest should throw away any
NTP synchronization it thinks it has, and start again.

Because the region can be exposed all the way to userspace, applications
can still use time from a fast vDSO 'system call', and check the
disruption marker to be sure that their timestamp is indeed truthful.

The structure also allows for the precise time, as known by the host, to
be exposed directly to guests so that they don't have to wait for NTP to
resync from scratch.

The values and fields are based on the nascent virtio-rtc specification,
and the intent is that a version (hopefully precisely this version) of
this structure will be included as an optional part of that spec. In the
meantime, a simple ACPI device along the lines of VMGENID is perfectly
sufficient and is compatible with what's being shipped in certain
commercial hypervisors.

Linux guest support was merged into the 6.13-rc1 kernel:
https://git.kernel.org/torvalds/c/205032724226

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <07fd5e2f529098ad4d7cab1423fe9f4a03a9cc14.camel@infradead.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2025-01-15 17:43:24 -05:00
..
kvm hw/xen: Check if len is 0 before memcpy() 2025-01-09 10:43:13 +00:00
xen hw/i386: Mark devices as little-endian 2024-12-31 21:21:34 +01:00
acpi-build.c hw/acpi: Add vmclock device 2025-01-15 17:43:24 -05:00
acpi-build.h hw/acpi/ich9: Enable ACPI PCI hot-plug 2021-07-16 04:33:35 -04:00
acpi-common.c hw/i386/acpi: Set PCAT_COMPAT bit only when pic is not disabled 2024-04-23 17:35:25 +02:00
acpi-common.h hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h' 2024-02-20 20:34:21 +03:00
acpi-microvm.c hw/i386/acpi-microvm.c: Use common function to add virtio in DSDT 2024-01-10 18:47:46 +10:00
acpi-microvm.h microvm/acpi: add minimal acpi support 2020-09-17 14:16:19 +02:00
amd_iommu-stub.c amd_iommu: report x2APIC support to the operating system 2024-02-14 06:09:32 -05:00
amd_iommu.c hw/i386/amd_iommu: Simplify non-KVM checks on XTSup feature 2024-12-31 21:21:34 +01:00
amd_iommu.h amd_iommu: Use shared memory region for Interrupt Remapping 2024-11-04 16:03:24 -05:00
e820_memory_layout.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
e820_memory_layout.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
fw_cfg.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
fw_cfg.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
intel_iommu.c intel_iommu: Introduce a property to control FS1GP cap bit setting 2025-01-15 13:06:36 -05:00
intel_iommu_internal.h intel_iommu: Introduce a property x-flts for stage-1 translation 2025-01-15 13:06:35 -05:00
Kconfig hw/acpi: Add vmclock device 2025-01-15 17:43:24 -05:00
meson.build machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
microvm-dt.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
microvm-dt.h microvm: add device tree support. 2021-11-02 17:24:17 +01:00
microvm.c hw/pci-host/gpex: Allow more than 4 legacy IRQs 2024-12-30 20:04:50 +01:00
monitor.c hw/i386: move rtc-reset-reinjection command out of hw/rtc 2024-05-10 15:45:15 +02:00
multiboot.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
multiboot.h target/i386: use DMA-enabled multiboot ROM for new-enough QEMU machine types 2021-11-02 15:57:27 +01:00
nitro_enclave.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
pc.c intel_iommu: Set default aw_bits to 48 starting from QEMU 9.2 2025-01-15 13:06:30 -05:00
pc_piix.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
pc_q35.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
pc_sysfw.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
pc_sysfw_ovmf-stubs.c hw/i386: Introduce X86_FW_OVMF Kconfig symbol 2021-07-14 22:28:58 +02:00
pc_sysfw_ovmf.c hw/i386: Replace magic number with field length calculation 2022-03-06 05:08:23 -05:00
port92.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
sgx-epc.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
sgx-stub.c target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine 2024-07-31 13:13:31 +02:00
sgx.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
trace-events vmmouse: replace DPRINTF with tracing 2023-09-12 10:37:01 +04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vapic.c hw/i386: Mark devices as little-endian 2024-12-31 21:21:34 +01:00
vmmouse.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vmport.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
x86-common.c hw/i386/pc: Fix level interrupt sharing for Xen event channel GSI 2025-01-09 10:40:11 +00:00
x86-cpu.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
x86-iommu-stub.c hw/i386/pc: Remove x86_iommu_get_type() 2021-11-01 18:49:10 -04:00
x86-iommu.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
x86.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00