Re: [PATCH v3 10/16] KVM: selftests: Reuse virt mapping functions for nested EPTs
From: Sean Christopherson
Date: Tue Dec 23 2025 - 18:14:30 EST
On Thu, Nov 27, 2025, Yosry Ahmed wrote:
> + /*
> + * EPTs do not have 'present' or 'user' bits, instead bit 0 is the
> + * 'readable' bit. In some cases, EPTs can be execute-only and an entry
> + * is present but not readable. However, for the purposes of testing we
> + * assume 'present' == 'user' == 'readable' for simplicity.
> + */
> + pte_masks = (struct pte_masks){
> + .present = BIT_ULL(0),
> + .user = BIT_ULL(0),
> + .writable = BIT_ULL(1),
> + .x = BIT_ULL(2),
> + .accessed = BIT_ULL(5),
> + .dirty = BIT_ULL(6),
Almost forgot, the Accessed and Dirty bits are wrong. They are bits 8 and 9
respectively, not 5 and 6. Amusingly (well, it's amusing *now*, it wasn't so
amusing at the time), I found that out when I couldn't get KVM to create a writable
SPTE on a read fault in the nested dirty log test :-)