Re: [PATCH v7 8/8] KVM: selftests: Add nested SVM DecodeAssists test
From: Jim Mattson
Date: Fri Sep 18 2026 - 07:29:27 EST
On Fri, Sep 18, 2026 at 1:56 AM Tina Zhang <zhang_wei@xxxxxxxxxxxxxx> wrote:
>
> Add a focused nested SVM selftest for DecodeAssists. Verify that KVM
> exposes the feature to L1 and provides EXITINFO for representative
> MOV CR/DR, CLTS, INTn, INVLPG, and INVLPGA intercepts, including a
> MOV-to-CR0 selective intercept. Check hardware and forced-emulation
> paths against the same expected values. Poison the instruction-byte
> fields before each instruction-intercept test and verify that the byte
> count is cleared on exit.
>
> Exercise instruction bytes for hardware and synthesized #NPF/#PF exits.
> Cover a synthesized #NPF that follows a hardware #NPF in the same emulated
> instruction, an unreadable instruction tail that leaves only the cached
> opcode, and the absence of bytes for an instruction-fetch #PF. Modify the
> MOVSB opcode while its MMIO read is pending to verify that the emulator's
> cached bytes are preserved.
>
> Inject a userspace #PF while an MMIO read is pending. Verify that after
> MMIO completion, L1 receives instruction bytes from the current RIP,
> not the previous instruction's emulator cache.
>
> The hardware instruction-intercept, synthesized OUTSB #NPF, and
> userspace-injected #PF cases run by default. The forced-emulation #PF
> and instruction-intercept paths require kvm.force_emulation_prefix=1.
>
> Signed-off-by: Tina Zhang <zhang_wei@xxxxxxxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>