Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809990/?format=api
{ "id": 809990, "url": "http://patchwork.ozlabs.org/api/patches/809990/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20170905081029.19769-2-mperttunen@nvidia.com/", "project": { "id": 21, "url": "http://patchwork.ozlabs.org/api/projects/21/?format=api", "name": "Linux Tegra Development", "link_name": "linux-tegra", "list_id": "linux-tegra.vger.kernel.org", "list_email": "linux-tegra@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170905081029.19769-2-mperttunen@nvidia.com>", "list_archive_url": null, "date": "2017-09-05T08:10:24", "name": "[v2,1/6] gpu: host1x: Enable Tegra186 syncpoint protection", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "2e56df862610d0d1b397e69a7397a352830c53b1", "submitter": { "id": 26499, "url": "http://patchwork.ozlabs.org/api/people/26499/?format=api", "name": "Mikko Perttunen", "email": "mperttunen@nvidia.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20170905081029.19769-2-mperttunen@nvidia.com/mbox/", "series": [ { "id": 1506, "url": "http://patchwork.ozlabs.org/api/series/1506/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/list/?series=1506", "date": "2017-09-05T08:10:29", "name": "Miscellaneous improvements to Host1x and TegraDRM", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/1506/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809990/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809990/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-tegra-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-tegra-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tsecure) header.d=kapsi.fi header.i=@kapsi.fi header.b=\"XiLe1HT2\";\n\tdkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmfcG13pWz9s0g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 18:13:34 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751317AbdIEIM2 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 04:12:28 -0400", "from mail.kapsi.fi ([91.232.154.25]:57471 \"EHLO mail.kapsi.fi\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1750993AbdIEIKk (ORCPT <rfc822;linux-tegra@vger.kernel.org>);\n\tTue, 5 Sep 2017 04:10:40 -0400", "from dsl-hkibng41-567306-181.dhcp.inet.fi ([86.115.6.181]\n\thelo=localhost.localdomain) by mail.kapsi.fi with esmtpsa\n\t(TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2)\n\t(envelope-from <mperttunen@nvidia.com>)\n\tid 1dp8wN-0001nH-D5; Tue, 05 Sep 2017 11:10:35 +0300" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi;\n\ts=20161220; \n\th=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From;\n\tbh=U9jKtLgeF9CmZ3b6A1H4RJ5gMKbLCdBGxFomWK7RJrs=; \n\tb=XiLe1HT2/obAQ08CZnnyivDXQWKY/AMW+tJHE2lqwDDNS1Q49TUCDj72ewPPtJQKA84vzHzD86zBph7TgVNYzeepz41iiBUyT/iZeo3CFXjneJuABcSDAjVpcwsmCXEv4g+CoUcCaXyHRseAtgWcXtm570FKHmux4bQRdDV8SAwegoVS9ZCS84QruO1+6IHuVpO3aWB7xPQERB/w4mPbvVHn4YbatWEN5ZRza9hGB5LE4QXAZByZj6FCsrAmRZ6Fu/uNx+/xjJjHmg4WR7+wODRl4gDS4kcuAe4wZNjpwG5Bmu07CwpAgBQtaHLnsuVLr9i3WwNrOLn2grAyY3TEPQ==;", "From": "Mikko Perttunen <mperttunen@nvidia.com>", "To": "thierry.reding@gmail.com, jonathanh@nvidia.com", "Cc": "digetx@gmail.com, dri-devel@lists.freedesktop.org,\n\tlinux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tMikko Perttunen <mperttunen@nvidia.com>", "Subject": "[PATCH v2 1/6] gpu: host1x: Enable Tegra186 syncpoint protection", "Date": "Tue, 5 Sep 2017 11:10:24 +0300", "Message-Id": "<20170905081029.19769-2-mperttunen@nvidia.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170905081029.19769-1-mperttunen@nvidia.com>", "References": "<20170905081029.19769-1-mperttunen@nvidia.com>", "X-SA-Exim-Connect-IP": "86.115.6.181", "X-SA-Exim-Mail-From": "mperttunen@nvidia.com", "X-SA-Exim-Scanned": "No (on mail.kapsi.fi); SAEximRunCond expanded to false", "Sender": "linux-tegra-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-tegra.vger.kernel.org>", "X-Mailing-List": "linux-tegra@vger.kernel.org" }, "content": "Since Tegra186 the Host1x hardware allows syncpoints to be assigned to\nspecific channels, preventing any other channels from incrementing\nthem.\n\nEnable this feature where available and assign syncpoints to channels\nwhen submitting a job. Syncpoints are currently never unassigned from\nchannels since that would require extra work and is unnecessary with\nthe current channel allocation model.\n\nSigned-off-by: Mikko Perttunen <mperttunen@nvidia.com>\n---\n\nNotes:\n v2:\n - Changed from set_protection(bool) to enable_protection\n - Added some comments\n - Added missing check for hv_regs being NULL in\n enable_protection\n\n drivers/gpu/host1x/dev.h | 15 +++++++++++++\n drivers/gpu/host1x/hw/channel_hw.c | 3 +++\n drivers/gpu/host1x/hw/syncpt_hw.c | 46 ++++++++++++++++++++++++++++++++++++++\n drivers/gpu/host1x/syncpt.c | 8 +++++++\n 4 files changed, 72 insertions(+)", "diff": "diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h\nindex def802c0a6bf..7497cc5ead9e 100644\n--- a/drivers/gpu/host1x/dev.h\n+++ b/drivers/gpu/host1x/dev.h\n@@ -79,6 +79,9 @@ struct host1x_syncpt_ops {\n \tu32 (*load)(struct host1x_syncpt *syncpt);\n \tint (*cpu_incr)(struct host1x_syncpt *syncpt);\n \tint (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);\n+\tvoid (*assign_channel)(struct host1x_syncpt *syncpt,\n+\t struct host1x_channel *channel);\n+\tvoid (*enable_protection)(struct host1x *host);\n };\n \n struct host1x_intr_ops {\n@@ -186,6 +189,18 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,\n \treturn host->syncpt_op->patch_wait(sp, patch_addr);\n }\n \n+static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,\n+\t\t\t\t\t\t struct host1x_syncpt *sp,\n+\t\t\t\t\t\t struct host1x_channel *ch)\n+{\n+\treturn host->syncpt_op->assign_channel(sp, ch);\n+}\n+\n+static inline void host1x_hw_syncpt_enable_protection(struct host1x *host)\n+{\n+\treturn host->syncpt_op->enable_protection(host);\n+}\n+\n static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,\n \t\t\tvoid (*syncpt_thresh_work)(struct work_struct *))\n {\ndiff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c\nindex 8447a56c41ca..0161da331702 100644\n--- a/drivers/gpu/host1x/hw/channel_hw.c\n+++ b/drivers/gpu/host1x/hw/channel_hw.c\n@@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)\n \n \tsyncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);\n \n+\t/* assign syncpoint to channel */\n+\thost1x_hw_syncpt_assign_channel(host, sp, ch);\n+\n \tjob->syncpt_end = syncval;\n \n \t/* add a setclass for modules that require it */\ndiff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c\nindex 7b0270d60742..dc7a44614fef 100644\n--- a/drivers/gpu/host1x/hw/syncpt_hw.c\n+++ b/drivers/gpu/host1x/hw/syncpt_hw.c\n@@ -106,6 +106,50 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)\n \treturn 0;\n }\n \n+/**\n+ * syncpt_assign_channel() - Assign syncpoint to channel\n+ * @sp: syncpoint\n+ * @ch: channel\n+ *\n+ * On chips with the syncpoint protection feature (Tegra186+), assign @sp to\n+ * @ch, preventing other channels from incrementing the syncpoints. If @ch is\n+ * NULL, unassigns the syncpoint.\n+ *\n+ * On older chips, do nothing.\n+ */\n+static void syncpt_assign_channel(struct host1x_syncpt *sp,\n+\t\t\t\t struct host1x_channel *ch)\n+{\n+#if HOST1X_HW >= 6\n+\tstruct host1x *host = sp->host;\n+\n+\tif (!host->hv_regs)\n+\t\treturn;\n+\n+\thost1x_sync_writel(host,\n+\t\t\t HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),\n+\t\t\t HOST1X_SYNC_SYNCPT_CH_APP(sp->id));\n+#endif\n+}\n+\n+/**\n+ * syncpt_enable_protection() - Enable syncpoint protection\n+ * @host: host1x instance\n+ *\n+ * On chips with the syncpoint protection feature (Tegra186+), enable this\n+ * feature. On older chips, do nothing.\n+ */\n+static void syncpt_enable_protection(struct host1x *host)\n+{\n+#if HOST1X_HW >= 6\n+\tif (!host->hv_regs)\n+\t\treturn;\n+\n+\thost1x_hypervisor_writel(host, HOST1X_HV_SYNCPT_PROT_EN_CH_EN,\n+\t\t\t\t HOST1X_HV_SYNCPT_PROT_EN);\n+#endif\n+}\n+\n static const struct host1x_syncpt_ops host1x_syncpt_ops = {\n \t.restore = syncpt_restore,\n \t.restore_wait_base = syncpt_restore_wait_base,\n@@ -113,4 +157,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {\n \t.load = syncpt_load,\n \t.cpu_incr = syncpt_cpu_incr,\n \t.patch_wait = syncpt_patch_wait,\n+\t.assign_channel = syncpt_assign_channel,\n+\t.enable_protection = syncpt_enable_protection,\n };\ndiff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c\nindex 048ac9e344ce..4c7a4c8b2ad2 100644\n--- a/drivers/gpu/host1x/syncpt.c\n+++ b/drivers/gpu/host1x/syncpt.c\n@@ -398,6 +398,13 @@ int host1x_syncpt_init(struct host1x *host)\n \tfor (i = 0; i < host->info->nb_pts; i++) {\n \t\tsyncpt[i].id = i;\n \t\tsyncpt[i].host = host;\n+\n+\t\t/*\n+\t\t * Unassign syncpt from channels for purposes of Tegra186\n+\t\t * syncpoint protection. This prevents any channel from\n+\t\t * accessing it until it is reassigned.\n+\t\t */\n+\t\thost1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);\n \t}\n \n \tfor (i = 0; i < host->info->nb_bases; i++)\n@@ -408,6 +415,7 @@ int host1x_syncpt_init(struct host1x *host)\n \thost->bases = bases;\n \n \thost1x_syncpt_restore(host);\n+\thost1x_hw_syncpt_enable_protection(host);\n \n \t/* Allocate sync point to use for clearing waits for expired fences */\n \thost->nop_sp = host1x_syncpt_alloc(host, NULL, 0);\n", "prefixes": [ "v2", "1/6" ] }