]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: mmu: Fix SPTE encoding of MMIO generation upper half
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Sat, 5 Dec 2020 00:48:08 +0000 (01:48 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 12 Dec 2020 00:18:43 +0000 (19:18 -0500)
commit73532ab0781403aaa829fc039894b6e97ccdfff6
tree8902487302d44024632c943bf6369fedd6cdefa1
parentfeefac355d3dc37fa419aca646e1c5c5b29c40b2
KVM: mmu: Fix SPTE encoding of MMIO generation upper half

Commit c64046c2ae8b ("KVM: x86: Refactor the MMIO SPTE generation handling")
cleaned up the computation of MMIO generation SPTE masks, however it
introduced a bug how the upper part was encoded:
SPTE bits 52-61 were supposed to contain bits 10-19 of the current
generation number, however a missing shift encoded bits 1-10 there instead
(mostly duplicating the lower part of the encoded generation number that
then consisted of bits 1-9).

In the meantime, the upper part was shrunk by one bit and moved by
subsequent commits to become an upper half of the encoded generation number
(bits 9-17 of bits 0-17 encoded in a SPTE).

In addition to the above, commit 771b4bc6b242 ("KVM: x86: fix overlap between SPTE_MMIO_MASK and generation")
has changed the SPTE bit range assigned to encode the generation number and
the total number of bits encoded but did not update them in the comment
attached to their defines, nor in the KVM MMU doc.
Let's do it here, too, since it is too trivial thing to warrant a separate
commit.

Fixes: c64046c2ae8b ("KVM: x86: Refactor the MMIO SPTE generation handling")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Message-Id: <156700708db2a5296c5ed7a8b9ac71f1e9765c85.1607129096.git.maciej.szmigiero@oracle.com>
Cc: stable@vger.kernel.org
[Reorganize macros so that everything is computed from the bit ranges. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/virt/kvm/mmu.rst
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h