Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715301

[PATCH 2/4] gpu: host1x: Enable gather filter

From Mikko Perttunen <mperttunen@nvidia.com>
Newsgroups linux.kernel
Subject [PATCH 2/4] gpu: host1x: Enable gather filter
Date 2017-08-18 18:20 +0200
Message-ID <ufSa6-69c-23@gated-at.bofh.it> (permalink)
References <ufSa6-69c-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Miscellaneous improvements to Host1x and TegraDRM Mikko Perttunen <mperttunen@nvidia.com> - 2017-08-18 18:20 +0200
  [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen <mperttunen@nvidia.com> - 2017-08-18 18:20 +0200
    Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 00:40 +0200
      Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-19 10:20 +0200
        Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 12:20 +0200
          Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-19 12:40 +0200
            Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 13:20 +0200
              Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-19 13:40 +0200
                Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 14:00 +0200
    Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 14:10 +0200
    Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 18:20 +0200
    Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 19:00 +0200
    Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 20:20 +0200
  [PATCH 2/4] gpu: host1x: Enable gather filter Mikko Perttunen <mperttunen@nvidia.com> - 2017-08-18 18:20 +0200
    Re: [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 12:50 +0200
      Re: [PATCH 2/4] gpu: host1x: Enable gather filter Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-19 12:50 +0200
        Re: [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 14:10 +0200
    Re: [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 18:30 +0200
      Re: [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 18:50 +0200
        Re: [PATCH 2/4] gpu: host1x: Enable gather filter Dmitry Osipenko <digetx@gmail.com> - 2017-08-20 19:00 +0200
          Re: [PATCH 2/4] gpu: host1x: Enable gather filter Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-21 19:30 +0200
            Re: [PATCH 2/4] gpu: host1x: Enable gather filter Mikko Perttunen <cyndis@kapsi.fi> - 2017-08-21 19:30 +0200
  [PATCH 3/4] gpu: host1x: Improve debug disassembly formatting Mikko Perttunen <mperttunen@nvidia.com> - 2017-08-18 18:20 +0200
    Re: [PATCH 3/4] gpu: host1x: Improve debug disassembly formatting Dmitry Osipenko <digetx@gmail.com> - 2017-08-19 00:00 +0200

csiph-web