// SPDX-License-Identifier: GPL-2.0 OR MIT /* * Copyright 2016-2022 Advanced Micro Devices, 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. *
*/
packet->sh_mem_config = qpd->sh_mem_config;
packet->sh_mem_bases = qpd->sh_mem_bases; if (qpd->tba_addr) {
packet->sq_shader_tba_lo = lower_32_bits(qpd->tba_addr >> 8); /* On GFX9, unlike GFX10, bit TRAP_EN of SQ_SHADER_TBA_HI is * not defined, so setting it won't do any harm.
*/
packet->sq_shader_tba_hi = upper_32_bits(qpd->tba_addr >> 8)
| 1 << SQ_SHADER_TBA_HI__TRAP_EN__SHIFT;
/* Determine the number of processes to map together to HW: * it can not exceed the number of VMIDs available to the * scheduler, and it is determined by the smaller of the number * of processes in the runlist and kfd module parameter * hws_max_conc_proc. * However, if enforce_isolation is set (toggle LDS/VGPRs/SGPRs * cleaner between process switch), enable single-process mode * in HWS. * Note: the arbitration between the number of VMIDs and * hws_max_conc_proc has been done in * kgd2kfd_device_init().
*/
concurrent_proc_cnt = (adev->enforce_isolation[kfd->node_id] ==
AMDGPU_ENFORCE_ISOLATION_ENABLE) ?
1 : min(pm->dqm->processes_count, kfd->max_proc_per_quantum);
switch (q->properties.type) { case KFD_QUEUE_TYPE_COMPUTE: if (is_static)
packet->bitfields2.queue_type =
queue_type__mes_map_queues__normal_latency_static_queue_vi; break; case KFD_QUEUE_TYPE_DIQ:
packet->bitfields2.queue_type =
queue_type__mes_map_queues__debug_interface_queue_vi; break; case KFD_QUEUE_TYPE_SDMA: case KFD_QUEUE_TYPE_SDMA_XGMI: if (q->properties.sdma_engine_id < 2 &&
!pm_use_ext_eng(q->device->kfd))
packet->bitfields2.engine_sel = q->properties.sdma_engine_id +
engine_sel__mes_map_queues__sdma0_vi; else { /* * For GFX9.4.3, SDMA engine id can be greater than 8. * For such cases, set extended_engine_sel to 2 and * ensure engine_sel lies between 0-7.
*/ if (q->properties.sdma_engine_id >= 8)
packet->bitfields2.extended_engine_sel =
extended_engine_sel__mes_map_queues__sdma8_to_15_sel; else
packet->bitfields2.extended_engine_sel =
extended_engine_sel__mes_map_queues__sdma0_to_7_sel;
/* For all gfx9 ASICs > gfx941, * Reduce CP_IQ_WAIT_TIME2.QUE_SLEEP to 0x1 from default 0x40. * On a 1GHz machine this is roughly 1 microsecond, which is * about how long it takes to load data out of memory during * queue connect * QUE_SLEEP: Wait Count for Dequeue Retry. * * Set CWSR grace period to 1x1000 cycle for GFX9.4.3 APU
*/ if (KFD_GC_VERSION(pm->dqm->dev) < IP_VERSION(9, 4, 1) ||
KFD_GC_VERSION(pm->dqm->dev) >= IP_VERSION(10, 0, 0)) return -EPERM;
break;
} case KFD_DEQUEUE_WAIT_RESET: /* reg_data would be set to dqm->wait_times */
pm_build_dequeue_wait_counts_packet_info(pm, 0, 0, ®_offset, ®_data); break;
case KFD_DEQUEUE_WAIT_SET_SCH_WAVE: /* The CP cannot handle value 0 and it will result in * an infinite grace period being set so set to 1 to prevent this. Also * avoid debugger API breakage as it sets 0 and expects a low value.
*/ if (!value)
value = 1;
pm_build_dequeue_wait_counts_packet_info(pm, value, 0, ®_offset, ®_data); break; default:
pr_err("Invalid dequeue wait cmd\n"); return -EINVAL;
}
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.