From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64F2130AAD6 for ; Mon, 9 Feb 2026 21:36:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770673020; cv=none; b=pHZ0gM9jMSnQorWbp24qTtE16jIa2KCizhQzxyIfqqC7ssIQFXaWKJe2VcaHAZDI13He9/yOI0SbdQTQIP5UW4Nh5ndxvG7jeDcbEnZ1/5DvkCjUsFfPfHpeBBO+pbKQHbqI5yQaMWiZfSVQsFofIO9QI4e7C8HSLNFfq58k2t8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770673020; c=relaxed/simple; bh=4vMrD1qtowWL1DOzFpHUbYkKx4V7YYCbE6s+0yjbYoM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AGgsL7arZAr5aicN5uhnxRjxUCt0KSJnwPhpJ0m4OuYgQy0X34ee3G6YVFcvLQ+7glGicoOiEV9RMds+vK4wLh6aT5a4LoYJOrCwwbyeg5hgk9axTWisZov7QurOAnWx2Zs2RDYC0INFiv61npmG2KDb2C2rlk61ooxmZbfzy4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=roPYW2Uu; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="roPYW2Uu" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-354c7febaefso312069a91.3 for ; Mon, 09 Feb 2026 13:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770673019; x=1771277819; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FA7IJyutkB47JiXV9V/fjE1MEG6+dQ48Jc6fRYn5OAo=; b=roPYW2UuZaW/+1dFTW9+YAz5MyBG11DEzG/FfmXBQchaAsepB2ea6RQTEAqoZpJUml 7HdH5UQJ5bT59Lg/nmxgoNPOyczfwkAU1DZGt8i3sGq4FAWFuujd2UcjjRpDiQUddolm Iq9SNp1FKmJW2yg91q/8ahC+41EUQDcA3n71yOknefNw1A/qJjP1Bbm6hW0IPiCz/v97 h6PpbGpCZQC7oaS6pPFE86CWqdGDns7uNjjKVh1HC5SgQYMouJ3uaJZDYY2WVxpNh9i1 xB2q5swvuR7r+JMvZWM5bLMlKEech53chl/3mSvLpZqdWwZtBwyA09Lveau8ykA2Seln BU2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770673019; x=1771277819; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FA7IJyutkB47JiXV9V/fjE1MEG6+dQ48Jc6fRYn5OAo=; b=w9s2JHQ4jrrjLkSTU+Dq9F1KvTs5v/VIu/66e9bK7BY37JrCZcGF6JVeG/jjI8s6Bn lUPPcQAxjKhEsc1g0a1cN9u+V0ZUeBWTBIskdq69WkmwCDUVHKzwa0IBqWpL+30rnuk9 FdhzH7P1EOCtouz+infbu6eLuowdVIj5IZm+xo8RUtpYs3/pn+VVxeg477FrkpIQYpK6 XlSQxb+ZxUjnHdJUvwTsGDeoGQjDWLpHmudofxaO3qHha1Yd/Vwh9qNwgCY3ozP72D18 xbw7tyt+lxianHYJFc08FCCAmU9MMa1VLlSplsXn50GSYY/lBsetNc/sxkxqwm2ekkxK Iiiw== X-Forwarded-Encrypted: i=1; AJvYcCW3RnWQbvCn7IfnUP/7XB0zbrLSwKLJONDhxpW/57raS9ghAZHUMWy00qhbjFQ0U+KO2TVk2zDz6wV2AEA=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg/2/0VRVgRR4UiSuVp4Tf8o9KcyjxccYjn2AzPVL2XjxLdfZG ZDmknA54yLMnUONUzlhupLrQJpNnVQfHIhBiV3RKydq2UQoJHegT7OseklQqQpVoYj8OuMGJADB D5Y96Rg== X-Received: from pjbch6.prod.google.com ([2002:a17:90a:f406:b0:355:1a0a:cf7f]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2785:b0:356:3032:1d5e with SMTP id 98e67ed59e1d1-356303224c0mr4655205a91.22.1770673018603; Mon, 09 Feb 2026 13:36:58 -0800 (PST) Date: Mon, 9 Feb 2026 13:36:56 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260203190711.458413-1-seanjc@google.com> <20260203190711.458413-2-seanjc@google.com> Message-ID: Subject: Re: [PATCH 1/2] KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC From: Sean Christopherson To: Naveen N Rao Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jim Mattson , "Maciej S . Szmigiero" Content-Type: text/plain; charset="us-ascii" On Mon, Feb 09, 2026, Naveen N Rao wrote: > On Fri, Feb 06, 2026 at 10:17:29AM -0800, Sean Christopherson wrote: > > > > arch/x86/kvm/svm/avic.c | 2 +- > > > > arch/x86/kvm/svm/svm.c | 2 +- > > > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c > > > > index f92214b1a938..44e07c27b190 100644 > > > > --- a/arch/x86/kvm/svm/avic.c > > > > +++ b/arch/x86/kvm/svm/avic.c > > > > @@ -368,7 +368,7 @@ void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb) > > > > vmcb->control.avic_physical_id = __sme_set(__pa(kvm_svm->avic_physical_id_table)); > > > > vmcb->control.avic_vapic_bar = APIC_DEFAULT_PHYS_BASE; > > > > > > > > - if (kvm_apicv_activated(svm->vcpu.kvm)) > > > > + if (kvm_vcpu_apicv_active(&svm->vcpu)) > > > > avic_activate_vmcb(svm); > > > > else > > > > avic_deactivate_vmcb(svm); > > > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > > > > index 5f0136dbdde6..e8313fdc5465 100644 > > > > --- a/arch/x86/kvm/svm/svm.c > > > > +++ b/arch/x86/kvm/svm/svm.c > > > > @@ -1189,7 +1189,7 @@ static void init_vmcb(struct kvm_vcpu *vcpu, bool init_event) > > > > if (guest_cpu_cap_has(vcpu, X86_FEATURE_ERAPS)) > > > > svm->vmcb->control.erap_ctl |= ERAP_CONTROL_ALLOW_LARGER_RAP; > > > > > > > > - if (kvm_vcpu_apicv_active(vcpu)) > > > > + if (enable_apicv && irqchip_in_kernel(vcpu->kvm)) > > > > avic_init_vmcb(svm, vmcb); > > > > > > Doesn't have to be done as part of this series, but I'm wondering if it > > > makes sense to turn this into a helper to clarify the intent and to make > > > it more obvious: > > > > Hmm, yeah, though my only hesitation is the name. For whatever reason, "possible" > > makes me think "is APICv possible *right now*" (ignoring that I wrote exactly that > > in the changelog). > > > > What if we go with kvm_can_use_apicv()? That would align with vmx_can_use_ipiv() > > and vmx_can_use_vtd_pi(), which are pretty much identical in concept. > > Yes, that's better. I'll use that and post it as a subsequent cleanup, > unless you want to pick it up rightaway. Go ahead and post it separately, it's nice to have a proper paper trail.