Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806964/?format=api
{ "id": 806964, "url": "http://patchwork.ozlabs.org/api/patches/806964/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1503987820-31933-9-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": "<1503987820-31933-9-git-send-email-sukadev@linux.vnet.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1503987820-31933-9-git-send-email-sukadev@linux.vnet.ibm.com/", "date": "2017-08-29T06:23:38", "name": "[v8,08/10] powerpc/vas: Define vas_win_close() interface", "commit_ref": "98271d4198699947d66d6f8a02c09bd27cb90022", "pull_url": null, "state": "accepted", "archived": false, "hash": "5a19df2b047de4e86139ca1c062c7943cb1a82b7", "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/1503987820-31933-9-git-send-email-sukadev@linux.vnet.ibm.com/mbox/", "series": [ { "id": 310, "url": "http://patchwork.ozlabs.org/api/series/310/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=310", "date": "2017-08-29T06:23:30", "name": "Enable VAS", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/310/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806964/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806964/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 3xhJtj1Q06z9t2v\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 16:41:01 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhJtj0S8TzDqkX\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 16:41:01 +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 3xhJXH2rSPzDqXl\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 16:25:03 +1000 (AEST)", "from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 3xhJXH19Jkz8vmR\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 16:25:03 +1000 (AEST)", "by ozlabs.org (Postfix)\n\tid 3xhJXH0pSkz9t2v; Tue, 29 Aug 2017 16:25:03 +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 3xhJXG2KkSz9sP5\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 29 Aug 2017 16:25:02 +1000 (AEST)", "from pps.filterd (m0098421.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7T6OwE3009519\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 29 Aug 2017 02:25:00 -0400", "from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cmurp0mea-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 29 Aug 2017 02:24:59 -0400", "from localhost\n\tby e12.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\tTue, 29 Aug 2017 02:24:07 -0400", "from b01cxnp23034.gho.pok.ibm.com (9.57.198.29)\n\tby e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 29 Aug 2017 02:24:04 -0400", "from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com\n\t[9.57.199.110])\n\tby b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid v7T6O3GM25362460; Tue, 29 Aug 2017 06:24:03 GMT", "from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 478F6AE04E;\n\tTue, 29 Aug 2017 02:24:27 -0400 (EDT)", "from suka-w540.usor.ibm.com (unknown [9.70.94.25])\n\tby b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 6D9F3AE034;\n\tTue, 29 Aug 2017 02:24:26 -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 v8 08/10] powerpc/vas: Define vas_win_close() interface", "Date": "Mon, 28 Aug 2017 23:23:38 -0700", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1503987820-31933-1-git-send-email-sukadev@linux.vnet.ibm.com>", "References": "<1503987820-31933-1-git-send-email-sukadev@linux.vnet.ibm.com>", "X-TM-AS-GCONF": "00", "x-cbid": "17082906-0048-0000-0000-000001DB0A26", "X-IBM-SpamModules-Scores": "", "X-IBM-SpamModules-Versions": "BY=3.00007631; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000226; SDB=6.00909146; UDB=6.00455923;\n\tIPR=6.00689401; \n\tBA=6.00005559; 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.00016912;\n\tXFM=3.00000015; UTC=2017-08-29 06:24:06", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "17082906-0049-0000-0000-0000426238C3", "Message-Id": "<1503987820-31933-9-git-send-email-sukadev@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-29_01:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=2\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-1708290096", "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 the vas_win_close() interface which should be used to close a\nsend or receive windows.\n\nWhile the hardware configurations required to open send and receive windows\ndiffer, the configuration to close a window is the same for both. So we use\na single interface to close the window.\n\nSigned-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>\n---\nChangelog[v8]\n\t- [Michael Ellerman] Set task_state() and pass correct values to\n\t schedule_timeout().\n\nChangelog[v4]:\n\t- Drop the poll for credits return (we can set the required credit,\n\t but cannot really find the available credit at a point in time)\n\t- Export the symbol\n\nChangelog[v3]:\n\t- Fix order of parameters in GET_FIELD().\n\t- Update references and sequence for closing/quiescing a window.\n\nConflicts:\n\tarch/powerpc/platforms/powernv/vas-window.c\n---\n arch/powerpc/include/asm/vas.h | 7 ++\n arch/powerpc/platforms/powernv/vas-window.c | 101 ++++++++++++++++++++++++++--\n 2 files changed, 103 insertions(+), 5 deletions(-)", "diff": "diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h\nindex 5ce800a..e124856 100644\n--- a/arch/powerpc/include/asm/vas.h\n+++ b/arch/powerpc/include/asm/vas.h\n@@ -96,4 +96,11 @@ extern void vas_init_rx_win_attr(struct vas_rx_win_attr *rxattr,\n extern struct vas_window *vas_rx_win_open(int vasid, enum vas_cop_type cop,\n \t\t\tstruct vas_rx_win_attr *attr);\n \n+/*\n+ * Close the send or receive window identified by @win. For receive windows\n+ * return -EAGAIN if there are active send windows attached to this receive\n+ * window.\n+ */\n+int vas_win_close(struct vas_window *win);\n+\n #endif /* _MISC_VAS_H */\ndiff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c\nindex 783c8c6..39aa0e4 100644\n--- a/arch/powerpc/platforms/powernv/vas-window.c\n+++ b/arch/powerpc/platforms/powernv/vas-window.c\n@@ -130,7 +130,7 @@ static void unmap_region(void *addr, u64 start, int len)\n /*\n * Unmap the paste address region for a window.\n */\n-void unmap_paste_region(struct vas_window *window)\n+static void unmap_paste_region(struct vas_window *window)\n {\n \tint len;\n \tu64 busaddr_start;\n@@ -522,7 +522,7 @@ static int vas_assign_window_id(struct ida *ida)\n \treturn winid;\n }\n \n-void vas_window_free(struct vas_window *window)\n+static void vas_window_free(struct vas_window *window)\n {\n \tint winid = window->winid;\n \tstruct vas_instance *vinst = window->vinst;\n@@ -560,6 +560,14 @@ static struct vas_window *vas_window_alloc(struct vas_instance *vinst)\n \treturn ERR_PTR(-ENOMEM);\n }\n \n+static void put_rx_win(struct vas_window *rxwin)\n+{\n+\t/* Better not be a send window! */\n+\tWARN_ON_ONCE(rxwin->tx_win);\n+\n+\tatomic_dec(&rxwin->num_txwins);\n+}\n+\n /*\n * Get the VAS receive window associated with NX engine identified\n * by @cop and if applicable, @pswid.\n@@ -627,7 +635,7 @@ static void set_vinst_win(struct vas_instance *vinst,\n * Clear this window from the table(s) of windows for this VAS instance.\n * See also function header of set_vinst_win().\n */\n-void clear_vinst_win(struct vas_window *window)\n+static void clear_vinst_win(struct vas_window *window)\n {\n \tint id = window->winid;\n \tstruct vas_instance *vinst = window->vinst;\n@@ -839,8 +847,91 @@ struct vas_window *vas_rx_win_open(int vasid, enum vas_cop_type cop,\n }\n EXPORT_SYMBOL_GPL(vas_rx_win_open);\n \n-/* stub for now */\n+static void poll_window_busy_state(struct vas_window *window)\n+{\n+\tint busy;\n+\tu64 val;\n+\n+retry:\n+\t/*\n+\t * Poll Window Busy flag\n+\t */\n+\tval = read_hvwc_reg(window, VREG(WIN_STATUS));\n+\tbusy = GET_FIELD(VAS_WIN_BUSY, val);\n+\tif (busy) {\n+\t\tval = 0;\n+\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n+\t\tschedule_timeout(HZ);\n+\t\tgoto retry;\n+\t}\n+}\n+\n+static void poll_window_castout(struct vas_window *window)\n+{\n+\tint cached;\n+\tu64 val;\n+\n+\t/* Cast window context out of the cache */\n+retry:\n+\tval = read_hvwc_reg(window, VREG(WIN_CTX_CACHING_CTL));\n+\tcached = GET_FIELD(VAS_WIN_CACHE_STATUS, val);\n+\tif (cached) {\n+\t\tval = 0ULL;\n+\t\tval = SET_FIELD(VAS_CASTOUT_REQ, val, 1);\n+\t\tval = SET_FIELD(VAS_PUSH_TO_MEM, val, 0);\n+\t\twrite_hvwc_reg(window, VREG(WIN_CTX_CACHING_CTL), val);\n+\n+\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n+\t\tschedule_timeout(HZ);\n+\t\tgoto retry;\n+\t}\n+}\n+\n+/*\n+ * Close a window.\n+ *\n+ * See Section 1.12.1 of VAS workbook v1.05 for details on closing window:\n+ *\t- Disable new paste operations (unmap paste address)\n+ *\t- Poll for the \"Window Busy\" bit to be cleared\n+ *\t- Clear the Open/Enable bit for the Window.\n+ *\t- Poll for return of window Credits (implies FIFO empty for Rx win?)\n+ *\t- Unpin and cast window context out of cache\n+ *\n+ * Besides the hardware, kernel has some bookkeeping of course.\n+ */\n int vas_win_close(struct vas_window *window)\n {\n-\treturn -1;\n+\tu64 val;\n+\n+\tif (!window)\n+\t\treturn 0;\n+\n+\tif (!window->tx_win && atomic_read(&window->num_txwins) != 0) {\n+\t\tpr_devel(\"Attempting to close an active Rx window!\\n\");\n+\t\tWARN_ON_ONCE(1);\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tunmap_paste_region(window);\n+\n+\tclear_vinst_win(window);\n+\n+\tpoll_window_busy_state(window);\n+\n+\t/* Unpin window from cache and close it */\n+\tval = read_hvwc_reg(window, VREG(WINCTL));\n+\tval = SET_FIELD(VAS_WINCTL_PIN, val, 0);\n+\tval = SET_FIELD(VAS_WINCTL_OPEN, val, 0);\n+\twrite_hvwc_reg(window, VREG(WINCTL), val);\n+\n+\tpoll_window_castout(window);\n+\n+\t/* if send window, drop reference to matching receive window */\n+\tif (window->tx_win)\n+\t\tput_rx_win(window->rxwin);\n+\n+\tvas_window_free(window);\n+\n+\treturn 0;\n }\n+EXPORT_SYMBOL_GPL(vas_win_close);\n", "prefixes": [ "v8", "08/10" ] }