{"id":2231430,"url":"http://patchwork.ozlabs.org/api/patches/2231430/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-51-pbonzini@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430172204.1006673-51-pbonzini@redhat.com>","list_archive_url":null,"date":"2026-04-30T17:21:56","name":"[PULL,50/58] target/i386: emulate: use exception_payload for fault address","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"35ca09c6fe504fd6dc71f9bd9ab8a88d4ad0769d","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/?format=json","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-51-pbonzini@redhat.com/mbox/","series":[{"id":502347,"url":"http://patchwork.ozlabs.org/api/series/502347/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502347","date":"2026-04-30T17:21:16","name":"[PULL,01/58] pythondeps: bump to meson 1.11.1","version":1,"mbox":"http://patchwork.ozlabs.org/series/502347/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231430/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231430/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=K5zdE+Vi;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=kyPtOKlA;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g61L50wx5z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 03:26:21 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIV8D-0001cW-6Z; Thu, 30 Apr 2026 13:24:59 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV83-0001Oq-LR\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:24:47 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV81-0004xy-RU\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:24:47 -0400","from mail-qv1-f70.google.com (mail-qv1-f70.google.com\n [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-363-j7MiLVQbOXWH_o4x7dsdKw-1; Thu, 30 Apr 2026 13:24:43 -0400","by mail-qv1-f70.google.com with SMTP id\n 6a1803df08f44-8b4bebd2b2aso10784966d6.1\n for <qemu-devel@nongnu.org>; Thu, 30 Apr 2026 10:24:43 -0700 (PDT)","from [192.168.10.48] ([151.49.85.67])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b3ff301c24sm22789796d6.6.2026.04.30.10.24.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Apr 2026 10:24:41 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777569885;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=mwSTO23tatX4qo/4Z8YUUEq0ozPSpRwl9jKyMZLnpSI=;\n b=K5zdE+ViOvpLXQiN1ncTtwqOfha8ZpTz4jkspVjafz55tsezZgt9dNJzilOvc8tB5A0dFJ\n f9XEDtZE/XLPC8+G/SO7iE6wrOPoXScemgikyHGJQoMX4ChuYv8AW1kGgySytzBM+Nn9VN\n tso3lxgtWHgRISYfnZBZbgA2jUm8Bfg=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1777569882; x=1778174682; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=mwSTO23tatX4qo/4Z8YUUEq0ozPSpRwl9jKyMZLnpSI=;\n b=kyPtOKlAHwXoU7Fe/6JbhTrKrqJLKYrpidKVPp4pOmGWUWw7/kgNBMqecQV0Jr1MHV\n 3H1FJItNY5H5bOtay5KTNZ4mDtANwTBAB5I0YSP+TaqmBjrjfo9KdIOcWJNUhWzHN+rt\n z7t5Z2T8KIpOgW4xg/CIqWfXu6f/9HoX/s2R5NsgHym9hUst8iEU5y6eVEFpGj5r1ZBD\n yWTzwXxb+d61dDlw9Acr7/xuBhCpVrREVAqINMLQtz2UKbPVCZ/eB6RiC6rLQuSMr3pn\n UKxNgZRbLL6BDy9CRYMVD1sWyRml+Q0llp3xRGwcwgAkY9KPW262kT/eLtJV7MolzBAP\n 1E1A=="],"X-MC-Unique":"j7MiLVQbOXWH_o4x7dsdKw-1","X-Mimecast-MFC-AGG-ID":"j7MiLVQbOXWH_o4x7dsdKw_1777569883","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777569882; x=1778174682;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=mwSTO23tatX4qo/4Z8YUUEq0ozPSpRwl9jKyMZLnpSI=;\n b=lTyxYJ6fD65bLDZqmrku2csVv36hqLePxcVar6m5TC/N9bAB/ohiB4/YVZkAWMIFy0\n RR5AuVTQppdiDjKC8cm3J81HdwjvBQ9prNjNR6fzHQUoogiOFrCAqiHYM9jEdQVIeJd1\n 5AYdGVFT42zUrpP6rpm2jx7mbR+bc9n3ZI/Bkvz45UgwDe3S3EW1T4+lVVY7ysX/E/vm\n 99OlPPR0JH/KGiBOQQcu0TOvZKYGbLTVhqV2uu3eYD7xHlceMLiKHNZbo01vLf9+eAMn\n irb4yydrSo5GdOk6Jlzi/RPGLXQMn4t4Rtmb9pw9tU+wfVujF9SphY+odo1l/Y+YOuY7\n goLw==","X-Gm-Message-State":"AOJu0Yysc0kwqSJxNSLcejzm+yLDJCt10by4TMznwE8yrxTqaqZEol7g\n J4zV79jbM5149OfP0IW2x1tlTnIe2aTIr1Bp7fEax0S7ZgzuQFSNHxBBoJ63UGO1W1e1NuQhkdf\n lt40iQZ9cuvEk8yDHW1yR3vLG1PpE1VvYTYNm6VkayB972zvlpApHBLuZz37QIkZUhk8Ywgt4/K\n 9BhWIX9oRFmdaeuze/0ZB4pyLlgsc78irr2QdShnqK","X-Gm-Gg":"AeBDieuuHrMtI6puKgjdlUPu6nJ4yo+ujZAPtWPnWA+x9JvX45sYPvedbDWXXB5HG6S\n 5PxmSplqpgdtmPY6bSdQKvc0zBPwQfCzzgSXCbQgJtRacFmJ+Qk8xPDSe2kINUAqrzNL7SOuqmv\n +yKqbdRZnlWClxhbufgjC+KmaUwXmLicrqm5T329KyHp50X3WFy8F8YTEOvGQwlqZfOhO3it3ND\n m51Cem+TNxCNYL9AaD9AuUbp6aFajMZ9Im3lipZbHV/FfzLUKT0SaRmvrftA4eQZ8KWFmAEcqmk\n Mro2lIdORqwons3YA6uGhJPruWKrf59MQ/uGJ0lY6MLebgA3LbPXPm/mmA85ejt6m7/xi0mjN+f\n P8NnOEem61sn36dE+8zh55yEdu7d4RiZQRW+YjUrh8InZXyoE8MmkwA7mJVinawnxK0jxcV7f8v\n 5qqm8htLwNJE8i2H4VTrqE1X7BLeElDXGVG/g=","X-Received":["by 2002:a05:6214:3d0b:b0:8ac:9fe9:bcd5 with SMTP id\n 6a1803df08f44-8b4000fc37dmr43928916d6.35.1777569882435;\n Thu, 30 Apr 2026 10:24:42 -0700 (PDT)","by 2002:a05:6214:3d0b:b0:8ac:9fe9:bcd5 with SMTP id\n 6a1803df08f44-8b4000fc37dmr43928426d6.35.1777569881956;\n Thu, 30 Apr 2026 10:24:41 -0700 (PDT)"],"From":"Paolo Bonzini <pbonzini@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"Mohamed Mediouni <mohamed@unpredictable.fr>","Subject":"[PULL 50/58] target/i386: emulate: use exception_payload for fault\n address","Date":"Thu, 30 Apr 2026 19:21:56 +0200","Message-ID":"<20260430172204.1006673-51-pbonzini@redhat.com>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260430172204.1006673-1-pbonzini@redhat.com>","References":"<20260430172204.1006673-1-pbonzini@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.129.124;\n envelope-from=pbonzini@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-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.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Mohamed Mediouni <mohamed@unpredictable.fr>\n\nInstead of directly putting it in cr[2], put it in exception_payload.\n\nSigned-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>\nLink: https://lore.kernel.org/r/20260422214225.2242-27-mohamed@unpredictable.fr\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n target/i386/emulate/x86_mmu.c | 3 ++-\n target/i386/whpx/whpx-all.c   | 6 +++---\n 2 files changed, 5 insertions(+), 4 deletions(-)","diff":"diff --git a/target/i386/emulate/x86_mmu.c b/target/i386/emulate/x86_mmu.c\nindex 007de582de9..8d4371467fd 100644\n--- a/target/i386/emulate/x86_mmu.c\n+++ b/target/i386/emulate/x86_mmu.c\n@@ -277,7 +277,8 @@ static MMUTranslateResult x86_write_mem_ex(CPUState *cpu, void *data, target_ulo\n         translate_res = mmu_gva_to_gpa(cpu, gva, &gpa, translate_flags);\n         if (translate_res) {\n             int error_code = translate_res_to_error_code(translate_res, true, is_user(cpu));\n-            env->cr[2] = gva;\n+            env->exception_has_payload = 1;\n+            env->exception_payload = gva;\n             x86_emul_raise_exception(env, EXCP0E_PAGE, error_code);\n             return translate_res;\n         }\ndiff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c\nindex 25ace38ff60..8d8aabf4db7 100644\n--- a/target/i386/whpx/whpx-all.c\n+++ b/target/i386/whpx/whpx-all.c\n@@ -1891,11 +1891,11 @@ static void whpx_inject_exceptions(CPUState* cpu)\n         WHV_REGISTER_VALUE reg = {};\n         reg.ExceptionEvent.EventPending = 1;\n         reg.ExceptionEvent.EventType = WHvX64PendingEventException;\n-        reg.ExceptionEvent.DeliverErrorCode = 1;\n+        reg.ExceptionEvent.DeliverErrorCode = env->has_error_code;\n         reg.ExceptionEvent.Vector = env->exception_nr;\n         reg.ExceptionEvent.ErrorCode = env->error_code;\n-        if (env->exception_nr == EXCP0E_PAGE) {\n-            reg.ExceptionEvent.ExceptionParameter = env->cr[2];\n+        if (env->exception_has_payload) {\n+            reg.ExceptionEvent.ExceptionParameter = env->exception_payload;\n         }\n         whpx_set_reg(cpu, WHvRegisterPendingEvent, reg);\n     }\n","prefixes":["PULL","50/58"]}