<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c, branch v6.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-09-09T16:28:28Z</updated>
<entry>
<title>amd/amdkfd: correct mem limit calculation for small APUs</title>
<updated>2025-09-09T16:28:28Z</updated>
<author>
<name>Yifan Zhang</name>
<email>yifan1.zhang@amd.com</email>
</author>
<published>2025-08-20T08:10:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=53503556273a5ead8b75534085e2dcb46e96f883'/>
<id>urn:sha1:53503556273a5ead8b75534085e2dcb46e96f883</id>
<content type='text'>
Current mem limit check leaks some GTT memory (reserved_for_pt
reserved_for_ras + adev-&gt;vram_pin_size) for small APUs.

Since carveout VRAM is tunable on APUs, there are three case
regarding the carveout VRAM size relative to GTT:

1. 0 &lt; carveout &lt; gtt
   apu_prefer_gtt = true, is_app_apu = false

2. carveout &gt; gtt / 2
   apu_prefer_gtt = false, is_app_apu = false

3. 0 = carveout
   apu_prefer_gtt = true, is_app_apu = true

It doesn't make sense to check below limitation in case 1
(default case, small carveout) because the values in the below
expression are mixed with carveout and gtt.

adev-&gt;kfd.vram_used[xcp_id] + vram_needed &gt;
    vram_size - reserved_for_pt - reserved_for_ras -
    atomic64_read(&amp;adev-&gt;vram_pin_size)

gtt: kfd.vram_used, vram_needed, vram_size
carveout: reserved_for_pt, reserved_for_ras, adev-&gt;vram_pin_size

In case 1, vram allocation will go to gtt domain, skip vram check
since ttm_mem_limit check already cover this allocation.

Signed-off-by: Yifan Zhang &lt;yifan1.zhang@amd.com&gt;
Reviewed-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit fa7c99f04f6dd299388e9282812b14e95558ac8e)
</content>
</entry>
<entry>
<title>amd/amdkfd: Trigger segfault for early userptr unmmapping</title>
<updated>2025-05-07T21:45:09Z</updated>
<author>
<name>Shane Xiao</name>
<email>shane.xiao@amd.com</email>
</author>
<published>2025-04-23T09:28:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d274bf7099bc5e95fabaa93f23d0eb2977187ad'/>
<id>urn:sha1:2d274bf7099bc5e95fabaa93f23d0eb2977187ad</id>
<content type='text'>
If applications unmap the memory before destroying the userptr, it needs
trigger a segfault to notify user space to correct the free sequence in
VM debug mode.

v2: Send gpu access fault to user space
v3: Report gpu address to user space, remove unnecessary params
v4: update pr_err into one line, remove userptr log info

Signed-off-by: Shane Xiao &lt;shane.xiao@amd.com&gt;
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;Felix.Kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: use GFP_NOWAIT for memory allocations</title>
<updated>2025-03-21T16:15:08Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2025-01-15T14:10:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=16590745b571c07869ef8958e0bbe44ab6f08d1f'/>
<id>urn:sha1:16590745b571c07869ef8958e0bbe44ab6f08d1f</id>
<content type='text'>
In the critical submission path memory allocations can't wait for
reclaim since that can potentially wait for submissions to finish.

Finally clean that up and mark most memory allocations in the critical
path with GFP_NOWAIT. The only exception left is the dma_fence_array()
used when no VMID is available, but that will be cleaned up later on.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Acked-by: Srinivasan Shanmugam &lt;srinivasan.shanmugam@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdkfd: remove unnecessary cpu domain validation</title>
<updated>2025-03-05T15:46:55Z</updated>
<author>
<name>James Zhu</name>
<email>James.Zhu@amd.com</email>
</author>
<published>2025-03-03T18:10:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ca17c8e149112270b598791bbd98968fe9231115'/>
<id>urn:sha1:ca17c8e149112270b598791bbd98968fe9231115</id>
<content type='text'>
before move to GTT domain.

Signed-off-by: James Zhu &lt;James.Zhu@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: remove all KFD fences from the BO on release</title>
<updated>2025-02-21T15:41:49Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2025-01-29T15:28:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cb0de06d1b0afb2d0c600ad748069f5ce27730ec'/>
<id>urn:sha1:cb0de06d1b0afb2d0c600ad748069f5ce27730ec</id>
<content type='text'>
Remove all KFD BOs from the private dma_resv object.

This prevents the KFD from being evict unecessarily when an exported BO
is released.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: James Zhu &lt;James.Zhu@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Reviewed-and-tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdkfd: Fix pasid value leak</title>
<updated>2025-02-13T02:05:50Z</updated>
<author>
<name>Xiaogang Chen</name>
<email>xiaogang.chen@amd.com</email>
</author>
<published>2025-02-12T06:24:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=10e08943caedfb4b0b95933d248503a6f6b9fef6'/>
<id>urn:sha1:10e08943caedfb4b0b95933d248503a6f6b9fef6</id>
<content type='text'>
Curret kfd does not allocate pasid values, instead uses pasid value for each
vm from graphic driver. So should not prevent graphic driver from releasing
pasid values since the values are allocated by graphic driver, not kfd driver
anymore. This patch does not stop graphic driver release pasid values.

Fixes: 8544374c0f82 ("drm/amdkfd: Have kfd driver use same PASID values from graphic driver")
Signed-off-by: Xiaogang Chen &lt;xiaogang.chen@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdkfd: add a new flag to manage where VRAM allocations go</title>
<updated>2025-02-13T02:04:08Z</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2025-01-30T20:12:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b0d068e7dd177eca506d908622095b4a6c9d168'/>
<id>urn:sha1:8b0d068e7dd177eca506d908622095b4a6c9d168</id>
<content type='text'>
On big and small APUs we send KFD VRAM allocations to GTT
since the carve out is either non-existent or relatively
small.  However, if someone sets the carve out size to be
relatively large, we may end up using GTT rather than VRAM.

No change of logic with this patch, but it allows the
driver to determine which logic to use based on the
carve out size in the future.

Reviewed-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdkfd: Have kfd driver use same PASID values from graphic driver</title>
<updated>2025-02-13T02:02:55Z</updated>
<author>
<name>Xiaogang Chen</name>
<email>xiaogang.chen@amd.com</email>
</author>
<published>2025-01-13T23:35:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8544374c0f82edb285779f21b149826fe2c2977c'/>
<id>urn:sha1:8544374c0f82edb285779f21b149826fe2c2977c</id>
<content type='text'>
Current kfd driver has its own PASID value for a kfd process and uses it to
locate vm at interrupt handler or mapping between kfd process and vm. That
design is not working when a physical gpu device has multiple spatial
partitions, ex: adev in CPX mode. This patch has kfd driver use same pasid
values that graphic driver generated which is per vm per pasid.

These pasid values are passed to fw/hardware. We do not need change interrupt
handler though more pasid values are used. Also, pasid values at log are
replaced by user process pid; pasid values are not exposed to user. Users see
their process pids that have meaning in user space.

Signed-off-by: Xiaogang Chen &lt;xiaogang.chen@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: Failed to check various return code</title>
<updated>2024-12-18T17:18:20Z</updated>
<author>
<name>Andrew Martin</name>
<email>Andrew.Martin@amd.com</email>
</author>
<published>2024-12-10T16:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=357ef5b3b7e98b4d21cb0abc1bde1140332c7eb8'/>
<id>urn:sha1:357ef5b3b7e98b4d21cb0abc1bde1140332c7eb8</id>
<content type='text'>
Clean up code to quiet the compiler on us failing to check the return
code.

Signed-off-by: Andrew Martin &lt;Andrew.Martin@amd.com&gt;
Reviewed-by: Harish Kasiviswanathan &lt;Harish.Kasiviswanathan@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdkfd: Not restore userptr buffer if kfd process has been removed</title>
<updated>2024-10-22T21:50:12Z</updated>
<author>
<name>Xiaogang Chen</name>
<email>xiaogang.chen@amd.com</email>
</author>
<published>2024-10-17T05:01:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=10112bf828c39ca440287c93b1cdc93f404383b8'/>
<id>urn:sha1:10112bf828c39ca440287c93b1cdc93f404383b8</id>
<content type='text'>
When kfd process has been terminated not restore userptr buffer after mmu
notifier invalidates a range.

Signed-off-by: Xiaogang Chen &lt;xiaogang.chen@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
</feed>
