get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2221595/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2221595,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221595/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260409220614.65558-7-lucaaamaral@gmail.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api",
        "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": ""
    },
    "msgid": "<20260409220614.65558-7-lucaaamaral@gmail.com>",
    "date": "2026-04-09T22:06:14",
    "name": "[v6,6/6] target/arm/hvf, whpx: wire ISV=0 emulation for data aborts",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "136c45b214afcc31aeef91cd81cd5dd0494f6762",
    "submitter": {
        "id": 92822,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/92822/?format=api",
        "name": "Lucas Amaral",
        "email": "lucaaamaral@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260409220614.65558-7-lucaaamaral@gmail.com/mbox/",
    "series": [
        {
            "id": 499365,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499365/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499365",
            "date": "2026-04-09T22:06:14",
            "name": null,
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/499365/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221595/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221595/checks/",
    "tags": {},
    "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=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=kMhxRzX+;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.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 4fsDZ64Qrdz1yGd\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 08:07:24 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAxWT-0008K3-FL; Thu, 09 Apr 2026 18:06:49 -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 <lucaaamaral@gmail.com>)\n id 1wAxWS-0008IQ-Hb\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 18:06:48 -0400",
            "from mail-dy1-x1332.google.com ([2607:f8b0:4864:20::1332])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <lucaaamaral@gmail.com>)\n id 1wAxWQ-0000d7-Ku\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 18:06:48 -0400",
            "by mail-dy1-x1332.google.com with SMTP id\n 5a478bee46e88-2cc4c693d59so971785eec.1\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 15:06:46 -0700 (PDT)",
            "from localhost.localdomain ([2804:7f4:c030:bb40:195d:78fd:ecba:d45])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2d561bde68bsm1534567eec.17.2026.04.09.15.06.41\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Thu, 09 Apr 2026 15:06:44 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775772405; x=1776377205; 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=VoJVdciZFaewroq0cySKl+vu/S+aD/kerrA4/hB7jSw=;\n b=kMhxRzX+KqRMLJI2Y7HOEVZkxbpmG+T80eMgG6aWzMA3Ks6e7pveo8SxzJrfL5WseH\n QN5zrnUDUr4Xx+jdzGn3/9SnWyXQ4uNc0mPChXcXNPKSlacVo0i00jrTKAbo85YQWuyp\n VMKjM0JzHxQa7/ljpbjO+FdQ3aDbF72M+I/XjDg/ApAjmUGTj/o3E7hTPTRyHh4hHxjG\n cNoddiZbfqPKuAPaZlQa/NFvlJfD6vgZxdH4xeTWZcF4p+SFgJF+yaze1HC+ORS2Noxi\n lnFSQT9zYOKdbu5UcN+1iKY8tpiibvjAGcx+jxdy5thjPcAR4SJYSDpK2egZ0mOdAI32\n MCcA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775772405; x=1776377205;\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=VoJVdciZFaewroq0cySKl+vu/S+aD/kerrA4/hB7jSw=;\n b=D2/a6fJwc/wtpxUOf5xgmRqlKTvO2s7YYO0zf50tUZ2ov0IpvFQu0ATghBUNzhy5zR\n nKt+qrIC160VsBzxbzUIUUglz2+7b2ler0F+/xQaZ7nSljM5vgxzXVIwF+jHS0VPZEzp\n BiGLMwVPSmZBJuR+3eQF/EeqplUWkmae+MLfVyHrnfoK1R7LmMKTe8FMoAvI32iDMxL4\n fo2KPPv81ysNBjD8ymQ5Gp+3L/52LvD3Np0Dejzk5FspX2RzptLCA5v6cB4gCFnNDuQu\n sSHqG9ZHl6yZGZwOlxHC1H749X6hKIOevfo1awI3Af0FB9CkGnZFR3J3d/lgQjh3aWzI\n DrDA==",
        "X-Gm-Message-State": "AOJu0YxnwjNnZeZjXQ68GY/r0y5E+hAXsCCkC+iEScvPKWdRnBza/dRO\n 7CUVUbS5Wly17Bvv2uxHtN92bELoN9PFAQg3byyY/FHaVFJGkU/NjT3pODD+SQXv",
        "X-Gm-Gg": "AeBDieudzMmZSUjSUzEd499bEVB38H/R/pIHurvn8Ik/3tz1j68w4deMQOpLyTQ0nUk\n xQz091rfHW+b5YPC/XdU7J7PE+c/wj+O9++96iCvpniRxiec8A6xsUwE0yDFJrjKWa6DInKKEAx\n 2n4qkJfSUZ3qIt7YBrYPx1zsIIfNmJpu68YHlFpxUY7mwM0O0rCb+Q6qtakVMvc0HrMkg/vSMxP\n xXNcL5rcFIRc/zGuN2DTRQbK62dm3J47px9ZwDSgme9stggWwq+B/dniQOa2bEH1QAq7jjyJom6\n 0m4/iJFztFSnrxFRP07IgevgvkUKNJ+ojgeo3ORmHapubG9C+PJ1iMO+ExpY1n0XTfHXPUJo07+\n 2Ru5uoqkg6TwmTcR7/sW2qxe5dGSSXt4ROWy3bLhsUq2YRxIzDlWeraBNLMV3GKaEn1S3xyqcAb\n k+yxl2+SuSmEd8ZqFs/a2X8XmjB9SJSzqNBA+rj/uV+uql+JvtX8OhmAaZpX9zjw==",
        "X-Received": "by 2002:a05:7300:6d03:b0:2c1:778:d897 with SMTP id\n 5a478bee46e88-2d5888a07c5mr501111eec.21.1775772404920;\n Thu, 09 Apr 2026 15:06:44 -0700 (PDT)",
        "From": "Lucas Amaral <lucaaamaral@gmail.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "qemu-arm@nongnu.org, agraf@csgraf.de, peter.maydell@linaro.org,\n mohamed@unpredictable.fr, alex.bennee@linaro.org,\n richard.henderson@linaro.org, Lucas Amaral <lucaaamaral@gmail.com>",
        "Subject": "[PATCH v6 6/6] target/arm/hvf,\n whpx: wire ISV=0 emulation for data aborts",
        "Date": "Thu,  9 Apr 2026 19:06:14 -0300",
        "Message-ID": "<20260409220614.65558-7-lucaaamaral@gmail.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260409220614.65558-1-lucaaamaral@gmail.com>",
        "References": "<20260409220614.65558-1-lucaaamaral@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1332;\n envelope-from=lucaaamaral@gmail.com; helo=mail-dy1-x1332.google.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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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": "When a data abort with ISV=0 occurs during MMIO emulation, the\nsyndrome register does not carry the access size or target register.\nPreviously this hit an assert(isv) and killed the VM.\n\nReplace the assert with instruction fetch + decode + emulate using the\nshared library in target/arm/emulate/.  The faulting instruction is read\nfrom guest memory via cpu_memory_rw_debug(), decoded by the decodetree-\ngenerated decoder, and emulated against the vCPU register file.\n\nBoth HVF (macOS) and WHPX (Windows Hyper-V) use the same pattern:\n  1. cpu_synchronize_state() to flush hypervisor registers\n  2. Fetch 4-byte instruction at env->pc\n  3. arm_emul_insn(env, insn)\n  4. On success, advance PC past the emulated instruction\n\nIf the instruction is unhandled or a memory error occurs, a synchronous\nexternal abort is injected into the guest via syn_data_abort_no_iss()\nwith fnv=1 and fsc=0x10, matching the syndrome that KVM uses in\nkvm_inject_arm_sea().  The guest kernel's fault handler then reports\nthe error through its normal data abort path.\n\nWHPX adds a whpx_inject_data_abort() helper and adjusts the\nwhpx_handle_mmio() return convention so the caller skips PC advancement\nwhen an exception has been injected.\n\nSigned-off-by: Lucas Amaral <lucaaamaral@gmail.com>\n---\n target/arm/hvf/hvf.c       | 46 ++++++++++++++++++++++++++--\n target/arm/whpx/whpx-all.c | 61 +++++++++++++++++++++++++++++++++++++-\n 2 files changed, 103 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c\nindex 5fc8f6bb..000e54bd 100644\n--- a/target/arm/hvf/hvf.c\n+++ b/target/arm/hvf/hvf.c\n@@ -32,6 +32,7 @@\n #include \"arm-powerctl.h\"\n #include \"target/arm/cpu.h\"\n #include \"target/arm/internals.h\"\n+#include \"emulate/arm_emulate.h\"\n #include \"target/arm/multiprocessing.h\"\n #include \"target/arm/gtimer.h\"\n #include \"target/arm/trace.h\"\n@@ -2175,10 +2176,49 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)\n         assert(!s1ptw);\n \n         /*\n-         * TODO: ISV will be 0 for SIMD or SVE accesses.\n-         * Inject the exception into the guest.\n+         * ISV=0: syndrome doesn't carry access size/register info.\n+         * Fetch and emulate via target/arm/emulate/.\n          */\n-        assert(isv);\n+        if (!isv) {\n+            ARMCPU *arm_cpu = ARM_CPU(cpu);\n+            CPUARMState *env = &arm_cpu->env;\n+            uint32_t insn;\n+            ArmEmulResult r;\n+\n+            cpu_synchronize_state(cpu);\n+\n+            if (cpu_memory_rw_debug(cpu, env->pc,\n+                                    (uint8_t *)&insn, 4, false) != 0) {\n+                bool same_el = arm_current_el(env) == 1;\n+                uint32_t esr = syn_data_abort_no_iss(same_el,\n+                    1, 0, 0, 0, iswrite, 0x10);\n+\n+                error_report(\"HVF: cannot read insn at pc=0x%\" PRIx64,\n+                             (uint64_t)env->pc);\n+                env->exception.vaddress = excp->virtual_address;\n+                hvf_raise_exception(cpu, EXCP_DATA_ABORT, esr, 1);\n+                break;\n+            }\n+\n+            r = arm_emul_insn(env, insn);\n+            if (r == ARM_EMUL_UNHANDLED || r == ARM_EMUL_ERR_MEM) {\n+                bool same_el = arm_current_el(env) == 1;\n+                uint32_t esr = syn_data_abort_no_iss(same_el,\n+                    1, 0, 0, 0, iswrite, 0x10);\n+\n+                error_report(\"HVF: ISV=0 %s insn 0x%08x at \"\n+                             \"pc=0x%\" PRIx64 \", injecting data abort\",\n+                             r == ARM_EMUL_UNHANDLED ? \"unhandled\"\n+                                                     : \"memory error\",\n+                             insn, (uint64_t)env->pc);\n+                env->exception.vaddress = excp->virtual_address;\n+                hvf_raise_exception(cpu, EXCP_DATA_ABORT, esr, 1);\n+                break;\n+            }\n+\n+            advance_pc = true;\n+            break;\n+        }\n \n         /*\n          * Emulate MMIO.\ndiff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c\nindex 513551be..0c04073e 100644\n--- a/target/arm/whpx/whpx-all.c\n+++ b/target/arm/whpx/whpx-all.c\n@@ -29,6 +29,7 @@\n #include \"syndrome.h\"\n #include \"target/arm/cpregs.h\"\n #include \"internals.h\"\n+#include \"emulate/arm_emulate.h\"\n \n #include \"system/whpx-internal.h\"\n #include \"system/whpx-accel-ops.h\"\n@@ -352,6 +353,27 @@ static void whpx_set_gp_reg(CPUState *cpu, int rt, uint64_t val)\n     whpx_set_reg(cpu, reg, reg_val);\n }\n \n+/*\n+ * Inject a synchronous external abort (data abort) into the guest.\n+ * Used when ISV=0 instruction emulation fails.  Matches the syndrome\n+ * that KVM uses in kvm_inject_arm_sea().\n+ */\n+static void whpx_inject_data_abort(CPUState *cpu, bool iswrite)\n+{\n+    ARMCPU *arm_cpu = ARM_CPU(cpu);\n+    CPUARMState *env = &arm_cpu->env;\n+    bool same_el = arm_current_el(env) == 1;\n+    uint32_t esr = syn_data_abort_no_iss(same_el, 1, 0, 0, 0, iswrite, 0x10);\n+\n+    cpu->exception_index = EXCP_DATA_ABORT;\n+    env->exception.target_el = 1;\n+    env->exception.syndrome = esr;\n+\n+    bql_lock();\n+    arm_cpu_do_interrupt(cpu);\n+    bql_unlock();\n+}\n+\n static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx)\n {\n     uint64_t syndrome = ctx->Syndrome;\n@@ -366,7 +388,40 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx)\n     uint64_t val = 0;\n \n     assert(!cm);\n-    assert(isv);\n+\n+    /*\n+     * ISV=0: syndrome doesn't carry access size/register info.\n+     * Fetch and decode the faulting instruction via the emulation library.\n+     */\n+    if (!isv) {\n+        ARMCPU *arm_cpu = ARM_CPU(cpu);\n+        CPUARMState *env = &arm_cpu->env;\n+        uint32_t insn;\n+        ArmEmulResult r;\n+\n+        cpu_synchronize_state(cpu);\n+\n+        if (cpu_memory_rw_debug(cpu, env->pc,\n+                                (uint8_t *)&insn, 4, false) != 0) {\n+            error_report(\"WHPX: cannot read insn at pc=0x%\" PRIx64,\n+                         (uint64_t)env->pc);\n+            whpx_inject_data_abort(cpu, iswrite);\n+            return 1;\n+        }\n+\n+        r = arm_emul_insn(env, insn);\n+        if (r == ARM_EMUL_UNHANDLED || r == ARM_EMUL_ERR_MEM) {\n+            error_report(\"WHPX: ISV=0 %s insn 0x%08x at \"\n+                         \"pc=0x%\" PRIx64 \", injecting data abort\",\n+                         r == ARM_EMUL_UNHANDLED ? \"unhandled\"\n+                                                 : \"memory error\",\n+                         insn, (uint64_t)env->pc);\n+            whpx_inject_data_abort(cpu, iswrite);\n+            return 1;\n+        }\n+\n+        return 0;\n+    }\n \n     if (iswrite) {\n         val = whpx_get_gp_reg(cpu, srt);\n@@ -451,6 +506,10 @@ int whpx_vcpu_run(CPUState *cpu)\n             }\n \n             ret = whpx_handle_mmio(cpu, &vcpu->exit_ctx.MemoryAccess);\n+            if (ret > 0) {\n+                advance_pc = false;\n+                ret = 0;\n+            }\n             break;\n         case WHvRunVpExitReasonCanceled:\n             cpu->exception_index = EXCP_INTERRUPT;\n",
    "prefixes": [
        "v6",
        "6/6"
    ]
}