This series ports some of CWSR functions from KFD to KGD side for userqueues.
Things which are part of this series -
v1:
Allocation of TBA/TMA regions for first level handler. First level handler is
always from driver.
Presently, this takes care of only dGPU allocations and is TBD for APUs.
Backend to add second
level handler is added, but there is no IOCTL provided yet. TBA is allocated
only once and TMA is
allocated per VM. It's tracked by a cwsr object which is maintained in
userqueue manager.
Adds save area and control stack calculations to KGD side. Also, support to
specify save/restore
area params while creating user queues. TBD:IOCTL parameters need to be
modified to specify save
area params. Also, need to confirm size calculations with multi-xcc and
obtain the number of XCCs
used by a userqueue manager.
v2:
Remove association of cwsr with user queue manager (Christian)
Add ioctl support to query cwsr size, set cwsr parameters for user queues and
set second level
handler.
TBD: Handle level1 trap handler allocation for APUs.
v3:
Removed 'TBD: Handle level1 trap handler allocation for APUs' (confirmed that
APUs also use
the same path).
Rebase against amd-staging-drm-next.
Fixes for issues reported by Jesse Zhang:
Keep 2 pages for cwsr handler (TBA) and 1 page for TMA.
Add cwsr_enabled in addition to cwsr_supported and use it for NULL pointer
issues.
Lijo Lazar (10):
drm/amdgpu: Add helper function to get xcc count
drm/amdgpu: Add cwsr functions
drm/amdgpu: Fill cwsr save area details
drm/amdgpu: Add user save area params validation
drm/amdgpu: Add cwsr to device init/fini sequence
drm/amdgpu: Add first level cwsr handler to userq
drm/amdgpu: Add user save area params to mqd input
drm/amdgpu: Add ioctl to get cwsr details
drm/amdgpu: Add ioctl support for cwsr params
drm/amdgpu: Add ioctl to set level2 handler
drivers/gpu/drm/amd/amdgpu/Makefile | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_cwsr.c | 598 +++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_cwsr.h | 91 ++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 29 +
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 24 +
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 5 +
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h | 22 +
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 14 +
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 27 +
include/uapi/drm/amdgpu_drm.h | 56 ++
14 files changed, 887 insertions(+), 3 deletions(-)
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_cwsr.c
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_cwsr.h
--
2.49.0