]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpu: host1x: Enable gather filter
authorMikko Perttunen <mperttunen@nvidia.com>
Thu, 28 Sep 2017 12:50:40 +0000 (15:50 +0300)
committerThierry Reding <treding@nvidia.com>
Fri, 20 Oct 2017 12:19:52 +0000 (14:19 +0200)
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>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/host1x/hw/channel_hw.c
drivers/gpu/host1x/hw/hw_host1x04_channel.h
drivers/gpu/host1x/hw/hw_host1x05_channel.h

index 1d3e9bdde2ce78a373d90cc1ed03c16ede63e9cc..9af758785a112733d122e7096a08d3733b5c8942 100644 (file)
@@ -180,10 +180,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;
 }
 
index 95e6f96142b9d7ec97eea04338258dd523964454..2e8b635aa6607aeab086c64c510a91e08eb29956 100644 (file)
@@ -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
index fce6e2c1ff4c1af968fbf1fe5de9d6c337eb62a7..abbbc2641ce650f966959e1759ad585ba8d7acc9 100644 (file)
@@ -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