Commit ebae30b1 authored by Arto Merilainen's avatar Arto Merilainen Committed by Thierry Reding

gpu: host1x: Rework CPU syncpoint increment

This patch merges host1x_syncpt_cpu_incr to host1x_syncpt_incr() as
they are in practise doing the same thing. host1x_syncpt_incr() is
also modified to return error codes. User space interface is modified
accordingly to pass return values.
Signed-off-by: default avatarArto Merilainen <amerilainen@nvidia.com>
Acked-By: default avatarTerje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent ece66891
...@@ -73,7 +73,7 @@ struct host1x_syncpt_ops { ...@@ -73,7 +73,7 @@ struct host1x_syncpt_ops {
void (*restore_wait_base)(struct host1x_syncpt *syncpt); void (*restore_wait_base)(struct host1x_syncpt *syncpt);
void (*load_wait_base)(struct host1x_syncpt *syncpt); void (*load_wait_base)(struct host1x_syncpt *syncpt);
u32 (*load)(struct host1x_syncpt *syncpt); u32 (*load)(struct host1x_syncpt *syncpt);
void (*cpu_incr)(struct host1x_syncpt *syncpt); int (*cpu_incr)(struct host1x_syncpt *syncpt);
int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr); int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
}; };
...@@ -157,10 +157,10 @@ static inline u32 host1x_hw_syncpt_load(struct host1x *host, ...@@ -157,10 +157,10 @@ static inline u32 host1x_hw_syncpt_load(struct host1x *host,
return host->syncpt_op->load(sp); return host->syncpt_op->load(sp);
} }
static inline void host1x_hw_syncpt_cpu_incr(struct host1x *host, static inline int host1x_hw_syncpt_cpu_incr(struct host1x *host,
struct host1x_syncpt *sp) struct host1x_syncpt *sp)
{ {
host->syncpt_op->cpu_incr(sp); return host->syncpt_op->cpu_incr(sp);
} }
static inline int host1x_hw_syncpt_patch_wait(struct host1x *host, static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
......
...@@ -387,8 +387,7 @@ static int tegra_syncpt_incr(struct drm_device *drm, void *data, ...@@ -387,8 +387,7 @@ static int tegra_syncpt_incr(struct drm_device *drm, void *data,
if (!sp) if (!sp)
return -EINVAL; return -EINVAL;
host1x_syncpt_incr(sp); return host1x_syncpt_incr(sp);
return 0;
} }
static int tegra_syncpt_wait(struct drm_device *drm, void *data, static int tegra_syncpt_wait(struct drm_device *drm, void *data,
......
...@@ -44,7 +44,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr, ...@@ -44,7 +44,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
u32 i; u32 i;
for (i = 0; i < syncpt_incrs; i++) for (i = 0; i < syncpt_incrs; i++)
host1x_syncpt_cpu_incr(cdma->timeout.syncpt); host1x_syncpt_incr(cdma->timeout.syncpt);
/* after CPU incr, ensure shadow is up to date */ /* after CPU incr, ensure shadow is up to date */
host1x_syncpt_load(cdma->timeout.syncpt); host1x_syncpt_load(cdma->timeout.syncpt);
......
...@@ -77,21 +77,19 @@ static u32 syncpt_load(struct host1x_syncpt *sp) ...@@ -77,21 +77,19 @@ static u32 syncpt_load(struct host1x_syncpt *sp)
* Write a cpu syncpoint increment to the hardware, without touching * Write a cpu syncpoint increment to the hardware, without touching
* the cache. * the cache.
*/ */
static void syncpt_cpu_incr(struct host1x_syncpt *sp) static int syncpt_cpu_incr(struct host1x_syncpt *sp)
{ {
struct host1x *host = sp->host; struct host1x *host = sp->host;
u32 reg_offset = sp->id / 32; u32 reg_offset = sp->id / 32;
if (!host1x_syncpt_client_managed(sp) && if (!host1x_syncpt_client_managed(sp) &&
host1x_syncpt_idle(sp)) { host1x_syncpt_idle(sp))
dev_err(host->dev, "Trying to increment syncpoint id %d beyond max\n", return -EINVAL;
sp->id);
host1x_debug_dump(sp->host);
return;
}
host1x_sync_writel(host, BIT_MASK(sp->id), host1x_sync_writel(host, BIT_MASK(sp->id),
HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset)); HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset));
wmb(); wmb();
return 0;
} }
/* remove a wait pointed to by patch_addr */ /* remove a wait pointed to by patch_addr */
......
...@@ -128,23 +128,12 @@ u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp) ...@@ -128,23 +128,12 @@ u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp)
return val; return val;
} }
/*
* Write a cpu syncpoint increment to the hardware, without touching
* the cache. Caller is responsible for host being powered.
*/
void host1x_syncpt_cpu_incr(struct host1x_syncpt *sp)
{
host1x_hw_syncpt_cpu_incr(sp->host, sp);
}
/* /*
* Increment syncpoint value from cpu, updating cache * Increment syncpoint value from cpu, updating cache
*/ */
void host1x_syncpt_incr(struct host1x_syncpt *sp) int host1x_syncpt_incr(struct host1x_syncpt *sp)
{ {
if (host1x_syncpt_client_managed(sp)) return host1x_hw_syncpt_cpu_incr(sp->host, sp);
host1x_syncpt_incr_max(sp, 1);
host1x_syncpt_cpu_incr(sp);
} }
/* /*
......
...@@ -115,9 +115,6 @@ static inline bool host1x_syncpt_idle(struct host1x_syncpt *sp) ...@@ -115,9 +115,6 @@ static inline bool host1x_syncpt_idle(struct host1x_syncpt *sp)
/* Return pointer to struct denoting sync point id. */ /* Return pointer to struct denoting sync point id. */
struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id); struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id);
/* Request incrementing a sync point. */
void host1x_syncpt_cpu_incr(struct host1x_syncpt *sp);
/* Load current value from hardware to the shadow register. */ /* Load current value from hardware to the shadow register. */
u32 host1x_syncpt_load(struct host1x_syncpt *sp); u32 host1x_syncpt_load(struct host1x_syncpt *sp);
...@@ -133,8 +130,8 @@ void host1x_syncpt_restore(struct host1x *host); ...@@ -133,8 +130,8 @@ void host1x_syncpt_restore(struct host1x *host);
/* Read current wait base value into shadow register and return it. */ /* Read current wait base value into shadow register and return it. */
u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp); u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp);
/* Increment sync point and its max. */ /* Request incrementing a sync point. */
void host1x_syncpt_incr(struct host1x_syncpt *sp); int host1x_syncpt_incr(struct host1x_syncpt *sp);
/* Indicate future operations by incrementing the sync point max. */ /* Indicate future operations by incrementing the sync point max. */
u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs); u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment