get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1627170,
    "url": "http://patchwork.ozlabs.org/api/patches/1627170/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20220505184938.351866-9-danielhb413@gmail.com/",
    "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": "<20220505184938.351866-9-danielhb413@gmail.com>",
    "list_archive_url": null,
    "date": "2022-05-05T18:49:16",
    "name": "[PULL,08/30] ppc/xive: Update the state of the External interrupt signal",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2e12e21d436a5bec0216fd89925d215cf7ef82e6",
    "submitter": {
        "id": 74265,
        "url": "http://patchwork.ozlabs.org/api/people/74265/?format=api",
        "name": "Daniel Henrique Barboza",
        "email": "danielhb413@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20220505184938.351866-9-danielhb413@gmail.com/mbox/",
    "series": [
        {
            "id": 298671,
            "url": "http://patchwork.ozlabs.org/api/series/298671/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=298671",
            "date": "2022-05-05T18:49:09",
            "name": "[PULL,01/30] target/ppc: initialize 'val' union in kvm_get_one_spr()",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/298671/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1627170/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1627170/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@bilbo.ozlabs.org",
        "Authentication-Results": [
            "bilbo.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20210112 header.b=S0BoOJJe;\n\tdkim-atps=neutral",
            "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=<UNKNOWN>)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4KvNw162kPz9sBF\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  6 May 2022 05:25:53 +1000 (AEST)",
            "from localhost ([::1]:55034 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1nmh6l-000407-Nm\n\tfor incoming@patchwork.ozlabs.org; Thu, 05 May 2022 15:25:51 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10]:47380)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <danielhb413@gmail.com>)\n id 1nmgYd-00031m-Sg; Thu, 05 May 2022 14:50:35 -0400",
            "from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:44707)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <danielhb413@gmail.com>)\n id 1nmgYa-0004NN-Ty; Thu, 05 May 2022 14:50:35 -0400",
            "by mail-oi1-x230.google.com with SMTP id m11so5238858oib.11;\n Thu, 05 May 2022 11:50:32 -0700 (PDT)",
            "from balboa.ibmuc.com (201-1-57-208.dsl.telesp.net.br.\n [201.1.57.208]) by smtp.gmail.com with ESMTPSA id\n n67-20020aca4046000000b00325cda1ff94sm917146oia.19.2022.05.05.11.50.28\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 05 May 2022 11:50:31 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=RPMxvwAqQam90MVgCoGz5ATuhdIJWRrG9JDb0zbUbBg=;\n b=S0BoOJJeH4ENEAL3Q4gAbXS/ODEE99PPB04kBLNU6p5skZiGE+u8SmNrnCn9aCcFLP\n GXSNVUVPgWOMSHTANxsA1UYpJht7Pj48sQYMYvXjFgC+yylA+YJ0EwWvDRCWotzIidO+\n tprR+t9mMNe12x6wR3UMYsN8agEkytzqvS7cJZbUTT1dDXRPl9aKGY+xlNv62uBTJTNo\n jGSxQKqo21QjRjvZIFlRv2enF3TafK2KTWcRHFStbny/YWG0jcQuk7ym5Ih7fyoJ8MW8\n +Cc1nLMVkhpzoKKBbIOHg8zh7BC+5wmbMVnBEquxGys4fTXReEQv/7j0tKGZt94JmgWy\n dp1A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=RPMxvwAqQam90MVgCoGz5ATuhdIJWRrG9JDb0zbUbBg=;\n b=nmLsueqpJCIxqKwoC9/JyQI/Jd93rH8CXXSAXJGZvnmGHaRISgIzP5ArRYrvW+ee/e\n kPtWV+uZrQ9mayButhW/lFEToGUXnfBuq4jSs533BgfrCLjjnRL0TneYGp721bn1RoCc\n iISwExH/0Qf5qX/rf1dYrH4zjZKwLSaDUBv9Lj3jnKTXne4NbYBVDwh/NS0Ou5qVGVWp\n HxLFUls//0TgEoIVr39rVIZ/DTrsYHoqEU1EXyJszuBsGS+6OEVWOC9+Ykc+bjhrKg9o\n 8NCFJ+3LZPm7vn96Iw/pHainioCH5NCIAKWQ4h/2U1TeigyhhL5zFin0uSNB5zGrq2N7\n 9eWw==",
        "X-Gm-Message-State": "AOAM533/ceBkmeFJzRM6jF0y1q/CTypPGeur7fjX0zLAS26h8gzw8Cz7\n JTbe6X5wNFdBq5smDNw2uSOvrn9bivc=",
        "X-Google-Smtp-Source": "\n ABdhPJyb08ziSO5n8m56n2jOHvoy4PjlH7ZPe/EB9A2ogn3a8AIJ0PYbzHzac/npvF5TqU8Gud5LJQ==",
        "X-Received": "by 2002:a05:6808:a89:b0:325:9d65:7b24 with SMTP id\n q9-20020a0568080a8900b003259d657b24mr3244572oij.266.1651776631689;\n Thu, 05 May 2022 11:50:31 -0700 (PDT)",
        "From": "Daniel Henrique Barboza <danielhb413@gmail.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org,\n richard.henderson@linaro.org, Frederic Barrat <fbarrat@linux.ibm.com>,\n\t=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org>",
        "Subject": "[PULL 08/30] ppc/xive: Update the state of the External interrupt\n signal",
        "Date": "Thu,  5 May 2022 15:49:16 -0300",
        "Message-Id": "<20220505184938.351866-9-danielhb413@gmail.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220505184938.351866-1-danielhb413@gmail.com>",
        "References": "<20220505184938.351866-1-danielhb413@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::230;\n envelope-from=danielhb413@gmail.com; helo=mail-oi1-x230.google.com",
        "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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,\n T_SCC_BODY_TEXT_LINE=-0.01 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-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\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "From: Frederic Barrat <fbarrat@linux.ibm.com>\n\nWhen pulling or pushing an OS context from/to a CPU, we should\nre-evaluate the state of the External interrupt signal. Otherwise, we\ncan end up catching the External interrupt exception in hypervisor\nmode, which is unexpected.\n\nThe problem is best illustrated with the following scenario:\n\n1. an External interrupt is raised while the guest is on the CPU.\n\n2. before the guest can ack the External interrupt, an hypervisor\ninterrupt is raised, for example the Hypervisor Decrementer or\nHypervisor Virtualization interrupt. The hypervisor interrupt forces\nthe guest to exit while the External interrupt is still pending.\n\n3. the hypervisor handles the hypervisor interrupt. At this point, the\nExternal interrupt is still pending. So it's very likely to be\ndelivered while the hypervisor is running. That's unexpected and can\nresult in an infinite loop where the hypervisor catches the External\ninterrupt, looks for an interrupt in its hypervisor queue, doesn't\nfind any, exits the interrupt handler with the External interrupt\nstill raised, repeat...\n\nThe fix is simply to always lower the External interrupt signal when\npulling an OS context. It means it needs to be raised again when\nre-pushing the OS context. Fortunately, it's already the case, as we\nnow always call xive_tctx_ipb_update(), which will raise the signal if\nneeded.\n\nReviewed-by: Cédric Le Goater <clg@kaod.org>\nSigned-off-by: Frederic Barrat <fbarrat@linux.ibm.com>\nMessage-Id: <20220429071620.177142-3-fbarrat@linux.ibm.com>\nSigned-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>\n---\n hw/intc/xive.c        | 14 ++++++++++++++\n hw/intc/xive2.c       |  2 ++\n include/hw/ppc/xive.h |  1 +\n 3 files changed, 17 insertions(+)",
    "diff": "diff --git a/hw/intc/xive.c b/hw/intc/xive.c\nindex c729f6a478..ae221fed73 100644\n--- a/hw/intc/xive.c\n+++ b/hw/intc/xive.c\n@@ -114,6 +114,17 @@ static void xive_tctx_notify(XiveTCTX *tctx, uint8_t ring)\n     }\n }\n \n+void xive_tctx_reset_os_signal(XiveTCTX *tctx)\n+{\n+    /*\n+     * Lower the External interrupt. Used when pulling an OS\n+     * context. It is necessary to avoid catching it in the hypervisor\n+     * context. It should be raised again when re-pushing the OS\n+     * context.\n+     */\n+    qemu_irq_lower(xive_tctx_output(tctx, TM_QW1_OS));\n+}\n+\n static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t ring, uint8_t cppr)\n {\n     uint8_t *regs = &tctx->regs[ring];\n@@ -388,6 +399,8 @@ static uint64_t xive_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,\n     /* Invalidate CAM line */\n     qw1w2_new = xive_set_field32(TM_QW1W2_VO, qw1w2, 0);\n     xive_tctx_set_os_cam(tctx, qw1w2_new);\n+\n+    xive_tctx_reset_os_signal(tctx);\n     return qw1w2;\n }\n \n@@ -420,6 +433,7 @@ static void xive_tctx_need_resend(XiveRouter *xrtr, XiveTCTX *tctx,\n      * was saved when the context was pulled and that we need to take\n      * into account by recalculating the PIPR (which is not\n      * saved/restored).\n+     * It will also raise the External interrupt signal if needed.\n      */\n     xive_tctx_ipb_update(tctx, TM_QW1_OS, ipb);\n }\ndiff --git a/hw/intc/xive2.c b/hw/intc/xive2.c\nindex 400fd70aa8..4d9ff41956 100644\n--- a/hw/intc/xive2.c\n+++ b/hw/intc/xive2.c\n@@ -269,6 +269,7 @@ uint64_t xive2_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,\n         xive2_tctx_save_os_ctx(xrtr, tctx, nvp_blk, nvp_idx);\n     }\n \n+    xive_tctx_reset_os_signal(tctx);\n     return qw1w2;\n }\n \n@@ -350,6 +351,7 @@ static void xive2_tctx_need_resend(Xive2Router *xrtr, XiveTCTX *tctx,\n      * was saved when the context was pulled and that we need to take\n      * into account by recalculating the PIPR (which is not\n      * saved/restored).\n+     * It will also raise the External interrupt signal if needed.\n      */\n     xive_tctx_ipb_update(tctx, TM_QW1_OS, ipb);\n }\ndiff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h\nindex 126e4e2c3a..f7eea4ca81 100644\n--- a/include/hw/ppc/xive.h\n+++ b/include/hw/ppc/xive.h\n@@ -527,6 +527,7 @@ Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp);\n void xive_tctx_reset(XiveTCTX *tctx);\n void xive_tctx_destroy(XiveTCTX *tctx);\n void xive_tctx_ipb_update(XiveTCTX *tctx, uint8_t ring, uint8_t ipb);\n+void xive_tctx_reset_os_signal(XiveTCTX *tctx);\n \n /*\n  * KVM XIVE device helpers\n",
    "prefixes": [
        "PULL",
        "08/30"
    ]
}