get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 811502,
    "url": "http://patchwork.ozlabs.org/api/patches/811502/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170908103558.31632-17-david@gibson.dropbear.id.au/",
    "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": "<20170908103558.31632-17-david@gibson.dropbear.id.au>",
    "list_archive_url": null,
    "date": "2017-09-08T10:35:34",
    "name": "[PULL,16/40] ppc: spapr: Make VCPU ID handling private to SPAPR",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c8f38fc3c7613c6dd2887bfd3e073f0976ba53ee",
    "submitter": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/people/47/?format=api",
        "name": "David Gibson",
        "email": "david@gibson.dropbear.id.au"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170908103558.31632-17-david@gibson.dropbear.id.au/mbox/",
    "series": [
        {
            "id": 2179,
            "url": "http://patchwork.ozlabs.org/api/series/2179/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2179",
            "date": "2017-09-08T10:35:20",
            "name": "[PULL,01/40] hw/ppc/spapr_drc.c: change spapr_drc_needed to use drc->dev",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2179/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/811502/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/811502/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": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=gibson.dropbear.id.au\n\theader.i=@gibson.dropbear.id.au header.b=\"axIzHcE8\"; \n\tdkim-atps=neutral"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpYnw3q8Yz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 20:43:32 +1000 (AEST)",
            "from localhost ([::1]:44478 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dqGl0-0000AA-IE\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 06:43:30 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:58686)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dqGe5-00029E-UM\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:30 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dqGe0-0003EO-GE\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:21 -0400",
            "from ozlabs.org ([103.22.144.67]:38485)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgibson@ozlabs.org>)\n\tid 1dqGdz-0003BE-6h; Fri, 08 Sep 2017 06:36:16 -0400",
            "by ozlabs.org (Postfix, from userid 1007)\n\tid 3xpYdK1hNqz9t43; Fri,  8 Sep 2017 20:36:04 +1000 (AEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\td=gibson.dropbear.id.au; s=201602; t=1504866965;\n\tbh=ORycx4MAZDM1Z6iazF6vcXik/w3jF7GqF7rZ3KFpPGs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=axIzHcE8UFbN9UQ4XA9yCJLwsXDkGYfNd1ntSi3t6Dy/CHiqCTSzmGoVMPX0HYACm\n\t+XVuC6Jnp/tjwuq93Kx/91bEaGFZdrMbvT3LoyJDxKMIcYzytIN+g7zDirQWBFLcps\n\twwe9b2k4J/UfqOVajwPvGNY3s08zoZpdUIOY0JPc=",
        "From": "David Gibson <david@gibson.dropbear.id.au>",
        "To": "peter.maydell@linaro.org",
        "Date": "Fri,  8 Sep 2017 20:35:34 +1000",
        "Message-Id": "<20170908103558.31632-17-david@gibson.dropbear.id.au>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170908103558.31632-1-david@gibson.dropbear.id.au>",
        "References": "<20170908103558.31632-1-david@gibson.dropbear.id.au>",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "103.22.144.67",
        "Subject": "[Qemu-devel] [PULL 16/40] ppc: spapr: Make VCPU ID handling private\n\tto SPAPR",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://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\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "qemu-devel@nongnu.org, aik@ozlabs.ru, agraf@suse.de,\n\tmdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org,\n\timammedo@redhat.com, sam.bobroff@au1.ibm.com,\n\tDavid Gibson <david@gibson.dropbear.id.au>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "From: Sam Bobroff <sam.bobroff@au1.ibm.com>\n\nThe concept of a VCPU ID that differs from the CPU's index\n(cpu->cpu_index) exists only within SPAPR machines so, move the\nfunctions ppc_get_vcpu_id() and ppc_get_cpu_by_vcpu_id() into spapr.c\nand rename them appropriately.\n\nSigned-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>\nSigned-off-by: David Gibson <david@gibson.dropbear.id.au>\n---\n hw/ppc/ppc.c           | 21 ---------------------\n hw/ppc/spapr.c         | 40 +++++++++++++++++++++++++++++++++-------\n hw/ppc/spapr_hcall.c   |  4 ++--\n hw/ppc/spapr_rtas.c    |  4 ++--\n include/hw/ppc/spapr.h |  3 +++\n target/ppc/cpu.h       | 18 ------------------\n target/ppc/kvm.c       |  2 +-\n 7 files changed, 41 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c\nindex 4477d4ad89..f76886f4d3 100644\n--- a/hw/ppc/ppc.c\n+++ b/hw/ppc/ppc.c\n@@ -1358,27 +1358,6 @@ void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val)\n     }\n }\n \n-/* CPU device-tree ID helpers */\n-int ppc_get_vcpu_id(PowerPCCPU *cpu)\n-{\n-    return cpu->vcpu_id;\n-}\n-\n-PowerPCCPU *ppc_get_cpu_by_vcpu_id(int vcpu_id)\n-{\n-    CPUState *cs;\n-\n-    CPU_FOREACH(cs) {\n-        PowerPCCPU *cpu = POWERPC_CPU(cs);\n-\n-        if (cpu->vcpu_id == vcpu_id) {\n-            return cpu;\n-        }\n-    }\n-\n-    return NULL;\n-}\n-\n void ppc_cpu_parse_features(const char *cpu_model)\n {\n     CPUClass *cc;\ndiff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex f7a4c73e08..067f571416 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -208,7 +208,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,\n     int i, ret = 0;\n     uint32_t servers_prop[smt_threads];\n     uint32_t gservers_prop[smt_threads * 2];\n-    int index = ppc_get_vcpu_id(cpu);\n+    int index = spapr_vcpu_id(cpu);\n \n     if (cpu->compat_pvr) {\n         ret = fdt_setprop_cell(fdt, offset, \"cpu-version\", cpu->compat_pvr);\n@@ -237,7 +237,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,\n \n static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)\n {\n-    int index = ppc_get_vcpu_id(cpu);\n+    int index = spapr_vcpu_id(cpu);\n     uint32_t associativity[] = {cpu_to_be32(0x5),\n                                 cpu_to_be32(0x0),\n                                 cpu_to_be32(0x0),\n@@ -341,7 +341,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)\n         PowerPCCPU *cpu = POWERPC_CPU(cs);\n         CPUPPCState *env = &cpu->env;\n         DeviceClass *dc = DEVICE_GET_CLASS(cs);\n-        int index = ppc_get_vcpu_id(cpu);\n+        int index = spapr_vcpu_id(cpu);\n         int compat_smt = MIN(smp_threads, ppc_compat_max_threads(cpu));\n \n         if ((index % smt) != 0) {\n@@ -493,7 +493,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,\n     PowerPCCPU *cpu = POWERPC_CPU(cs);\n     CPUPPCState *env = &cpu->env;\n     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);\n-    int index = ppc_get_vcpu_id(cpu);\n+    int index = spapr_vcpu_id(cpu);\n     uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40),\n                        0xffffffff, 0xffffffff};\n     uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq()\n@@ -626,7 +626,7 @@ static void spapr_populate_cpus_dt_node(void *fdt, sPAPRMachineState *spapr)\n      */\n     CPU_FOREACH_REVERSE(cs) {\n         PowerPCCPU *cpu = POWERPC_CPU(cs);\n-        int index = ppc_get_vcpu_id(cpu);\n+        int index = spapr_vcpu_id(cpu);\n         DeviceClass *dc = DEVICE_GET_CLASS(cs);\n         int offset;\n \n@@ -3025,7 +3025,7 @@ static void *spapr_populate_hotplug_cpu_dt(CPUState *cs, int *fdt_offset,\n {\n     PowerPCCPU *cpu = POWERPC_CPU(cs);\n     DeviceClass *dc = DEVICE_GET_CLASS(cs);\n-    int id = ppc_get_vcpu_id(cpu);\n+    int id = spapr_vcpu_id(cpu);\n     void *fdt;\n     int offset, fdt_size;\n     char *nodename;\n@@ -3435,7 +3435,7 @@ static void spapr_ics_resend(XICSFabric *dev)\n \n static ICPState *spapr_icp_get(XICSFabric *xi, int vcpu_id)\n {\n-    PowerPCCPU *cpu = ppc_get_cpu_by_vcpu_id(vcpu_id);\n+    PowerPCCPU *cpu = spapr_find_cpu(vcpu_id);\n \n     return cpu ? ICP(cpu->intc) : NULL;\n }\n@@ -3455,6 +3455,32 @@ static void spapr_pic_print_info(InterruptStatsProvider *obj,\n     ics_pic_print_info(spapr->ics, mon);\n }\n \n+int spapr_vcpu_id(PowerPCCPU *cpu)\n+{\n+    CPUState *cs = CPU(cpu);\n+\n+    if (kvm_enabled()) {\n+        return kvm_arch_vcpu_id(cs);\n+    } else {\n+        return cs->cpu_index;\n+    }\n+}\n+\n+PowerPCCPU *spapr_find_cpu(int vcpu_id)\n+{\n+    CPUState *cs;\n+\n+    CPU_FOREACH(cs) {\n+        PowerPCCPU *cpu = POWERPC_CPU(cs);\n+\n+        if (spapr_vcpu_id(cpu) == vcpu_id) {\n+            return cpu;\n+        }\n+    }\n+\n+    return NULL;\n+}\n+\n static void spapr_machine_class_init(ObjectClass *oc, void *data)\n {\n     MachineClass *mc = MACHINE_CLASS(oc);\ndiff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c\nindex 4ca233854a..7cf0993800 100644\n--- a/hw/ppc/spapr_hcall.c\n+++ b/hw/ppc/spapr_hcall.c\n@@ -999,7 +999,7 @@ static target_ulong h_register_vpa(PowerPCCPU *cpu, sPAPRMachineState *spapr,\n     CPUPPCState *tenv;\n     PowerPCCPU *tcpu;\n \n-    tcpu = ppc_get_cpu_by_vcpu_id(procno);\n+    tcpu = spapr_find_cpu(procno);\n     if (!tcpu) {\n         return H_PARAMETER;\n     }\n@@ -1431,7 +1431,7 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *cpu,\n \n     } else {\n         /* Unicast */\n-        cs = CPU(ppc_get_cpu_by_vcpu_id(target));\n+        cs = CPU(spapr_find_cpu(target));\n         if (cs) {\n             run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL);\n             return H_SUCCESS;\ndiff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c\nindex 626c06b375..cdf0b607a0 100644\n--- a/hw/ppc/spapr_rtas.c\n+++ b/hw/ppc/spapr_rtas.c\n@@ -104,7 +104,7 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,\n     }\n \n     id = rtas_ld(args, 0);\n-    cpu = ppc_get_cpu_by_vcpu_id(id);\n+    cpu = spapr_find_cpu(id);\n     if (cpu != NULL) {\n         if (CPU(cpu)->halted) {\n             rtas_st(rets, 1, 0);\n@@ -158,7 +158,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,\n     start = rtas_ld(args, 1);\n     r3 = rtas_ld(args, 2);\n \n-    cpu = ppc_get_cpu_by_vcpu_id(id);\n+    cpu = spapr_find_cpu(id);\n     if (cpu != NULL) {\n         CPUState *cs = CPU(cpu);\n         CPUPPCState *env = &cpu->env;\ndiff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h\nindex 5d161ec580..91617e3277 100644\n--- a/include/hw/ppc/spapr.h\n+++ b/include/hw/ppc/spapr.h\n@@ -705,4 +705,7 @@ void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);\n \n #define HTAB_SIZE(spapr)        (1ULL << ((spapr)->htab_shift))\n \n+int spapr_vcpu_id(PowerPCCPU *cpu);\n+PowerPCCPU *spapr_find_cpu(int vcpu_id);\n+\n #endif /* HW_SPAPR_H */\ndiff --git a/target/ppc/cpu.h b/target/ppc/cpu.h\nindex 687e66acde..cf4ded7b8e 100644\n--- a/target/ppc/cpu.h\n+++ b/target/ppc/cpu.h\n@@ -2514,23 +2514,5 @@ static inline bool lsw_reg_in_range(int start, int nregs, int rx)\n \n void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env);\n \n-/**\n- * ppc_get_vcpu_id:\n- * @cs: a PowerPCCPU struct.\n- *\n- * Returns a device-tree ID for a CPU.\n- */\n-int ppc_get_vcpu_id(PowerPCCPU *cpu);\n-\n-/**\n- * ppc_get_cpu_by_vcpu_id:\n- * @vcpu_id: a VCPU ID\n- *\n- * Searches for a CPU by @vcpu_id.\n- *\n- * Returns: a PowerPCCPU struct\n- */\n-PowerPCCPU *ppc_get_cpu_by_vcpu_id(int vcpu_id);\n-\n void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len);\n #endif /* PPC_CPU_H */\ndiff --git a/target/ppc/kvm.c b/target/ppc/kvm.c\nindex 1142d5c970..f1d54106ac 100644\n--- a/target/ppc/kvm.c\n+++ b/target/ppc/kvm.c\n@@ -520,7 +520,7 @@ bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)\n \n unsigned long kvm_arch_vcpu_id(CPUState *cpu)\n {\n-    return ppc_get_vcpu_id(POWERPC_CPU(cpu));\n+    return POWERPC_CPU(cpu)->vcpu_id;\n }\n \n /* e500 supports 2 h/w breakpoint and 2 watchpoint.\n",
    "prefixes": [
        "PULL",
        "16/40"
    ]
}