Skip to content

Commit ff28ff9

Browse files
committed
drm/amdgpu/gmc12: 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 3f2289b commit ff28ff9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static int gmc_v12_0_process_interrupt(struct amdgpu_device *adev,
9191
struct amdgpu_iv_entry *entry)
9292
{
9393
struct amdgpu_vmhub *hub;
94+
bool retry_fault = !!(entry->src_data[1] & 0x80);
95+
bool write_fault = !!(entry->src_data[1] & 0x20);
9496
uint32_t status = 0;
9597
u64 addr;
9698

@@ -102,6 +104,31 @@ static int gmc_v12_0_process_interrupt(struct amdgpu_device *adev,
102104
else
103105
hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
104106

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

0 commit comments

Comments
 (0)