On Tue, Aug 26, 2025, Sagi Shahar wrote: > On Tue, Aug 26, 2025 at 3:29 PM Sagi Shahar <sa...@google.com> wrote: > > > > On Tue, Aug 26, 2025 at 3:14 PM Ira Weiny <ira.we...@intel.com> wrote: > > > > > > Sean Christopherson wrote: > > > > Ugh. IMO, this is a KVM bug. Allowing KVM_CREATE_IRQCHIP for a TDX VM > > > > is simply > > > > wrong. It _can't_ work. Waiting until KVM_CREATE_VCPU to fail setup > > > > is terrible > > > > ABI. > > > > > > > > If we stretch the meaning of ENOTTY a bit and return that when trying > > > > to create > > > > a fully in-kernel IRQCHIP for a TDX VM, then the selftests code Just > > > > Works thanks > > > > to the code below, which handles the scenario where KVM was be built > > > > without > > > ^^^^^^^^^^ > > > > > > I'm not following. Was there supposed to be a patch attached? > > > > > > > I think Sean refers to the original implementation which was out of > > the scope for the git diff so it was left out of the patch:
Yep, exactly. > /* > * Allocate a fully in-kernel IRQ chip by default, but fall back to a > * split model (x86 only) if that fails (KVM x86 allows compiling out > * support for KVM_CREATE_IRQCHIP). > */ > r = __vm_ioctl(vm, KVM_CREATE_IRQCHIP, NULL); > if (r && errno == ENOTTY && kvm_has_cap(KVM_CAP_SPLIT_IRQCHIP)) > vm_enable_cap(vm, KVM_CAP_SPLIT_IRQCHIP, 24); > else > TEST_ASSERT_VM_VCPU_IOCTL(!r, KVM_CREATE_IRQCHIP, r, vm);