get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 406249,
    "url": "http://patchwork.ozlabs.org/api/patches/406249/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1415030910-5799-2-git-send-email-shreyas@linux.vnet.ibm.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<1415030910-5799-2-git-send-email-shreyas@linux.vnet.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1415030910-5799-2-git-send-email-shreyas@linux.vnet.ibm.com/",
    "date": "2014-11-03T16:08:27",
    "name": "[1/4] powerpc: powernv: Switch off MMU before entering nap/sleep/rvwinkle mode",
    "commit_ref": "8117ac6a6c2fa0f847ff6a21a1f32c8d2c8501d0",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a6f492536395bba9b3982b55473a19eee3d27f0f",
    "submitter": {
        "id": 64129,
        "url": "http://patchwork.ozlabs.org/api/people/64129/?format=api",
        "name": "Shreyas B. Prabhu",
        "email": "shreyas@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1415030910-5799-2-git-send-email-shreyas@linux.vnet.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/406249/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/406249/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 590C41400A3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  4 Nov 2014 03:10:52 +1100 (AEDT)",
            "from ozlabs.org (ozlabs.org [103.22.144.67])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 2693F1A042F\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  4 Nov 2014 03:10:52 +1100 (AEDT)",
            "from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 85BE01A0089\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue,  4 Nov 2014 03:08:53 +1100 (AEDT)",
            "from /spool/local\n\tby e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <shreyas@linux.vnet.ibm.com>;\n\tMon, 3 Nov 2014 09:08:51 -0700",
            "from d03dlp01.boulder.ibm.com (9.17.202.177)\n\tby e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tMon, 3 Nov 2014 09:08:49 -0700",
            "from b03cxnp07028.gho.boulder.ibm.com\n\t(b03cxnp07028.gho.boulder.ibm.com [9.17.130.15])\n\tby d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 5B8F51FF0039\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon,  3 Nov 2014 08:57:33 -0700 (MST)",
            "from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com\n\t[9.17.195.167])\n\tby b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id sA3G8mre1900974\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 3 Nov 2014 17:08:48 +0100",
            "from d03av01.boulder.ibm.com (localhost [127.0.0.1])\n\tby d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP\n\tid sA3G8lHb026417\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 3 Nov 2014 09:08:48 -0700",
            "from adminib-ovr2cdm.in.ibm.com ([9.79.201.189])\n\tby d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP\n\tid sA3G8YB7025138; Mon, 3 Nov 2014 09:08:45 -0700"
        ],
        "From": "\"Shreyas B. Prabhu\" <shreyas@linux.vnet.ibm.com>",
        "To": "linux-kernel@vger.kernel.org",
        "Subject": "[PATCH 1/4] powerpc: powernv: Switch off MMU before entering\n\tnap/sleep/rvwinkle mode",
        "Date": "Mon,  3 Nov 2014 21:38:27 +0530",
        "Message-Id": "<1415030910-5799-2-git-send-email-shreyas@linux.vnet.ibm.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1415030910-5799-1-git-send-email-shreyas@linux.vnet.ibm.com>",
        "References": "<1415030910-5799-1-git-send-email-shreyas@linux.vnet.ibm.com>",
        "X-TM-AS-MML": "disable",
        "X-Content-Scanned": "Fidelis XPS MAILER",
        "x-cbid": "14110316-0025-0000-0000-000005D0EA57",
        "Cc": "\"Shreyas B. Prabhu\" <shreyas@linux.vnet.ibm.com>,\n\tlinuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.18",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"
    },
    "content": "From: Paul Mackerras <paulus@samba.org>\n\nCurrently, when going idle, we set the flag indicating that we are in\nnap mode (paca->kvm_hstate.hwthread_state) and then execute the nap\n(or sleep or rvwinkle) instruction, all with the MMU on.  This is bad\nfor two reasons: (a) the architecture specifies that those instructions\nmust be executed with the MMU off, and in fact with only the SF, HV, ME\nand possibly RI bits set, and (b) this introduces a race, because as\nsoon as we set the flag, another thread can switch the MMU to a guest\ncontext.  If the race is lost, this thread will typically start looping\non relocation-on ISIs at 0xc...4400.\n\nThis fixes it by setting the MSR as required by the architecture before\nsetting the flag or executing the nap/sleep/rvwinkle instruction.\n\n[ shreyas@linux.vnet.ibm.com: Edited to handle LE ]\nSigned-off-by: Paul Mackerras <paulus@samba.org>\nSigned-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>\nCc: Benjamin Herrenschmidt <benh@kernel.crashing.org>\nCc: Michael Ellerman <mpe@ellerman.id.au>\nCc: linuxppc-dev@lists.ozlabs.org\n---\n arch/powerpc/include/asm/reg.h    |  2 ++\n arch/powerpc/kernel/idle_power7.S | 18 +++++++++++++++++-\n 2 files changed, 19 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h\nindex c998279..a68ee15 100644\n--- a/arch/powerpc/include/asm/reg.h\n+++ b/arch/powerpc/include/asm/reg.h\n@@ -118,8 +118,10 @@\n #define __MSR\t\t(MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV)\n #ifdef __BIG_ENDIAN__\n #define MSR_\t\t__MSR\n+#define MSR_IDLE\t(MSR_ME | MSR_SF | MSR_HV)\n #else\n #define MSR_\t\t(__MSR | MSR_LE)\n+#define MSR_IDLE\t(MSR_ME | MSR_SF | MSR_HV | MSR_LE)\n #endif\n #define MSR_KERNEL\t(MSR_ | MSR_64BIT)\n #define MSR_USER32\t(MSR_ | MSR_PR | MSR_EE)\ndiff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S\nindex c0754bb..283c603 100644\n--- a/arch/powerpc/kernel/idle_power7.S\n+++ b/arch/powerpc/kernel/idle_power7.S\n@@ -101,7 +101,23 @@ _GLOBAL(power7_powersave_common)\n \tstd\tr9,_MSR(r1)\n \tstd\tr1,PACAR1(r13)\n \n-_GLOBAL(power7_enter_nap_mode)\n+\t/*\n+\t * Go to real mode to do the nap, as required by the architecture.\n+\t * Also, we need to be in real mode before setting hwthread_state,\n+\t * because as soon as we do that, another thread can switch\n+\t * the MMU context to the guest.\n+\t */\n+\tLOAD_REG_IMMEDIATE(r5, MSR_IDLE)\n+\tli\tr6, MSR_RI\n+\tandc\tr6, r9, r6\n+\tLOAD_REG_ADDR(r7, power7_enter_nap_mode)\n+\tmtmsrd\tr6, 1\t\t/* clear RI before setting SRR0/1 */\n+\tmtspr\tSPRN_SRR0, r7\n+\tmtspr\tSPRN_SRR1, r5\n+\trfid\n+\n+\t.globl\tpower7_enter_nap_mode\n+power7_enter_nap_mode:\n #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n \t/* Tell KVM we're napping */\n \tli\tr4,KVM_HWTHREAD_IN_NAP\n",
    "prefixes": [
        "1/4"
    ]
}