diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2019-01-25 18:06:46 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-01-31 01:18:04 -0500 |
commit | d39781054f63a510b0eaccee5e1099d7ae6ce132 (patch) | |
tree | 484198d2d4be323f6db334bacd764498311b004f /drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |
parent | 61bb9dc40395257fa1dc15d267496e3deb32a3e5 (diff) |
gpu: nvgpu: allocate ctxsw buffers once only
In *_set_ctxsw_preemption_mode, only allocate
buffers the first time through.
Bug 200418468
Change-Id: I22d06463416615b9a9d671c32b6fe76b602a2623
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2004301
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Satish Arora <satisha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index be1e2038..f70a5a00 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GP10B GPU GR | 2 | * GP10B GPU GR |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -1013,36 +1013,39 @@ int gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g, | |||
1013 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", | 1013 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", |
1014 | attrib_cb_size); | 1014 | attrib_cb_size); |
1015 | 1015 | ||
1016 | err = gr_gp10b_alloc_buffer(vm, | 1016 | /* Only allocate buffers the first time through */ |
1017 | if (!nvgpu_mem_is_valid(&gr_ctx->preempt_ctxsw_buffer)) { | ||
1018 | err = gr_gp10b_alloc_buffer(vm, | ||
1017 | g->gr.ctx_vars.preempt_image_size, | 1019 | g->gr.ctx_vars.preempt_image_size, |
1018 | &gr_ctx->preempt_ctxsw_buffer); | 1020 | &gr_ctx->preempt_ctxsw_buffer); |
1019 | if (err) { | 1021 | if (err) { |
1020 | nvgpu_err(g, "cannot allocate preempt buffer"); | 1022 | nvgpu_err(g, "cannot allocate preempt buffer"); |
1021 | goto fail; | 1023 | goto fail; |
1022 | } | 1024 | } |
1023 | 1025 | ||
1024 | err = gr_gp10b_alloc_buffer(vm, | 1026 | err = gr_gp10b_alloc_buffer(vm, |
1025 | spill_size, | 1027 | spill_size, |
1026 | &gr_ctx->spill_ctxsw_buffer); | 1028 | &gr_ctx->spill_ctxsw_buffer); |
1027 | if (err) { | 1029 | if (err) { |
1028 | nvgpu_err(g, "cannot allocate spill buffer"); | 1030 | nvgpu_err(g, "cannot allocate spill buffer"); |
1029 | goto fail_free_preempt; | 1031 | goto fail_free_preempt; |
1030 | } | 1032 | } |
1031 | 1033 | ||
1032 | err = gr_gp10b_alloc_buffer(vm, | 1034 | err = gr_gp10b_alloc_buffer(vm, |
1033 | attrib_cb_size, | 1035 | attrib_cb_size, |
1034 | &gr_ctx->betacb_ctxsw_buffer); | 1036 | &gr_ctx->betacb_ctxsw_buffer); |
1035 | if (err) { | 1037 | if (err) { |
1036 | nvgpu_err(g, "cannot allocate beta buffer"); | 1038 | nvgpu_err(g, "cannot allocate beta buffer"); |
1037 | goto fail_free_spill; | 1039 | goto fail_free_spill; |
1038 | } | 1040 | } |
1039 | 1041 | ||
1040 | err = gr_gp10b_alloc_buffer(vm, | 1042 | err = gr_gp10b_alloc_buffer(vm, |
1041 | pagepool_size, | 1043 | pagepool_size, |
1042 | &gr_ctx->pagepool_ctxsw_buffer); | 1044 | &gr_ctx->pagepool_ctxsw_buffer); |
1043 | if (err) { | 1045 | if (err) { |
1044 | nvgpu_err(g, "cannot allocate page pool"); | 1046 | nvgpu_err(g, "cannot allocate page pool"); |
1045 | goto fail_free_betacb; | 1047 | goto fail_free_betacb; |
1048 | } | ||
1046 | } | 1049 | } |
1047 | 1050 | ||
1048 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; | 1051 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; |