From 90aeab9dee07a63e4bac6d92646dfd80e65d2edd Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 10 Nov 2017 05:02:37 -0800 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1596930 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b/gr_gm20b.c') 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, return err; if (class == MAXWELL_COMPUTE_B) - (*gr_ctx)->compute_preempt_mode = NVGPU_COMPUTE_PREEMPTION_MODE_CTA; + (*gr_ctx)->compute_preempt_mode = NVGPU_PREEMPTION_MODE_COMPUTE_CTA; gk20a_dbg_fn("done"); @@ -887,7 +887,7 @@ void gr_gm20b_update_ctxsw_preemption_mode(struct gk20a *g, gk20a_dbg_fn(""); - if (gr_ctx->compute_preempt_mode == NVGPU_COMPUTE_PREEMPTION_MODE_CTA) { + if (gr_ctx->compute_preempt_mode == NVGPU_PREEMPTION_MODE_COMPUTE_CTA) { gk20a_dbg_info("CTA: %x", cta_preempt_option); nvgpu_mem_wr(g, mem, ctxsw_prog_main_image_preemption_options_o(), @@ -1410,15 +1410,15 @@ int gr_gm20b_get_preemption_mode_flags(struct gk20a *g, struct nvgpu_preemption_modes_rec *preemption_modes_rec) { preemption_modes_rec->graphics_preemption_mode_flags = - NVGPU_GRAPHICS_PREEMPTION_MODE_WFI; + NVGPU_PREEMPTION_MODE_GRAPHICS_WFI; preemption_modes_rec->compute_preemption_mode_flags = ( - NVGPU_COMPUTE_PREEMPTION_MODE_WFI | - NVGPU_COMPUTE_PREEMPTION_MODE_CTA); + NVGPU_PREEMPTION_MODE_COMPUTE_WFI | + NVGPU_PREEMPTION_MODE_COMPUTE_CTA); preemption_modes_rec->default_graphics_preempt_mode = - NVGPU_GRAPHICS_PREEMPTION_MODE_WFI; + NVGPU_PREEMPTION_MODE_GRAPHICS_WFI; preemption_modes_rec->default_compute_preempt_mode = - NVGPU_COMPUTE_PREEMPTION_MODE_CTA; + NVGPU_PREEMPTION_MODE_COMPUTE_CTA; return 0; } -- cgit v1.2.2