From d07c4b48cfd5bbd52e3ece9c0234d16c97b75228 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 6 Sep 2016 15:58:16 +0530 Subject: gpu: nvgpu: select target based on aperture While programming ucode's inst block in API gr_gk20a_load_falcon_bind_instblk(), use gk20a_aperture_mask() to select target address (i.e. if address is in sysmem or vidmem) based on aperture Also add target accessors for gr_fecs_new_ctx and gr_fecs_arb_ctx_ptr Jira DNVGPU-22 Change-Id: I88198080f188b349a4448a229dff8416a6a18073 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1216139 (cherry picked from commit 42bc14110df17400dd655bc994dc9e61c73048b1) Reviewed-on: http://git-master/r/1219703 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 8 ++++++-- drivers/gpu/nvgpu/gk20a/hw_gr_gk20a.h | 16 ++++++++++++++++ drivers/gpu/nvgpu/gm206/hw_gr_gm206.h | 16 ++++++++++++++++ drivers/gpu/nvgpu/gm20b/hw_gr_gm20b.h | 16 ++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 4c650520..35e4f0b8 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2219,12 +2219,16 @@ void gr_gk20a_load_falcon_bind_instblk(struct gk20a *g) inst_ptr = gk20a_mm_inst_block_addr(g, &ucode_info->inst_blk_desc); gk20a_writel(g, gr_fecs_new_ctx_r(), gr_fecs_new_ctx_ptr_f(inst_ptr >> 12) | - gr_fecs_new_ctx_target_m() | + gk20a_aperture_mask(g, &ucode_info->inst_blk_desc, + gr_fecs_new_ctx_target_sys_mem_ncoh_f(), + gr_fecs_new_ctx_target_vid_mem_f()) | gr_fecs_new_ctx_valid_m()); gk20a_writel(g, gr_fecs_arb_ctx_ptr_r(), gr_fecs_arb_ctx_ptr_ptr_f(inst_ptr >> 12) | - gr_fecs_arb_ctx_ptr_target_m()); + gk20a_aperture_mask(g, &ucode_info->inst_blk_desc, + gr_fecs_arb_ctx_ptr_target_sys_mem_ncoh_f(), + gr_fecs_arb_ctx_ptr_target_vid_mem_f())); gk20a_writel(g, gr_fecs_arb_ctx_cmd_r(), 0x7); diff --git a/drivers/gpu/nvgpu/gk20a/hw_gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/hw_gr_gk20a.h index 11cbe10c..1a888b53 100644 --- a/drivers/gpu/nvgpu/gk20a/hw_gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/hw_gr_gk20a.h @@ -1210,6 +1210,14 @@ static inline u32 gr_fecs_new_ctx_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_new_ctx_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_new_ctx_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_new_ctx_valid_s(void) { return 1; @@ -1262,6 +1270,14 @@ static inline u32 gr_fecs_arb_ctx_ptr_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_arb_ctx_ptr_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_arb_ctx_ptr_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_arb_ctx_cmd_r(void) { return 0x00409a10; diff --git a/drivers/gpu/nvgpu/gm206/hw_gr_gm206.h b/drivers/gpu/nvgpu/gm206/hw_gr_gm206.h index 011e3142..ff677844 100644 --- a/drivers/gpu/nvgpu/gm206/hw_gr_gm206.h +++ b/drivers/gpu/nvgpu/gm206/hw_gr_gm206.h @@ -1206,6 +1206,14 @@ static inline u32 gr_fecs_new_ctx_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_new_ctx_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_new_ctx_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_new_ctx_valid_s(void) { return 1; @@ -1258,6 +1266,14 @@ static inline u32 gr_fecs_arb_ctx_ptr_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_arb_ctx_ptr_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_arb_ctx_ptr_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_arb_ctx_cmd_r(void) { return 0x00409a10; diff --git a/drivers/gpu/nvgpu/gm20b/hw_gr_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_gr_gm20b.h index 45240e97..68b5a6d4 100644 --- a/drivers/gpu/nvgpu/gm20b/hw_gr_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/hw_gr_gm20b.h @@ -1226,6 +1226,14 @@ static inline u32 gr_fecs_new_ctx_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_new_ctx_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_new_ctx_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_new_ctx_valid_s(void) { return 1; @@ -1278,6 +1286,14 @@ static inline u32 gr_fecs_arb_ctx_ptr_target_v(u32 r) { return (r >> 28) & 0x3; } +static inline u32 gr_fecs_arb_ctx_ptr_target_vid_mem_f(void) +{ + return 0x0; +} +static inline u32 gr_fecs_arb_ctx_ptr_target_sys_mem_ncoh_f(void) +{ + return 0x30000000; +} static inline u32 gr_fecs_arb_ctx_cmd_r(void) { return 0x00409a10; -- cgit v1.2.2