Re: [PATCH v2 3/8] KVM: VMX: Disallowing using to_vmx() in common VT code

From: Xiaoyao Li

Date: Thu Aug 27 2026 - 07:22:27 EST


On 8/27/2026 1:12 AM, Sean Christopherson wrote:
Poison to_vmx() in main.c and posted_intr.c so that attempting to interpret
the vCPU as a VMX vCPU will fail at compile time, as opposed to failing at
runtime, or worse corrupting state without outright failing.

Note, to_tdx() is buried in tdx.c, i.e. isn't broadly reachable, and so
doesn't need the same treatment as to_vmx().

Signed-off-by: Sean Christopherson<seanjc@xxxxxxxxxx>

Reviewed-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>