Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235)
@ 2026-05-22  4:00 Tina Zhang
  2026-05-22 12:56 ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: Tina Zhang @ 2026-05-22  4:00 UTC (permalink / raw)
  To: kvm; +Cc: seanjc, pbonzini, mlevitsk, naveen, linux-kernel, Tina Zhang,
	stable

Hygon Family 18h CPUs are derived from AMD Family 17h (Zen1) silicon and
share the same erratum #1235: hardware may read a stale IsRunning=1 bit
during ICR write emulation and silently fail to generate an
AVIC_IPI_FAILURE_TARGET_NOT_RUNNING VM-Exit on the sending vCPU.

The absence of the VM-Exit causes KVM to miss the required wakeup of
blocking target vCPUs, leading to hung vCPUs and unbounded delays in
guest execution.

Extend the existing AMD Family 17h erratum #1235 workaround to also cover
Hygon Family 18h.  With IPI virtualization disabled, KVM never sets
IsRunning=1 in the Physical ID table, so every non-self IPI generates a
VM-Exit and is correctly emulated.

Fixes: 8de4a1c8164e ("KVM: SVM: Disable (x2)AVIC IPI virtualization if CPU has erratum #1235")
Cc: <stable@vger.kernel.org>
Signed-off-by: Tina Zhang <zhang_wei@open-hieco.net>
---
 arch/x86/kvm/svm/avic.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index adf211860949..993b551180fe 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -1300,12 +1300,14 @@ bool __init avic_hardware_setup(void)
 	}
 
 	/*
-	 * Disable IPI virtualization for AMD Family 17h CPUs (Zen1 and Zen2)
-	 * due to erratum 1235, which results in missed VM-Exits on the sender
-	 * and thus missed wake events for blocking vCPUs due to the CPU
-	 * failing to see a software update to clear IsRunning.
+	 * Disable IPI virtualization for AMD Family 17h (Zen1 and Zen2) and
+	 * Hygon Family 18h (derived from AMD Zen1) CPUs due to erratum 1235,
+	 * which results in missed VM-Exits on the sender and thus missed wake
+	 * events for blocking vCPUs due to the CPU failing to see a software
+	 * update to clear IsRunning.
 	 */
-	enable_ipiv = enable_ipiv && boot_cpu_data.x86 != 0x17;
+	if (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18)
+		enable_ipiv = false;
 
 	amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);
 
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235)
  2026-05-22  4:00 [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235) Tina Zhang
@ 2026-05-22 12:56 ` Sean Christopherson
  2026-05-25  3:58   ` 张巍
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2026-05-22 12:56 UTC (permalink / raw)
  To: Tina Zhang; +Cc: kvm, pbonzini, mlevitsk, naveen, linux-kernel, stable

On Fri, May 22, 2026, Tina Zhang wrote:
> Hygon Family 18h CPUs are derived from AMD Family 17h (Zen1) silicon and
> share the same erratum #1235: hardware may read a stale IsRunning=1 bit
> during ICR write emulation and silently fail to generate an
> AVIC_IPI_FAILURE_TARGET_NOT_RUNNING VM-Exit on the sending vCPU.
> 
> The absence of the VM-Exit causes KVM to miss the required wakeup of
> blocking target vCPUs, leading to hung vCPUs and unbounded delays in
> guest execution.
> 
> Extend the existing AMD Family 17h erratum #1235 workaround to also cover
> Hygon Family 18h.  With IPI virtualization disabled, KVM never sets
> IsRunning=1 in the Physical ID table, so every non-self IPI generates a
> VM-Exit and is correctly emulated.
> 
> Fixes: 8de4a1c8164e ("KVM: SVM: Disable (x2)AVIC IPI virtualization if CPU has erratum #1235")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Tina Zhang <zhang_wei@open-hieco.net>
> ---
>  arch/x86/kvm/svm/avic.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index adf211860949..993b551180fe 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -1300,12 +1300,14 @@ bool __init avic_hardware_setup(void)
>  	}
>  
>  	/*
> -	 * Disable IPI virtualization for AMD Family 17h CPUs (Zen1 and Zen2)
> -	 * due to erratum 1235, which results in missed VM-Exits on the sender
> -	 * and thus missed wake events for blocking vCPUs due to the CPU
> -	 * failing to see a software update to clear IsRunning.
> +	 * Disable IPI virtualization for AMD Family 17h (Zen1 and Zen2) and
> +	 * Hygon Family 18h (derived from AMD Zen1) CPUs due to erratum 1235,
> +	 * which results in missed VM-Exits on the sender and thus missed wake
> +	 * events for blocking vCPUs due to the CPU failing to see a software
> +	 * update to clear IsRunning.
>  	 */
> -	enable_ipiv = enable_ipiv && boot_cpu_data.x86 != 0x17;
> +	if (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18)

IIUC, family 18h is carved out entirely for Hygon, correct?  I.e. there's no risk
of disabling IPI virtualization on unaffected AMD CPUs?

> +		enable_ipiv = false;
>  
>  	amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);
>  
> -- 
> 2.43.7
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235)
  2026-05-22 12:56 ` Sean Christopherson
@ 2026-05-25  3:58   ` 张巍
  2026-05-26 19:14     ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: 张巍 @ 2026-05-25  3:58 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, pbonzini, mlevitsk, naveen, linux-kernel, stable

On Fri, May 22, 2026, Sean Christopherson wrote:
> IIUC, family 18h is carved out entirely for Hygon, correct?  I.e.
> there's no risk of disabling IPI virtualization on unaffected AMD CPUs?

Yes, that is my understanding.

The original Hygon enablement [1] uses Family 18h together with the
HygonGenuine vendor ID to distinguish Hygon Dhyana from AMD Family 17h,
and explicitly states that only Hygon is expected to use Family 18h.  So
this should not affect unaffected AMD CPUs.

I can add an X86_VENDOR_HYGON check too if you prefer making the
dependency explicit.

[1] https://lwn.net/Articles/764481/

Thanks,
Tina

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235)
  2026-05-25  3:58   ` 张巍
@ 2026-05-26 19:14     ` Sean Christopherson
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2026-05-26 19:14 UTC (permalink / raw)
  To: 张巍; +Cc: kvm, pbonzini, mlevitsk, naveen, linux-kernel, stable

On Mon, May 25, 2026, 张巍 wrote:
> On Fri, May 22, 2026, Sean Christopherson wrote:
> > IIUC, family 18h is carved out entirely for Hygon, correct?  I.e.
> > there's no risk of disabling IPI virtualization on unaffected AMD CPUs?
> 
> Yes, that is my understanding.
> 
> The original Hygon enablement [1] uses Family 18h together with the
> HygonGenuine vendor ID to distinguish Hygon Dhyana from AMD Family 17h,
> and explicitly states that only Hygon is expected to use Family 18h.  So
> this should not affect unaffected AMD CPUs.
> 
> I can add an X86_VENDOR_HYGON check too if you prefer making the
> dependency explicit.

No need, I just wanted to double check.  And this is already in Linus' tree,
commit 9a12fa5213cf ("KVM: SVM: Disable AVIC IPI virtualization on Hygon Family
18h (erratum #1235)"), so what I would have preferred is irrelevant :-)

Thanks for the follow-up!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-26 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22  4:00 [PATCH] KVM: SVM: Disable AVIC IPI virtualization on Hygon Family 18h (erratum #1235) Tina Zhang
2026-05-22 12:56 ` Sean Christopherson
2026-05-25  3:58   ` 张巍
2026-05-26 19:14     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox