Skip to content

Commit 5b5133e

Browse files
Radon10043sean-jc
authored andcommitted
Documentation: KVM: Call out that KVM strictly follows the 8254 PIT spec
Explicitly document that the behavior of KVM_SET_PIT2 strictly conforms to the Intel 8254 PIT hardware specification, specifically that a write of '0' adheres to the spec's definition that a programmed count of '0' is converted to the maximum possible value (2^16). E.g. an unaware userspace might attempt to validate that KVM_GET_PIT2 returns the exact state set via KVM_SET_PIT2, and be surprised when the returned count is 65536, not 0. Add a references to the Intel 8254 PIT datasheet that will hopefully stay fresh for some time (the internet isn't exactly brimming with copies of the 8254 datasheet). Link: https://lore.kernel.org/all/CANypQFbEySjKOFLqtFFf2vrEe=NBr7XJfbkjQhqXuZGg7Rpoxw@mail.gmail.com Signed-off-by: Jiaming Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: add context Link, drop local APIC change, massage changelog accordingly] Signed-off-by: Sean Christopherson <[email protected]>
1 parent cbd8602 commit 5b5133e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Documentation/virt/kvm/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,6 +3075,12 @@ This IOCTL replaces the obsolete KVM_GET_PIT.
30753075
Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2.
30763076
See KVM_GET_PIT2 for details on struct kvm_pit_state2.
30773077

3078+
.. Tip::
3079+
``KVM_SET_PIT2`` strictly adheres to the spec of Intel 8254 PIT. For example,
3080+
a ``count`` value of 0 in ``struct kvm_pit_channel_state`` is interpreted as
3081+
65536, which is the maximum count value. Refer to `Intel 8254 programmable
3082+
interval timer <https://www.scs.stanford.edu/10wi-cs140/pintos/specs/8254.pdf>`_.
3083+
30783084
This IOCTL replaces the obsolete KVM_SET_PIT.
30793085

30803086

0 commit comments

Comments
 (0)