diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/gr_gp106.c | 43 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 43 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 43 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c | 57 |
4 files changed, 100 insertions, 86 deletions
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c index 2de0ae87..59915ad4 100644 --- a/drivers/gpu/nvgpu/gp106/gr_gp106.c +++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GP106 GPU GR | 2 | * GP106 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"), |
@@ -189,36 +189,39 @@ int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g, | |||
189 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", | 189 | nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", |
190 | attrib_cb_size); | 190 | attrib_cb_size); |
191 | 191 | ||
192 | err = gr_gp10b_alloc_buffer(vm, | 192 | /* Only allocate buffers the first time through */ |
193 | if (!nvgpu_mem_is_valid(&gr_ctx->preempt_ctxsw_buffer)) { | ||
194 | err = gr_gp10b_alloc_buffer(vm, | ||
193 | g->gr.ctx_vars.preempt_image_size, | 195 | g->gr.ctx_vars.preempt_image_size, |
194 | &gr_ctx->preempt_ctxsw_buffer); | 196 | &gr_ctx->preempt_ctxsw_buffer); |
195 | if (err) { | 197 | if (err) { |
196 | nvgpu_err(g, "cannot allocate preempt buffer"); | 198 | nvgpu_err(g, "cannot allocate preempt buffer"); |
197 | goto fail; | 199 | goto fail; |
198 | } | 200 | } |
199 | 201 | ||
200 | err = gr_gp10b_alloc_buffer(vm, | 202 | err = gr_gp10b_alloc_buffer(vm, |
201 | spill_size, | 203 | spill_size, |
202 | &gr_ctx->spill_ctxsw_buffer); | 204 | &gr_ctx->spill_ctxsw_buffer); |
203 | if (err) { | 205 | if (err) { |
204 | nvgpu_err(g, "cannot allocate spill buffer"); | 206 | nvgpu_err(g, "cannot allocate spill buffer"); |
205 | goto fail_free_preempt; | 207 | goto fail_free_preempt; |
206 | } | 208 | } |
207 | 209 | ||
208 | err = gr_gp10b_alloc_buffer(vm, | 210 | err = gr_gp10b_alloc_buffer(vm, |
209 | attrib_cb_size, | 211 | attrib_cb_size, |
210 | &gr_ctx->betacb_ctxsw_buffer); | 212 | &gr_ctx->betacb_ctxsw_buffer); |
211 | if (err) { | 213 | if (err) { |
212 | nvgpu_err(g, "cannot allocate beta buffer"); | 214 | nvgpu_err(g, "cannot allocate beta buffer"); |
213 | goto fail_free_spill; | 215 | goto fail_free_spill; |
214 | } | 216 | } |
215 | 217 | ||
216 | err = gr_gp10b_alloc_buffer(vm, | 218 | err = gr_gp10b_alloc_buffer(vm, |
217 | pagepool_size, | 219 | pagepool_size, |
218 | &gr_ctx->pagepool_ctxsw_buffer); | 220 | &gr_ctx->pagepool_ctxsw_buffer); |
219 | if (err) { | 221 | if (err) { |
220 | nvgpu_err(g, "cannot allocate page pool"); | 222 | nvgpu_err(g, "cannot allocate page pool"); |
221 | goto fail_free_betacb; | 223 | goto fail_free_betacb; |
224 | } | ||
222 | } | 225 | } |
223 | 226 | ||
224 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; | 227 | gr_ctx->graphics_preempt_mode = graphics_preempt_mode; |
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; |
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; |
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c index 8110902f..eb6f4408 100644 --- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c +++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -140,47 +140,52 @@ int vgpu_gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g, | |||
140 | nvgpu_log_info(g, "gfxp context attrib cb size=%d", | 140 | nvgpu_log_info(g, "gfxp context attrib cb size=%d", |
141 | attrib_cb_size); | 141 | attrib_cb_size); |
142 | 142 | ||
143 | err = gr_gp10b_alloc_buffer(vm, | 143 | /* Only allocate buffers the first time through */ |
144 | if (!nvgpu_mem_is_valid(&gr_ctx->preempt_ctxsw_buffer)) { | ||
145 | err = gr_gp10b_alloc_buffer(vm, | ||
144 | g->gr.ctx_vars.preempt_image_size, | 146 | g->gr.ctx_vars.preempt_image_size, |
145 | &gr_ctx->preempt_ctxsw_buffer); | 147 | &gr_ctx->preempt_ctxsw_buffer); |
146 | if (err) { | 148 | if (err) { |
147 | err = -ENOMEM; | 149 | err = -ENOMEM; |
148 | goto fail; | 150 | goto fail; |
151 | } | ||
152 | |||
153 | err = gr_gp10b_alloc_buffer(vm, | ||
154 | spill_size, | ||
155 | &gr_ctx->spill_ctxsw_buffer); | ||
156 | if (err) { | ||
157 | err = -ENOMEM; | ||
158 | goto fail; | ||
159 | } | ||
160 | err = gr_gp10b_alloc_buffer(vm, | ||
161 | pagepool_size, | ||
162 | &gr_ctx->pagepool_ctxsw_buffer); | ||
163 | if (err) { | ||
164 | err = -ENOMEM; | ||
165 | goto fail; | ||
166 | } | ||
167 | err = gr_gp10b_alloc_buffer(vm, | ||
168 | attrib_cb_size, | ||
169 | &gr_ctx->betacb_ctxsw_buffer); | ||
170 | if (err) { | ||
171 | err = -ENOMEM; | ||
172 | goto fail; | ||
173 | } | ||
149 | } | 174 | } |
175 | |||
150 | desc = &gr_ctx->preempt_ctxsw_buffer; | 176 | desc = &gr_ctx->preempt_ctxsw_buffer; |
151 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_MAIN] = desc->gpu_va; | 177 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_MAIN] = desc->gpu_va; |
152 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_MAIN] = desc->size; | 178 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_MAIN] = desc->size; |
153 | 179 | ||
154 | err = gr_gp10b_alloc_buffer(vm, | ||
155 | spill_size, | ||
156 | &gr_ctx->spill_ctxsw_buffer); | ||
157 | if (err) { | ||
158 | err = -ENOMEM; | ||
159 | goto fail; | ||
160 | } | ||
161 | desc = &gr_ctx->spill_ctxsw_buffer; | 180 | desc = &gr_ctx->spill_ctxsw_buffer; |
162 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_SPILL] = desc->gpu_va; | 181 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_SPILL] = desc->gpu_va; |
163 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_SPILL] = desc->size; | 182 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_SPILL] = desc->size; |
164 | 183 | ||
165 | err = gr_gp10b_alloc_buffer(vm, | ||
166 | pagepool_size, | ||
167 | &gr_ctx->pagepool_ctxsw_buffer); | ||
168 | if (err) { | ||
169 | err = -ENOMEM; | ||
170 | goto fail; | ||
171 | } | ||
172 | desc = &gr_ctx->pagepool_ctxsw_buffer; | 184 | desc = &gr_ctx->pagepool_ctxsw_buffer; |
173 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_PAGEPOOL] = | 185 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_PAGEPOOL] = |
174 | desc->gpu_va; | 186 | desc->gpu_va; |
175 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_PAGEPOOL] = desc->size; | 187 | p->size[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_PAGEPOOL] = desc->size; |
176 | 188 | ||
177 | err = gr_gp10b_alloc_buffer(vm, | ||
178 | attrib_cb_size, | ||
179 | &gr_ctx->betacb_ctxsw_buffer); | ||
180 | if (err) { | ||
181 | err = -ENOMEM; | ||
182 | goto fail; | ||
183 | } | ||
184 | desc = &gr_ctx->betacb_ctxsw_buffer; | 189 | desc = &gr_ctx->betacb_ctxsw_buffer; |
185 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_BETACB] = | 190 | p->gpu_va[TEGRA_VGPU_GR_BIND_CTXSW_BUFFER_BETACB] = |
186 | desc->gpu_va; | 191 | desc->gpu_va; |