Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1715297 > unrolled thread
| Started by | Mikko Perttunen <mperttunen@nvidia.com> |
|---|---|
| First post | 2017-08-18 18:20 +0200 |
| Last post | 2017-08-19 00:00 +0200 |
| Articles | 20 on this page of 24 — 3 participants |
Back to article view | Back to linux.kernel
[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
Page 1 of 2 [1] 2 Next page →
| From | Mikko Perttunen <mperttunen@nvidia.com> |
|---|---|
| Date | 2017-08-18 18:20 +0200 |
| Subject | [PATCH 0/4] Miscellaneous improvements to Host1x and TegraDRM |
| Message-ID | <ufSa6-69c-3@gated-at.bofh.it> |
Hi all, here are some new features and improvements. Patch 1 enables syncpoint protection which prevents channels from touching syncpoints not belonging to them on Tegra186. Patch 2 enables the gather filter which prevents userspace command buffers from using CDMA commands usually reserved for the kernel. A test is available at git://github.com/cyndis/host1x_test, branch gather-filter. Patch 3 greatly improves formatting of debug dumps spewed by host1x in case of job timeouts. They are now actually readable by humans without use of additional scripts. Patch 4 is a simple aesthetical fix to the TegraDRM submit path. Everything was tested on TX1 and TX2 and should be applied on the previously posted Tegra186 support series. Cheers, Mikko *** BLURB HERE *** Mikko Perttunen (4): gpu: host1x: Enable Tegra186 syncpoint protection gpu: host1x: Enable gather filter gpu: host1x: Improve debug disassembly formatting drm/tegra: Use u64_to_user_ptr helper drivers/gpu/drm/tegra/drm.c | 9 +++--- drivers/gpu/host1x/debug.c | 14 ++++++++- drivers/gpu/host1x/debug.h | 14 ++++++--- drivers/gpu/host1x/dev.h | 16 ++++++++++ drivers/gpu/host1x/hw/channel_hw.c | 25 ++++++++++++++++ drivers/gpu/host1x/hw/debug_hw.c | 46 ++++++++++++++++++----------- drivers/gpu/host1x/hw/debug_hw_1x01.c | 8 ++--- drivers/gpu/host1x/hw/debug_hw_1x06.c | 9 +++--- drivers/gpu/host1x/hw/hw_host1x04_channel.h | 12 ++++++++ drivers/gpu/host1x/hw/hw_host1x05_channel.h | 12 ++++++++ drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++ drivers/gpu/host1x/syncpt.c | 3 ++ 12 files changed, 159 insertions(+), 35 deletions(-) -- 2.14.1
[toc] | [next] | [standalone]
| From | Mikko Perttunen <mperttunen@nvidia.com> |
|---|---|
| Date | 2017-08-18 18:20 +0200 |
| Subject | [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ufSa6-69c-13@gated-at.bofh.it> |
| In reply to | #1715297 |
Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
specific channels, preventing any other channels from incrementing
them.
Enable this feature where available and assign syncpoints to channels
when submitting a job. Syncpoints are currently never unassigned from
channels since that would require extra work and is unnecessary with
the current channel allocation model.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
drivers/gpu/host1x/hw/channel_hw.c | 3 +++
drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
drivers/gpu/host1x/syncpt.c | 3 +++
4 files changed, 48 insertions(+)
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index def802c0a6bf..2432a30ff6e2 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
u32 (*load)(struct host1x_syncpt *syncpt);
int (*cpu_incr)(struct host1x_syncpt *syncpt);
int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
+ void (*assign_channel)(struct host1x_syncpt *syncpt,
+ struct host1x_channel *channel);
+ void (*set_protection)(struct host1x *host, bool enabled);
};
struct host1x_intr_ops {
@@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
return host->syncpt_op->patch_wait(sp, patch_addr);
}
+static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
+ struct host1x_syncpt *sp,
+ struct host1x_channel *ch)
+{
+ return host->syncpt_op->assign_channel(sp, ch);
+}
+
+static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
+ bool enabled)
+{
+ return host->syncpt_op->set_protection(host, enabled);
+}
+
static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
void (*syncpt_thresh_work)(struct work_struct *))
{
diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
index 8447a56c41ca..0161da331702 100644
--- a/drivers/gpu/host1x/hw/channel_hw.c
+++ b/drivers/gpu/host1x/hw/channel_hw.c
@@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
+ /* assign syncpoint to channel */
+ host1x_hw_syncpt_assign_channel(host, sp, ch);
+
job->syncpt_end = syncval;
/* add a setclass for modules that require it */
diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
index 7b0270d60742..5d117ab1699e 100644
--- a/drivers/gpu/host1x/hw/syncpt_hw.c
+++ b/drivers/gpu/host1x/hw/syncpt_hw.c
@@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
return 0;
}
+static void syncpt_assign_channel(struct host1x_syncpt *sp,
+ struct host1x_channel *ch)
+{
+#if HOST1X_HW >= 6
+ struct host1x *host = sp->host;
+
+ if (!host->hv_regs)
+ return;
+
+ host1x_sync_writel(host,
+ HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
+ HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
+#endif
+}
+
+static void syncpt_set_protection(struct host1x *host, bool enabled)
+{
+#if HOST1X_HW >= 6
+ host1x_hypervisor_writel(host,
+ enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
+ HOST1X_HV_SYNCPT_PROT_EN);
+#endif
+}
+
static const struct host1x_syncpt_ops host1x_syncpt_ops = {
.restore = syncpt_restore,
.restore_wait_base = syncpt_restore_wait_base,
@@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
.load = syncpt_load,
.cpu_incr = syncpt_cpu_incr,
.patch_wait = syncpt_patch_wait,
+ .assign_channel = syncpt_assign_channel,
+ .set_protection = syncpt_set_protection,
};
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 048ac9e344ce..fe4d963b3e2a 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
for (i = 0; i < host->info->nb_pts; i++) {
syncpt[i].id = i;
syncpt[i].host = host;
+
+ host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
}
for (i = 0; i < host->info->nb_bases; i++)
@@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
host->bases = bases;
host1x_syncpt_restore(host);
+ host1x_hw_syncpt_set_protection(host, true);
/* Allocate sync point to use for clearing waits for expired fences */
host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 00:40 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ufY5P-1ue-1@gated-at.bofh.it> |
| In reply to | #1715299 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
> specific channels, preventing any other channels from incrementing
> them.
>
> Enable this feature where available and assign syncpoints to channels
> when submitting a job. Syncpoints are currently never unassigned from
> channels since that would require extra work and is unnecessary with
> the current channel allocation model.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
> drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
> drivers/gpu/host1x/hw/channel_hw.c | 3 +++
> drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/host1x/syncpt.c | 3 +++
> 4 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
> index def802c0a6bf..2432a30ff6e2 100644
> --- a/drivers/gpu/host1x/dev.h
> +++ b/drivers/gpu/host1x/dev.h
> @@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
> u32 (*load)(struct host1x_syncpt *syncpt);
> int (*cpu_incr)(struct host1x_syncpt *syncpt);
> int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
> + void (*assign_channel)(struct host1x_syncpt *syncpt,
> + struct host1x_channel *channel);
> + void (*set_protection)(struct host1x *host, bool enabled);
> };
>
> struct host1x_intr_ops {
> @@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
> return host->syncpt_op->patch_wait(sp, patch_addr);
> }
>
> +static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
> + struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> + return host->syncpt_op->assign_channel(sp, ch);
> +}
> +
> +static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
> + bool enabled)
> +{
> + return host->syncpt_op->set_protection(host, enabled);
> +}
> +
> static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
> void (*syncpt_thresh_work)(struct work_struct *))
> {
> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
> index 8447a56c41ca..0161da331702 100644
> --- a/drivers/gpu/host1x/hw/channel_hw.c
> +++ b/drivers/gpu/host1x/hw/channel_hw.c
> @@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
>
> syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
>
> + /* assign syncpoint to channel */
> + host1x_hw_syncpt_assign_channel(host, sp, ch);
> +
> job->syncpt_end = syncval;
>
> /* add a setclass for modules that require it */
> diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
> index 7b0270d60742..5d117ab1699e 100644
> --- a/drivers/gpu/host1x/hw/syncpt_hw.c
> +++ b/drivers/gpu/host1x/hw/syncpt_hw.c
> @@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
> return 0;
> }
>
> +static void syncpt_assign_channel(struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> +#if HOST1X_HW >= 6
> + struct host1x *host = sp->host;
> +
> + if (!host->hv_regs)
> + return;
> +
> + host1x_sync_writel(host,
> + HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
> + HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
> +#endif
> +}
> +
> +static void syncpt_set_protection(struct host1x *host, bool enabled)
> +{
> +#if HOST1X_HW >= 6
> + host1x_hypervisor_writel(host,
> + enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
> + HOST1X_HV_SYNCPT_PROT_EN);
> +#endif
> +}
> +
> static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .restore = syncpt_restore,
> .restore_wait_base = syncpt_restore_wait_base,
> @@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .load = syncpt_load,
> .cpu_incr = syncpt_cpu_incr,
> .patch_wait = syncpt_patch_wait,
> + .assign_channel = syncpt_assign_channel,
> + .set_protection = syncpt_set_protection,
> };
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index 048ac9e344ce..fe4d963b3e2a 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
> for (i = 0; i < host->info->nb_pts; i++) {
> syncpt[i].id = i;
> syncpt[i].host = host;
> +
> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
> }
>
> for (i = 0; i < host->info->nb_bases; i++)
> @@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
> host->bases = bases;
>
> host1x_syncpt_restore(host);
> + host1x_hw_syncpt_set_protection(host, true);
Is it really okay to force the protection? Maybe protection should be enabled
with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to
avoid software jobs validation for Tegra124+.
>
> /* Allocate sync point to use for clearing waits for expired fences */
> host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Mikko Perttunen <cyndis@kapsi.fi> |
|---|---|
| Date | 2017-08-19 10:20 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ug798-7h3-7@gated-at.bofh.it> |
| In reply to | #1715487 |
On 08/19/2017 01:36 AM, Dmitry Osipenko wrote:
> On 18.08.2017 19:15, Mikko Perttunen wrote:
>> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
>> specific channels, preventing any other channels from incrementing
>> them.
>>
>> Enable this feature where available and assign syncpoints to channels
>> when submitting a job. Syncpoints are currently never unassigned from
>> channels since that would require extra work and is unnecessary with
>> the current channel allocation model.
>>
>> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
>> ---
>> drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
>> drivers/gpu/host1x/hw/channel_hw.c | 3 +++
>> drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
>> drivers/gpu/host1x/syncpt.c | 3 +++
>> 4 files changed, 48 insertions(+)
>>
>> diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
>> index def802c0a6bf..2432a30ff6e2 100644
>> --- a/drivers/gpu/host1x/dev.h
>> +++ b/drivers/gpu/host1x/dev.h
>> @@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
>> u32 (*load)(struct host1x_syncpt *syncpt);
>> int (*cpu_incr)(struct host1x_syncpt *syncpt);
>> int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
>> + void (*assign_channel)(struct host1x_syncpt *syncpt,
>> + struct host1x_channel *channel);
>> + void (*set_protection)(struct host1x *host, bool enabled);
>> };
>>
>> struct host1x_intr_ops {
>> @@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
>> return host->syncpt_op->patch_wait(sp, patch_addr);
>> }
>>
>> +static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
>> + struct host1x_syncpt *sp,
>> + struct host1x_channel *ch)
>> +{
>> + return host->syncpt_op->assign_channel(sp, ch);
>> +}
>> +
>> +static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
>> + bool enabled)
>> +{
>> + return host->syncpt_op->set_protection(host, enabled);
>> +}
>> +
>> static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
>> void (*syncpt_thresh_work)(struct work_struct *))
>> {
>> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
>> index 8447a56c41ca..0161da331702 100644
>> --- a/drivers/gpu/host1x/hw/channel_hw.c
>> +++ b/drivers/gpu/host1x/hw/channel_hw.c
>> @@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
>>
>> syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
>>
>> + /* assign syncpoint to channel */
>> + host1x_hw_syncpt_assign_channel(host, sp, ch);
>> +
>> job->syncpt_end = syncval;
>>
>> /* add a setclass for modules that require it */
>> diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
>> index 7b0270d60742..5d117ab1699e 100644
>> --- a/drivers/gpu/host1x/hw/syncpt_hw.c
>> +++ b/drivers/gpu/host1x/hw/syncpt_hw.c
>> @@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
>> return 0;
>> }
>>
>> +static void syncpt_assign_channel(struct host1x_syncpt *sp,
>> + struct host1x_channel *ch)
>> +{
>> +#if HOST1X_HW >= 6
>> + struct host1x *host = sp->host;
>> +
>> + if (!host->hv_regs)
>> + return;
>> +
>> + host1x_sync_writel(host,
>> + HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
>> + HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
>> +#endif
>> +}
>> +
>> +static void syncpt_set_protection(struct host1x *host, bool enabled)
>> +{
>> +#if HOST1X_HW >= 6
>> + host1x_hypervisor_writel(host,
>> + enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
>> + HOST1X_HV_SYNCPT_PROT_EN);
>> +#endif
>> +}
>> +
>> static const struct host1x_syncpt_ops host1x_syncpt_ops = {
>> .restore = syncpt_restore,
>> .restore_wait_base = syncpt_restore_wait_base,
>> @@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
>> .load = syncpt_load,
>> .cpu_incr = syncpt_cpu_incr,
>> .patch_wait = syncpt_patch_wait,
>> + .assign_channel = syncpt_assign_channel,
>> + .set_protection = syncpt_set_protection,
>> };
>> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
>> index 048ac9e344ce..fe4d963b3e2a 100644
>> --- a/drivers/gpu/host1x/syncpt.c
>> +++ b/drivers/gpu/host1x/syncpt.c
>> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
>> for (i = 0; i < host->info->nb_pts; i++) {
>> syncpt[i].id = i;
>> syncpt[i].host = host;
>> +
>> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
>> }
>>
>> for (i = 0; i < host->info->nb_bases; i++)
>> @@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
>> host->bases = bases;
>>
>> host1x_syncpt_restore(host);
>> + host1x_hw_syncpt_set_protection(host, true);
>
> Is it really okay to force the protection? Maybe protection should be enabled
> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to
> avoid software jobs validation for Tegra124+.
I don't quite get your comment. The hardware syncpt protection layer
being enabled should never hurt - it doesn't mess with any valid jobs.
It's also only on Tegra186 so I'm not sure where the Tegra124 comes from.
Cheers,
Mikko
>
>>
>> /* Allocate sync point to use for clearing waits for expired fences */
>> host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
>>
>
>
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 12:20 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ug91f-8vG-9@gated-at.bofh.it> |
| In reply to | #1715587 |
On 19.08.2017 11:10, Mikko Perttunen wrote: [snip] >>> + host1x_hw_syncpt_set_protection(host, true); >> >> Is it really okay to force the protection? Maybe protection should be enabled >> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to >> avoid software jobs validation for Tegra124+. > > I don't quite get your comment. The hardware syncpt protection layer being > enabled should never hurt - it doesn't mess with any valid jobs. It's also only > on Tegra186 so I'm not sure where the Tegra124 comes from. Right, it's the gather filter on T124+, my bad. This raises several questions. 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we actually want to be a bit more flexible and allow to disable it. Imagine that you are making a custom application and want to utilize channels in a different way. 2) Since syncpoint protection is a T186 feature, what about previous generations? Should we validate syncpoints in software for them? We have 'syncpoint validation' patch staged in grate's kernel https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7 (I'll start sending out this and other patches after a bit more thorough testing.) Improperly used syncpoints potentially could allow one program to damage others. 3) What exactly does gather filter? Could you list all the commands that it filters out, please? 4) What about T30/T114 that do not have gather filter? Should we validate those commands for them in a software firewall? So maybe we should implement several layers of validation in the SW firewall. Like all layers for T20 (memory boundaries validation etc), software gather filter for T30/114 and software syncpoint validation for T30/114/124/210. -- Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Mikko Perttunen <cyndis@kapsi.fi> |
|---|---|
| Date | 2017-08-19 12:40 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ug9kC-aj-19@gated-at.bofh.it> |
| In reply to | #1715624 |
On 08/19/2017 01:09 PM, Dmitry Osipenko wrote: > On 19.08.2017 11:10, Mikko Perttunen wrote: > [snip] >>>> + host1x_hw_syncpt_set_protection(host, true); >>> >>> Is it really okay to force the protection? Maybe protection should be enabled >>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to >>> avoid software jobs validation for Tegra124+. >> >> I don't quite get your comment. The hardware syncpt protection layer being >> enabled should never hurt - it doesn't mess with any valid jobs. It's also only >> on Tegra186 so I'm not sure where the Tegra124 comes from. > > Right, it's the gather filter on T124+, my bad. This raises several questions. > > 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we > actually want to be a bit more flexible and allow to disable it. Imagine that > you are making a custom application and want to utilize channels in a different way. I think it should be up to the user to decide whether they want the firewall or not. It's clearly the most useful on the older chips - especially Tegra20 due to lack of IOMMU. The performance penalty is too great to force it on always. The programming model should always be considered the same - the rules of what you are allowed to do are the same whether the firewall, or any hardware-implemented protection features, are on or not. > > 2) Since syncpoint protection is a T186 feature, what about previous > generations? Should we validate syncpoints in software for them? We have > 'syncpoint validation' patch staged in grate's kernel > https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7 > (I'll start sending out this and other patches after a bit more thorough > testing.) Improperly used syncpoints potentially could allow one program to > damage others. Yes, I think the firewall should have this feature for older generations. We could disable the check on Tegra186, as you point towards in question 4. > > 3) What exactly does gather filter? Could you list all the commands that it > filters out, please? According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND are filtered. > > 4) What about T30/T114 that do not have gather filter? Should we validate those > commands for them in a software firewall? Yes, the firewall should validate that. > > So maybe we should implement several layers of validation in the SW firewall. > Like all layers for T20 (memory boundaries validation etc), software gather > filter for T30/114 and software syncpoint validation for T30/114/124/210. > That seems like a good idea. Thanks, Mikko
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 13:20 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ug9Xk-Ce-17@gated-at.bofh.it> |
| In reply to | #1715632 |
On 19.08.2017 13:35, Mikko Perttunen wrote: > On 08/19/2017 01:09 PM, Dmitry Osipenko wrote: >> On 19.08.2017 11:10, Mikko Perttunen wrote: >> [snip] >>>>> + host1x_hw_syncpt_set_protection(host, true); >>>> >>>> Is it really okay to force the protection? Maybe protection should be enabled >>>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to >>>> avoid software jobs validation for Tegra124+. >>> >>> I don't quite get your comment. The hardware syncpt protection layer being >>> enabled should never hurt - it doesn't mess with any valid jobs. It's also only >>> on Tegra186 so I'm not sure where the Tegra124 comes from. >> >> Right, it's the gather filter on T124+, my bad. This raises several questions. >> >> 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we >> actually want to be a bit more flexible and allow to disable it. Imagine that >> you are making a custom application and want to utilize channels in a >> different way. > > I think it should be up to the user to decide whether they want the firewall or > not. It's clearly the most useful on the older chips - especially Tegra20 due to > lack of IOMMU. The performance penalty is too great to force it on always. > Of course there is some overhead but is not that great. Usually command buffer contains just a dozen of commands. It should be an interesting challenge to optimize its performance though. > The programming model should always be considered the same - the rules of what > you are allowed to do are the same whether the firewall, or any > hardware-implemented protection features, are on or not. > Well, okay. >> >> 2) Since syncpoint protection is a T186 feature, what about previous >> generations? Should we validate syncpoints in software for them? We have >> 'syncpoint validation' patch staged in grate's kernel >> https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7 >> >> (I'll start sending out this and other patches after a bit more thorough >> testing.) Improperly used syncpoints potentially could allow one program to >> damage others. > > Yes, I think the firewall should have this feature for older generations. We > could disable the check on Tegra186, as you point towards in question 4. > >> >> 3) What exactly does gather filter? Could you list all the commands that it >> filters out, please? > > According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND > are filtered. > Okay, then what about SETSTRMID command, I don't see its disassembly in the host1x gather debug dump. Is it accidentally missed? >> >> 4) What about T30/T114 that do not have gather filter? Should we validate those >> commands for them in a software firewall? > > Yes, the firewall should validate that. > >> >> So maybe we should implement several layers of validation in the SW firewall. >> Like all layers for T20 (memory boundaries validation etc), software gather >> filter for T30/114 and software syncpoint validation for T30/114/124/210. >> > > That seems like a good idea. Alright, factoring out firewall from job.c probably should be the first step. -- Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Mikko Perttunen <cyndis@kapsi.fi> |
|---|---|
| Date | 2017-08-19 13:40 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugagF-KD-5@gated-at.bofh.it> |
| In reply to | #1715639 |
On 08/19/2017 02:11 PM, Dmitry Osipenko wrote: > On 19.08.2017 13:35, Mikko Perttunen wrote: >> On 08/19/2017 01:09 PM, Dmitry Osipenko wrote: >>> On 19.08.2017 11:10, Mikko Perttunen wrote: >>> [snip] >>>>>> + host1x_hw_syncpt_set_protection(host, true); >>>>> >>>>> Is it really okay to force the protection? Maybe protection should be enabled >>>>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to >>>>> avoid software jobs validation for Tegra124+. >>>> >>>> I don't quite get your comment. The hardware syncpt protection layer being >>>> enabled should never hurt - it doesn't mess with any valid jobs. It's also only >>>> on Tegra186 so I'm not sure where the Tegra124 comes from. >>> >>> Right, it's the gather filter on T124+, my bad. This raises several questions. >>> >>> 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we >>> actually want to be a bit more flexible and allow to disable it. Imagine that >>> you are making a custom application and want to utilize channels in a >>> different way. >> >> I think it should be up to the user to decide whether they want the firewall or >> not. It's clearly the most useful on the older chips - especially Tegra20 due to >> lack of IOMMU. The performance penalty is too great to force it on always. >> > > Of course there is some overhead but is not that great. Usually command buffer > contains just a dozen of commands. It should be an interesting challenge to > optimize its performance though. > >> The programming model should always be considered the same - the rules of what >> you are allowed to do are the same whether the firewall, or any >> hardware-implemented protection features, are on or not. >> > > Well, okay. > >>> >>> 2) Since syncpoint protection is a T186 feature, what about previous >>> generations? Should we validate syncpoints in software for them? We have >>> 'syncpoint validation' patch staged in grate's kernel >>> https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7 >>> >>> (I'll start sending out this and other patches after a bit more thorough >>> testing.) Improperly used syncpoints potentially could allow one program to >>> damage others. >> >> Yes, I think the firewall should have this feature for older generations. We >> could disable the check on Tegra186, as you point towards in question 4. >> >>> >>> 3) What exactly does gather filter? Could you list all the commands that it >>> filters out, please? >> >> According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND >> are filtered. >> > > Okay, then what about SETSTRMID command, I don't see its disassembly in the > host1x gather debug dump. Is it accidentally missed? > True, it's a new command in Tegra186 and I missed adding it to the disassembler. It's probably fine to add it in another patch since it's only intended for kernel use and it's useless without IOMMU support anyway (which we don't have currently on Tegra186). >>> >>> 4) What about T30/T114 that do not have gather filter? Should we validate those >>> commands for them in a software firewall? >> >> Yes, the firewall should validate that. >> >>> >>> So maybe we should implement several layers of validation in the SW firewall. >>> Like all layers for T20 (memory boundaries validation etc), software gather >>> filter for T30/114 and software syncpoint validation for T30/114/124/210. >>> >> >> That seems like a good idea. > > Alright, factoring out firewall from job.c probably should be the first step. >
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 14:00 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugaA1-Ra-3@gated-at.bofh.it> |
| In reply to | #1715643 |
On 19.08.2017 14:32, Mikko Perttunen wrote: > > > On 08/19/2017 02:11 PM, Dmitry Osipenko wrote: >> On 19.08.2017 13:35, Mikko Perttunen wrote: >>> On 08/19/2017 01:09 PM, Dmitry Osipenko wrote: >>>> On 19.08.2017 11:10, Mikko Perttunen wrote: >>>> [snip] >>>>>>> + host1x_hw_syncpt_set_protection(host, true); >>>>>> >>>>>> Is it really okay to force the protection? Maybe protection should be enabled >>>>>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to >>>>>> avoid software jobs validation for Tegra124+. >>>>> >>>>> I don't quite get your comment. The hardware syncpt protection layer being >>>>> enabled should never hurt - it doesn't mess with any valid jobs. It's also >>>>> only >>>>> on Tegra186 so I'm not sure where the Tegra124 comes from. >>>> >>>> Right, it's the gather filter on T124+, my bad. This raises several questions. >>>> >>>> 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we >>>> actually want to be a bit more flexible and allow to disable it. Imagine that >>>> you are making a custom application and want to utilize channels in a >>>> different way. >>> >>> I think it should be up to the user to decide whether they want the firewall or >>> not. It's clearly the most useful on the older chips - especially Tegra20 due to >>> lack of IOMMU. The performance penalty is too great to force it on always. >>> >> >> Of course there is some overhead but is not that great. Usually command buffer >> contains just a dozen of commands. It should be an interesting challenge to >> optimize its performance though. >> >>> The programming model should always be considered the same - the rules of what >>> you are allowed to do are the same whether the firewall, or any >>> hardware-implemented protection features, are on or not. >>> >> >> Well, okay. >> >>>> >>>> 2) Since syncpoint protection is a T186 feature, what about previous >>>> generations? Should we validate syncpoints in software for them? We have >>>> 'syncpoint validation' patch staged in grate's kernel >>>> https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7 >>>> >>>> >>>> (I'll start sending out this and other patches after a bit more thorough >>>> testing.) Improperly used syncpoints potentially could allow one program to >>>> damage others. >>> >>> Yes, I think the firewall should have this feature for older generations. We >>> could disable the check on Tegra186, as you point towards in question 4. >>> >>>> >>>> 3) What exactly does gather filter? Could you list all the commands that it >>>> filters out, please? >>> >>> According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND >>> are filtered. >>> >> >> Okay, then what about SETSTRMID command, I don't see its disassembly in the >> host1x gather debug dump. Is it accidentally missed? >> > > True, it's a new command in Tegra186 and I missed adding it to the disassembler. > It's probably fine to add it in another patch since it's only intended for > kernel use and it's useless without IOMMU support anyway (which we don't have > currently on Tegra186). > Yeah, but it probably would be more preferable that this patch would predate the "gather filter" enabling. >>>> >>>> 4) What about T30/T114 that do not have gather filter? Should we validate those >>>> commands for them in a software firewall? >>> >>> Yes, the firewall should validate that. >>> >>>> >>>> So maybe we should implement several layers of validation in the SW firewall. >>>> Like all layers for T20 (memory boundaries validation etc), software gather >>>> filter for T30/114 and software syncpoint validation for T30/114/124/210. >>>> >>> >>> That seems like a good idea. >> >> Alright, factoring out firewall from job.c probably should be the first step. >> -- Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 14:10 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugaJI-19w-9@gated-at.bofh.it> |
| In reply to | #1715299 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
> specific channels, preventing any other channels from incrementing
> them.
>
> Enable this feature where available and assign syncpoints to channels
> when submitting a job. Syncpoints are currently never unassigned from
> channels since that would require extra work and is unnecessary with
> the current channel allocation model.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
[snip]
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index 048ac9e344ce..fe4d963b3e2a 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
> for (i = 0; i < host->info->nb_pts; i++) {
> syncpt[i].id = i;
> syncpt[i].host = host;
> +
> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
> }
What about to factor out that assignment and add a comment, something like this:
/* clear syncpoint-channel assignments on Tegra186+ */
for (i = 0; i < host->info->nb_pts; i++)
host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
And maybe even add an inline function for clarity, like:
static inline void host1x_hw_syncpt_deassign_channel(struct host1x *host,
struct host1x_syncpt *sp)
{
return host->syncpt_op->assign_channel(sp, NULL);
}
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 18:20 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugB7b-Nn-7@gated-at.bofh.it> |
| In reply to | #1715299 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
> specific channels, preventing any other channels from incrementing
> them.
>
> Enable this feature where available and assign syncpoints to channels
> when submitting a job. Syncpoints are currently never unassigned from
> channels since that would require extra work and is unnecessary with
> the current channel allocation model.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
> drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
> drivers/gpu/host1x/hw/channel_hw.c | 3 +++
> drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/host1x/syncpt.c | 3 +++
> 4 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
> index def802c0a6bf..2432a30ff6e2 100644
> --- a/drivers/gpu/host1x/dev.h
> +++ b/drivers/gpu/host1x/dev.h
> @@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
> u32 (*load)(struct host1x_syncpt *syncpt);
> int (*cpu_incr)(struct host1x_syncpt *syncpt);
> int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
> + void (*assign_channel)(struct host1x_syncpt *syncpt,
> + struct host1x_channel *channel);
> + void (*set_protection)(struct host1x *host, bool enabled);
> };
>
> struct host1x_intr_ops {
> @@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
> return host->syncpt_op->patch_wait(sp, patch_addr);
> }
>
> +static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
> + struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> + return host->syncpt_op->assign_channel(sp, ch);
> +}
> +
> +static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
> + bool enabled)
> +{
> + return host->syncpt_op->set_protection(host, enabled);
> +}
> +
> static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
> void (*syncpt_thresh_work)(struct work_struct *))
> {
> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
> index 8447a56c41ca..0161da331702 100644
> --- a/drivers/gpu/host1x/hw/channel_hw.c
> +++ b/drivers/gpu/host1x/hw/channel_hw.c
> @@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
>
> syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
>
> + /* assign syncpoint to channel */
> + host1x_hw_syncpt_assign_channel(host, sp, ch);
> +
> job->syncpt_end = syncval;
>
> /* add a setclass for modules that require it */
> diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
> index 7b0270d60742..5d117ab1699e 100644
> --- a/drivers/gpu/host1x/hw/syncpt_hw.c
> +++ b/drivers/gpu/host1x/hw/syncpt_hw.c
> @@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
> return 0;
> }
>
> +static void syncpt_assign_channel(struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> +#if HOST1X_HW >= 6
> + struct host1x *host = sp->host;
> +
> + if (!host->hv_regs)
> + return;
> +
> + host1x_sync_writel(host,
> + HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
> + HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
> +#endif
> +}
> +
> +static void syncpt_set_protection(struct host1x *host, bool enabled)
> +{
> +#if HOST1X_HW >= 6
> + host1x_hypervisor_writel(host,
> + enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
> + HOST1X_HV_SYNCPT_PROT_EN);
> +#endif
> +}
> +
> static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .restore = syncpt_restore,
> .restore_wait_base = syncpt_restore_wait_base,
> @@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .load = syncpt_load,
> .cpu_incr = syncpt_cpu_incr,
> .patch_wait = syncpt_patch_wait,
> + .assign_channel = syncpt_assign_channel,
> + .set_protection = syncpt_set_protection,
> };
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index 048ac9e344ce..fe4d963b3e2a 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
> for (i = 0; i < host->info->nb_pts; i++) {
> syncpt[i].id = i;
> syncpt[i].host = host;
> +
> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
> }
>
> for (i = 0; i < host->info->nb_bases; i++)
> @@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
> host->bases = bases;
>
> host1x_syncpt_restore(host);
> + host1x_hw_syncpt_set_protection(host, true);
Since protection is never disabled maybe something like
host1x_hw_syncpt_enable_protection() would fit a bit better.
>
> /* Allocate sync point to use for clearing waits for expired fences */
> host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 19:00 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugBJT-12y-13@gated-at.bofh.it> |
| In reply to | #1715299 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
> specific channels, preventing any other channels from incrementing
> them.
>
> Enable this feature where available and assign syncpoints to channels
> when submitting a job. Syncpoints are currently never unassigned from
> channels since that would require extra work and is unnecessary with
> the current channel allocation model.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
> drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
> drivers/gpu/host1x/hw/channel_hw.c | 3 +++
> drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/host1x/syncpt.c | 3 +++
> 4 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
> index def802c0a6bf..2432a30ff6e2 100644
> --- a/drivers/gpu/host1x/dev.h
> +++ b/drivers/gpu/host1x/dev.h
> @@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
> u32 (*load)(struct host1x_syncpt *syncpt);
> int (*cpu_incr)(struct host1x_syncpt *syncpt);
> int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
> + void (*assign_channel)(struct host1x_syncpt *syncpt,
> + struct host1x_channel *channel);
> + void (*set_protection)(struct host1x *host, bool enabled);
> };
>
> struct host1x_intr_ops {
> @@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
> return host->syncpt_op->patch_wait(sp, patch_addr);
> }
>
> +static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
> + struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> + return host->syncpt_op->assign_channel(sp, ch);
> +}
> +
> +static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
> + bool enabled)
> +{
> + return host->syncpt_op->set_protection(host, enabled);
> +}
> +
> static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
> void (*syncpt_thresh_work)(struct work_struct *))
> {
> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
> index 8447a56c41ca..0161da331702 100644
> --- a/drivers/gpu/host1x/hw/channel_hw.c
> +++ b/drivers/gpu/host1x/hw/channel_hw.c
> @@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
>
> syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
>
> + /* assign syncpoint to channel */
> + host1x_hw_syncpt_assign_channel(host, sp, ch);
> +
> job->syncpt_end = syncval;
>
> /* add a setclass for modules that require it */
> diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
> index 7b0270d60742..5d117ab1699e 100644
> --- a/drivers/gpu/host1x/hw/syncpt_hw.c
> +++ b/drivers/gpu/host1x/hw/syncpt_hw.c
> @@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
> return 0;
> }
>
> +static void syncpt_assign_channel(struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> +#if HOST1X_HW >= 6
> + struct host1x *host = sp->host;
> +
> + if (!host->hv_regs)
> + return;
This check should be placed in syncpt_set_protection().
> +
> + host1x_sync_writel(host,
> + HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
> + HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
> +#endif
> +}
> +
> +static void syncpt_set_protection(struct host1x *host, bool enabled)
> +{
> +#if HOST1X_HW >= 6
> + host1x_hypervisor_writel(host,
> + enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
> + HOST1X_HV_SYNCPT_PROT_EN);
> +#endif
> +}
> +
> static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .restore = syncpt_restore,
> .restore_wait_base = syncpt_restore_wait_base,
> @@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .load = syncpt_load,
> .cpu_incr = syncpt_cpu_incr,
> .patch_wait = syncpt_patch_wait,
> + .assign_channel = syncpt_assign_channel,
> + .set_protection = syncpt_set_protection,
> };
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index 048ac9e344ce..fe4d963b3e2a 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
> for (i = 0; i < host->info->nb_pts; i++) {
> syncpt[i].id = i;
> syncpt[i].host = host;
> +
> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
> }
>
> for (i = 0; i < host->info->nb_bases; i++)
> @@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
> host->bases = bases;
>
> host1x_syncpt_restore(host);
> + host1x_hw_syncpt_set_protection(host, true);
>
> /* Allocate sync point to use for clearing waits for expired fences */
> host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 20:20 +0200 |
| Subject | Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection |
| Message-ID | <ugCZk-1Ze-3@gated-at.bofh.it> |
| In reply to | #1715299 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> Since Tegra186 the Host1x hardware allows syncpoints to be assigned to
> specific channels, preventing any other channels from incrementing
> them.
>
> Enable this feature where available and assign syncpoints to channels
> when submitting a job. Syncpoints are currently never unassigned from
> channels since that would require extra work and is unnecessary with
> the current channel allocation model.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
> drivers/gpu/host1x/dev.h | 16 ++++++++++++++++
> drivers/gpu/host1x/hw/channel_hw.c | 3 +++
> drivers/gpu/host1x/hw/syncpt_hw.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/host1x/syncpt.c | 3 +++
> 4 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
> index def802c0a6bf..2432a30ff6e2 100644
> --- a/drivers/gpu/host1x/dev.h
> +++ b/drivers/gpu/host1x/dev.h
> @@ -79,6 +79,9 @@ struct host1x_syncpt_ops {
> u32 (*load)(struct host1x_syncpt *syncpt);
> int (*cpu_incr)(struct host1x_syncpt *syncpt);
> int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
> + void (*assign_channel)(struct host1x_syncpt *syncpt,
> + struct host1x_channel *channel);
> + void (*set_protection)(struct host1x *host, bool enabled);
> };
>
> struct host1x_intr_ops {
> @@ -186,6 +189,19 @@ static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
> return host->syncpt_op->patch_wait(sp, patch_addr);
> }
>
> +static inline void host1x_hw_syncpt_assign_channel(struct host1x *host,
> + struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> + return host->syncpt_op->assign_channel(sp, ch);
> +}
> +
> +static inline void host1x_hw_syncpt_set_protection(struct host1x *host,
> + bool enabled)
> +{
> + return host->syncpt_op->set_protection(host, enabled);
> +}
> +
> static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
> void (*syncpt_thresh_work)(struct work_struct *))
> {
> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
> index 8447a56c41ca..0161da331702 100644
> --- a/drivers/gpu/host1x/hw/channel_hw.c
> +++ b/drivers/gpu/host1x/hw/channel_hw.c
> @@ -147,6 +147,9 @@ static int channel_submit(struct host1x_job *job)
>
> syncval = host1x_syncpt_incr_max(sp, user_syncpt_incrs);
>
> + /* assign syncpoint to channel */
> + host1x_hw_syncpt_assign_channel(host, sp, ch);
> +
Since there is one client per channel, it probably would make sense to assign
client syncpoints on host1x_channel_request().
> job->syncpt_end = syncval;
>
> /* add a setclass for modules that require it */
> diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
> index 7b0270d60742..5d117ab1699e 100644
> --- a/drivers/gpu/host1x/hw/syncpt_hw.c
> +++ b/drivers/gpu/host1x/hw/syncpt_hw.c
> @@ -106,6 +106,30 @@ static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
> return 0;
> }
>
> +static void syncpt_assign_channel(struct host1x_syncpt *sp,
> + struct host1x_channel *ch)
> +{
> +#if HOST1X_HW >= 6
> + struct host1x *host = sp->host;
> +
> + if (!host->hv_regs)
> + return;
> +
> + host1x_sync_writel(host,
> + HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
> + HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
> +#endif
> +}
> +
> +static void syncpt_set_protection(struct host1x *host, bool enabled)
> +{
> +#if HOST1X_HW >= 6
> + host1x_hypervisor_writel(host,
> + enabled ? HOST1X_HV_SYNCPT_PROT_EN_CH_EN : 0,
> + HOST1X_HV_SYNCPT_PROT_EN);
> +#endif
> +}
> +
> static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .restore = syncpt_restore,
> .restore_wait_base = syncpt_restore_wait_base,
> @@ -113,4 +137,6 @@ static const struct host1x_syncpt_ops host1x_syncpt_ops = {
> .load = syncpt_load,
> .cpu_incr = syncpt_cpu_incr,
> .patch_wait = syncpt_patch_wait,
> + .assign_channel = syncpt_assign_channel,
> + .set_protection = syncpt_set_protection,
> };
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index 048ac9e344ce..fe4d963b3e2a 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -398,6 +398,8 @@ int host1x_syncpt_init(struct host1x *host)
> for (i = 0; i < host->info->nb_pts; i++) {
> syncpt[i].id = i;
> syncpt[i].host = host;
> +
> + host1x_hw_syncpt_assign_channel(host, &syncpt[i], NULL);
> }
>
> for (i = 0; i < host->info->nb_bases; i++)
> @@ -408,6 +410,7 @@ int host1x_syncpt_init(struct host1x *host)
> host->bases = bases;
>
> host1x_syncpt_restore(host);
> + host1x_hw_syncpt_set_protection(host, true);
>
> /* Allocate sync point to use for clearing waits for expired fences */
> host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Mikko Perttunen <mperttunen@nvidia.com> |
|---|---|
| Date | 2017-08-18 18:20 +0200 |
| Subject | [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ufSa6-69c-23@gated-at.bofh.it> |
| In reply to | #1715297 |
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
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 12:50 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ug9uh-dN-1@gated-at.bofh.it> |
| In reply to | #1715301 |
On 18.08.2017 19:15, Mikko Perttunen wrote: > 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> > --- TRM says that "Invalid Gbuffer cmd" interrupt would be raised when filtering happens. Is that interrupt disabled by default or it would cause 'unhandled interrupt'? -- Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Mikko Perttunen <cyndis@kapsi.fi> |
|---|---|
| Date | 2017-08-19 12:50 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ug9ui-dN-7@gated-at.bofh.it> |
| In reply to | #1715633 |
On 08/19/2017 01:42 PM, Dmitry Osipenko wrote: > On 18.08.2017 19:15, Mikko Perttunen wrote: >> 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> >> --- > > TRM says that "Invalid Gbuffer cmd" interrupt would be raised when filtering > happens. Is that interrupt disabled by default or it would cause 'unhandled > interrupt'? > It's disabled by default. Jobs that are stopped by the filter are then handled by the usual timeout mechanism. Mikko
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-19 14:10 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ugaJI-19w-11@gated-at.bofh.it> |
| In reply to | #1715635 |
On 19.08.2017 13:46, Mikko Perttunen wrote: > On 08/19/2017 01:42 PM, Dmitry Osipenko wrote: >> On 18.08.2017 19:15, Mikko Perttunen wrote: >>> 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> >>> --- >> >> TRM says that "Invalid Gbuffer cmd" interrupt would be raised when filtering >> happens. Is that interrupt disabled by default or it would cause 'unhandled >> interrupt'? >> > > It's disabled by default. Jobs that are stopped by the filter are then handled > by the usual timeout mechanism. > Alright, then it looks good to me. Reviewed-by: Dmitry Osipenko <digetx@gmail.com> -- Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 18:30 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ugBgR-Qz-1@gated-at.bofh.it> |
| In reply to | #1715301 |
On 18.08.2017 19:15, Mikko Perttunen wrote:
> 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;
Is it really possible that gather filter could be not present on HW without
hypervisor? Maybe there is other way to enable it in that case?
Is possible at all that hypervisor could be missed?
> +
> + 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
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 18:50 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ugBAe-Z0-13@gated-at.bofh.it> |
| In reply to | #1715955 |
On 20.08.2017 19:24, Dmitry Osipenko wrote:
> On 18.08.2017 19:15, Mikko Perttunen wrote:
>> 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;
>
> Is it really possible that gather filter could be not present on HW without
> hypervisor? Maybe there is other way to enable it in that case?
>
> Is possible at all that hypervisor could be missed?
BTW, this is also incoherent with the 'syncpoint protection' patch which doesn't
check for hypervisor presence.
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Osipenko <digetx@gmail.com> |
|---|---|
| Date | 2017-08-20 19:00 +0200 |
| Subject | Re: [PATCH 2/4] gpu: host1x: Enable gather filter |
| Message-ID | <ugBJT-12y-15@gated-at.bofh.it> |
| In reply to | #1715967 |
On 20.08.2017 19:44, Dmitry Osipenko wrote:
> On 20.08.2017 19:24, Dmitry Osipenko wrote:
>> On 18.08.2017 19:15, Mikko Perttunen wrote:
>>> 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;
>>
>> Is it really possible that gather filter could be not present on HW without
>> hypervisor? Maybe there is other way to enable it in that case?
>>
>> Is possible at all that hypervisor could be missed?
>
> BTW, this is also incoherent with the 'syncpoint protection' patch which doesn't
> check for hypervisor presence.
>
However, I noticed that check and it's wrongly placed ;) See comment to the
'syncpoint protection' patch.
--
Dmitry
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web