From nobody Mon Feb 9 21:27:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1635600733141935.8782623632331; Sat, 30 Oct 2021 06:32:13 -0700 (PDT) Received: from localhost ([::1]:38088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgoSx-0003G3-BK for importer@patchew.org; Sat, 30 Oct 2021 09:32:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgoQs-0002Rv-O1 for qemu-devel@nongnu.org; Sat, 30 Oct 2021 09:30:02 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:40992 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgoQr-00029F-30 for qemu-devel@nongnu.org; Sat, 30 Oct 2021 09:30:02 -0400 Received: from [2a00:23c4:8b9d:f500:9396:df17:737c:b32c] (helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgoQN-0003Ry-H8; Sat, 30 Oct 2021 14:29:35 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, qemu-devel@nongnu.org Date: Sat, 30 Oct 2021 14:29:43 +0100 Message-Id: <20211030132943.21362-1-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8b9d:f500:9396:df17:737c:b32c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH] target/i386: ensure EXCP0D_GPF is propagated back to the guest X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1635600734534100001 Content-Type: text/plain; charset="utf-8" In the case where mmu_translate() returns EXCP0D_GPF ensure that handle_mmu= _fault() returns immediately to propagate the fault back to the guest instead of ret= urning EXCP0E_PAGE. Signed-off-by: Mark Cave-Ayland Fixes: 661ff4879e ("target/i386: extract mmu_translate") Closes: https://gitlab.com/qemu-project/qemu/-/issues/394 --- [Paolo: this appears to fix the regression booting Windows 7 on TCG that ap= peared in 6.1 as per the above Gitlab issue. Unfortunately as I'm not really familiar wi= th x86 it will probably need a better implementation/description but it should at least i= ndicate what the problem is.] target/i386/tcg/sysemu/excp_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/= excp_helper.c index 7af887be4d..0170f7f791 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -439,6 +439,10 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, = int size, prot, mmu_idx, page_size); return 0; } else { + if (cs->exception_index =3D=3D EXCP0D_GPF) { + return 1; + } + if (env->intercept_exceptions & (1 << EXCP0E_PAGE)) { /* cr2 is not modified in case of exceptions */ x86_stq_phys(cs, --=20 2.20.1