public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Mikko Perttunen <mperttunen@nvidia.com>
To: thierry.reding@gmail.com, jonathanh@nvidia.com
Cc: linux-tegra@vger.kernel.org, digetx@gmail.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Mikko Perttunen <mperttunen@nvidia.com>
Subject: [PATCH 2/4] gpu: host1x: Enable gather filter
Date: Fri, 18 Aug 2017 19:15:51 +0300	[thread overview]
Message-ID: <20170818161553.27597-3-mperttunen@nvidia.com> (raw)
In-Reply-To: <20170818161553.27597-1-mperttunen@nvidia.com>

The gather filter is a feature present on Tegra124 and newer where the
hardware prevents GATHERed command buffers from executing commands
normally reserved for the CDMA pushbuffer which is maintained by the
kernel driver.

This commit enables the gather filter on all supporting hardware.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/host1x/hw/channel_hw.c          | 22 ++++++++++++++++++++++
 drivers/gpu/host1x/hw/hw_host1x04_channel.h | 12 ++++++++++++
 drivers/gpu/host1x/hw/hw_host1x05_channel.h | 12 ++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
index 0161da331702..5c0dc6bb51d1 100644
--- a/drivers/gpu/host1x/hw/channel_hw.c
+++ b/drivers/gpu/host1x/hw/channel_hw.c
@@ -181,10 +181,32 @@ static int channel_submit(struct host1x_job *job)
 	return err;
 }
 
+static void enable_gather_filter(struct host1x *host,
+				 struct host1x_channel *ch)
+{
+#if HOST1X_HW >= 6
+	u32 val;
+
+	if (!host->hv_regs)
+		return;
+
+	val = host1x_hypervisor_readl(
+		host, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32));
+	val |= BIT(ch->id % 32);
+	host1x_hypervisor_writel(
+		host, val, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32));
+#elif HOST1X_HW >= 4
+	host1x_ch_writel(ch,
+			 HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(1),
+			 HOST1X_CHANNEL_CHANNELCTRL);
+#endif
+}
+
 static int host1x_channel_init(struct host1x_channel *ch, struct host1x *dev,
 			       unsigned int index)
 {
 	ch->regs = dev->regs + index * HOST1X_CHANNEL_SIZE;
+	enable_gather_filter(dev, ch);
 	return 0;
 }
 
diff --git a/drivers/gpu/host1x/hw/hw_host1x04_channel.h b/drivers/gpu/host1x/hw/hw_host1x04_channel.h
index 95e6f96142b9..2e8b635aa660 100644
--- a/drivers/gpu/host1x/hw/hw_host1x04_channel.h
+++ b/drivers/gpu/host1x/hw/hw_host1x04_channel.h
@@ -117,5 +117,17 @@ static inline u32 host1x_channel_dmactrl_dmainitget(void)
 }
 #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
 	host1x_channel_dmactrl_dmainitget()
+static inline u32 host1x_channel_channelctrl_r(void)
+{
+	return 0x98;
+}
+#define HOST1X_CHANNEL_CHANNELCTRL \
+	host1x_channel_channelctrl_r()
+static inline u32 host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v)
+{
+	return (v & 0x1) << 2;
+}
+#define HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(v) \
+	host1x_channel_channelctrl_kernel_filter_gbuffer_f(v)
 
 #endif
diff --git a/drivers/gpu/host1x/hw/hw_host1x05_channel.h b/drivers/gpu/host1x/hw/hw_host1x05_channel.h
index fce6e2c1ff4c..abbbc2641ce6 100644
--- a/drivers/gpu/host1x/hw/hw_host1x05_channel.h
+++ b/drivers/gpu/host1x/hw/hw_host1x05_channel.h
@@ -117,5 +117,17 @@ static inline u32 host1x_channel_dmactrl_dmainitget(void)
 }
 #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
 	host1x_channel_dmactrl_dmainitget()
+static inline u32 host1x_channel_channelctrl_r(void)
+{
+	return 0x98;
+}
+#define HOST1X_CHANNEL_CHANNELCTRL \
+	host1x_channel_channelctrl_r()
+static inline u32 host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v)
+{
+	return (v & 0x1) << 2;
+}
+#define HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(v) \
+	host1x_channel_channelctrl_kernel_filter_gbuffer_f(v)
 
 #endif
-- 
2.14.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-08-18 16:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 16:15 [PATCH 0/4] Miscellaneous improvements to Host1x and TegraDRM Mikko Perttunen
2017-08-18 16:15 ` [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen
     [not found]   ` <20170818161553.27597-2-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-18 22:36     ` Dmitry Osipenko
     [not found]       ` <d6d10aec-3d2a-99b3-a23d-41147478f412-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19  8:10         ` Mikko Perttunen
     [not found]           ` <5ff98485-e8ac-75e0-ca8f-3887f8593ec4-/1wQRMveznE@public.gmane.org>
2017-08-19 10:09             ` Dmitry Osipenko
2017-08-19 10:35               ` Mikko Perttunen
     [not found]                 ` <6979443e-ad2b-1da6-f71c-61913242f257-/1wQRMveznE@public.gmane.org>
2017-08-19 11:11                   ` Dmitry Osipenko
     [not found]                     ` <ed7f2987-062a-fa53-6243-bd81a600e96e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 11:32                       ` Mikko Perttunen
     [not found]                         ` <72fc513b-2626-fd86-1b98-5d2f8e89dc5f-/1wQRMveznE@public.gmane.org>
2017-08-19 11:51                           ` Dmitry Osipenko
2017-08-19 12:02     ` Dmitry Osipenko
2017-08-20 16:18     ` Dmitry Osipenko
2017-08-20 16:59     ` Dmitry Osipenko
2017-08-20 18:13     ` Dmitry Osipenko
2017-08-18 16:15 ` Mikko Perttunen [this message]
     [not found]   ` <20170818161553.27597-3-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-19 10:42     ` [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko
     [not found]       ` <ae084d08-89d0-ced0-c040-78500aa8e5d5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 10:46         ` Mikko Perttunen
     [not found]           ` <64de3b3b-7c9e-54e9-49f4-d89b3d2c5f21-/1wQRMveznE@public.gmane.org>
2017-08-19 12:05             ` Dmitry Osipenko
2017-08-20 16:24     ` Dmitry Osipenko
     [not found]       ` <78e11be6-1e4f-18e0-cdc0-13db4bf57bf6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-20 16:44         ` Dmitry Osipenko
2017-08-20 16:59           ` Dmitry Osipenko
     [not found]             ` <f42a2854-d70c-ef40-7d45-ec14f581c337-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-21 17:27               ` Mikko Perttunen
2017-08-21 17:28                 ` Mikko Perttunen
2017-08-18 16:15 ` [PATCH 3/4] gpu: host1x: Improve debug disassembly formatting Mikko Perttunen
2017-08-18 21:54   ` Dmitry Osipenko
2017-08-18 16:15 ` [PATCH 4/4] drm/tegra: Use u64_to_user_ptr helper Mikko Perttunen
     [not found]   ` <20170818161553.27597-5-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-18 22:05     ` Dmitry Osipenko
     [not found]       ` <f16347d6-991e-4d61-eb55-cca24bcf5625-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19  8:06         ` Mikko Perttunen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170818161553.27597-3-mperttunen@nvidia.com \
    --to=mperttunen@nvidia.com \
    --cc=digetx@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox