summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-10-12 18:24:11 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:56:50 -0500
commitb6408e26c1a6c4c91233c144bae84db9728c4338 (patch)
tree8ff80253f32ecc7f3da7476c77dead79304a1089
parent7f7bf15564ad6a1198807e10bab156337f9dde9b (diff)
gpu: nvgpu: At FB reset wait for scrubber
We need to wait for scrubber to have finished before we can allow any accesses to memory. Do the wait in place where on iGPU we would do FB reset. Bug 1799537 Bug 1815139 Change-Id: Ic92dee936388a13c4abf0b295fd99581522c430f Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1235541 (cherry picked from commit 1ef73ecb4e37da042e7117426ab2823b7f4528dc) Reviewed-on: http://git-master/r/1239955 GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/gpu/nvgpu/gp106/fb_gp106.c21
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_fb_gp106.h28
2 files changed, 48 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gp106/fb_gp106.c b/drivers/gpu/nvgpu/gp106/fb_gp106.c
index 1c5b3e0a..ef9f1094 100644
--- a/drivers/gpu/nvgpu/gp106/fb_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/fb_gp106.c
@@ -12,14 +12,33 @@
12 */ 12 */
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/delay.h>
15 16
16#include "gk20a/gk20a.h" 17#include "gk20a/gk20a.h"
17#include "gp10b/fb_gp10b.h" 18#include "gp10b/fb_gp10b.h"
19#include "hw_fb_gp106.h"
20
21#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */
22#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */
23
24static void gp106_fb_reset(struct gk20a *g)
25{
26 int retries = HW_SCRUB_TIMEOUT_MAX / HW_SCRUB_TIMEOUT_DEFAULT;
27 /* wait for memory to be accessible */
28 do {
29 u32 w = gk20a_readl(g, fb_niso_scrub_status_r());
30 if (fb_niso_scrub_status_flag_v(w)) {
31 gk20a_dbg_fn("done");
32 break;
33 }
34 udelay(HW_SCRUB_TIMEOUT_DEFAULT);
35 } while (--retries);
36}
18 37
19void gp106_init_fb(struct gpu_ops *gops) 38void gp106_init_fb(struct gpu_ops *gops)
20{ 39{
21 gp10b_init_fb(gops); 40 gp10b_init_fb(gops);
22 41
23 gops->fb.init_fs_state = NULL; 42 gops->fb.init_fs_state = NULL;
24 gops->fb.reset = NULL; 43 gops->fb.reset = gp106_fb_reset;
25} 44}
diff --git a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
index d76f78b9..19d88464 100644
--- a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
+++ b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
@@ -574,4 +574,32 @@ static inline u32 fb_fbpa_fbio_cmd_delay_cmd_priv_max_v(void)
574{ 574{
575 return 1; 575 return 1;
576} 576}
577static inline u32 fb_niso_scrubber_status_r(void)
578{
579 return 0x00100b20;
580}
581static inline u32 fb_niso_scrubber_status_flag_s(void)
582{
583 return 1;
584}
585static inline u32 fb_niso_scrubber_status_flag_f(u32 v)
586{
587 return (v & 0x1) << 0;
588}
589static inline u32 fb_niso_scrubber_status_flag_m(void)
590{
591 return 0x1 << 0;
592}
593static inline u32 fb_niso_scrubber_status_flag_v(u32 r)
594{
595 return (r >> 0) & 0x1;
596}
597static inline u32 fb_niso_scrub_status_r(void)
598{
599 return 0x00100b20;
600}
601static inline u32 fb_niso_scrub_status_flag_v(u32 r)
602{
603 return (r >> 0) & 0x1;
604}
577#endif 605#endif