/* * Copyright 2023 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE.
*/ #include <rm/gr.h>
for (int i = 0; i < gr->ctxbuf_nr; i++) {
NV2080_CTRL_GPU_PROMOTE_CTX_BUFFER_ENTRY *entry =
&ctrl->promoteEntry[ctrl->entryCount]; constbool alloc = golden || !gr->ctxbuf[i].global; int ret;
info = nvkm_gsp_rm_ctrl_rd(&gsp->internal.device.subdevice,
NV2080_CTRL_CMD_INTERNAL_STATIC_KGR_GET_CONTEXT_BUFFERS_INFO, sizeof(*info)); if (WARN_ON(IS_ERR(info))) return PTR_ERR(info);
for (int i = 0; i < ARRAY_SIZE(info->engineContextBuffersInfo[0].engine); i++)
r535_gr_get_ctxbuf_info(gr, i, &info->engineContextBuffersInfo[0].engine[i]);
/* Allocate a channel to use for golden context init. */
ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x12000, 0, true, &golden.inst); if (ret) goto done;
ret = nvkm_vmm_new(device, 0x1000, 0, NULL, 0, NULL, "grGoldenVmm", &golden.vmm); if (ret) goto done;
ret = r535_mmu_vaspace_new(golden.vmm, NVKM_RM_VASPACE, false); if (ret) goto done;
/* Fetch context buffer info from RM and allocate each of them here to use * during golden context init (or later as a global context buffer). * * Also build the information that'll be used to create channel contexts.
*/
ret = rm->api->gr->get_ctxbufs_info(gr); if (ret) goto done;
/* Promote golden context to RM. */
ret = r535_gr_promote_ctx(gr, true, golden.vmm, gr->ctxbuf_mem, golden.vma, &golden.chan); if (ret) goto done;
/* Allocate 3D class on channel to trigger golden context init in RM. */
ret = nvkm_gsp_rm_alloc(&golden.chan, NVKM_RM_THREED, rm->gpu->gr.class.threed, 0, &threed); if (ret) goto done;
/* There's no need to keep the golden channel around, as RM caches the context. */
nvkm_gsp_rm_free(&threed);
done:
nvkm_gsp_rm_free(&golden.chan); for (int i = gr->ctxbuf_nr - 1; i >= 0; i--)
nvkm_vmm_put(golden.vmm, &golden.vma[i]);
nvkm_vmm_unref(&golden.vmm);
nvkm_memory_unref(&golden.inst); return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.