Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Arto Merilainen <amerilainen@nvidia.com>
Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Arto Merilainen and committed by
Thierry Reding
ebae30b1 ece66891

+15 -32
+4 -4
drivers/gpu/host1x/dev.h
··· 73 73 void (*restore_wait_base)(struct host1x_syncpt *syncpt); 74 74 void (*load_wait_base)(struct host1x_syncpt *syncpt); 75 75 u32 (*load)(struct host1x_syncpt *syncpt); 76 - void (*cpu_incr)(struct host1x_syncpt *syncpt); 76 + int (*cpu_incr)(struct host1x_syncpt *syncpt); 77 77 int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr); 78 78 }; 79 79 ··· 157 157 return host->syncpt_op->load(sp); 158 158 } 159 159 160 - static inline void host1x_hw_syncpt_cpu_incr(struct host1x *host, 161 - struct host1x_syncpt *sp) 160 + static inline int host1x_hw_syncpt_cpu_incr(struct host1x *host, 161 + struct host1x_syncpt *sp) 162 162 { 163 - host->syncpt_op->cpu_incr(sp); 163 + return host->syncpt_op->cpu_incr(sp); 164 164 } 165 165 166 166 static inline int host1x_hw_syncpt_patch_wait(struct host1x *host,
+1 -2
drivers/gpu/host1x/drm/drm.c
··· 387 387 if (!sp) 388 388 return -EINVAL; 389 389 390 - host1x_syncpt_incr(sp); 391 - return 0; 390 + return host1x_syncpt_incr(sp); 392 391 } 393 392 394 393 static int tegra_syncpt_wait(struct drm_device *drm, void *data,
+1 -1
drivers/gpu/host1x/hw/cdma_hw.c
··· 44 44 u32 i; 45 45 46 46 for (i = 0; i < syncpt_incrs; i++) 47 - host1x_syncpt_cpu_incr(cdma->timeout.syncpt); 47 + host1x_syncpt_incr(cdma->timeout.syncpt); 48 48 49 49 /* after CPU incr, ensure shadow is up to date */ 50 50 host1x_syncpt_load(cdma->timeout.syncpt);
+5 -7
drivers/gpu/host1x/hw/syncpt_hw.c
··· 77 77 * Write a cpu syncpoint increment to the hardware, without touching 78 78 * the cache. 79 79 */ 80 - static void syncpt_cpu_incr(struct host1x_syncpt *sp) 80 + static int syncpt_cpu_incr(struct host1x_syncpt *sp) 81 81 { 82 82 struct host1x *host = sp->host; 83 83 u32 reg_offset = sp->id / 32; 84 84 85 85 if (!host1x_syncpt_client_managed(sp) && 86 - host1x_syncpt_idle(sp)) { 87 - dev_err(host->dev, "Trying to increment syncpoint id %d beyond max\n", 88 - sp->id); 89 - host1x_debug_dump(sp->host); 90 - return; 91 - } 86 + host1x_syncpt_idle(sp)) 87 + return -EINVAL; 92 88 host1x_sync_writel(host, BIT_MASK(sp->id), 93 89 HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset)); 94 90 wmb(); 91 + 92 + return 0; 95 93 } 96 94 97 95 /* remove a wait pointed to by patch_addr */
+2 -13
drivers/gpu/host1x/syncpt.c
··· 129 129 } 130 130 131 131 /* 132 - * Write a cpu syncpoint increment to the hardware, without touching 133 - * the cache. Caller is responsible for host being powered. 134 - */ 135 - void host1x_syncpt_cpu_incr(struct host1x_syncpt *sp) 136 - { 137 - host1x_hw_syncpt_cpu_incr(sp->host, sp); 138 - } 139 - 140 - /* 141 132 * Increment syncpoint value from cpu, updating cache 142 133 */ 143 - void host1x_syncpt_incr(struct host1x_syncpt *sp) 134 + int host1x_syncpt_incr(struct host1x_syncpt *sp) 144 135 { 145 - if (host1x_syncpt_client_managed(sp)) 146 - host1x_syncpt_incr_max(sp, 1); 147 - host1x_syncpt_cpu_incr(sp); 136 + return host1x_hw_syncpt_cpu_incr(sp->host, sp); 148 137 } 149 138 150 139 /*
+2 -5
drivers/gpu/host1x/syncpt.h
··· 115 115 /* Return pointer to struct denoting sync point id. */ 116 116 struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id); 117 117 118 - /* Request incrementing a sync point. */ 119 - void host1x_syncpt_cpu_incr(struct host1x_syncpt *sp); 120 - 121 118 /* Load current value from hardware to the shadow register. */ 122 119 u32 host1x_syncpt_load(struct host1x_syncpt *sp); 123 120 ··· 130 133 /* Read current wait base value into shadow register and return it. */ 131 134 u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp); 132 135 133 - /* Increment sync point and its max. */ 134 - void host1x_syncpt_incr(struct host1x_syncpt *sp); 136 + /* Request incrementing a sync point. */ 137 + int host1x_syncpt_incr(struct host1x_syncpt *sp); 135 138 136 139 /* Indicate future operations by incrementing the sync point max. */ 137 140 u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);