[PATCH v3 04/10] target/i386/kvm: Use AMD MCE status encoding for Hygon
Tina Zhang <[email protected]>
| Newsgroups | org.kernel.vger.kvm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
QEMU's KVM memory-failure injection path builds synthetic MCI_STATUS records for the guest CPU. The status encoding is vendor-specific: Intel-style records use bits such as MCI_STATUS_S and MCI_STATUS_AR for action-required events, while the AMD path uses the AMD memory-failure encoding. Today QEMU selects the AMD status encoding only for AuthenticAMD guests. Hygon guests should use the AMD status encoding as well, but currently get Intel-style injected status bits, including MCI_STATUS_S and MCI_STATUS_AR for action-required events, and a non-deferred action-optional record. That can prevent a guest OS running on the Hygon CPU model from handling the injected MCE correctly. Use the AMD injected-memory-failure MCE status encoding for Hygon guests as well. This does not depend on Hygon exposing CPUID 0x80000007.EBX recovery features such as SUCCOR, and it does not advertise any new recovery capability. The change is limited to QEMU's synthetic KVM memory-failure MCE status; it does not change CPUID, MCE bank state, or migrated CPU state. Signed-off-by: Tina Zhang <[email protected]> Reviewed-by: Zhao Liu <[email protected]> --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 644c45fb0a..d1c6dbe636 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -707,7 +707,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, int code) uint64_t mcg_status = MCG_STATUS_MCIP | MCG_STATUS_RIPV; int flags = 0; - if (!IS_AMD_CPU(env)) { + if (!IS_AMD_CPU(env) && !IS_HYGON_CPU(env)) { status |= MCI_STATUS_S | MCI_STATUS_UC; if (code == BUS_MCEERR_AR) { status |= MCI_STATUS_AR | 0x134; -- 2.43.7