get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2216873,
    "url": "http://patchwork.ozlabs.org/api/patches/2216873/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260327111700.795099-29-peter.maydell@linaro.org/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/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": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260327111700.795099-29-peter.maydell@linaro.org>",
    "list_archive_url": null,
    "date": "2026-03-27T11:16:23",
    "name": "[v2,28/65] hw/intc/arm_gicv5: Update SPI state for CLEAR/SET events",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "00903392778695887bf9e1c3ad60fa680618052f",
    "submitter": {
        "id": 5111,
        "url": "http://patchwork.ozlabs.org/api/people/5111/?format=api",
        "name": "Peter Maydell",
        "email": "peter.maydell@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260327111700.795099-29-peter.maydell@linaro.org/mbox/",
    "series": [
        {
            "id": 497750,
            "url": "http://patchwork.ozlabs.org/api/series/497750/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497750",
            "date": "2026-03-27T11:16:25",
            "name": "arm: Implement an emulation of GICv5 interrupt controller",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/497750/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216873/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216873/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 (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=wfEpRQj4;\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 (lists.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 4fhymp4ZTYz1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 22:18:02 +1100 (AEDT)",
            "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 1w65C4-0006oj-BJ; Fri, 27 Mar 2026 07:17:36 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1w65C0-0006jt-Sn\n for qemu-devel@nongnu.org; Fri, 27 Mar 2026 07:17:32 -0400",
            "from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1w65By-00080U-Nu\n for qemu-devel@nongnu.org; Fri, 27 Mar 2026 07:17:32 -0400",
            "by mail-wr1-x42f.google.com with SMTP id\n ffacd0b85a97d-43b8982c2f4so1121578f8f.2\n for <qemu-devel@nongnu.org>; Fri, 27 Mar 2026 04:17:30 -0700 (PDT)",
            "from lanath.. (wildly.archaic.org.uk. [81.2.115.145])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43b919cf2b2sm15484227f8f.18.2026.03.27.04.17.28\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 27 Mar 2026 04:17:28 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1774610249; x=1775215049; 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=xoyJziqdU/nken6or35eJw+c9H0GsrA0zPSsjs/9kKo=;\n b=wfEpRQj4+ZOWYQ/QpxkjZZo21umgPIEahwTvgyCVul4CY72Y1FKsDaIHW8FCQCBfYm\n THzE4jrJmrcrx4XS84j0ecrmmSXPeEypgW/5LGia0sADvV1J1TFoWeLSYT3cvDXrzPkF\n WSIJ6lWlskUr9jqLAZ5CQQND10SXbe8CJE5hjY3R4WHftGLK8274CiURaEWmVx73p6w3\n hOF3VVdxja0xF1K4cJon+39PNachpbWzwBSguvxfDxcI64P77LwHZDxaum6jGmOFahjX\n 6RgI6jcyUNdQzhlpUtWk7hmxzUlh34ZiDd+meEiuxq3fG+eph15quS29e30+c0ugjuwR\n FEww==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774610249; x=1775215049;\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=xoyJziqdU/nken6or35eJw+c9H0GsrA0zPSsjs/9kKo=;\n b=KR2QEJ8mCMFznnrgIHMI1gMNRjy47q8hvfDrSrqXP1V05D/8a6rnu1Yg9K1z5cmnd4\n gU4B1F0IpsRXlHgYFZpFExa9T5OiFdjH/tuOPy1g3724iQiRgmdY/vOUHEQlNUM8NMW6\n 5619VURjjXixP1N+GoXUZJpD4WRTeuupCUWPpo+fUKvi+BtfHjsGV/rFDQSpHQZ7fHyK\n zZtLeGEXPCqhgYIlQ47+x4cYmQXJ0KooKoVB+EDMvCRd3+kKK8NKDXLMcfbyhNqu3r5N\n oUMEkAqM6eLr073YQ+1DYPtWVsOaQPndrPfEwMudruzgtg5ejHGk8AQj3c2gJ17MmyXn\n g3Pg==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCXFhKQ9ptDNpNbUEYO9KjdMCVh7ZywmYj0tEslWp/KLNxb3Ofr90WWyVvTFWjwE0Dx/9sxqza7WliSp@nongnu.org",
        "X-Gm-Message-State": "AOJu0YyhlH9YRSG5cYu+IrEYILTDH+Z+/+Ya3K9z5dDoaazIQhBO3J+y\n ylEzACEVInAWcUqpM9Fds2rqkb0i0e7hQ0W3u0o/1bejKZEjZnWizEYJBTJ/XKgRuKE=",
        "X-Gm-Gg": "ATEYQzxlWrye7sAbSQRxy+pkZMZ3TWauGyDFPsOzBA4gArNWE/icFSZ8haHqF9Sm3R3\n FI3QQN9M4/8PjGzbFglV/n71wfwqkPtYVmx7q74BROS5b+WtMUl7e0azWd7Mw3Ooqt7iveZjMip\n veTTvx6KOpkTj/n90DwqiCrawTpANMldbc6sMat2d2D30x2AHz3PyikqoCExh5/YvDGq1VzbsF5\n CD0hpKkivc6Hqpn++2wdgbQaYiejplWhv8LLTGWPd4vZGEQONrYMJbVohcFVZxw4CVv9j30ipla\n NF9RXlkpqx6SDGcWroGhH4SrO4TOFU5FOrG/P/fzMOU9CXPcauPnoJ736MdLizl/x1N95hrDk8l\n OwHf92CF4bodH2TsdDU3duHrmM9YYoUnb4pw4gOpoKjL2ausoALOMyjMAhAnPA0IcPXpf7CBrk8\n 7ZNA48PAxYSgLxTkMjB31E9KTQlAuvANjQc/V/fl3nVYvKD6WtvTp8ZmhKDLQxolmhhDD20/N1P\n BONKW9vOromS3Ct6wTOAgRntlYIE+rzC307pFfNDw==",
        "X-Received": "by 2002:a05:6000:220c:b0:439:ca7b:f4b with SMTP id\n ffacd0b85a97d-43b9ea77996mr3253924f8f.50.1774610248816;\n Fri, 27 Mar 2026 04:17:28 -0700 (PDT)",
        "From": "Peter Maydell <peter.maydell@linaro.org>",
        "To": "qemu-arm@nongnu.org,\n\tqemu-devel@nongnu.org",
        "Cc": "Jonathan Cameron <jonathan.cameron@huawei.com>",
        "Subject": "[PATCH v2 28/65] hw/intc/arm_gicv5: Update SPI state for CLEAR/SET\n events",
        "Date": "Fri, 27 Mar 2026 11:16:23 +0000",
        "Message-ID": "<20260327111700.795099-29-peter.maydell@linaro.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260327111700.795099-1-peter.maydell@linaro.org>",
        "References": "<20260327111700.795099-1-peter.maydell@linaro.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2a00:1450:4864:20::42f;\n envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable 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 an SPI irq line changes level, this causes what the spec\ndescribes as SET_LEVEL, SET_EDGE or CLEAR events.  These also happen\nwhen the trigger mode is reconfigured, or when software requests a\nmanual resample via the IRS_SPI_RESAMPLER register.\n\nSET_LEVEL and SET_EDGE events make the interrupt pending, and update\nits handler mode to match its trigger mode.  CLEAR events make the\ninterrupt no longer pending.\n\nSigned-off-by: Peter Maydell <peter.maydell@linaro.org>\nReviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>\n---\n hw/intc/arm_gicv5.c  | 59 ++++++++++++++++++++++++++++++++++++++++++++\n hw/intc/trace-events |  1 +\n 2 files changed, 60 insertions(+)",
    "diff": "diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c\nindex 6ff3a79745..bc887233f5 100644\n--- a/hw/intc/arm_gicv5.c\n+++ b/hw/intc/arm_gicv5.c\n@@ -946,6 +946,28 @@ static void irs_ist_baser_write(GICv5 *s, GICv5Domain domain, uint64_t value)\n     }\n }\n \n+static void spi_sample(GICv5SPIState *spi)\n+{\n+    /*\n+     * Sample the state of the SPI input line; this generates\n+     * SET_EDGE, SET_LEVEL or CLEAR events which update the SPI's\n+     * pending state and handling mode per R_HHKMN.  The logic is the\n+     * same for \"the input line changed\" (R_QBXXV) and \"software asked\n+     * us to resample\" (R_DMTFM).\n+     */\n+    if (spi->level) {\n+        /*\n+         * SET_LEVEL or SET_EDGE: interrupt becomes pending, and the\n+         * handling mode is updated to match the trigger mode.\n+         */\n+        spi->pending = true;\n+        spi->hm = spi->tm == GICV5_TRIGGER_EDGE ? GICV5_EDGE : GICV5_LEVEL;\n+    } else if (spi->tm == GICV5_TRIGGER_LEVEL) {\n+        /* falling edges only trigger a CLEAR event for level-triggered */\n+        spi->pending = false;\n+    }\n+}\n+\n static bool config_readl(GICv5 *s, GICv5Domain domain, hwaddr offset,\n                          uint64_t *data, MemTxAttrs attrs)\n {\n@@ -1096,7 +1118,24 @@ static bool config_writel(GICv5 *s, GICv5Domain domain, hwaddr offset,\n     {\n         GICv5SPIState *spi = spi_for_selr(cs, domain);\n         if (spi) {\n+            GICv5TriggerMode old_tm = spi->tm;\n             spi->tm = FIELD_EX32(data, IRS_SPI_CFGR, TM);\n+            if (spi->tm != old_tm) {\n+                /*\n+                 * R_KBPXL: updates to SPI trigger mode can generate CLEAR or\n+                 * SET_LEVEL events. This is not the same logic as spi_sample().\n+                 */\n+                if (spi->tm == GICV5_TRIGGER_LEVEL) {\n+                    if (spi->level) {\n+                        spi->pending = true;\n+                        spi->hm = GICV5_LEVEL;\n+                    } else {\n+                        spi->pending = false;\n+                    }\n+                } else if (spi->level) {\n+                    spi->pending = false;\n+                }\n+            }\n         }\n         return true;\n     }\n@@ -1109,6 +1148,17 @@ static bool config_writel(GICv5 *s, GICv5Domain domain, hwaddr offset,\n             }\n         }\n         return true;\n+    case A_IRS_SPI_RESAMPLER:\n+    {\n+        uint32_t id = FIELD_EX32(data, IRS_SPI_RESAMPLER, SPI_ID);\n+        GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);\n+\n+        if (spi) {\n+            spi_sample(spi);\n+        }\n+        trace_gicv5_spi_state(id, spi->level, spi->pending, spi->active);\n+        return true;\n+    }\n     }\n \n     return false;\n@@ -1259,8 +1309,17 @@ static void gicv5_set_spi(void *opaque, int irq, int level)\n     /* These irqs are all SPIs; the INTID is irq + s->spi_base */\n     GICv5Common *cs = ARM_GICV5_COMMON(opaque);\n     uint32_t spi_id = irq + cs->spi_base;\n+    GICv5SPIState *spi = gicv5_raw_spi_state(cs, spi_id);\n+\n+    if (!spi || spi->level == level) {\n+        return;\n+    }\n \n     trace_gicv5_spi(spi_id, level);\n+\n+    spi->level = level;\n+    spi_sample(spi);\n+    trace_gicv5_spi_state(spi_id, spi->level, spi->pending, spi->active);\n }\n \n static void gicv5_reset_hold(Object *obj, ResetType type)\ndiff --git a/hw/intc/trace-events b/hw/intc/trace-events\nindex 409935e15a..4c55af2780 100644\n--- a/hw/intc/trace-events\n+++ b/hw/intc/trace-events\n@@ -241,6 +241,7 @@ gicv5_set_pending(const char *domain, const char *type, bool virtual, uint32_t i\n gicv5_set_handling(const char *domain, const char *type, bool virtual, uint32_t id, int handling) \"GICv5 IRS SetHandling %s %s virtual:%d ID %u handling %d\"\n gicv5_set_target(const char *domain, const char *type, bool virtual, uint32_t id, uint32_t iaffid, int irm) \"GICv5 IRS SetTarget %s %s virtual:%d ID %u IAFFID %u routingmode %d\"\n gicv5_request_config(const char *domain, const char *type, bool virtual, uint32_t id, uint64_t icsr) \"GICv5 IRS RequestConfig %s %s virtual:%d ID %u ICSR 0x%\" PRIx64\n+gicv5_spi_state(uint32_t spi_id, bool level, bool pending, bool active) \"GICv5 IRS SPI ID %u now level %d pending %d active %d\"\n \n # arm_gicv5_common.c\n gicv5_common_realize(uint32_t irsid, uint32_t num_cpus, uint32_t spi_base, uint32_t spi_irs_range, uint32_t spi_range) \"GICv5 IRS realized: IRS ID %u, %u CPUs, SPI base %u, SPI IRS range %u, SPI range %u\"\n",
    "prefixes": [
        "v2",
        "28/65"
    ]
}