From nobody Thu Oct 2 09:22:08 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 441B21DF27F for ; Fri, 19 Sep 2025 00:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758241307; cv=none; b=C8J05aro7ycF9pQhd/IokfE5/VA2qEul6KQIsPQQDd1WIjwDoO9J1hH8rGj2BrDjW3bNCUJJzBRRxhqM5aaVPBaAZAtlu3Bu9dczwWilYIBNYxk39Rcn5CS5GCqcboJeSQi76UInjRkqeP9iDNVusXcCRAoUtWvMKFzqQIuITjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758241307; c=relaxed/simple; bh=uR8EWR+aR/ZBzhlH8PMTT7QLPFi5Y9kpl91tdSjqO/Q=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GjsW90+mZ5+NuBlqg4atX5WpfeT3K3/+eAqgGihw6lLU07Zk8qjuiuNfHdJc10Ba+3oARlU9e4C2ZxIZI/OMJfg8iRIBY9xdZ8O6+HBzkBd8yLf6ZGA4r9vnaQ1wmizHRIAzOyartEdUAihb9Bkz9svb2a4MsfFQUd0Nt9gU+XE= 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=L16eSsB8; arc=none smtp.client-ip=209.85.216.74 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="L16eSsB8" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-32ec69d22b2so1557628a91.1 for ; Thu, 18 Sep 2025 17:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758241305; x=1758846105; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=kAOxtVdYXlNFHXrxQs4hk1M8tgpSADrBdmDcGNSV7fI=; b=L16eSsB8elsrieiSoKvK1W6YuxUwAb8wq/kzKQFC5Jd2rCmgfl0Q1NlHF2Aj9F1xxq MxI+DowDvLTbkgK7HTXZ5DWX/Bn8/8r5CgswwTut+GjIN1Mq3LH0Dng2zIufRhrffGGB qFDcsdQGCNDkVVwIX+l62byJSQvLlG5XXpT5ApFcXTPh+ditSMSw+MrAxIvg9A8Syq7y hwoNnXXSuVVI4/I0HOBMQrtpmLkaUwVa/SRyA9SvqVfeoirpseSqojUNFE0BZoDpqNl2 II8GpZEtFIq5vp47rr3QoqaZMlZYOhbOP8I985pMTvV94oue8m3+7nEgShH4toUkUT3i q2tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758241305; x=1758846105; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kAOxtVdYXlNFHXrxQs4hk1M8tgpSADrBdmDcGNSV7fI=; b=JiCP77IjKjWmCLsm+swXZyxgRHjhQjnP0xniZ6Dk/awk+7h9mq1VqR03bCTvI8ZSJn rwdP96hef7+Q8QEWPhNXAF6IcWy2jzUg0zTo7+W7OiWZwMujauSXvV4jGrreY0LlpLuW kfIO9f+jQ8gqf8hFXuSEPGImH79R+he7OnA244Xw66Wv5d6aWp53Bjg37fE3FAwARSdL M7Zyu+qZob742+v0pQItd//JqSTwiGC9dLGfFDBr9IZdjdCDVWR7U4IE/DQmmeujYZ80 DqVCE5ZwCPQ7ER8IYAKlaD/5xDwmfwPotTqbggmiJQWoAQRbwrzzzzJUhSYo/wvjyClA 0D3w== X-Forwarded-Encrypted: i=1; AJvYcCUpvnr0Gu+tpSqj+lzrAWeSWkcV7HiDpATtBDLraLoOG0t7C7GFi6wA07Js4iJivOm2zFXMFmOZH+Tit5g=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5YLC7HXZP1egjr3KMV3VfNt5yHlgltO3reUqJgwomanWIucaG cv9RyrjIYSPJaf4T4Y2FpNbWV09LwocSji7N5lCKLtE+TJQuSL0Enc2XH/c7djNRp6Tw39O4Ig6 QakFa8A== X-Google-Smtp-Source: AGHT+IEbLmauAmVJ3kfuAJUo2uqSb5YOltEYyw+1bKa8JZGv5ZAIj9GTRGbYYMv6m8PEfzurqfv8GLwqOYU= X-Received: from pji13.prod.google.com ([2002:a17:90b:3fcd:b0:330:6c04:207]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1e12:b0:32d:fcd8:1a9 with SMTP id 98e67ed59e1d1-33098385bd1mr1332845a91.32.1758241305547; Thu, 18 Sep 2025 17:21:45 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 18 Sep 2025 17:21:34 -0700 In-Reply-To: <20250919002136.1349663-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250919002136.1349663-1-seanjc@google.com> X-Mailer: git-send-email 2.51.0.470.ga7dc726c21-goog Message-ID: <20250919002136.1349663-5-seanjc@google.com> Subject: [PATCH v3 4/6] KVM: SVM: Don't advise the user to do force_avic=y (when x2AVIC is detected) From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Naveen N Rao Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't advise the end user to try to force enable AVIC when x2AVIC is reported as supported in CPUID, as forcefully enabling AVIC isn't something that should be done lightly. E.g. some Zen4 client systems hide AVIC but leave x2AVIC behind, and while such a configuration is indeed due to buggy firmware in the sense the reporting x2AVIC without AVIC is nonsensical, KVM has no idea _why_ firmware disabled AVIC in the first place. Suggesting that the user try to run with force_avic=3Dy is sketchy even if the user explicitly tries to enable AVIC, and will be downright irresponsible once KVM starts enabling AVIC by default. Alternatively, KVM could print the message only when the user explicitly asks for AVIC, but running with force_avic=3Dy isn't something that should be encouraged for random users. force_avic is a useful knob for developers and perhaps even advanced users, but isn't something that KVM should advertise broadly. Opportunistically append a newline to the pr_warn() so that it prints out immediately, and tweak the message to say that AVIC is unsupported instead of disabled (disabled suggests that the kernel/KVM is somehow responsible). Suggested-by: Naveen N Rao Signed-off-by: Sean Christopherson Reviewed-by: Naveen N Rao (AMD) Suggested-by: Naveen N Rao (AMD) --- arch/x86/kvm/svm/avic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c index bafef2f75af2..497d755c206f 100644 --- a/arch/x86/kvm/svm/avic.c +++ b/arch/x86/kvm/svm/avic.c @@ -1154,10 +1154,8 @@ bool __init avic_hardware_setup(struct kvm_x86_ops *= svm_ops) =20 /* AVIC is a prerequisite for x2AVIC. */ if (!boot_cpu_has(X86_FEATURE_AVIC) && !force_avic) { - if (boot_cpu_has(X86_FEATURE_X2AVIC)) { - pr_warn(FW_BUG "Cannot support x2AVIC due to AVIC is disabled"); - pr_warn(FW_BUG "Try enable AVIC using force_avic option"); - } + if (boot_cpu_has(X86_FEATURE_X2AVIC)) + pr_warn(FW_BUG "Cannot enable x2AVIC, AVIC is unsupported\n"); return false; } =20 --=20 2.51.0.470.ga7dc726c21-goog