This patch fixes the VRAM BO eviction issue during resume when
playing the steam game cuphead.
During psp resume, it requests a VRAM buffer of size 10240 KiB for
the trusted memory region, as part of this memory allocation we are
trying to evict few user buffers from VRAM to SYSTEM domain, the
eviction process fails as the selected resource doesn't have contiguous
blocks. Hence, the TMR memory request fails and the system stuck at
resume process.
This change will skip the resource which has non-contiguous blocks and
goes to the next available resource until it finds the contiguous blocks
resource and moves the resource from VRAM to SYSTEM domain and proceed
for the successful TMR allocation in VRAM and thus system comes out of
resume process.
Gitlab issue link: https://gitlab.freedesktop.org/drm/amd/-/issues/2213
v2: Added issue link and fixes tag.
Fixes: c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam(a)amd.com>
Cc: stable(a)vger.kernel.org #6.0
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index aea8d26b1724..1964de6ac997 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1369,6 +1369,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
amdgpu_bo_encrypted(ttm_to_amdgpu_bo(bo)))
return false;
+ if (bo->resource->mem_type == TTM_PL_VRAM &&
+ !(bo->resource->placement & TTM_PL_FLAG_CONTIGUOUS))
+ return false;
+
return ttm_bo_eviction_valuable(bo, place);
}
--
2.25.1
From: Wyes Karny <wyes.karny(a)amd.com>
MSR_AMD_PERF_CTL register should be reseted while initializing the
amd_pstate driver. On a running system, if we switch the cpufreq driver
from acpi_cpufreq to amd_pstate, we see the following issue: There is no
frequency change on cores which were previously running at a non-zero
pstate. Hence, reset the pstate to zero on all the cores during the
initialization of the amd_pstate driver to avoid performance drop.
While the AMD_PERF_CTL MSR is guaranteed to be set to 0 on a cold boot,
the same is not true for a kexec boot, which is a very common mode of
switching kernels/reboot in MDCs and Ubuntu.
Signed-off-by: Wyes Karny <wyes.karny(a)amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan(a)amd.com>
Cc: stable(a)vger.kernel.org
---
drivers/cpufreq/amd-pstate.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 1ffb97b6dbe2..0057ad5dfa97 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -420,12 +420,18 @@ static void amd_pstate_boost_init(struct amd_cpudata *cpudata)
amd_pstate_driver.boost_enabled = true;
}
+static void amd_perf_ctl_reset(unsigned int cpu)
+{
+ wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0);
+}
+
static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
{
int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
struct device *dev;
struct amd_cpudata *cpudata;
+ amd_perf_ctl_reset(policy->cpu);
dev = get_cpu_device(policy->cpu);
if (!dev)
return -ENODEV;
--
2.25.1