* [PATCH AUTOSEL 6.0 27/44] drm/amdgpu: Fix the lpfn checking condition in drm buddy
[not found] <20221119021124.1773699-1-sashal@kernel.org>
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 34/44] drm/amd/display: Zeromem mypipe heap struct before using it Sasha Levin
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, tao.zhou1, Arunpravin.PaneerSelvam, Xinhui.Pan,
amd-gfx, Ma Jun, nirmoy.das, dri-devel, daniel, alexander.deucher,
airlied, Christian König
From: Ma Jun <Jun.Ma2@amd.com>
[ Upstream commit e0b26b9482461e9528552f54fa662c2269f75b3f ]
Because the value of man->size is changed during suspend/resume process,
use mgr->mm.size instead of man->size here for lpfn checking.
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220914125331.2467162-1-Jun.Ma2@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 28ec5f8ac1c1..27159f1d112e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -435,7 +435,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
if (place->flags & TTM_PL_FLAG_TOPDOWN)
vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
- if (fpfn || lpfn != man->size)
+ if (fpfn || lpfn != mgr->mm.size)
/* Allocate blocks in desired range */
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 34/44] drm/amd/display: Zeromem mypipe heap struct before using it
[not found] <20221119021124.1773699-1-sashal@kernel.org>
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 27/44] drm/amdgpu: Fix the lpfn checking condition in drm buddy Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 35/44] drm/amd/display: Fix FCLK deviation and tool compile issues Sasha Levin
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Alan Liu, Sasha Levin, george.shen, sunpeng.li, airlied,
dri-devel, Xinhui.Pan, Rodrigo.Siqueira, amd-gfx, nathan,
Daniel Wheeler, Aurabindo Pillai, Alvin.Lee2, daniel,
Martin Leung, Alex Deucher, jun.lei, harry.wentland,
christian.koenig
From: Aurabindo Pillai <aurabindo.pillai@amd.com>
[ Upstream commit ab4b35008db9b7ae747679250e5c26d7c3a90cea ]
[Why&How]
Bug was caused when moving variable from stack to heap because it was reusable
and garbage was left over, so we need to zero mem.
Reviewed-by: Martin Leung <Martin.Leung@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Martin Leung <Martin.Leung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
index 52525833a99b..96714dc6b695 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
@@ -3194,6 +3194,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
mode_lib->vba.FCLKChangeLatency, mode_lib->vba.UrgLatency[i],
mode_lib->vba.SREnterPlusExitTime);
+ memset(&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull, 0, sizeof(DmlPipe));
v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.Dppclk = mode_lib->vba.RequiredDPPCLK[i][j][k];
v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.Dispclk = mode_lib->vba.RequiredDISPCLK[i][j];
v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.PixelClock = mode_lib->vba.PixelClock[k];
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 35/44] drm/amd/display: Fix FCLK deviation and tool compile issues
[not found] <20221119021124.1773699-1-sashal@kernel.org>
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 27/44] drm/amdgpu: Fix the lpfn checking condition in drm buddy Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 34/44] drm/amd/display: Zeromem mypipe heap struct before using it Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 36/44] drm/amd/display: Fix gpio port mapping issue Sasha Levin
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Alan Liu, Sasha Levin, chris.park, sunpeng.li, airlied,
Xinhui.Pan, Rodrigo.Siqueira, amd-gfx, nathan, Daniel Wheeler,
aurabindo.pillai, yang.lee, dri-devel, daniel, george.shen,
Alex Deucher, Chaitanya Dhere, jun.lei, harry.wentland,
christian.koenig
From: Chaitanya Dhere <chaitanya.dhere@amd.com>
[ Upstream commit 0d5c5c210a4d4e655feb93b379647f0b179cdafe ]
[Why]
Recent backports from open source do not have header inclusion pattern
that is consistent with inclusion style in the rest of the file. This
breaks the internal tool builds as well. A recent commit erronously
modified the original DML formula for calculating
ActiveClockChangeLatencyHidingY. This resulted in a FCLK deviation
from the golden values.
[How]
Change the way in which display_mode_vba.h is included so that it is
consistent with the inclusion style in rest of the file which also fixes
the tool build. Restore the DML formula to its original state to fix the
FCLK deviation.
Reviewed-by: Aurabindo Pillai <Aurabindo.Pillai@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Chaitanya Dhere <chaitanya.dhere@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c | 2 +-
.../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
index 365d290bba99..d0f3f2414fb8 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
@@ -4396,7 +4396,7 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
if (v->NumberOfActiveSurfaces > 1) {
ActiveClockChangeLatencyHidingY = ActiveClockChangeLatencyHidingY
- - (1 - 1 / v->NumberOfActiveSurfaces) * SwathHeightY[k] * v->HTotal[k]
+ - (1.0 - 1.0 / v->NumberOfActiveSurfaces) * SwathHeightY[k] * v->HTotal[k]
/ v->PixelClock[k] / v->VRatio[k];
}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
index 0b427d89b3c5..f174f5c5ff92 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
@@ -30,7 +30,7 @@
#include "os_types.h"
#include "../dc_features.h"
#include "../display_mode_structs.h"
-#include "dml/display_mode_vba.h"
+#include "../display_mode_vba.h"
unsigned int dml32_dscceComputeDelay(
unsigned int bpc,
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 36/44] drm/amd/display: Fix gpio port mapping issue
[not found] <20221119021124.1773699-1-sashal@kernel.org>
` (2 preceding siblings ...)
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 35/44] drm/amd/display: Fix FCLK deviation and tool compile issues Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 37/44] Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" Sasha Levin
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Alan Liu, Sasha Levin, amd-gfx, dri-devel, sunpeng.li, airlied,
qingqing.zhuo, Xinhui.Pan, Rodrigo.Siqueira, Steve Su,
Daniel Wheeler, aurabindo.pillai, Alvin Lee, daniel, Alex Deucher,
harry.wentland, christian.koenig
From: Steve Su <steve.su@amd.com>
[ Upstream commit c0b2753f5db281b07013899c79b5f06a614055f9 ]
[Why]
1. Port of gpio has different mapping.
[How]
1. Add a dummy entry in mapping table.
2. Fix incorrect mask bit field access.
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Steve Su <steve.su@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../amd/display/dc/gpio/dcn32/hw_factory_dcn32.c | 14 ++++++++++++++
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c | 9 ++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c b/drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c
index d635b73af46f..0ea52ba5ac82 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c
@@ -107,6 +107,13 @@ static const struct ddc_registers ddc_data_regs_dcn[] = {
ddc_data_regs_dcn2(3),
ddc_data_regs_dcn2(4),
ddc_data_regs_dcn2(5),
+ {
+ // add a dummy entry for cases no such port
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+ .ddc_setup = 0,
+ .phy_aux_cntl = 0,
+ .dc_gpio_aux_ctrl_5 = 0
+ },
{
DDC_GPIO_VGA_REG_LIST(DATA),
.ddc_setup = 0,
@@ -121,6 +128,13 @@ static const struct ddc_registers ddc_clk_regs_dcn[] = {
ddc_clk_regs_dcn2(3),
ddc_clk_regs_dcn2(4),
ddc_clk_regs_dcn2(5),
+ {
+ // add a dummy entry for cases no such port
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+ .ddc_setup = 0,
+ .phy_aux_cntl = 0,
+ .dc_gpio_aux_ctrl_5 = 0
+ },
{
DDC_GPIO_VGA_REG_LIST(CLK),
.ddc_setup = 0,
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
index 6fd38cdd68c0..525bc8881950 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
@@ -94,11 +94,14 @@ static enum gpio_result set_config(
* is required for detection of AUX mode */
if (hw_gpio->base.en != GPIO_DDC_LINE_VIP_PAD) {
if (!ddc_data_pd_en || !ddc_clk_pd_en) {
-
- REG_SET_2(gpio.MASK_reg, regval,
+ if (hw_gpio->base.en == GPIO_DDC_LINE_DDC_VGA) {
+ // bit 4 of mask has different usage in some cases
+ REG_SET(gpio.MASK_reg, regval, DC_GPIO_DDC1DATA_PD_EN, 1);
+ } else {
+ REG_SET_2(gpio.MASK_reg, regval,
DC_GPIO_DDC1DATA_PD_EN, 1,
DC_GPIO_DDC1CLK_PD_EN, 1);
-
+ }
if (config_data->type ==
GPIO_CONFIG_TYPE_I2C_AUX_DUAL_MODE)
msleep(3);
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 37/44] Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly""
[not found] <20221119021124.1773699-1-sashal@kernel.org>
` (3 preceding siblings ...)
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 36/44] drm/amd/display: Fix gpio port mapping issue Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling Sasha Levin
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, stalkerg, Guchun Chen, Xinhui.Pan, amd-gfx,
Asher Song, dri-devel, daniel, Alex Deucher, evan.quan, airlied,
christian.koenig
From: Asher Song <Asher.Song@amd.com>
[ Upstream commit 30b8e7b8ee3be003e0df85c857c5cd0e0bd58b82 ]
This reverts commit 4545ae2ed3f2f7c3f615a53399c9c8460ee5bca7.
The origin patch "drm/amdgpu: getting fan speed pwm for vega10 properly" works fine.
Test failure is caused by test case self.
Signed-off-by: Asher Song <Asher.Song@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../amd/pm/powerplay/hwmgr/vega10_thermal.c | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c
index dad3e3741a4e..190af79f3236 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c
@@ -67,22 +67,21 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,
int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr,
uint32_t *speed)
{
- uint32_t current_rpm;
- uint32_t percent = 0;
-
- if (hwmgr->thermal_controller.fanInfo.bNoFan)
- return 0;
+ struct amdgpu_device *adev = hwmgr->adev;
+ uint32_t duty100, duty;
+ uint64_t tmp64;
- if (vega10_get_current_rpm(hwmgr, ¤t_rpm))
- return -1;
+ duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1),
+ CG_FDO_CTRL1, FMAX_DUTY100);
+ duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS),
+ CG_THERMAL_STATUS, FDO_PWM_DUTY);
- if (hwmgr->thermal_controller.
- advanceFanControlParameters.usMaxFanRPM != 0)
- percent = current_rpm * 255 /
- hwmgr->thermal_controller.
- advanceFanControlParameters.usMaxFanRPM;
+ if (!duty100)
+ return -EINVAL;
- *speed = MIN(percent, 255);
+ tmp64 = (uint64_t)duty * 255;
+ do_div(tmp64, duty100);
+ *speed = MIN((uint32_t)tmp64, 255);
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling
[not found] <20221119021124.1773699-1-sashal@kernel.org>
` (4 preceding siblings ...)
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 37/44] Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-21 9:57 ` Michel Dänzer
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 39/44] drm/amdgpu: Drop eviction lock when allocating PT BO Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 40/44] drm/amd/display: only fill dirty rectangles when PSR is enabled Sasha Levin
7 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, Philip Yang, Xinhui.Pan, amd-gfx, luben.tuikov,
dri-devel, daniel, Alex Deucher, airlied, Christian König
From: Philip Yang <Philip.Yang@amd.com>
[ Upstream commit 64f65135c41a75f933d3bca236417ad8e9eb75de ]
Get below kernel WARNING backtrace when pressing ctrl-C to kill kfdtest
application.
If amdgpu_cs_parser_bos returns error after taking bo_list_mutex, as
caller amdgpu_cs_ioctl will not unlock bo_list_mutex, this generates the
kernel WARNING.
Add unlock bo_list_mutex after amdgpu_cs_parser_bos error handling to
cleanup bo_list userptr bo.
WARNING: kfdtest/2930 still has locks held!
1 lock held by kfdtest/2930:
(&list->bo_list_mutex){+.+.}-{3:3}, at: amdgpu_cs_ioctl+0xce5/0x1f10 [amdgpu]
stack backtrace:
dump_stack_lvl+0x44/0x57
get_signal+0x79f/0xd00
arch_do_signal_or_restart+0x36/0x7b0
exit_to_user_mode_prepare+0xfd/0x1b0
syscall_exit_to_user_mode+0x19/0x40
do_syscall_64+0x40/0x80
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index b7bae833c804..9d59f83c8faa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -655,6 +655,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
}
mutex_unlock(&p->bo_list->bo_list_mutex);
}
+ mutex_unlock(&p->bo_list->bo_list_mutex);
return r;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 39/44] drm/amdgpu: Drop eviction lock when allocating PT BO
[not found] <20221119021124.1773699-1-sashal@kernel.org>
` (5 preceding siblings ...)
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 40/44] drm/amd/display: only fill dirty rectangles when PSR is enabled Sasha Levin
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, Philip Yang, mukul.joshi, Felix.Kuehling, Xinhui.Pan,
amd-gfx, qiang.yu, dri-devel, daniel, Alex Deucher, airlied,
airlied, Christian König
From: Philip Yang <Philip.Yang@amd.com>
[ Upstream commit e034a0d9aaee5c9129d5dfdfdfcab988a953412d ]
Re-take the eviction lock immediately again after the allocation is
completed, to fix circular locking warning with drm_buddy allocator.
Move amdgpu_vm_eviction_lock/unlock/trylock to amdgpu_vm.h as they are
called from multiple files.
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 26 -----------------------
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 26 +++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 ++
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 04130f8813ef..369c0d03e3c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -143,32 +143,6 @@ int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return 0;
}
-/*
- * vm eviction_lock can be taken in MMU notifiers. Make sure no reclaim-FS
- * happens while holding this lock anywhere to prevent deadlocks when
- * an MMU notifier runs in reclaim-FS context.
- */
-static inline void amdgpu_vm_eviction_lock(struct amdgpu_vm *vm)
-{
- mutex_lock(&vm->eviction_lock);
- vm->saved_flags = memalloc_noreclaim_save();
-}
-
-static inline int amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm)
-{
- if (mutex_trylock(&vm->eviction_lock)) {
- vm->saved_flags = memalloc_noreclaim_save();
- return 1;
- }
- return 0;
-}
-
-static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm)
-{
- memalloc_noreclaim_restore(vm->saved_flags);
- mutex_unlock(&vm->eviction_lock);
-}
-
/**
* amdgpu_vm_bo_evicted - vm_bo is evicted
*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 9ecb7f663e19..1f3599363481 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -488,4 +488,30 @@ static inline uint64_t amdgpu_vm_tlb_seq(struct amdgpu_vm *vm)
return atomic64_read(&vm->tlb_seq);
}
+/*
+ * vm eviction_lock can be taken in MMU notifiers. Make sure no reclaim-FS
+ * happens while holding this lock anywhere to prevent deadlocks when
+ * an MMU notifier runs in reclaim-FS context.
+ */
+static inline void amdgpu_vm_eviction_lock(struct amdgpu_vm *vm)
+{
+ mutex_lock(&vm->eviction_lock);
+ vm->saved_flags = memalloc_noreclaim_save();
+}
+
+static inline bool amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm)
+{
+ if (mutex_trylock(&vm->eviction_lock)) {
+ vm->saved_flags = memalloc_noreclaim_save();
+ return true;
+ }
+ return false;
+}
+
+static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm)
+{
+ memalloc_noreclaim_restore(vm->saved_flags);
+ mutex_unlock(&vm->eviction_lock);
+}
+
#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
index 88de9f0d4728..983899574464 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
@@ -597,7 +597,9 @@ static int amdgpu_vm_pt_alloc(struct amdgpu_device *adev,
if (entry->bo)
return 0;
+ amdgpu_vm_eviction_unlock(vm);
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt);
+ amdgpu_vm_eviction_lock(vm);
if (r)
return r;
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 6.0 40/44] drm/amd/display: only fill dirty rectangles when PSR is enabled
[not found] <20221119021124.1773699-1-sashal@kernel.org>
` (6 preceding siblings ...)
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 39/44] drm/amdgpu: Drop eviction lock when allocating PT BO Sasha Levin
@ 2022-11-19 2:11 ` Sasha Levin
7 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-19 2:11 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, Leo Li, airlied, dri-devel, Xinhui.Pan,
Rodrigo.Siqueira, roman.li, amd-gfx, nicholas.kazlauskas,
Jerry.Zuo, aurabindo.pillai, Hamza Mahfooz, daniel, Alex Deucher,
harry.wentland, christian.koenig
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
[ Upstream commit 675d84621a24490e1de3d59a4992a17fa9ff92b5 ]
Currently, we are calling fill_dc_dirty_rects() even if PSR isn't
supported by the relevant link in amdgpu_dm_commit_planes(), this is
undesirable especially because when drm.debug is enabled we are printing
messages in fill_dc_dirty_rects() that are only useful for debugging PSR
(and confusing otherwise). So, we can instead limit the filling of dirty
rectangles to only when PSR is enabled.
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 3be70848b202..aaf7e4b22ed0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7639,9 +7639,10 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
bundle->surface_updates[planes_count].plane_info =
&bundle->plane_infos[planes_count];
- fill_dc_dirty_rects(plane, old_plane_state, new_plane_state,
- new_crtc_state,
- &bundle->flip_addrs[planes_count]);
+ if (acrtc_state->stream->link->psr_settings.psr_feature_enabled)
+ fill_dc_dirty_rects(plane, old_plane_state,
+ new_plane_state, new_crtc_state,
+ &bundle->flip_addrs[planes_count]);
/*
* Only allow immediate flips for fast updates that don't
--
2.35.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling Sasha Levin
@ 2022-11-21 9:57 ` Michel Dänzer
2022-11-21 11:07 ` Christian König
0 siblings, 1 reply; 11+ messages in thread
From: Michel Dänzer @ 2022-11-21 9:57 UTC (permalink / raw)
To: Sasha Levin, linux-kernel, stable
Cc: Philip Yang, Xinhui.Pan, dri-devel, luben.tuikov, amd-gfx, daniel,
Alex Deucher, airlied, Christian König
On 11/19/22 03:11, Sasha Levin wrote:
> From: Philip Yang <Philip.Yang@amd.com>
>
> [ Upstream commit 64f65135c41a75f933d3bca236417ad8e9eb75de ]
>
> Get below kernel WARNING backtrace when pressing ctrl-C to kill kfdtest
> application.
>
> If amdgpu_cs_parser_bos returns error after taking bo_list_mutex, as
> caller amdgpu_cs_ioctl will not unlock bo_list_mutex, this generates the
> kernel WARNING.
>
> Add unlock bo_list_mutex after amdgpu_cs_parser_bos error handling to
> cleanup bo_list userptr bo.
>
> WARNING: kfdtest/2930 still has locks held!
> 1 lock held by kfdtest/2930:
> (&list->bo_list_mutex){+.+.}-{3:3}, at: amdgpu_cs_ioctl+0xce5/0x1f10 [amdgpu]
> stack backtrace:
> dump_stack_lvl+0x44/0x57
> get_signal+0x79f/0xd00
> arch_do_signal_or_restart+0x36/0x7b0
> exit_to_user_mode_prepare+0xfd/0x1b0
> syscall_exit_to_user_mode+0x19/0x40
> do_syscall_64+0x40/0x80
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index b7bae833c804..9d59f83c8faa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -655,6 +655,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
> }
> mutex_unlock(&p->bo_list->bo_list_mutex);
> }
> + mutex_unlock(&p->bo_list->bo_list_mutex);
> return r;
> }
>
Looks doubtful that this is a correct backport — there's an identical mutex_unlock call just above.
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling
2022-11-21 9:57 ` Michel Dänzer
@ 2022-11-21 11:07 ` Christian König
2022-11-24 16:50 ` Sasha Levin
0 siblings, 1 reply; 11+ messages in thread
From: Christian König @ 2022-11-21 11:07 UTC (permalink / raw)
To: Michel Dänzer, Sasha Levin, linux-kernel, stable
Cc: Philip Yang, Xinhui.Pan, dri-devel, luben.tuikov, amd-gfx, daniel,
Alex Deucher, airlied
Am 21.11.22 um 10:57 schrieb Michel Dänzer:
> On 11/19/22 03:11, Sasha Levin wrote:
>> From: Philip Yang <Philip.Yang@amd.com>
>>
>> [ Upstream commit 64f65135c41a75f933d3bca236417ad8e9eb75de ]
>>
>> Get below kernel WARNING backtrace when pressing ctrl-C to kill kfdtest
>> application.
>>
>> If amdgpu_cs_parser_bos returns error after taking bo_list_mutex, as
>> caller amdgpu_cs_ioctl will not unlock bo_list_mutex, this generates the
>> kernel WARNING.
>>
>> Add unlock bo_list_mutex after amdgpu_cs_parser_bos error handling to
>> cleanup bo_list userptr bo.
>>
>> WARNING: kfdtest/2930 still has locks held!
>> 1 lock held by kfdtest/2930:
>> (&list->bo_list_mutex){+.+.}-{3:3}, at: amdgpu_cs_ioctl+0xce5/0x1f10 [amdgpu]
>> stack backtrace:
>> dump_stack_lvl+0x44/0x57
>> get_signal+0x79f/0xd00
>> arch_do_signal_or_restart+0x36/0x7b0
>> exit_to_user_mode_prepare+0xfd/0x1b0
>> syscall_exit_to_user_mode+0x19/0x40
>> do_syscall_64+0x40/0x80
>>
>> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index b7bae833c804..9d59f83c8faa 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -655,6 +655,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>> }
>> mutex_unlock(&p->bo_list->bo_list_mutex);
>> }
>> + mutex_unlock(&p->bo_list->bo_list_mutex);
>> return r;
>> }
>>
> Looks doubtful that this is a correct backport — there's an identical mutex_unlock call just above.
Oh, yes good point. This patch doesn't needs to be backported at all
because it just fixes a problem introduced in the same cycle:
commit 4953b6b22ab9d7f64706631a027b1ed1130ce4c8
Author: Christian König <christian.koenig@amd.com>
Date: Tue Sep 13 09:52:13 2022 +0200
drm/amdgpu: cleanup error handling in amdgpu_cs_parser_bos
Return early on success and so remove all those "if (r)" in the error
path.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Regards,
Christian.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling
2022-11-21 11:07 ` Christian König
@ 2022-11-24 16:50 ` Sasha Levin
0 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-11-24 16:50 UTC (permalink / raw)
To: Christian König
Cc: Philip Yang, Michel Dänzer, dri-devel, Xinhui.Pan,
linux-kernel, amd-gfx, luben.tuikov, stable, daniel, Alex Deucher,
airlied
On Mon, Nov 21, 2022 at 12:07:40PM +0100, Christian König wrote:
>Am 21.11.22 um 10:57 schrieb Michel Dänzer:
>>On 11/19/22 03:11, Sasha Levin wrote:
>>>From: Philip Yang <Philip.Yang@amd.com>
>>>
>>>[ Upstream commit 64f65135c41a75f933d3bca236417ad8e9eb75de ]
>>>
>>>Get below kernel WARNING backtrace when pressing ctrl-C to kill kfdtest
>>>application.
>>>
>>>If amdgpu_cs_parser_bos returns error after taking bo_list_mutex, as
>>>caller amdgpu_cs_ioctl will not unlock bo_list_mutex, this generates the
>>>kernel WARNING.
>>>
>>>Add unlock bo_list_mutex after amdgpu_cs_parser_bos error handling to
>>>cleanup bo_list userptr bo.
>>>
>>> WARNING: kfdtest/2930 still has locks held!
>>> 1 lock held by kfdtest/2930:
>>> (&list->bo_list_mutex){+.+.}-{3:3}, at: amdgpu_cs_ioctl+0xce5/0x1f10 [amdgpu]
>>> stack backtrace:
>>> dump_stack_lvl+0x44/0x57
>>> get_signal+0x79f/0xd00
>>> arch_do_signal_or_restart+0x36/0x7b0
>>> exit_to_user_mode_prepare+0xfd/0x1b0
>>> syscall_exit_to_user_mode+0x19/0x40
>>> do_syscall_64+0x40/0x80
>>>
>>>Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>>>Reviewed-by: Christian König <christian.koenig@amd.com>
>>>Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>Signed-off-by: Sasha Levin <sashal@kernel.org>
>>>---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>>index b7bae833c804..9d59f83c8faa 100644
>>>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>>@@ -655,6 +655,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>>> }
>>> mutex_unlock(&p->bo_list->bo_list_mutex);
>>> }
>>>+ mutex_unlock(&p->bo_list->bo_list_mutex);
>>> return r;
>>> }
>>Looks doubtful that this is a correct backport — there's an identical mutex_unlock call just above.
>
>
>Oh, yes good point. This patch doesn't needs to be backported at all
>because it just fixes a problem introduced in the same cycle:
Dropping it, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-11-24 16:51 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221119021124.1773699-1-sashal@kernel.org>
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 27/44] drm/amdgpu: Fix the lpfn checking condition in drm buddy Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 34/44] drm/amd/display: Zeromem mypipe heap struct before using it Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 35/44] drm/amd/display: Fix FCLK deviation and tool compile issues Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 36/44] drm/amd/display: Fix gpio port mapping issue Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 37/44] Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling Sasha Levin
2022-11-21 9:57 ` Michel Dänzer
2022-11-21 11:07 ` Christian König
2022-11-24 16:50 ` Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 39/44] drm/amdgpu: Drop eviction lock when allocating PT BO Sasha Levin
2022-11-19 2:11 ` [PATCH AUTOSEL 6.0 40/44] drm/amd/display: only fill dirty rectangles when PSR is enabled Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox