From 0b6c4d38cebf79c8c92550ddec86b3e030041f0b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 29 Jul 2026 18:33:34 +0200 Subject: [PATCH] 7.1-stable patches added patches: drm-amd-pm-fix-smu13-power-limit-range-calculation.patch drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch --- ...-smu13-power-limit-range-calculation.patch | 105 ++++++++++++++++++ ...x-check-in-amdgpu_hmm_invalidate_gfx.patch | 61 ++++++++++ queue-7.1/series | 2 + 3 files changed, 168 insertions(+) create mode 100644 queue-7.1/drm-amd-pm-fix-smu13-power-limit-range-calculation.patch create mode 100644 queue-7.1/drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch diff --git a/queue-7.1/drm-amd-pm-fix-smu13-power-limit-range-calculation.patch b/queue-7.1/drm-amd-pm-fix-smu13-power-limit-range-calculation.patch new file mode 100644 index 0000000000..b69f725d30 --- /dev/null +++ b/queue-7.1/drm-amd-pm-fix-smu13-power-limit-range-calculation.patch @@ -0,0 +1,105 @@ +From 220f22e1d66c1cfb63387eb1c4210f92a357c2d9 Mon Sep 17 00:00:00 2001 +From: Yang Wang +Date: Wed, 1 Jul 2026 09:11:15 +0800 +Subject: drm/amd/pm: fix smu13 power limit range calculation + +From: Yang Wang + +commit 220f22e1d66c1cfb63387eb1c4210f92a357c2d9 upstream. + +SMU13 reports SocketPowerLimitAc/Dc as the default power limit, but +MsgLimits.Power may carry a different firmware bound for the same PPT +throttler. Using only the socket limit for both min and max can therefore +expose an incorrect power range. + +Keep the socket limit as the default, but derive the range from both values: +use the lower value for the min base and the higher value for the max base +before applying OD percentages. Keep the current limit query independent +from the cap calculation. + +Fixes: 1eaf26db9590 ("drm/amd/pm: fix smu13 power limit default/cap calculation") +Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5419 +Signed-off-by: Yang Wang +Reviewed-by: Kenneth Feng +Signed-off-by: Alex Deucher +(cherry picked from commit f45bbf0f62f266ed8422d84f347d75d5fca846a7) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 11 +++++++---- + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 15 ++++++++------- + 2 files changed, 15 insertions(+), 11 deletions(-) + +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +@@ -2403,11 +2403,14 @@ static int smu_v13_0_0_get_power_limit(s + uint32_t pp_limit = smu->adev->pm.ac_power ? + skutable->SocketPowerLimitAc[PPT_THROTTLER_PPT0] : + skutable->SocketPowerLimitDc[PPT_THROTTLER_PPT0]; +- uint32_t power_limit = 0, od_percent_upper = 0, od_percent_lower = 0; ++ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; ++ uint32_t min_limit = min_t(uint32_t, pp_limit, msg_limit); ++ uint32_t max_limit = max_t(uint32_t, pp_limit, msg_limit); ++ uint32_t od_percent_upper = 0, od_percent_lower = 0; + int ret; + + if (current_power_limit) { +- ret = smu_v13_0_get_current_power_limit(smu, &power_limit); ++ ret = smu_v13_0_get_current_power_limit(smu, current_power_limit); + if (ret) + *current_power_limit = pp_limit; + } +@@ -2430,12 +2433,12 @@ static int smu_v13_0_0_get_power_limit(s + od_percent_upper, od_percent_lower, pp_limit); + + if (max_power_limit) { +- *max_power_limit = pp_limit * (100 + od_percent_upper); ++ *max_power_limit = max_limit * (100 + od_percent_upper); + *max_power_limit /= 100; + } + + if (min_power_limit) { +- *min_power_limit = pp_limit * (100 - od_percent_lower); ++ *min_power_limit = min_limit * (100 - od_percent_lower); + *min_power_limit /= 100; + } + +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +@@ -2385,15 +2385,16 @@ static int smu_v13_0_7_get_power_limit(s + uint32_t pp_limit = smu->adev->pm.ac_power ? + skutable->SocketPowerLimitAc[PPT_THROTTLER_PPT0] : + skutable->SocketPowerLimitDc[PPT_THROTTLER_PPT0]; +- uint32_t power_limit = 0, od_percent_upper = 0, od_percent_lower = 0; ++ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; ++ uint32_t min_limit = min_t(uint32_t, pp_limit, msg_limit); ++ uint32_t max_limit = max_t(uint32_t, pp_limit, msg_limit); ++ uint32_t od_percent_upper = 0, od_percent_lower = 0; + int ret; + + if (current_power_limit) { +- ret = smu_v13_0_get_current_power_limit(smu, &power_limit); ++ ret = smu_v13_0_get_current_power_limit(smu, current_power_limit); + if (ret) +- power_limit = pp_limit; +- +- *current_power_limit = power_limit; ++ *current_power_limit = pp_limit; + } + + if (default_power_limit) +@@ -2414,12 +2415,12 @@ static int smu_v13_0_7_get_power_limit(s + od_percent_upper, od_percent_lower, pp_limit); + + if (max_power_limit) { +- *max_power_limit = pp_limit * (100 + od_percent_upper); ++ *max_power_limit = max_limit * (100 + od_percent_upper); + *max_power_limit /= 100; + } + + if (min_power_limit) { +- *min_power_limit = pp_limit * (100 - od_percent_lower); ++ *min_power_limit = min_limit * (100 - od_percent_lower); + *min_power_limit /= 100; + } + diff --git a/queue-7.1/drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch b/queue-7.1/drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch new file mode 100644 index 0000000000..e6653bbd78 --- /dev/null +++ b/queue-7.1/drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch @@ -0,0 +1,61 @@ +From 52f650963d8825e97a0ccdd2b616f8a01d9d3d38 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= +Date: Wed, 24 Jun 2026 16:00:41 +0200 +Subject: drm/amdgpu: fix check in amdgpu_hmm_invalidate_gfx +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christian König + +commit 52f650963d8825e97a0ccdd2b616f8a01d9d3d38 upstream. + +For a short moment during alloc/free the userptr BO is not part of his VM, +so bo->vm_bo can be NULL. + +Keep a reference to the VM root PD as parent of the userptr BO so that +we can always use that to wait for all submissions of the VM instead of +only the one involving the userptr BO. + +Signed-off-by: Christian König +Fixes: 91250893cbaa ("drm/amdgpu: fix waiting for all submissions for userptrs") +Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5399 +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +(cherry picked from commit 631849ff5d603841e74f19f4a5e30fe1f7d7cf30) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 1 + + drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 3 +-- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +@@ -535,6 +535,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_ + bo = gem_to_amdgpu_bo(gobj); + bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT; + bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT; ++ bo->parent = amdgpu_bo_ref(fpriv->vm.root.bo); + r = amdgpu_ttm_tt_set_userptr(&bo->tbo, args->addr, args->flags); + if (r) + goto release_object; +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +@@ -67,7 +67,6 @@ static bool amdgpu_hmm_invalidate_gfx(st + { + struct amdgpu_bo *bo = container_of(mni, struct amdgpu_bo, notifier); + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); +- struct amdgpu_bo *vm_root = bo->vm_bo->vm->root.bo; + long r; + + if (!mmu_notifier_range_blockable(range)) +@@ -78,7 +77,7 @@ static bool amdgpu_hmm_invalidate_gfx(st + mmu_interval_set_seq(mni, cur_seq); + + amdgpu_vm_bo_invalidate(bo, false); +- r = dma_resv_wait_timeout(vm_root->tbo.base.resv, ++ r = dma_resv_wait_timeout(bo->parent->tbo.base.resv, + DMA_RESV_USAGE_BOOKKEEP, false, + MAX_SCHEDULE_TIMEOUT); + mutex_unlock(&adev->notifier_lock); diff --git a/queue-7.1/series b/queue-7.1/series index b1dd494c4e..03d83b2d0b 100644 --- a/queue-7.1/series +++ b/queue-7.1/series @@ -717,3 +717,5 @@ drm-amdgpu-fix-resource-leak-on-acp-reset-timeout.patch drm-amdgpu-invoke-pm_genpd_remove-before-freeing-genpd.patch drm-amdgpu-reject-mapping-a-reserved-doorbell-to-a-new-queue.patch drm-amdgpu-fix-aperture-mapping-leak.patch +drm-amd-pm-fix-smu13-power-limit-range-calculation.patch +drm-amdgpu-fix-check-in-amdgpu_hmm_invalidate_gfx.patch -- 2.47.3