Re: [PATCH] KVM: mmu: Fix SPTE encoding of MMIO generation upper half

From: Paolo Bonzini
Date: Wed Dec 09 2020 - 04:10:23 EST


On 08/12/20 22:12, Sean Christopherson wrote:
#define MMIO_SPTE_GEN_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_BITS + MMIO_SPTE_GEN_HIGH_BITS - 1, 0)
What if we leave MMIO_SPTE_GEN_MASK as is, GENMASK_ULL(17, 0), and instead add a
BUILD_BUG_ON() to assert that it matches the above logic? It's really easy to
get lost when reading through the chain of defines, I find the explicit mask
helps provide an anchor/reference for understand what's going on. It'll require
an update if/when PT64_SECOND_AVAIL_BITS_SHIFT, but that's not necessarily a bad
thing, e.g. the comment above this block will also be stale.

Sounds good.

Paolo