get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 805270,
    "url": "http://patchwork.ozlabs.org/api/patches/805270/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1503556688-15412-13-git-send-email-sukadev@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": "<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com/",
    "date": "2017-08-24T06:38:08",
    "name": "[v7,12/12] powerpc/vas: Define copy/paste interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "708bd2eed9efea4101fe7262d34fa595431ce615",
    "submitter": {
        "id": 984,
        "url": "http://patchwork.ozlabs.org/api/people/984/?format=api",
        "name": "Sukadev Bhattiprolu",
        "email": "sukadev@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/805270/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/805270/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 [103.22.144.68])\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 3xdFVp6YmHz9s3w\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 16:58:10 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xdFVp5F6nzDrNl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 16:58:10 +1000 (AEST)",
            "from ozlabs.org (bilbo.ozlabs.org [103.22.144.67])\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 3xdF4P6vN4zDrJs\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 24 Aug 2017 16:38:45 +1000 (AEST)",
            "from ozlabs.org (bilbo.ozlabs.org [103.22.144.67])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 3xdF4P32kYz8t37\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 24 Aug 2017 16:38:45 +1000 (AEST)",
            "by ozlabs.org (Postfix)\n\tid 3xdF4P1Fvkz9t4P; Thu, 24 Aug 2017 16:38:45 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xdF4N36jrz9t3P\n\tfor <linuxppc-dev@ozlabs.org>; Thu, 24 Aug 2017 16:38:44 +1000 (AEST)",
            "from pps.filterd (m0098413.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7O6ZXQc094487\n\tfor <linuxppc-dev@ozlabs.org>; Thu, 24 Aug 2017 02:38:42 -0400",
            "from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2chm6sqr5p-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@ozlabs.org>; Thu, 24 Aug 2017 02:38:42 -0400",
            "from localhost\n\tby e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@ozlabs.org> from <sukadev@linux.vnet.ibm.com>;\n\tThu, 24 Aug 2017 02:38:41 -0400",
            "from b01cxnp22036.gho.pok.ibm.com (9.57.198.26)\n\tby e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tThu, 24 Aug 2017 02:38:39 -0400",
            "from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com\n\t[9.57.199.107])\n\tby b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid v7O6ccFe30736532; Thu, 24 Aug 2017 06:38:38 GMT",
            "from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 81DE112403D;\n\tThu, 24 Aug 2017 02:35:59 -0400 (EDT)",
            "from suka-w540.usor.ibm.com (unknown [9.70.94.25])\n\tby b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id 9F4FE124035;\n\tThu, 24 Aug 2017 02:35:58 -0400 (EDT)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=sukadev@linux.vnet.ibm.com; receiver=<UNKNOWN>)",
        "From": "Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>",
        "To": "Michael Ellerman <mpe@ellerman.id.au>",
        "Subject": "[PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces",
        "Date": "Wed, 23 Aug 2017 23:38:08 -0700",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1503556688-15412-1-git-send-email-sukadev@linux.vnet.ibm.com>",
        "References": "<1503556688-15412-1-git-send-email-sukadev@linux.vnet.ibm.com>",
        "X-TM-AS-GCONF": "00",
        "x-cbid": "17082406-0008-0000-0000-000002738E4B",
        "X-IBM-SpamModules-Scores": "",
        "X-IBM-SpamModules-Versions": "BY=3.00007601; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000224; SDB=6.00906836; UDB=6.00454554;\n\tIPR=6.00687033; \n\tBA=6.00005550; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016840;\n\tXFM=3.00000015; UTC=2017-08-24 06:38:40",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17082406-0009-0000-0000-00003679683A",
        "Message-Id": "<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-24_03:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708240106",
        "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": "stewart@linux.vnet.ibm.com, mikey@neuling.org, linuxppc-dev@ozlabs.org, \n\tlinux-kernel@vger.kernel.org, apopple@au1.ibm.com, oohall@gmail.com",
        "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": "Define interfaces (wrappers) to the 'copy' and 'paste' instructions\n(which are new in PowerISA 3.0). These are intended to be used to\nby NX driver(s) to submit Coprocessor Request Blocks (CRBs) to the\nNX hardware engines.\n\nSigned-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>\n\n---\nChangelog[v4]\n\t- Export symbols\nChangelog[v3]\n\t- Map raw CR value from paste instruction into an error code.\n---\n MAINTAINERS                                 |  1 +\n arch/powerpc/include/asm/vas.h              | 13 +++++\n arch/powerpc/platforms/powernv/copy-paste.h | 74 +++++++++++++++++++++++++++++\n arch/powerpc/platforms/powernv/vas-window.c | 52 ++++++++++++++++++++\n arch/powerpc/platforms/powernv/vas.h        | 15 ++++++\n 5 files changed, 155 insertions(+)\n create mode 100644 arch/powerpc/platforms/powernv/copy-paste.h",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex abc235f..4ca94e8 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -6430,6 +6430,7 @@ M:\tSukadev Bhattiprolu\n L:\tlinuxppc-dev@lists.ozlabs.org\n S:\tSupported\n F:\tarch/powerpc/platforms/powernv/vas*\n+F:\tarch/powerpc/platforms/powernv/copy-paste.h\n F:\tarch/powerpc/include/asm/vas.h\n F:\tarch/powerpc/include/uapi/asm/vas.h\n \ndiff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h\nindex ed1be4c..29531df 100644\n--- a/arch/powerpc/include/asm/vas.h\n+++ b/arch/powerpc/include/asm/vas.h\n@@ -158,4 +158,17 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,\n  */\n int vas_win_close(struct vas_window *win);\n \n+/*\n+ * Copy the co-processor request block (CRB) @crb into the local L2 cache.\n+ * For now, @offset must be 0 and @first must be true.\n+ */\n+extern int vas_copy_crb(void *crb, int offset, bool first);\n+\n+/*\n+ * Paste a previously copied CRB (see vas_copy_crb()) from the L2 cache to\n+ * the hardware address associated with the window @win. For now, @off must\n+ * 0 and @last must be true. @re is expected/assumed to be true for NX windows.\n+ */\n+extern int vas_paste_crb(struct vas_window *win, int off, bool last, bool re);\n+\n #endif /* _MISC_VAS_H */\ndiff --git a/arch/powerpc/platforms/powernv/copy-paste.h b/arch/powerpc/platforms/powernv/copy-paste.h\nnew file mode 100644\nindex 0000000..7783bb8\n--- /dev/null\n+++ b/arch/powerpc/platforms/powernv/copy-paste.h\n@@ -0,0 +1,74 @@\n+/*\n+ * Copyright 2016 IBM Corp.\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License\n+ * as published by the Free Software Foundation; either version\n+ * 2 of the License, or (at your option) any later version.\n+ */\n+\n+/*\n+ * Macros taken from tools/testing/selftests/powerpc/context_switch/cp_abort.c\n+ */\n+#define PASTE(RA, RB, L, RC) \\\n+\t.long (0x7c00070c | (RA) << (31-15) | (RB) << (31-20) \\\n+\t\t\t  | (L) << (31-10) | (RC) << (31-31))\n+\n+#define COPY(RA, RB, L) \\\n+\t.long (0x7c00060c | (RA) << (31-15) | (RB) << (31-20) \\\n+\t\t\t  | (L) << (31-10))\n+\n+#define CR0_FXM\t\t\"0x80\"\n+#define CR0_SHIFT\t28\n+#define CR0_MASK\t0xF\n+/*\n+ * Copy/paste instructions:\n+ *\n+ *\tcopy RA,RB,L\n+ *\t\tCopy contents of address (RA) + effective_address(RB)\n+ *\t\tto internal copy-buffer.\n+ *\n+ *\t\tL == 1 indicates this is the first copy.\n+ *\n+ *\t\tL == 0 indicates its a continuation of a prior first copy.\n+ *\n+ *\tpaste RA,RB,L\n+ *\t\tPaste contents of internal copy-buffer to the address\n+ *\t\t(RA) + effective_address(RB)\n+ *\n+ *\t\tL == 0 indicates its a continuation of a prior paste. i.e.\n+ *\t\tdon't wait for the completion or update status.\n+ *\n+ *\t\tL == 1 indicates this is the last paste in the group (i.e.\n+ *\t\twait for the group to complete and update status in CR0).\n+ *\n+ *\tFor Power9, the L bit must be 'true' in both copy and paste.\n+ */\n+\n+static inline int vas_copy(void *crb, int offset, int first)\n+{\n+\tWARN_ON_ONCE(!first);\n+\n+\t__asm__ __volatile(stringify_in_c(COPY(%0, %1, %2))\";\"\n+\t\t:\n+\t\t: \"b\" (offset), \"b\" (crb), \"i\" (1)\n+\t\t: \"memory\");\n+\n+\treturn 0;\n+}\n+\n+static inline int vas_paste(void *paste_address, int offset, int last)\n+{\n+\tunsigned long long cr;\n+\n+\tWARN_ON_ONCE(!last);\n+\n+\tcr = 0;\n+\t__asm__ __volatile(stringify_in_c(PASTE(%1, %2, 1, 1))\";\"\n+\t\t\"mfocrf %0,\" CR0_FXM \";\"\n+\t\t: \"=r\" (cr)\n+\t\t: \"b\" (paste_address), \"b\" (offset)\n+\t\t: \"memory\");\n+\n+\treturn cr;\n+}\ndiff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c\nindex 70762c3..73081b4 100644\n--- a/arch/powerpc/platforms/powernv/vas-window.c\n+++ b/arch/powerpc/platforms/powernv/vas-window.c\n@@ -16,6 +16,7 @@\n #include <linux/cred.h>\n \n #include \"vas.h\"\n+#include \"copy-paste.h\"\n \n /*\n  * Compute the paste address region for the window @window using the\n@@ -1040,6 +1041,57 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,\n }\n EXPORT_SYMBOL_GPL(vas_tx_win_open);\n \n+int vas_copy_crb(void *crb, int offset, bool first)\n+{\n+\tif (!vas_initialized())\n+\t\treturn -1;\n+\n+\treturn vas_copy(crb, offset, first);\n+}\n+EXPORT_SYMBOL_GPL(vas_copy_crb);\n+\n+#define RMA_LSMP_REPORT_ENABLE PPC_BIT(53)\n+int vas_paste_crb(struct vas_window *txwin, int offset, bool last, bool re)\n+{\n+\tint rc;\n+\tuint64_t val;\n+\tvoid *addr;\n+\n+\tif (!vas_initialized())\n+\t\treturn -1;\n+\t/*\n+\t * Only NX windows are supported for now and hardware assumes\n+\t * report-enable flag is set for NX windows. Ensure software\n+\t * complies too.\n+\t */\n+\tWARN_ON_ONCE(!re);\n+\n+\taddr = txwin->paste_kaddr;\n+\tif (re) {\n+\t\t/*\n+\t\t * Set the REPORT_ENABLE bit (equivalent to writing\n+\t\t * to 1K offset of the paste address)\n+\t\t */\n+\t\tval = SET_FIELD(RMA_LSMP_REPORT_ENABLE, 0ULL, 1);\n+\t\taddr += val;\n+\t}\n+\n+\t/*\n+\t * Map the raw CR value from vas_paste() to an error code (there\n+\t * is just pass or fail for now though).\n+\t */\n+\trc = vas_paste(addr, offset, last);\n+\tif (rc == 0x20000000)\n+\t\trc = 0;\n+\telse\n+\t\trc = -EINVAL;\n+\n+\tprint_fifo_msg_count(txwin);\n+\n+\treturn rc;\n+}\n+EXPORT_SYMBOL_GPL(vas_paste_crb);\n+\n static void poll_window_busy_state(struct vas_window *window)\n {\n \tint busy;\ndiff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h\nindex 61fd80f..4e3e5fe 100644\n--- a/arch/powerpc/platforms/powernv/vas.h\n+++ b/arch/powerpc/platforms/powernv/vas.h\n@@ -482,4 +482,19 @@ static inline void decode_pswid(u32 pswid, int *vasid, int *winid)\n \tif (winid)\n \t\t*winid = pswid & 0xFFFF;\n }\n+\n+#ifdef vas_debug\n+\n+static void print_fifo_msg_count(struct vas_window *txwin)\n+{\n+\tuint64_t read_hvwc_reg(struct vas_window *w, char *n, uint64_t o);\n+\tpr_devel(\"Winid %d, Msg count %llu\\n\", txwin->winid,\n+\t\t\t(uint64_t)read_hvwc_reg(txwin, VREG(LRFIFO_PUSH)));\n+}\n+#else\t/* vas_debug */\n+\n+#define print_fifo_msg_count(window)\n+\n+#endif\t/* vas_debug */\n+\n #endif /* _VAS_H */\n",
    "prefixes": [
        "v7",
        "12/12"
    ]
}