get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 766420,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/766420/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170524095819.GC18900@fergus.ozlabs.ibm.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20170524095819.GC18900@fergus.ozlabs.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170524095819.GC18900@fergus.ozlabs.ibm.com/",
    "date": "2017-05-24T09:58:19",
    "name": "[2/2] KVM: PPC: Book3S HV: Enable guests to use large decrementer mode on POWER9",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e504114c64dbc703ea1202acb7b179873cba60f8",
    "submitter": {
        "id": 67079,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/67079/?format=api",
        "name": "Paul Mackerras",
        "email": "paulus@ozlabs.org"
    },
    "delegate": {
        "id": 13,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/13/?format=api",
        "username": "paulus",
        "first_name": "Paul",
        "last_name": "Mackerras",
        "email": "paulus@samba.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170524095819.GC18900@fergus.ozlabs.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/766420/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/766420/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",
            "linuxppc-dev@ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3wXnwS1Tcgz9s06\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 24 May 2017 20:01:12 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3wXnwR6lv8zDqhv\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 24 May 2017 20:01:11 +1000 (AEST)",
            "from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3wXnsD6SPVzDqdX\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 24 May 2017 19:58:24 +1000 (AEST)",
            "by ozlabs.org (Postfix)\n\tid 3wXnsD5sFxz9sPC; Wed, 24 May 2017 19:58:24 +1000 (AEST)",
            "by ozlabs.org (Postfix, from userid 1003)\n\tid 3wXnsD55kJz9sP5; Wed, 24 May 2017 19:58:24 +1000 (AEST)"
        ],
        "Date": "Wed, 24 May 2017 19:58:19 +1000",
        "From": "Paul Mackerras <paulus@ozlabs.org>",
        "To": "linuxppc-dev@ozlabs.org, kvm@vger.kernel.org",
        "Subject": "[PATCH 2/2] KVM: PPC: Book3S HV: Enable guests to use large\n\tdecrementer mode on POWER9",
        "Message-ID": "<20170524095819.GC18900@fergus.ozlabs.ibm.com>",
        "References": "<20170524095531.GA18900@fergus.ozlabs.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "In-Reply-To": "<20170524095531.GA18900@fergus.ozlabs.ibm.com>",
        "User-Agent": "Mutt/1.5.24 (2015-08-30)",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "Cc": "kvm-ppc@vger.kernel.org",
        "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": "This allows userspace (e.g. QEMU) to enable large decrementer mode\nfor the guest, by setting the LPCR_LD bit in the guest LPCR value.\nWith this, the guest exit code saves 64 bits of the guest DEC value\non exit.  Other places that use the guest DEC value check the LPCR_LD\nbit in the guest LPCR value, and if it is set, omit the 32-bit sign\nextension that would otherwise be done.\n\nThis doesn't change the DEC emulation used by PR KVM because PR KVM\nis not supported on POWER9 yet.\n\nThis is partly based on an earlier patch by Oliver O'Halloran.\n\nSigned-off-by: Paul Mackerras <paulus@ozlabs.org>\n---\n arch/powerpc/include/asm/kvm_host.h     |  2 +-\n arch/powerpc/kvm/book3s_hv.c            |  2 ++\n arch/powerpc/kvm/book3s_hv_rmhandlers.S | 28 ++++++++++++++++++++++++----\n arch/powerpc/kvm/emulate.c              |  4 ++--\n 4 files changed, 29 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h\nindex 9c51ac4..3f879c8 100644\n--- a/arch/powerpc/include/asm/kvm_host.h\n+++ b/arch/powerpc/include/asm/kvm_host.h\n@@ -579,7 +579,7 @@ struct kvm_vcpu_arch {\n \tulong mcsrr0;\n \tulong mcsrr1;\n \tulong mcsr;\n-\tu32 dec;\n+\tulong dec;\n #ifdef CONFIG_BOOKE\n \tu32 decar;\n #endif\ndiff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c\nindex 42b7a4f..1f9c0ee 100644\n--- a/arch/powerpc/kvm/book3s_hv.c\n+++ b/arch/powerpc/kvm/book3s_hv.c\n@@ -1143,6 +1143,8 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr,\n \tmask = LPCR_DPFD | LPCR_ILE | LPCR_TC;\n \tif (cpu_has_feature(CPU_FTR_ARCH_207S))\n \t\tmask |= LPCR_AIL;\n+\tif (cpu_has_feature(CPU_FTR_LARGE_DEC))\n+\t\tmask |= LPCR_LD;\n \n \t/* Broken 32-bit version of LPCR must not clear top bits */\n \tif (preserve_top32)\ndiff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S\nindex bcb5401..e7a2c89 100644\n--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S\n+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S\n@@ -916,7 +916,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)\n \tmftb\tr7\n \tsubf\tr3,r7,r8\n \tmtspr\tSPRN_DEC,r3\n-\tstw\tr3,VCPU_DEC(r4)\n+\tstd\tr3,VCPU_DEC(r4)\n \n \tld\tr5, VCPU_SPRG0(r4)\n \tld\tr6, VCPU_SPRG1(r4)\n@@ -1030,7 +1030,13 @@ kvmppc_cede_reentry:\t\t/* r4 = vcpu, r13 = paca */\n \tli\tr0, BOOK3S_INTERRUPT_EXTERNAL\n \tbne\tcr1, 12f\n \tmfspr\tr0, SPRN_DEC\n-\tcmpwi\tr0, 0\n+BEGIN_FTR_SECTION\n+\t/* On POWER9 check whether the guest has large decrementer enabled */\n+\tandis.\tr8, r8, LPCR_LD@h\n+\tbne\t15f\n+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)\n+\textsw\tr0, r0\n+15:\tcmpdi\tr0, 0\n \tli\tr0, BOOK3S_INTERRUPT_DECREMENTER\n \tbge\t5f\n \n@@ -1457,12 +1463,18 @@ mc_cont:\n \tmtspr\tSPRN_SPURR,r4\n \n \t/* Save DEC */\n+\tld\tr3, HSTATE_KVM_VCORE(r13)\n \tmfspr\tr5,SPRN_DEC\n \tmftb\tr6\n+\t/* On P9, if the guest has large decr enabled, don't sign extend */\n+BEGIN_FTR_SECTION\n+\tld\tr4, VCORE_LPCR(r3)\n+\tandis.\tr4, r4, LPCR_LD@h\n+\tbne\t16f\n+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)\n \textsw\tr5,r5\n-\tadd\tr5,r5,r6\n+16:\tadd\tr5,r5,r6\n \t/* r5 is a guest timebase value here, convert to host TB */\n-\tld\tr3,HSTATE_KVM_VCORE(r13)\n \tld\tr4,VCORE_TB_OFFSET(r3)\n \tsubf\tr5,r4,r5\n \tstd\tr5,VCPU_DEC_EXPIRES(r9)\n@@ -2374,7 +2386,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)\n \tmfspr\tr3, SPRN_DEC\n \tmfspr\tr4, SPRN_HDEC\n \tmftb\tr5\n+BEGIN_FTR_SECTION\n+\t/* On P9 check whether the guest has large decrementer mode enabled */\n+\tld\tr6, HSTATE_KVM_VCORE(r13)\n+\tld\tr6, VCORE_LPCR(r6)\n+\tandis.\tr6, r6, LPCR_LD@h\n+\tbne\t68f\n+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)\n \textsw\tr3, r3\n+68:\n BEGIN_FTR_SECTION\n \textsw\tr4, r4\n END_FTR_SECTION_IFSET(CPU_FTR_LARGE_DEC)\ndiff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c\nindex c873ffe..4d8b4d6 100644\n--- a/arch/powerpc/kvm/emulate.c\n+++ b/arch/powerpc/kvm/emulate.c\n@@ -39,7 +39,7 @@ void kvmppc_emulate_dec(struct kvm_vcpu *vcpu)\n \tunsigned long dec_nsec;\n \tunsigned long long dec_time;\n \n-\tpr_debug(\"mtDEC: %x\\n\", vcpu->arch.dec);\n+\tpr_debug(\"mtDEC: %lx\\n\", vcpu->arch.dec);\n \thrtimer_try_to_cancel(&vcpu->arch.dec_timer);\n \n #ifdef CONFIG_PPC_BOOK3S\n@@ -109,7 +109,7 @@ static int kvmppc_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)\n \tcase SPRN_TBWU: break;\n \n \tcase SPRN_DEC:\n-\t\tvcpu->arch.dec = spr_val;\n+\t\tvcpu->arch.dec = (u32) spr_val;\n \t\tkvmppc_emulate_dec(vcpu);\n \t\tbreak;\n \n",
    "prefixes": [
        "2/2"
    ]
}