[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhR5DHLhoY=wz3QQLqjtqhSNewSfFqGk5wonA5TiJwnPmPLsw@mail.gmail.com>
Date: Tue, 26 Aug 2025 16:38:25 -0500
From: Sagi Shahar <sagis@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Ira Weiny <ira.weiny@...el.com>, linux-kselftest@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
Ackerley Tng <ackerleytng@...gle.com>, Ryan Afranji <afranji@...gle.com>,
Andrew Jones <ajones@...tanamicro.com>, Isaku Yamahata <isaku.yamahata@...el.com>,
Erdem Aktas <erdemaktas@...gle.com>, Rick Edgecombe <rick.p.edgecombe@...el.com>,
Roger Wang <runanwang@...gle.com>, Binbin Wu <binbin.wu@...ux.intel.com>,
Oliver Upton <oliver.upton@...ux.dev>, "Pratik R. Sampat" <pratikrajesh.sampat@....com>,
Reinette Chatre <reinette.chatre@...el.com>, Chao Gao <chao.gao@...el.com>,
Chenyi Qiang <chenyi.qiang@...el.com>, linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH v9 15/19] KVM: selftests: Hook TDX support to vm and vcpu creation
On Tue, Aug 26, 2025 at 4:31 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Tue, Aug 26, 2025, Sagi Shahar wrote:
> > On Tue, Aug 26, 2025 at 3:29 PM Sagi Shahar <sagis@...gle.com> wrote:
> > >
> > > On Tue, Aug 26, 2025 at 3:14 PM Ira Weiny <ira.weiny@...el.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.
>
I took a stab at updating the KVM ABI and sent out a small patch [1]
to fail KVM_CREATE_IRQCHIP with ENOTTY and the test passes without the
special handling for SPLIT_IRQCHIP for TDX.
[1] https://lore.kernel.org/lkml/20250826213455.2338722-1-sagis@google.com/
> > /*
> > * 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);
Powered by blists - more mailing lists