Signal MEMORY_EXCEPTION EVENTFD subscriptions from the VM fault interrupt path.
The VM fault path already detects GPU memory exceptions by decoding the fault address and status. Use that point to wake up matching EVENTFD subscribers. MEMORY_EXCEPTION is GPU-scoped, so no queue object is used. EVENTFD remains notification-only. Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> --- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c index 8eb9847d9e1e..2635fd308324 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c @@ -122,6 +122,9 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev, } if (!amdgpu_sriov_vf(adev)) { + struct drm_device *ddev = adev_to_drm(adev); + struct drm_file *file; + /* * Issue a dummy read to wait for the status register to * be updated to avoid reading an incorrect value due to @@ -135,6 +138,17 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev, amdgpu_vm_update_fault_cache(adev, entry->pasid, addr, status, entry->vmid_src ? AMDGPU_MMHUB0(0) : AMDGPU_GFXHUB(0)); + + mutex_lock(&ddev->filelist_mutex); + list_for_each_entry(file, &ddev->filelist, lhead) { + struct amdgpu_fpriv *fpriv = file->driver_priv; + + if (fpriv) + amdgpu_eventfd_signal(&fpriv->eventfd_mgr, + DRM_AMDGPU_EVENT_TYPE_MEMORY_EXCEPTION, + NULL); + } + mutex_unlock(&ddev->filelist_mutex); } if (printk_ratelimit()) { -- 2.34.1
