summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-11-10 08:02:37 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-14 07:58:39 -0500
commit90aeab9dee07a63e4bac6d92646dfd80e65d2edd (patch)
treea175a1724590dc14c599db9c23f04d79a8f3ac79 /drivers/gpu/nvgpu/gm20b/gr_gm20b.c
parentfd2cac59f3491cb5b4f5d1f3fc97df94734bd682 (diff)
gpu: nvgpu: define preemption modes in common code
We use linux specific graphics/compute preemption modes defined in uapi header (and of below form) in all over common code NVGPU_GRAPHICS_PREEMPTION_MODE_* NVGPU_COMPUTE_PREEMPTION_MODE_* Since common code should be independent of linux specific code, define new modes of the form in common code and used them everywhere NVGPU_PREEMPTION_MODE_GRAPHICS_* NVGPU_PREEMPTION_MODE_COMPUTE_* Add required parser functions to convert both the modes into each other For linux IOCTL NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE, we need to convert linux specific modes into common modes first before passing them to common code And to pass gpu characteristics to user space we need to first convert common modes into linux specific modes and then pass them to user space Jira NVGPU-392 Change-Id: I8c62c6859bdc1baa5b44eb31c7020e42d2462c8c Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1596930 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/gr_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/gr_gm20b.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
index 20f8e062..ef46c1ee 100644
--- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
@@ -870,7 +870,7 @@ int gr_gm20b_alloc_gr_ctx(struct gk20a *g,
870 return err; 870 return err;
871 871
872 if (class == MAXWELL_COMPUTE_B) 872 if (class == MAXWELL_COMPUTE_B)
873 (*gr_ctx)->compute_preempt_mode = NVGPU_COMPUTE_PREEMPTION_MODE_CTA; 873 (*gr_ctx)->compute_preempt_mode = NVGPU_PREEMPTION_MODE_COMPUTE_CTA;
874 874
875 gk20a_dbg_fn("done"); 875 gk20a_dbg_fn("done");
876 876
@@ -887,7 +887,7 @@ void gr_gm20b_update_ctxsw_preemption_mode(struct gk20a *g,
887 887
888 gk20a_dbg_fn(""); 888 gk20a_dbg_fn("");
889 889
890 if (gr_ctx->compute_preempt_mode == NVGPU_COMPUTE_PREEMPTION_MODE_CTA) { 890 if (gr_ctx->compute_preempt_mode == NVGPU_PREEMPTION_MODE_COMPUTE_CTA) {
891 gk20a_dbg_info("CTA: %x", cta_preempt_option); 891 gk20a_dbg_info("CTA: %x", cta_preempt_option);
892 nvgpu_mem_wr(g, mem, 892 nvgpu_mem_wr(g, mem,
893 ctxsw_prog_main_image_preemption_options_o(), 893 ctxsw_prog_main_image_preemption_options_o(),
@@ -1410,15 +1410,15 @@ int gr_gm20b_get_preemption_mode_flags(struct gk20a *g,
1410 struct nvgpu_preemption_modes_rec *preemption_modes_rec) 1410 struct nvgpu_preemption_modes_rec *preemption_modes_rec)
1411{ 1411{
1412 preemption_modes_rec->graphics_preemption_mode_flags = 1412 preemption_modes_rec->graphics_preemption_mode_flags =
1413 NVGPU_GRAPHICS_PREEMPTION_MODE_WFI; 1413 NVGPU_PREEMPTION_MODE_GRAPHICS_WFI;
1414 preemption_modes_rec->compute_preemption_mode_flags = ( 1414 preemption_modes_rec->compute_preemption_mode_flags = (
1415 NVGPU_COMPUTE_PREEMPTION_MODE_WFI | 1415 NVGPU_PREEMPTION_MODE_COMPUTE_WFI |
1416 NVGPU_COMPUTE_PREEMPTION_MODE_CTA); 1416 NVGPU_PREEMPTION_MODE_COMPUTE_CTA);
1417 1417
1418 preemption_modes_rec->default_graphics_preempt_mode = 1418 preemption_modes_rec->default_graphics_preempt_mode =
1419 NVGPU_GRAPHICS_PREEMPTION_MODE_WFI; 1419 NVGPU_PREEMPTION_MODE_GRAPHICS_WFI;
1420 preemption_modes_rec->default_compute_preempt_mode = 1420 preemption_modes_rec->default_compute_preempt_mode =
1421 NVGPU_COMPUTE_PREEMPTION_MODE_CTA; 1421 NVGPU_PREEMPTION_MODE_COMPUTE_CTA;
1422 1422
1423 return 0; 1423 return 0;
1424} 1424}