Re: [PATCH v3 34/40] KVM: x86: Move misc "VALID MASK" defines from kvm_host.h => x86.c

From: Sean Christopherson

Date: Fri Jun 05 2026 - 16:35:52 EST


On Fri, Jun 05, 2026, Kai Huang wrote:
> On Fri, 2026-05-29 at 15:22 -0700, Sean Christopherson wrote:
> > Move a variety of "VALID MASK" defines, e.g. that capture which flags in
> > a given ioctl are supported by KVM, from kvm_host.h to x86.c. The set of
> > valid flags/bits is very much a KVM-internal detail, as the hardcoded
> > defines are often massaged at runtime, i.e. *directly* using the macros
> > outside of KVM x86 would be actively dangerous.
>
> I am bit confused about what do you mean by "hardcoded defines are ofen
> massaged at runtime". Do you mean the supported flags can be changed at runtime
> via ioctl? But if we are talking about ioctl, then the flags must be part of
> uABI, which shouldn't change?

Not by ioctl, but by KVM's setup code. Is this more clear?

Move a variety of "VALID MASK" defines, e.g. that capture which flags in
a given ioctl are supported by KVM, from kvm_host.h to x86.c. The set of
valid flags/bits is very much a KVM-internal detail, as the values from the
hardcoded #defines are often captured and massaged by KVM's setup code, i.e.
*directly* using the macros outside of KVM x86 would be actively dangerous.