From nobody Mon Sep 29 21:24:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FA21C25B0D for ; Tue, 16 Aug 2022 04:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233036AbiHPExH (ORCPT ); Tue, 16 Aug 2022 00:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232828AbiHPEty (ORCPT ); Tue, 16 Aug 2022 00:49:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A11179E36; Mon, 15 Aug 2022 13:46:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C7BC2B811A0; Mon, 15 Aug 2022 20:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02FA4C433C1; Mon, 15 Aug 2022 20:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596385; bh=EcOBiTqXf//qzVoa4HOTvZq8CkOTYfOkzuvGn1aqL/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tm09f4lcQYappyQ1JhoDPwHUqfu14UNOBR4Ym7oKNNeDZaUkNRNVBh3n/tF7/nQXS 4mCer1H5ahtTY4l6XUsReEBXwon0b7l3LEPDlqXKurZr92DyOoOTFxoyHD5Pryo3uy vYtL9MYwNxktFGx1LVIeAlQpggtTRHHXD6DRCYK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lev Kujawski , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.19 1063/1157] KVM: set_msr_mce: Permit guests to ignore single-bit ECC errors Date: Mon, 15 Aug 2022 20:06:59 +0200 Message-Id: <20220815180522.596216664@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lev Kujawski [ Upstream commit 0471a7bd1bca2a47a5f378f2222c5cf39ce94152 ] Certain guest operating systems (e.g., UNIXWARE) clear bit 0 of MC1_CTL to ignore single-bit ECC data errors. Single-bit ECC data errors are always correctable and thus are safe to ignore because they are informational in nature rather than signaling a loss of data integrity. Prior to this patch, these guests would crash upon writing MC1_CTL, with resultant error messages like the following: error: kvm run failed Operation not permitted EAX=3Dfffffffe EBX=3Dfffffffe ECX=3D00000404 EDX=3Dffffffff ESI=3Dffffffff EDI=3D00000001 EBP=3Dfffdaba4 ESP=3Dfffdab20 EIP=3Dc01333a5 EFL=3D00000246 [---Z-P-] CPL=3D0 II=3D0 A20=3D1 SMM=3D0 HLT= =3D0 ES =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] CS =3D0100 00000000 ffffffff 00c09b00 DPL=3D0 CS32 [-RA] SS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] DS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] FS =3D0000 00000000 ffffffff 00c00000 GS =3D0000 00000000 ffffffff 00c00000 LDT=3D0118 c1026390 00000047 00008200 DPL=3D0 LDT TR =3D0110 ffff5af0 00000067 00008b00 DPL=3D0 TSS32-busy GDT=3D ffff5020 000002cf IDT=3D ffff52f0 000007ff CR0=3D8001003b CR2=3D00000000 CR3=3D0100a000 CR4=3D00000230 DR0=3D00000000 DR1=3D00000000 DR2=3D00000000 DR3=3D00000000 DR6=3Dffff0ff0 DR7=3D00000400 EFER=3D0000000000000000 Code=3D08 89 01 89 51 04 c3 8b 4c 24 08 8b 01 8b 51 04 8b 4c 24 04 <0f> 30 c3 f7 05 a4 6d ff ff 10 00 00 00 74 03 0f 31 c3 33 c0 33 d2 c3 8d 74 26 00 0f 31 c3 Signed-off-by: Lev Kujawski Message-Id: <20220521081511.187388-1-lkujaw@member.fsf.org> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/x86.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3245,10 +3245,13 @@ static int set_msr_mce(struct kvm_vcpu * /* only 0 or all 1s can be written to IA32_MCi_CTL * some Linux kernels though clear bit 10 in bank 4 to * workaround a BIOS/GART TBL issue on AMD K8s, ignore - * this to avoid an uncatched #GP in the guest + * this to avoid an uncatched #GP in the guest. + * + * UNIXWARE clears bit 0 of MC1_CTL to ignore + * correctable, single-bit ECC data errors. */ if ((offset & 0x3) =3D=3D 0 && - data !=3D 0 && (data | (1 << 10)) !=3D ~(u64)0) + data !=3D 0 && (data | (1 << 10) | 1) !=3D ~(u64)0) return -1; =20 /* MCi_STATUS */