Skip to content

Commit 3f2289b

Browse files
committed
drm/amdgpu/gmc11: add amdgpu_vm_handle_fault() handling
We need to call amdgpu_vm_handle_fault() on page fault on all gfx9 and newer parts to properly update the page tables, not just for recoverable page faults. Cc: stable@vger.kernel.org Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0300e6d commit 3f2289b

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,39 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,
103103
uint32_t vmhub_index = entry->client_id == SOC21_IH_CLIENTID_VMC ?
104104
AMDGPU_MMHUB0(0) : AMDGPU_GFXHUB(0);
105105
struct amdgpu_vmhub *hub = &adev->vmhub[vmhub_index];
106+
bool retry_fault = !!(entry->src_data[1] & 0x80);
107+
bool write_fault = !!(entry->src_data[1] & 0x20);
106108
uint32_t status = 0;
107109
u64 addr;
108110

109111
addr = (u64)entry->src_data[0] << 12;
110112
addr |= ((u64)entry->src_data[1] & 0xf) << 44;
111113

114+
if (retry_fault) {
115+
/* Returning 1 here also prevents sending the IV to the KFD */
116+
117+
/* Process it only if it's the first fault for this address */
118+
if (entry->ih != &adev->irq.ih_soft &&
119+
amdgpu_gmc_filter_faults(adev, entry->ih, addr, entry->pasid,
120+
entry->timestamp))
121+
return 1;
122+
123+
/* Delegate it to a different ring if the hardware hasn't
124+
* already done it.
125+
*/
126+
if (entry->ih == &adev->irq.ih) {
127+
amdgpu_irq_delegate(adev, entry, 8);
128+
return 1;
129+
}
130+
131+
/* Try to handle the recoverable page faults by filling page
132+
* tables
133+
*/
134+
if (amdgpu_vm_handle_fault(adev, entry->pasid, 0, 0, addr,
135+
entry->timestamp, write_fault))
136+
return 1;
137+
}
138+
112139
if (!amdgpu_sriov_vf(adev)) {
113140
/*
114141
* Issue a dummy read to wait for the status register to

0 commit comments

Comments
 (0)