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/gv11b/gr_gv11b.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/gv11b/gr_gv11b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 2e1b4664..9506db3a 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GV11b GPU GR | 2 | * GV11b GPU GR |
3 | * | 3 | * |
4 | * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2016-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"), |
@@ -1586,36 +1586,39 @@ int gr_gv11b_set_ctxsw_preemption_mode(struct gk20a *g, | |||
1586 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", | 1586 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", |
1587 | attrib_cb_size); | 1587 | attrib_cb_size); |
1588 | 1588 | ||
1589 | err = gr_gp10b_alloc_buffer(vm, | 1589 | /* Only allocate buffers the first time through */ |
1590 | if (!nvgpu_mem_is_valid(&gr_ctx->preempt_ctxsw_buffer)) { | ||
1591 | err = gr_gp10b_alloc_buffer(vm, | ||
1590 | g->gr.ctx_vars.preempt_image_size, | 1592 | g->gr.ctx_vars.preempt_image_size, |
1591 | &gr_ctx->preempt_ctxsw_buffer); | 1593 | &gr_ctx->preempt_ctxsw_buffer); |
1592 | if (err) { | 1594 | if (err) { |
1593 | nvgpu_err(g, "cannot allocate preempt buffer"); | 1595 | nvgpu_err(g, "cannot allocate preempt buffer"); |
1594 | goto fail; | 1596 | goto fail; |
1595 | } | 1597 | } |
1596 | 1598 | ||
1597 | err = gr_gp10b_alloc_buffer(vm, | 1599 | err = gr_gp10b_alloc_buffer(vm, |
1598 | spill_size, | 1600 | spill_size, |
1599 | &gr_ctx->spill_ctxsw_buffer); | 1601 | &gr_ctx->spill_ctxsw_buffer); |
1600 | if (err) { | 1602 | if (err) { |
1601 | nvgpu_err(g, "cannot allocate spill buffer"); | 1603 | nvgpu_err(g, "cannot allocate spill buffer"); |
1602 | goto fail_free_preempt; | 1604 | goto fail_free_preempt; |
1603 | } | 1605 | } |
1604 | 1606 | ||
1605 | err = gr_gp10b_alloc_buffer(vm, | 1607 | err = gr_gp10b_alloc_buffer(vm, |
1606 | attrib_cb_size, | 1608 | attrib_cb_size, |
1607 | &gr_ctx->betacb_ctxsw_buffer); | 1609 | &gr_ctx->betacb_ctxsw_buffer); |
1608 | if (err) { | 1610 | if (err) { |
1609 | nvgpu_err(g, "cannot allocate beta buffer"); | 1611 | nvgpu_err(g, "cannot allocate beta buffer"); |
1610 | goto fail_free_spill; | 1612 | goto fail_free_spill; |
1611 | } | 1613 | } |
1612 | 1614 | ||
1613 | err = gr_gp10b_alloc_buffer(vm, | 1615 | err = gr_gp10b_alloc_buffer(vm, |
1614 | pagepool_size, | 1616 | pagepool_size, |
1615 | &gr_ctx->pagepool_ctxsw_buffer); | 1617 | &gr_ctx->pagepool_ctxsw_buffer); |
1616 | if (err) { | 1618 | if (err) { |
1617 | nvgpu_err(g, "cannot allocate page pool"); | 1619 | nvgpu_err(g, "cannot allocate page pool"); |
1618 | goto fail_free_betacb; | 1620 | goto fail_free_betacb; |
1621 | } | ||
1619 | } | 1622 | } |
1620 | 1623 | ||
1621 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; | 1624 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; |