Skip to content

Commit 9f4ce48

Browse files
yosrym93sean-jc
authored andcommitted
KVM: x86: Document a virtualization gap for GIF on AMD CPUs
According to the APM Volume #2, Section 15.17, Table 15-10 (24593—Rev. 3.42—March 2024), When "GIF==0", an "Debug exception or trap, due to breakpoint register match" should be "Ignored and discarded". KVM lacks any handling of this. Even when vGIF is enabled and vGIF==0, the CPU does not ignore #DBs and relies on the VMM to do so. Handling this is possible, but the complexity is unjustified given the rarity of using HW breakpoints when GIF==0 (e.g. near VMRUN). KVM would need to intercept the #DB, temporarily disable the breakpoint, singe-step over the instruction (probably reusing NMI singe-stepping), and re-enable the breakpoint. Instead, document this as an erratum. Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev> Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com> Link: https://patch.msgid.link/20251030223757.2950309-1-yosry.ahmed@linux.dev Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 4da3768 commit 9f4ce48

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Documentation/virt/kvm/x86/errata.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ versus "has_error_code", i.e. KVM's ABI follows AMD behavior.
4848
Nested virtualization features
4949
------------------------------
5050

51-
TBD
51+
On AMD CPUs, when GIF is cleared, #DB exceptions or traps due to a breakpoint
52+
register match are ignored and discarded by the CPU. The CPU relies on the VMM
53+
to fully virtualize this behavior, even when vGIF is enabled for the guest
54+
(i.e. vGIF=0 does not cause the CPU to drop #DBs when the guest is running).
55+
KVM does not virtualize this behavior as the complexity is unjustified given
56+
the rarity of the use case. One way to handle this would be for KVM to
57+
intercept the #DB, temporarily disable the breakpoint, single-step over the
58+
instruction, then re-enable the breakpoint.
5259

5360
x2APIC
5461
------

0 commit comments

Comments
 (0)