Le Ma
2d7a1f7183
drm/amdgpu/mes: ring aggregatged doorbell when mes queue is unmapped
...
Ring aggregated doorbel to make unmapped queue scheduled in mes firmware.
Signed-off-by: Le Ma <le.ma@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-07-13 11:25:17 -04:00
Le Ma
0fe6906203
drm/amdgpu/mes: init aggregated doorbell
...
Allocate and enable aggregated doorbell.
Signed-off-by: Le Ma <le.ma@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-07-13 11:25:17 -04:00
Jack Xiao
737dad0b5d
drm/amdgpu/mes: fix bo va unmap issue in mes
...
Need reserve buffers before unmap mes ctx bo va.
v2: fix removal of dma_resv_excl_fence() (Alex)
v3: fix dma_resv_usage (Alex)
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-07-12 10:03:20 -04:00
Jack Xiao
35ba8850b6
drm/amdgpu/mes: fix mes submission in atomic context
...
For some cases (accessing registers, unmap legacy queue), it needs
access mes in atomic context. Use spinlock to protect agaist mes
ring buffer race condition.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-07-08 18:25:56 -04:00
Jack Xiao
6a4a1f6054
drm/amdgpu: add common interface for mes misc op
...
Add common interface for mes misc op, including accessing register
interface.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-06-30 15:27:57 -04:00
Jack Xiao
fe4e9ff987
drm/amdgpu: add mc wptr addr support for mes
...
MES requires mc wptr address for usermode queues.
Export bo gart address for mc wptr address.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-06-28 11:24:05 -04:00
Graham Sider
a957995618
drm/amdgpu: Update mes_v11_api_def.h
...
Update MES API to support oversubscription without aggregated doorbell
for usermode queues.
v2: Change oversubscription_no_aggregated_en to is_kfd_process (align
with MES)
Signed-off-by: Graham Sider <Graham.Sider@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-06-23 17:22:31 -04:00
Graham Sider
e77a541f5d
drm/amdkfd: Enable GFX11 usermode queue oversubscription
...
Starting with GFX11, MES requires wptr BOs to be GTT allocated/mapped to
GART for usermode queues in order to support oversubscription. In the
case that work is submitted to an unmapped queue, MES must have a GART
wptr address to determine whether the queue should be mapped.
This change is accompanied with changes in MES and is applicable for
MES_API_VERSION >= 2.
v3:
- Use amdgpu_vm_bo_lookup_mapping for wptr_bo mapping lookup
- Move wptr_bo refcount increment to amdgpu_amdkfd_map_gtt_bo_to_gart
- Remove list_del_init from amdgpu_amdkfd_map_gtt_bo_to_gart
- Cleanup/fix create_queue wptr_bo error handling
v4:
- Add MES version shift/mask defines to amdgpu_mes.h
- Change version check from MES_VERSION to MES_API_VERSION
- Add check in kfd_ioctl_create_queue before wptr bo pin/GART map to
ensure bo is a single page.
Signed-off-by: Graham Sider <Graham.Sider@amd.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Philip Yang <Philip.Yang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-06-23 17:22:12 -04:00
Graham Sider
ff83e6e7ab
drm/amdgpu: Fetch MES scheduler/KIQ versions
...
Store MES scheduler and MES KIQ version numbers in amdgpu_mes for GFX11.
Signed-off-by: Graham Sider <Graham.Sider@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-06-23 17:22:05 -04:00
Jack Xiao
18ee4ce63e
drm/amdgpu: add mes unmap legacy queue routine
...
For mes kiq has been taken over by mes sched, drv can't directly
use mes kiq to unmap queues. drv has to use mes sched api to
unmap legacy queue.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:54 -04:00
Mukul Joshi
464913c0dd
drm/amdgpu/mes: Update the doorbell function signatures
...
Update the function signatures for process doorbell allocations
with MES enabled to make them more generic. KFD would need to
access these functions to allocate/free doorbells when MES is
enabled.
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com >
Acked-by: Oak Zeng <Oak.Zeng@amd.com >
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com >
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:53 -04:00
Jack Xiao
7c18b40e22
drm/amdgpu/mes: fix vm csa update issue
...
Need reserve VM buffers before update VM csa.
v2: rebase fixes
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:53 -04:00
Jack Xiao
6624d16103
drm/amdgpu/mes: implement mes self test
...
Add mes self test to verify its fundamental functionality by
running ring test and ib test of mes kernel queue.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
e3652b0976
drm/amdgpu/mes: add helper functions to alloc/free ctx metadata
...
Add the helper functions to allocate/free context metadata.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
9cc654c8ce
drm/amdgpu/mes: implement removing mes ring
...
Remove the mes ring and its resources.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
d0c423b647
drm/amdgpu/mes: use ring for kernel queue submission
...
Use ring as the front end for kernel queue submission.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
11ec5b3605
drm/amdgpu/mes: add helper function to get the ctx meta data offset
...
Add the helper function to get the corresponding ctx meta data offset.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
bcc4e1e1d4
drm/amdgpu/mes: implement removing mes queue
...
Remove the MES queue from MES scheduling and free its resources.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:52 -04:00
Jack Xiao
be5609de15
drm/amdgpu/mes: implement adding mes queue
...
Allocate related resources for the queue and add it to mes
for scheduling.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
ea756bd5cc
drm/amdgpu/mes: implement resuming all gangs
...
Implement resuming all gangs.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
c8bb10572c
drm/amdgpu/mes: implement suspending all gangs
...
Implement suspending all gangs.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
b0306e5840
drm/amdgpu/mes: implement removing mes gang
...
Free the mes gang and its resources.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
5d0f619f72
drm/amdgpu/mes: implement adding mes gang
...
Gang is a group of the same type queue, which is the scheduling
unit of mes hardware scheduler.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
063a38d662
drm/amdgpu/mes: implement destroying mes process
...
Destroy the mes process, which free resources of the process.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
48dcd2b751
drm/amdgpu/mes: implement creating mes process v2
...
Create a mes process which contains process-related resources,
like vm, doorbell bitmap, process ctx bo and etc.
v2: move the simple variable to the end
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
b04c1d6468
drm/amdgpu/mes: initialize/finalize common mes structure v2
...
Initialize/finalize common mes structure.
v2: add mutex_init for adev->mes.mutex
Cc: Le Ma <le.ma@amd.com >
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:51 -04:00
Jack Xiao
cf064b4589
drm/amdgpu/mes: add mes kiq callback
...
Needed to properly initialize mes kiq.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:50 -04:00
Jack Xiao
207e8bbe66
drm/amdgpu/mes: extend mes framework to support multiple mes pipes
...
Add support for multiple mes pipes, so that reuse the existing
code to initialize more mes pipe and queue.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:49 -04:00
Jack Xiao
3a42c7f38b
drm/amdgpu: update mes process/gang/queue definitions
...
Update the definitions of MES process/gang/queue.
v2: add missing includes
v3: rebase fix, include mm.h
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2022-05-04 10:43:49 -04:00
Le Ma
ae4e3b62df
drm/amdgpu/mes: add status fence memory definitions
...
Update for new member query_status_fence_gpu_mc_ptr in MESAPI_SET_HW_RESOURCES.
Signed-off-by: Le Ma <le.ma@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2020-07-01 01:59:11 -04:00
Jack Xiao
3bbd31e0f4
drm/amdgpu/mes: update some mes definitions
...
Update some mes definitions.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2020-07-01 01:59:07 -04:00
Jack Xiao
5aa91248c0
drm/amdgpu/mes10.1: add mes firmware info fields
...
The newly added fields is to store mes firmware related information.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-06-21 18:59:28 -05:00
Jack Xiao
7bbc36765c
drm/amdgpu/mes: add definitions of ip callback function
...
Abstract mes ip independent function layer.
Acked-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-06-21 18:58:22 -05:00
Jack Xiao
a538bbe7a8
drm/amdgpu/mes: add mes header file and definition
...
Add dummy header file and definitions of mes.
Acked-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-06-21 18:58:22 -05:00