[PATCH] drm/amd/display: Fix memory leaks in S3 resume

2020-11-09 Thread Stylon Wang
EDID parsing in S3 resume pushes new display modes
to probed_modes list but doesn't consolidate to actual
mode list. This creates a race condition when
amdgpu_dm_connector_ddc_get_modes() re-initializes the
list head without walking the list and results in  memory leak.

Signed-off-by: Stylon Wang 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 0b6adf23d316..715e0bd489f8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2337,7 +2337,8 @@ void amdgpu_dm_update_connector_after_detect(
 
drm_connector_update_edid_property(connector,
   aconnector->edid);
-   drm_add_edid_modes(connector, aconnector->edid);
+   aconnector->num_modes = drm_add_edid_modes(connector, 
aconnector->edid);
+   drm_connector_list_update(connector);
 
if (aconnector->dc_link->aux_mode)
drm_dp_cec_set_edid(>dm_dp_aux.aux,
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/pm: correct table_clk_vlt memory size due to replacing one-element array with flexible-array in struct phm_clock_voltage_dependency_table

2020-11-09 Thread Mengbing Wang
From: mengbing wang 


Add 1 to the size passed to kzalloc after replacing one-element array.

There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

Refactor the code according to the use of a flexible-array member in
struct phm_ppt_v1_mm_clock_voltage_dependency_table, instead of a
one-element array, and use the struct_size() helper to calculate the
size for the allocation.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] 
https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays

Signee-off-by: Mengbing Wang 
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
index cf60f3992303..133a08444943 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
@@ -130,9 +130,10 @@ static int smu10_construct_max_power_limits_table(struct 
pp_hwmgr *hwmgr,
 static int smu10_init_dynamic_state_adjustment_rule_settings(
struct pp_hwmgr *hwmgr)
 {
+   int count = 8;
struct phm_clock_voltage_dependency_table *table_clk_vlt;
 
-   table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, 7),
+   table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, count),
GFP_KERNEL);
 
if (NULL == table_clk_vlt) {
@@ -140,7 +141,7 @@ static int 
smu10_init_dynamic_state_adjustment_rule_settings(
return -ENOMEM;
}
 
-   table_clk_vlt->count = 8;
+   table_clk_vlt->count = count;
table_clk_vlt->entries[0].clk = PP_DAL_POWERLEVEL_0;
table_clk_vlt->entries[0].v = 0;
table_clk_vlt->entries[1].clk = PP_DAL_POWERLEVEL_1;
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH] drm/amdgpu: update gfx golden setting for dimgrey_cavefish

2020-11-09 Thread Chen, Jiansong (Simon)
[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Jiansong Chen 

-Original Message-
From: Zhou1, Tao 
Sent: Tuesday, November 10, 2020 2:30 PM
To: Chen, Jiansong (Simon) ; Gui, Jack 
; Zhang, Hawking ; 
amd-gfx@lists.freedesktop.org
Cc: Zhou1, Tao 
Subject: [PATCH] drm/amdgpu: update gfx golden setting for dimgrey_cavefish

Set LDS_CONFIG to 0x20 on dimgrey_cavefish to fix GPU hang.

Signed-off-by: Tao Zhou 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 8c3bad3dfc01..e068133aec71 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3286,7 +3286,8 @@ static const struct soc15_reg_golden 
golden_settings_gc_10_3_4[] =
 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 
0x),
 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 
0x),
 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0x0103, 0x0103),
-SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a0, 0x00a0)
+SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a0, 0x00a0),
+SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG,  0x0020, 0x0020)
 };

 #define DEFAULT_SH_MEM_CONFIG \
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: update gfx golden setting for dimgrey_cavefish

2020-11-09 Thread Tao Zhou
Set LDS_CONFIG to 0x20 on dimgrey_cavefish to fix GPU hang.

Signed-off-by: Tao Zhou 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 8c3bad3dfc01..e068133aec71 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3286,7 +3286,8 @@ static const struct soc15_reg_golden 
golden_settings_gc_10_3_4[] =
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 
0x),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 
0x),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0x0103, 0x0103),
-   SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a0, 0x00a0)
+   SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a0, 0x00a0),
+   SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG,  0x0020, 0x0020)
 };
 
 #define DEFAULT_SH_MEM_CONFIG \
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/amdgpu: Import amdgpu_amdkfd_gfx_v9 header file into implementation

2020-11-09 Thread Felix Kuehling
This seems to fix a problem that was reported by the kernel test robot
in this email: "[radeon-alex:drm-next 655/663]
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:802:6: warning: no
previous prototype for function 'kgd_gfx_v9_get_cu_occupancy'". It would
have been good to include an appropriate "Reported-by:" tag, and also a
"Fixes:" tag to point out the recent change that introduced the warnings.

Regards,
  Felix

Am 2020-11-06 um 2:05 p.m. schrieb Ramesh Errabolu:
> [Why]
> Prevent compiler warnings when building amdgpu kernel module
>
> [How]
> Add the include directive for amdgpu_amdkfd_gfx_v9 header file
>
> Signed-off-by: Ramesh Errabolu 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
> index b75bf0bb05ae..c70d8cadaf18 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
> @@ -37,6 +37,7 @@
>  #include "soc15.h"
>  #include "soc15d.h"
>  #include "gfx_v9_0.h"
> +#include "amdgpu_amdkfd_gfx_v9.h"
>  
>  enum hqd_dequeue_request_type {
>   NO_ACTION = 0,
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.14 06/14] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 11beef7c595f2..d35e5d8e8a058 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1098,22 +1098,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
tmp = RREG32(mmSRBM_SOFT_RESET);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.4 04/10] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index c568293cb6c1a..f1745c5cdf7b3 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1118,22 +1118,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
cik_sdma_print_status((void *)adev);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.9 05/12] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index cb952acc71339..2934443fbd4dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1053,22 +1053,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
tmp = RREG32(mmSRBM_SOFT_RESET);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.19 07/21] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index d0fa2aac23888..ca66c2f797584 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1086,22 +1086,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
tmp = RREG32(mmSRBM_SOFT_RESET);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.19 09/21] drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 786436b453001dafe81025389f96bf9dac1e9690 ]

This reverts commit f87812284172a9809820d10143b573d833cd3f75 ("drm/amdgpu:
Fix bug where DPM is not enabled after hibernate and resume").
It was intended to fix Hawaii S4(hibernation) issue but break S3. As
ixFEATURE_STATUS is filled with garbage data on resume which can be
only cleared by reloading smc firmware(but that will involve many
changes). So, we will revert this S4 fix and seek a new way.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index 0d4dd607e85c8..c05bec5effb2e 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2723,10 +2723,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr 
*hwmgr)
 
 static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr)
 {
-   return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
-CGS_IND_REG__SMC, FEATURE_STATUS,
-VOLTAGE_CONTROLLER_ON))
-   ? true : false;
+   return ci_is_smc_ram_running(hwmgr);
 }
 
 static int ci_smu_init(struct pp_hwmgr *hwmgr)
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 4.19 08/21] drm/amd/pm: perform SMC reset on suspend/hibernation

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 277b080f98803cb73a83fb234f0be83a10e63958 ]

So that the succeeding resume can be performed based on
a clean state.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  |  4 
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |  1 +
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h|  2 ++
 .../gpu/drm/amd/powerplay/smumgr/ci_smumgr.c  | 24 +++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c |  8 +++
 5 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 058898b321b8a..d8e624d64ae38 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -1531,6 +1531,10 @@ int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to reset to default!", result = tmp_result);
 
+   tmp_result = smum_stop_smc(hwmgr);
+   PP_ASSERT_WITH_CODE((tmp_result == 0),
+   "Failed to stop smc!", result = tmp_result);
+
tmp_result = smu7_force_switch_to_arbf0(hwmgr);
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to force to switch arbf0!", result = 
tmp_result);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 6ee864455a12a..f59e1e737735f 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -216,6 +216,7 @@ struct pp_smumgr_func {
bool (*is_hw_avfs_present)(struct pp_hwmgr  *hwmgr);
int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void 
*profile_setting);
int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw); /*rw: true for read, false for write */
+   int (*stop_smc)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_hwmgr_func {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
index 82550a8a3a3fc..ef4f2392e2e7d 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
@@ -113,4 +113,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, 
void *profile_settin
 
 extern int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw);
 
+extern int smum_stop_smc(struct pp_hwmgr *hwmgr);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index db87cb8930d24..0d4dd607e85c8 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2934,6 +2934,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, 
uint32_t type)
return 0;
 }
 
+static void ci_reset_smc(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_RESET_CNTL,
+ rst_reg, 1);
+}
+
+
+static void ci_stop_smc_clock(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_CLOCK_CNTL_0,
+ ck_disable, 1);
+}
+
+static int ci_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   ci_reset_smc(hwmgr);
+   ci_stop_smc_clock(hwmgr);
+
+   return 0;
+}
+
 const struct pp_smumgr_func ci_smu_funcs = {
.smu_init = ci_smu_init,
.smu_fini = ci_smu_fini,
@@ -2957,4 +2980,5 @@ const struct pp_smumgr_func ci_smu_funcs = {
.is_dpm_running = ci_is_dpm_running,
.update_dpm_settings = ci_update_dpm_settings,
.update_smc_table = ci_update_smc_table,
+   .stop_smc = ci_stop_smc,
 };
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
index a6edd5df33b0f..20ecf994d47f3 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
@@ -213,3 +213,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t 
*table, uint16_t tabl
 
return -EINVAL;
 }
+
+int smum_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   if (hwmgr->smumgr_funcs->stop_smc)
+   return hwmgr->smumgr_funcs->stop_smc(hwmgr);
+
+   return 0;
+}
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.4 35/42] amd/amdgpu: Disable VCN DPG mode for Picasso

2020-11-09 Thread Sasha Levin
From: Veerabadhran Gopalakrishnan 

[ Upstream commit c6d2b0fbb893d5c7dda405aa0e7bcbecf1c75f98 ]

Concurrent operation of VCN and JPEG decoder in DPG mode is
causing ring timeout due to power state.

Signed-off-by: Veerabadhran Gopalakrishnan 
Reviewed-by: Leo Liu 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index c086262cc181d..317aa257c06bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -1144,8 +1144,7 @@ static int soc15_common_early_init(void *handle)
 
adev->pg_flags = AMD_PG_SUPPORT_SDMA |
AMD_PG_SUPPORT_MMHUB |
-   AMD_PG_SUPPORT_VCN |
-   AMD_PG_SUPPORT_VCN_DPG;
+   AMD_PG_SUPPORT_VCN;
} else {
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
AMD_CG_SUPPORT_GFX_MGLS |
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.4 16/42] drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 786436b453001dafe81025389f96bf9dac1e9690 ]

This reverts commit f87812284172a9809820d10143b573d833cd3f75 ("drm/amdgpu:
Fix bug where DPM is not enabled after hibernate and resume").
It was intended to fix Hawaii S4(hibernation) issue but break S3. As
ixFEATURE_STATUS is filled with garbage data on resume which can be
only cleared by reloading smc firmware(but that will involve many
changes). So, we will revert this S4 fix and seek a new way.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index 0f4f27a89020d..42c8f8731a504 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2725,10 +2725,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr 
*hwmgr)
 
 static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr)
 {
-   return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
-CGS_IND_REG__SMC, FEATURE_STATUS,
-VOLTAGE_CONTROLLER_ON))
-   ? true : false;
+   return ci_is_smc_ram_running(hwmgr);
 }
 
 static int ci_smu_init(struct pp_hwmgr *hwmgr)
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.4 14/42] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 4af9acc2dc4f9..450ad7d5e21a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1071,22 +1071,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
tmp = RREG32(mmSRBM_SOFT_RESET);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.9 43/55] amd/amdgpu: Disable VCN DPG mode for Picasso

2020-11-09 Thread Sasha Levin
From: Veerabadhran Gopalakrishnan 

[ Upstream commit c6d2b0fbb893d5c7dda405aa0e7bcbecf1c75f98 ]

Concurrent operation of VCN and JPEG decoder in DPG mode is
causing ring timeout due to power state.

Signed-off-by: Veerabadhran Gopalakrishnan 
Reviewed-by: Leo Liu 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index c28ebf41530aa..254ab2ada70a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -1220,8 +1220,7 @@ static int soc15_common_early_init(void *handle)
 
adev->pg_flags = AMD_PG_SUPPORT_SDMA |
AMD_PG_SUPPORT_MMHUB |
-   AMD_PG_SUPPORT_VCN |
-   AMD_PG_SUPPORT_VCN_DPG;
+   AMD_PG_SUPPORT_VCN;
} else {
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
AMD_CG_SUPPORT_GFX_MGLS |
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.4 15/42] drm/amd/pm: perform SMC reset on suspend/hibernation

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 277b080f98803cb73a83fb234f0be83a10e63958 ]

So that the succeeding resume can be performed based on
a clean state.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  |  4 
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |  1 +
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h|  2 ++
 .../gpu/drm/amd/powerplay/smumgr/ci_smumgr.c  | 24 +++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c |  8 +++
 5 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 35e6cbe805eb4..7cde55854b65c 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -1533,6 +1533,10 @@ int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to reset to default!", result = tmp_result);
 
+   tmp_result = smum_stop_smc(hwmgr);
+   PP_ASSERT_WITH_CODE((tmp_result == 0),
+   "Failed to stop smc!", result = tmp_result);
+
tmp_result = smu7_force_switch_to_arbf0(hwmgr);
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to force to switch arbf0!", result = 
tmp_result);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 7bf9a14bfa0be..f6490a1284384 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -229,6 +229,7 @@ struct pp_smumgr_func {
bool (*is_hw_avfs_present)(struct pp_hwmgr  *hwmgr);
int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void 
*profile_setting);
int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw); /*rw: true for read, false for write */
+   int (*stop_smc)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_hwmgr_func {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
index c5288831aa15c..05a55e850b5e0 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
@@ -114,4 +114,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, 
void *profile_settin
 
 extern int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw);
 
+extern int smum_stop_smc(struct pp_hwmgr *hwmgr);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index 09a3d8ae44491..0f4f27a89020d 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2936,6 +2936,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, 
uint32_t type)
return 0;
 }
 
+static void ci_reset_smc(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_RESET_CNTL,
+ rst_reg, 1);
+}
+
+
+static void ci_stop_smc_clock(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_CLOCK_CNTL_0,
+ ck_disable, 1);
+}
+
+static int ci_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   ci_reset_smc(hwmgr);
+   ci_stop_smc_clock(hwmgr);
+
+   return 0;
+}
+
 const struct pp_smumgr_func ci_smu_funcs = {
.name = "ci_smu",
.smu_init = ci_smu_init,
@@ -2960,4 +2983,5 @@ const struct pp_smumgr_func ci_smu_funcs = {
.is_dpm_running = ci_is_dpm_running,
.update_dpm_settings = ci_update_dpm_settings,
.update_smc_table = ci_update_smc_table,
+   .stop_smc = ci_stop_smc,
 };
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
index 4240aeec9000e..83d06f8e99ec2 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
@@ -217,3 +217,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t 
*table, uint16_t tabl
 
return -EINVAL;
 }
+
+int smum_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   if (hwmgr->smumgr_funcs->stop_smc)
+   return hwmgr->smumgr_funcs->stop_smc(hwmgr);
+
+   return 0;
+}
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.9 19/55] drm/amd/pm: correct the baco reset sequence for CI ASICs

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit c108725ef589af462be6b957f63c7925e38213eb ]

Correct some registers bitmasks and add mmBIOS_SCRATCH_7
reset.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c
index 3be40114e63d2..45f608838f6eb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c
@@ -142,12 +142,12 @@ static const struct baco_cmd_entry exit_baco_tbl[] =
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_BCLK_OFF_MASK,  
 BACO_CNTL__BACO_BCLK_OFF__SHIFT, 0, 0x00 },
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_POWER_OFF_MASK, 
 BACO_CNTL__BACO_POWER_OFF__SHIFT, 0, 0x00 },
{ CMD_DELAY_MS, 0, 0, 0, 20, 0 },
-   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_BF_MASK, 0, 0x, 
0x20 },
+   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_BF_MASK, 0, 0x, 
0x200 },
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_ISO_DIS_MASK, 
BACO_CNTL__BACO_ISO_DIS__SHIFT, 0, 0x01 },
-   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_MASK, 0, 5, 0x1c },
+   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_MASK, 0, 5, 0x1c00 },
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_ANA_ISO_DIS_MASK, 
BACO_CNTL__BACO_ANA_ISO_DIS__SHIFT, 0, 0x01 },
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_RESET_EN_MASK, 
BACO_CNTL__BACO_RESET_EN__SHIFT, 0, 0x00 },
-   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__RCU_BIF_CONFIG_DONE_MASK, 0, 5, 
0x10 },
+   { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__RCU_BIF_CONFIG_DONE_MASK, 0, 5, 
0x100 },
{ CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_EN_MASK, 
BACO_CNTL__BACO_EN__SHIFT, 0, 0x00 },
{ CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__BACO_MODE_MASK, 0, 0x, 
0x00 }
 };
@@ -155,6 +155,7 @@ static const struct baco_cmd_entry exit_baco_tbl[] =
 static const struct baco_cmd_entry clean_baco_tbl[] =
 {
{ CMD_WRITE, mmBIOS_SCRATCH_6, 0, 0, 0, 0 },
+   { CMD_WRITE, mmBIOS_SCRATCH_7, 0, 0, 0, 0 },
{ CMD_WRITE, mmCP_PFP_UCODE_ADDR, 0, 0, 0, 0 }
 };
 
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.9 18/55] drm/amdgpu: perform srbm soft reset always on SDMA resume

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]

This can address the random SDMA hang after pci config reset
seen on Hawaii.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 20f108818b2b9..a3c3fe96515f2 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1071,22 +1071,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   u32 tmp = RREG32(mmSRBM_STATUS2);
+   u32 tmp;
 
-   if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-   /* sdma0 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-   }
-   if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-   /* sdma1 */
-   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-   tmp |= SDMA0_F32_CNTL__HALT_MASK;
-   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-   }
+   /* sdma0 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+   /* sdma1 */
+   tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+   tmp |= SDMA0_F32_CNTL__HALT_MASK;
+   WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+   srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
if (srbm_soft_reset) {
tmp = RREG32(mmSRBM_SOFT_RESET);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.9 21/55] drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 786436b453001dafe81025389f96bf9dac1e9690 ]

This reverts commit f87812284172a9809820d10143b573d833cd3f75 ("drm/amdgpu:
Fix bug where DPM is not enabled after hibernate and resume").
It was intended to fix Hawaii S4(hibernation) issue but break S3. As
ixFEATURE_STATUS is filled with garbage data on resume which can be
only cleared by reloading smc firmware(but that will involve many
changes). So, we will revert this S4 fix and seek a new way.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index 09128122b4932..329bf4d44bbce 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2726,10 +2726,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr 
*hwmgr)
 
 static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr)
 {
-   return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
-CGS_IND_REG__SMC, FEATURE_STATUS,
-VOLTAGE_CONTROLLER_ON))
-   ? true : false;
+   return ci_is_smc_ram_running(hwmgr);
 }
 
 static int ci_smu_init(struct pp_hwmgr *hwmgr)
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.9 20/55] drm/amd/pm: perform SMC reset on suspend/hibernation

2020-11-09 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 277b080f98803cb73a83fb234f0be83a10e63958 ]

So that the succeeding resume can be performed based on
a clean state.

Signed-off-by: Evan Quan 
Tested-by: Sandeep Raghuraman 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  |  4 
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |  1 +
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h|  2 ++
 .../gpu/drm/amd/powerplay/smumgr/ci_smumgr.c  | 24 +++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c |  8 +++
 5 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index fc63d9e32e1f8..c8ee931075e52 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -1541,6 +1541,10 @@ static int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to reset to default!", result = tmp_result);
 
+   tmp_result = smum_stop_smc(hwmgr);
+   PP_ASSERT_WITH_CODE((tmp_result == 0),
+   "Failed to stop smc!", result = tmp_result);
+
tmp_result = smu7_force_switch_to_arbf0(hwmgr);
PP_ASSERT_WITH_CODE((tmp_result == 0),
"Failed to force to switch arbf0!", result = 
tmp_result);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 15ed6cbdf3660..91cdc53472f01 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -229,6 +229,7 @@ struct pp_smumgr_func {
bool (*is_hw_avfs_present)(struct pp_hwmgr  *hwmgr);
int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void 
*profile_setting);
int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw); /*rw: true for read, false for write */
+   int (*stop_smc)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_hwmgr_func {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h 
b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
index ad100b533d049..5f46f1a4f38ef 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
@@ -113,4 +113,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, 
void *profile_settin
 
 extern int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, 
uint16_t table_id, bool rw);
 
+extern int smum_stop_smc(struct pp_hwmgr *hwmgr);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index e4d1f3d66ef48..09128122b4932 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2939,6 +2939,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, 
uint32_t type)
return 0;
 }
 
+static void ci_reset_smc(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_RESET_CNTL,
+ rst_reg, 1);
+}
+
+
+static void ci_stop_smc_clock(struct pp_hwmgr *hwmgr)
+{
+   PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ SMC_SYSCON_CLOCK_CNTL_0,
+ ck_disable, 1);
+}
+
+static int ci_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   ci_reset_smc(hwmgr);
+   ci_stop_smc_clock(hwmgr);
+
+   return 0;
+}
+
 const struct pp_smumgr_func ci_smu_funcs = {
.name = "ci_smu",
.smu_init = ci_smu_init,
@@ -2964,4 +2987,5 @@ const struct pp_smumgr_func ci_smu_funcs = {
.is_dpm_running = ci_is_dpm_running,
.update_dpm_settings = ci_update_dpm_settings,
.update_smc_table = ci_update_smc_table,
+   .stop_smc = ci_stop_smc,
 };
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
index b6fb480668416..b6921db3c1305 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
@@ -245,3 +245,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t 
*table, uint16_t tabl
 
return -EINVAL;
 }
+
+int smum_stop_smc(struct pp_hwmgr *hwmgr)
+{
+   if (hwmgr->smumgr_funcs->stop_smc)
+   return hwmgr->smumgr_funcs->stop_smc(hwmgr);
+
+   return 0;
+}
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: enable 48-bit IH timestamp counter

2020-11-09 Thread Alex Sierra
By default this timestamp is based on a 32 bit counter.
This is used by the amdgpu_gmc_filter_faults, to
avoid process the same interrupt in retry configuration.
Apparently there's a problem when the timestamp coming from
IH overflows and compares against timestamp coming from the
the hash table.
This patch only extends the time overflow from 10 minutes to
aprx 455 days.

Signed-off-by: Alex Sierra 
---
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c 
b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
index 837769fcb35b..bda916f33805 100644
--- a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
@@ -94,6 +94,8 @@ static void navi10_ih_enable_interrupts(struct amdgpu_device 
*adev)
 
ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL, RB_ENABLE, 1);
ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL, ENABLE_INTR, 1);
+   ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL,
+  RB_GPU_TS_ENABLE, 1);
if (amdgpu_sriov_vf(adev) && adev->asic_type < CHIP_NAVI10) {
if (psp_reg_program(>psp, PSP_REG_IH_RB_CNTL, 
ih_rb_cntl)) {
DRM_ERROR("PSP program IH_RB_CNTL failed!\n");
@@ -109,6 +111,8 @@ static void navi10_ih_enable_interrupts(struct 
amdgpu_device *adev)
ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1);
ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
   RB_ENABLE, 1);
+   ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
+  RB_GPU_TS_ENABLE, 1);
if (amdgpu_sriov_vf(adev) && adev->asic_type < CHIP_NAVI10) {
if (psp_reg_program(>psp, 
PSP_REG_IH_RB_CNTL_RING1,
ih_rb_cntl)) {
@@ -125,6 +129,8 @@ static void navi10_ih_enable_interrupts(struct 
amdgpu_device *adev)
ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
   RB_ENABLE, 1);
+   ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
+  RB_GPU_TS_ENABLE, 1);
if (amdgpu_sriov_vf(adev) && adev->asic_type < CHIP_NAVI10) {
if (psp_reg_program(>psp, 
PSP_REG_IH_RB_CNTL_RING2,
ih_rb_cntl)) {
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 00/20] [Set 3] Rid W=1 warnings from GPU

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 4:19 PM Lee Jones  wrote:
>
> This set is part of a larger effort attempting to clean-up W=1
> kernel builds, which are currently overwhelmingly riddled with
> niggly little warnings.
>
> This set takes the running (decreasing) total from 5000 before
> [Set 1] down to 2300.
>
> Lee Jones (20):
>   drm/radeon/radeon_ttm: Place declaration of 'rdev' in same clause as
> its use
>   drm/radeon: Move radeon_ttm{init,fini} to shared location
>   drm/radeon/radeon_fence: Demote some non-conformant kernel-doc headers
> and fix another
>   drm/radeon: Move 'radeon_add_legacy_encoder' prototype to shared
> header
>   drm/radeon: Move 'radeon_add_legacy_encoder's prototype to shared
> location
>   drm/radeon/radeon_connectors: Strip out set but unused variable 'ret'
>   drm/radeon/radeon_display: Remove unused variable 'mod'
>   drm/radeon/radeon_i2c: Remove pointless function header
>   drm/radeon/radeon_irq_kms: Demote non-conformant kernel-doc fix
> another
>   drm/radeon/radeon_ring: Add missing function parameters 'rdev' and
> 'data'
>   drm/radeon/r600: Strip out set but unused 'tmp' variables
>   drm/radeon/radeon_cs: Fix a bunch of doc-rot issues
>   drm/radeon/evergreen: Move 'rv770_set_clk_bypass_mode' prototype to
> shared location
>   drm/radeon: Move 'radeon_pm_acpi_event_handler' prototype into shared
> header
>   drm/radeon/r600d: Move 'rc600_*' prototypes into shared header
>   drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location
>   drm/radeon/evergreend: Move 'evergreen_*' and 'sumo_*' prototypes out
> to shared location
>   drm/radeon/radeon_display: Fix function doc formatting and missing
> param issues
>   drm/radeon/r600: Fix a misnamed parameter description and a formatting
> issue
>   drm/radeon/cik: Fix a bunch of function parameter descriptions
>
>  drivers/gpu/drm/radeon/cik.c   | 10 +++
>  drivers/gpu/drm/radeon/evergreen.c |  1 -
>  drivers/gpu/drm/radeon/ni.c| 16 --
>  drivers/gpu/drm/radeon/r600.c  | 11 +++
>  drivers/gpu/drm/radeon/r600d.h | 14 +
>  drivers/gpu/drm/radeon/radeon.h| 34 ++
>  drivers/gpu/drm/radeon/radeon_acpi.c   |  2 --
>  drivers/gpu/drm/radeon/radeon_atombios.c   |  5 
>  drivers/gpu/drm/radeon/radeon_audio.c  | 23 +--
>  drivers/gpu/drm/radeon/radeon_audio.h  | 12 
>  drivers/gpu/drm/radeon/radeon_combios.c|  5 
>  drivers/gpu/drm/radeon/radeon_connectors.c |  4 +--
>  drivers/gpu/drm/radeon/radeon_cs.c | 12 
>  drivers/gpu/drm/radeon/radeon_display.c| 17 +--
>  drivers/gpu/drm/radeon/radeon_encoders.c   |  3 --
>  drivers/gpu/drm/radeon/radeon_fence.c  |  6 ++--
>  drivers/gpu/drm/radeon/radeon_i2c.c|  4 ---
>  drivers/gpu/drm/radeon/radeon_irq_kms.c|  6 ++--
>  drivers/gpu/drm/radeon/radeon_object.c |  2 --
>  drivers/gpu/drm/radeon/radeon_ring.c   |  3 ++
>  drivers/gpu/drm/radeon/radeon_ttm.c|  8 ++---
>  drivers/gpu/drm/radeon/si.c|  6 
>  22 files changed, 96 insertions(+), 108 deletions(-)

Instead of just dumping everything in radeon.h, I think it would be
cleaner to add new headers that match the .c files that define them.
E.g., add evergreen.h and put all the stuff from evergreen.c in there.
Add rv770.h and add all the stuff defined in rv770.c, etc.

Alex

>
> Cc: Alex Deucher 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: "Christian König" 
> Cc: Daniel Vetter 
> Cc: David Airlie 
> Cc: dri-de...@lists.freedesktop.org
> Cc: Jerome Glisse 
> Cc: linaro-mm-...@lists.linaro.org
> Cc: linux-me...@vger.kernel.org
> Cc: report to 
> Cc: Slava Grigorev 
> Cc: Sumit Semwal 
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 15/20] drm/radeon/r600d: Move 'rc600_*' prototypes into shared header

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 4:19 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/r600_hdmi.c:177:6: warning: no previous prototype for 
> ‘r600_hdmi_update_acr’ [-Wmissing-prototypes]
>  177 | void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
>  | ^~~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:217:6: warning: no previous prototype for 
> ‘r600_set_avi_packet’ [-Wmissing-prototypes]
>  217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:314:6: warning: no previous prototype for 
> ‘r600_hdmi_audio_set_dto’ [-Wmissing-prototypes]
>  314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:340:6: warning: no previous prototype for 
> ‘r600_set_vbi_packet’ [-Wmissing-prototypes]
>  340 | void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset)
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:351:6: warning: no previous prototype for 
> ‘r600_set_audio_packet’ [-Wmissing-prototypes]
>  351 | void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset)
>  | ^
>  drivers/gpu/drm/radeon/r600_hdmi.c:393:6: warning: no previous prototype for 
> ‘r600_set_mute’ [-Wmissing-prototypes]
>  393 | void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
>  | ^
>  drivers/gpu/drm/radeon/r600_hdmi.c:469:6: warning: no previous prototype for 
> ‘r600_hdmi_enable’ [-Wmissing-prototypes]
>  469 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/radeon/r600d.h| 14 ++
>  drivers/gpu/drm/radeon/radeon_audio.c | 11 +--
>  2 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
> index 2e00a5287bd2d..db4bcc8bee4e5 100644
> --- a/drivers/gpu/drm/radeon/r600d.h
> +++ b/drivers/gpu/drm/radeon/r600d.h
> @@ -27,6 +27,20 @@
>  #ifndef R600D_H
>  #define R600D_H
>
> +struct radeon_crtc;
> +struct radeon_hdmi_acr;
> +
> +void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset);
> +void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
> +void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
> +   struct radeon_crtc *crtc, unsigned int clock);
> +void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
> +   unsigned char *buffer, size_t size);
> +void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> +   const struct radeon_hdmi_acr *acr);
> +void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
> +void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
> +

the *d.h headers are supposed to just be hardware definitions.  I'd
prefer to keep driver stuff out of them.

Alex


>  #define CP_PACKET2 0x8000
>  #definePACKET2_PAD_SHIFT   0
>  #definePACKET2_PAD_MASK(0x3fff << 0)
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
> b/drivers/gpu/drm/radeon/radeon_audio.c
> index 8c63ccb8b6235..a2be60aa3cec4 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -27,6 +27,7 @@
>  #include 
>  #include "radeon.h"
>  #include "atom.h"
> +#include "r600d.h"
>  #include "radeon_audio.h"
>
>  void r600_audio_enable(struct radeon_device *rdev, struct r600_audio_pin 
> *pin,
> @@ -63,8 +64,6 @@ void dce6_afmt_write_latency_fields(struct drm_encoder 
> *encoder,
>  struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev);
>  struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev);
>  void dce6_afmt_select_pin(struct drm_encoder *encoder);
> -void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
> -   struct radeon_crtc *crtc, unsigned int clock);
>  void dce3_2_audio_set_dto(struct radeon_device *rdev,
> struct radeon_crtc *crtc, unsigned int clock);
>  void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
> @@ -75,31 +74,23 @@ void dce6_hdmi_audio_set_dto(struct radeon_device *rdev,
> struct radeon_crtc *crtc, unsigned int clock);
>  void dce6_dp_audio_set_dto(struct radeon_device *rdev,
> struct radeon_crtc *crtc, unsigned int clock);
> -void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
> -   unsigned char *buffer, size_t size);
>  void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset,
> unsigned char *buffer, size_t size);
> -void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> -   const struct radeon_hdmi_acr *acr);
>  void dce3_2_hdmi_update_acr(struct 

[PATCH 17/20] drm/radeon/evergreend: Move 'evergreen_*' and 'sumo_*' prototypes out to shared location

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/evergreen.c:1281:6: warning: no previous prototype for 
‘evergreen_fix_pci_max_read_req_size’ [-Wmissing-prototypes]
 1281 | void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/evergreen.c:2664:6: warning: no previous prototype for 
‘evergreen_mc_stop’ [-Wmissing-prototypes]
 2664 | void evergreen_mc_stop(struct radeon_device *rdev, struct 
evergreen_mc_save *save)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:2762:6: warning: no previous prototype for 
‘evergreen_mc_resume’ [-Wmissing-prototypes]
 2762 | void evergreen_mc_resume(struct radeon_device *rdev, struct 
evergreen_mc_save *save)
 | ^~~
 drivers/gpu/drm/radeon/evergreen.c:2850:6: warning: no previous prototype for 
‘evergreen_mc_program’ [-Wmissing-prototypes]
 2850 | void evergreen_mc_program(struct radeon_device *rdev)
 | ^~~~
 drivers/gpu/drm/radeon/evergreen.c:3710:5: warning: no previous prototype for 
‘evergreen_mc_init’ [-Wmissing-prototypes]
 3710 | int evergreen_mc_init(struct radeon_device *rdev)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:3769:6: warning: no previous prototype for 
‘evergreen_print_gpu_status_regs’ [-Wmissing-prototypes]
 3769 | void evergreen_print_gpu_status_regs(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/evergreen.c:3797:6: warning: no previous prototype for 
‘evergreen_is_display_hung’ [-Wmissing-prototypes]
 3797 | bool evergreen_is_display_hung(struct radeon_device *rdev)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:4009:6: warning: no previous prototype for 
‘evergreen_gpu_pci_config_reset’ [-Wmissing-prototypes]
 4009 | void evergreen_gpu_pci_config_reset(struct radeon_device *rdev)
 | ^~
 drivers/gpu/drm/radeon/evergreen.c:4110:6: warning: no previous prototype for 
‘sumo_rlc_fini’ [-Wmissing-prototypes]
 4110 | void sumo_rlc_fini(struct radeon_device *rdev)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:4153:5: warning: no previous prototype for 
‘sumo_rlc_init’ [-Wmissing-prototypes]
 4153 | int sumo_rlc_init(struct radeon_device *rdev)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:4381:5: warning: no previous prototype for 
‘evergreen_rlc_resume’ [-Wmissing-prototypes]
 4381 | int evergreen_rlc_resume(struct radeon_device *rdev)
 | ^
 drivers/gpu/drm/radeon/evergreen.c:4670:6: warning: no previous prototype for 
‘evergreen_irq_suspend’ [-Wmissing-prototypes]
 4670 | void evergreen_irq_suspend(struct radeon_device *rdev)
 | ^

NB: Lots more of these - snipped for brevity

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/ni.c | 16 
 drivers/gpu/drm/radeon/radeon.h | 23 +++
 drivers/gpu/drm/radeon/si.c |  6 --
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 02feb0801fd30..91bba473f2703 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -38,7 +38,6 @@
 #include "radeon_asic.h"
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
-
 /*
  * Indirect registers accessor
  */
@@ -190,21 +189,6 @@ static const u32 tn_rlc_save_restore_register_list[] =
0x802c,
 };
 
-extern bool evergreen_is_display_hung(struct radeon_device *rdev);
-extern void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
-extern void evergreen_mc_stop(struct radeon_device *rdev, struct 
evergreen_mc_save *save);
-extern void evergreen_mc_resume(struct radeon_device *rdev, struct 
evergreen_mc_save *save);
-extern int evergreen_mc_wait_for_idle(struct radeon_device *rdev);
-extern void evergreen_mc_program(struct radeon_device *rdev);
-extern void evergreen_irq_suspend(struct radeon_device *rdev);
-extern int evergreen_mc_init(struct radeon_device *rdev);
-extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev);
-extern void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
-extern void evergreen_program_aspm(struct radeon_device *rdev);
-extern void sumo_rlc_fini(struct radeon_device *rdev);
-extern int sumo_rlc_init(struct radeon_device *rdev);
-extern void evergreen_gpu_pci_config_reset(struct radeon_device *rdev);
-
 /* Firmware Names */
 MODULE_FIRMWARE("radeon/BARTS_pfp.bin");
 MODULE_FIRMWARE("radeon/BARTS_me.bin");
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 1cbbaff7cede2..3e53a9493ae92 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -2951,6 +2951,29 @@ extern u32 r6xx_remap_render_backend(struct 
radeon_device *rdev,
 extern int ni_init_microcode(struct radeon_device 

[PATCH 11/20] drm/radeon/r600: Strip out set but unused 'tmp' variables

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/r600.c: In function ‘r600_pcie_gart_tlb_flush’:
 drivers/gpu/drm/radeon/r600.c:1083:7: warning: variable ‘tmp’ set but not used 
[-Wunused-but-set-variable]
 drivers/gpu/drm/radeon/r600.c: At top level:
 drivers/gpu/drm/radeon/r600.c: In function ‘r600_mmio_hdp_flush’:
 drivers/gpu/drm/radeon/r600.c:4393:7: warning: variable ‘tmp’ set but not used 
[-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/r600.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index d9a33ca768f34..6e780b0109995 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1080,7 +1080,6 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev)
if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
!(rdev->flags & RADEON_IS_AGP)) {
void __iomem *ptr = (void *)rdev->gart.ptr;
-   u32 tmp;
 
/* r7xx hw bug.  write to HDP_DEBUG1 followed by fb read
 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
@@ -1088,7 +1087,7 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev)
 * method for them.
 */
WREG32(HDP_DEBUG1, 0);
-   tmp = readl((void __iomem *)ptr);
+   readl((void __iomem *)ptr);
} else
WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
 
@@ -4390,10 +4389,9 @@ void r600_mmio_hdp_flush(struct radeon_device *rdev)
if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) {
void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
-   u32 tmp;
 
WREG32(HDP_DEBUG1, 0);
-   tmp = readl((void __iomem *)ptr);
+   readl((void __iomem *)ptr);
} else
WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
 }
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 13/20] drm/radeon/evergreen: Move 'rv770_set_clk_bypass_mode' prototype to shared location

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/rv770.c:1138:6: warning: no previous prototype for 
‘rv770_set_clk_bypass_mode’ [-Wmissing-prototypes]
 1138 | void rv770_set_clk_bypass_mode(struct radeon_device *rdev)
 | ^

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/evergreen.c | 1 -
 drivers/gpu/drm/radeon/r600.c  | 1 -
 drivers/gpu/drm/radeon/radeon.h| 2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 14d90dc376e71..3541a9444be22 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -223,7 +223,6 @@ extern u32 si_get_csb_size(struct radeon_device *rdev);
 extern void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer);
 extern u32 cik_get_csb_size(struct radeon_device *rdev);
 extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer);
-extern void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
 
 static const u32 evergreen_golden_registers[] =
 {
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 6e780b0109995..9587792503525 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -112,7 +112,6 @@ void r600_fini(struct radeon_device *rdev);
 void r600_irq_disable(struct radeon_device *rdev);
 static void r600_pcie_gen2_enable(struct radeon_device *rdev);
 extern int evergreen_rlc_resume(struct radeon_device *rdev);
-extern void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
 
 /*
  * Indirect registers accessor
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 421f6b26512ed..32a2c894ee3ff 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -280,6 +280,8 @@ struct radeon_clock {
uint32_t vco_freq;
 };
 
+void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
+
 /*
  * Power management
  */
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 07/20] drm/radeon/radeon_display: Remove unused variable 'mod'

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_display.c: In function ‘radeon_div’:
 drivers/gpu/drm/radeon/radeon_display.c:1094:11: warning: variable ‘mod’ set 
but not used [-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: report to 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index bd60f16fd0d78..78fceedfd9255 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1091,11 +1091,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
 /* pre-avivo */
 static inline uint32_t radeon_div(uint64_t n, uint32_t d)
 {
-   uint64_t mod;
-
n += d / 2;
 
-   mod = do_div(n, d);
+   do_div(n, d);
return n;
 }
 
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 04/20] drm/radeon: Move 'radeon_add_legacy_encoder' prototype to shared header

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

  drivers/gpu/drm/radeon/radeon_legacy_encoders.c:1745:1: warning: no previous 
prototype for ‘radeon_add_legacy_encoder’ [-Wmissing-prototypes]
 1745 | radeon_add_legacy_encoder(struct drm_device *dev, uint32_t 
encoder_enum, uint32_t supported_device)
 | ^

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon.h  | 2 ++
 drivers/gpu/drm/radeon/radeon_encoders.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a0c2497cd4cf4..0cc8f081e113a 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -2817,6 +2817,8 @@ extern void radeon_wb_disable(struct radeon_device *rdev);
 extern void radeon_surface_init(struct radeon_device *rdev);
 extern int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data);
 extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int 
enable);
+extern void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
+struct drm_connector *drm_connector);
 extern void radeon_atom_set_clock_gating(struct radeon_device *rdev, int 
enable);
 extern void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 
domain);
 extern bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo);
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c 
b/drivers/gpu/drm/radeon/radeon_encoders.c
index ced022fae19d7..3e342fd812ff4 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -33,9 +33,6 @@
 #include "radeon.h"
 #include "atom.h"
 
-extern void
-radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
-struct drm_connector *drm_connector);
 extern void
 radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
   struct drm_connector *drm_connector);
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 20/20] drm/radeon/cik: Fix a bunch of function parameter descriptions

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/cik.c:1869:5: warning: no previous prototype for 
‘ci_mc_load_microcode’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c: In function ‘cik_gpu_init’:
 drivers/gpu/drm/radeon/cik.c:3181:6: warning: variable ‘mc_shared_chmap’ set 
but not used [-Wunused-but-set-variable]
 drivers/gpu/drm/radeon/cik.c: At top level:
 drivers/gpu/drm/radeon/cik.c:4852:5: warning: no previous prototype for 
‘cik_gpu_check_soft_reset’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:5850:6: warning: no previous prototype for 
‘cik_enter_rlc_safe_mode’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:5871:6: warning: no previous prototype for 
‘cik_exit_rlc_safe_mode’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:6289:6: warning: no previous prototype for 
‘cik_update_cg’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:6421:6: warning: no previous prototype for 
‘cik_init_cp_pg_table’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:6678:5: warning: no previous prototype for 
‘cik_get_csb_size’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:6710:6: warning: no previous prototype for 
‘cik_get_csb_buffer’ [-Wmissing-prototypes]
 drivers/gpu/drm/radeon/cik.c:3084: warning: Function parameter or member 
'max_rb_num_per_se' not described in 'cik_get_rb_disabled'
 drivers/gpu/drm/radeon/cik.c:3084: warning: Excess function parameter 
'max_rb_num' description in 'cik_get_rb_disabled'
 drivers/gpu/drm/radeon/cik.c:3084: warning: Excess function parameter 'se_num' 
description in 'cik_get_rb_disabled'
 drivers/gpu/drm/radeon/cik.c:3114: warning: Function parameter or member 
'max_rb_num_per_se' not described in 'cik_setup_rb'
 drivers/gpu/drm/radeon/cik.c:3114: warning: Excess function parameter 
'max_rb_num' description in 'cik_setup_rb'
 drivers/gpu/drm/radeon/cik.c:5662: warning: Function parameter or member 
'mc_client' not described in 'cik_vm_decode_fault'
 drivers/gpu/drm/radeon/cik.c:5690: warning: Function parameter or member 
'ring' not described in 'cik_vm_flush'
 drivers/gpu/drm/radeon/cik.c:5690: warning: Function parameter or member 
'vm_id' not described in 'cik_vm_flush'
 drivers/gpu/drm/radeon/cik.c:5690: warning: Function parameter or member 
'pd_addr' not described in 'cik_vm_flush'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/cik.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 5c42877fd6fbf..4494f9122fd91 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -3071,8 +3071,7 @@ static u32 cik_create_bitmask(u32 bit_width)
  * cik_get_rb_disabled - computes the mask of disabled RBs
  *
  * @rdev: radeon_device pointer
- * @max_rb_num: max RBs (render backends) for the asic
- * @se_num: number of SEs (shader engines) for the asic
+ * @max_rb_num_per_se: max RBs (render backends) for the asic
  * @sh_per_se: number of SH blocks per SE for the asic
  *
  * Calculates the bitmask of disabled RBs (CIK).
@@ -3104,7 +3103,7 @@ static u32 cik_get_rb_disabled(struct radeon_device *rdev,
  * @rdev: radeon_device pointer
  * @se_num: number of SEs (shader engines) for the asic
  * @sh_per_se: number of SH blocks per SE for the asic
- * @max_rb_num: max RBs (render backends) for the asic
+ * @max_rb_num_per_se: max RBs (render backends) for the asic
  *
  * Configures per-SE/SH RB registers (CIK).
  */
@@ -5654,6 +5653,7 @@ void cik_vm_fini(struct radeon_device *rdev)
  * @rdev: radeon_device pointer
  * @status: VM_CONTEXT1_PROTECTION_FAULT_STATUS register value
  * @addr: VM_CONTEXT1_PROTECTION_FAULT_ADDR register value
+ * @mc_client: VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT register value
  *
  * Print human readable fault information (CIK).
  */
@@ -5677,11 +5677,9 @@ static void cik_vm_decode_fault(struct radeon_device 
*rdev,
   block, mc_client, mc_id);
 }
 
-/**
+/*
  * cik_vm_flush - cik vm flush using the CP
  *
- * @rdev: radeon_device pointer
- *
  * Update the page table base and flush the VM TLB
  * using the CP (CIK).
  */
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 05/20] drm/radeon: Move 'radeon_add_legacy_encoder's prototype to shared location

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon.h  | 2 ++
 drivers/gpu/drm/radeon/radeon_atombios.c | 5 -
 drivers/gpu/drm/radeon/radeon_combios.c  | 5 -
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 0cc8f081e113a..421f6b26512ed 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -2819,6 +2819,8 @@ extern int radeon_cs_parser_init(struct radeon_cs_parser 
*p, void *data);
 extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int 
enable);
 extern void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
 struct drm_connector *drm_connector);
+extern void radeon_add_legacy_encoder(struct drm_device *dev, uint32_t 
encoder_enum,
+ uint32_t supported_device);
 extern void radeon_atom_set_clock_gating(struct radeon_device *rdev, int 
enable);
 extern void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 
domain);
 extern bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo);
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
b/drivers/gpu/drm/radeon/radeon_atombios.c
index 5d25917251892..557960e3b204f 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -39,11 +39,6 @@ extern void
 radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
uint32_t supported_device, u16 caps);
 
-/* from radeon_legacy_encoder.c */
-extern void
-radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
- uint32_t supported_device);
-
 union atom_supported_devices {
struct _ATOM_SUPPORTED_DEVICES_INFO info;
struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
b/drivers/gpu/drm/radeon/radeon_combios.c
index d3c04df7e75d7..b8cd37d76d8bf 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -40,11 +40,6 @@
 #include 
 #endif /* CONFIG_PPC_PMAC */
 
-/* from radeon_legacy_encoder.c */
-extern void
-radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
- uint32_t supported_device);
-
 /* old legacy ATI BIOS routines */
 
 /* COMBIOS table offsets */
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 14/20] drm/radeon: Move 'radeon_pm_acpi_event_handler' prototype into shared header

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/rv770.c:1138:6: warning: no previous prototype for 
‘rv770_set_clk_bypass_mode’ [-Wmissing-prototypes]
 1138 | void rv770_set_clk_bypass_mode(struct radeon_device *rdev)
 | ^

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon.h  | 1 +
 drivers/gpu/drm/radeon/radeon_acpi.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 32a2c894ee3ff..1cbbaff7cede2 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -291,6 +291,7 @@ void radeon_pm_fini(struct radeon_device *rdev);
 void radeon_pm_compute_clocks(struct radeon_device *rdev);
 void radeon_pm_suspend(struct radeon_device *rdev);
 void radeon_pm_resume(struct radeon_device *rdev);
+void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
 void radeon_combios_get_power_modes(struct radeon_device *rdev);
 void radeon_atombios_get_power_modes(struct radeon_device *rdev);
 int radeon_atom_get_clock_dividers(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c 
b/drivers/gpu/drm/radeon/radeon_acpi.c
index 6cf1645e7a1a8..0eb594b56af8c 100644
--- a/drivers/gpu/drm/radeon/radeon_acpi.c
+++ b/drivers/gpu/drm/radeon/radeon_acpi.c
@@ -45,8 +45,6 @@ static inline bool 
radeon_atpx_dgpu_req_power_for_displays(void) { return false;
 
 #define ACPI_AC_CLASS   "ac_adapter"
 
-extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
-
 struct atif_verify_interface {
u16 size;   /* structure size in bytes (includes size 
field) */
u16 version;/* version */
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 09/20] drm/radeon/radeon_irq_kms: Demote non-conformant kernel-doc fix another

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_irq_kms.c:56: warning: Function parameter or 
member 'irq' not described in 'radeon_driver_irq_handler_kms'
 drivers/gpu/drm/radeon/radeon_irq_kms.c:56: warning: Function parameter or 
member 'arg' not described in 'radeon_driver_irq_handler_kms'
 drivers/gpu/drm/radeon/radeon_irq_kms.c:571: warning: Function parameter or 
member 'n' not described in 'radeon_irq_kms_set_irq_n_enabled'
 drivers/gpu/drm/radeon/radeon_irq_kms.c:571: warning: Excess function 
parameter 'num' description in 'radeon_irq_kms_set_irq_n_enabled'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index b86bc88ad4308..3521084030d24 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -43,11 +43,9 @@
 
 #define RADEON_WAIT_IDLE_TIMEOUT 200
 
-/**
+/*
  * radeon_driver_irq_handler_kms - irq handler for KMS
  *
- * @int irq, void *arg: args
- *
  * This is the irq handler for the radeon KMS driver (all asics).
  * radeon_irq_process is a macro that points to the per-asic
  * irq handler callback.
@@ -556,7 +554,7 @@ void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, 
unsigned hpd_mask)
  * @mask: the mask that enables the interrupts
  * @enable: whether to enable or disable the interrupt register
  * @name: the name of the interrupt register to print to the kernel log
- * @num: the number of the interrupt register to print to the kernel log
+ * @n: the number of the interrupt register to print to the kernel log
  *
  * Helper for updating the enable state of interrupt registers. Checks whether
  * or not the interrupt matches the enable state we want. If it doesn't, then
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 01/20] drm/radeon/radeon_ttm: Place declaration of 'rdev' in same clause as its use

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_ttm.c: In function ‘radeon_ttm_tt_create’:
 drivers/gpu/drm/radeon/radeon_ttm.c:611:24: warning: variable ‘rdev’ set but 
not used [-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Jerome Glisse 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index 95038ac3382e2..a8c915920070f 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -608,21 +608,21 @@ static void radeon_ttm_backend_destroy(struct 
ttm_bo_device *bdev, struct ttm_tt
 static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,
   uint32_t page_flags)
 {
-   struct radeon_device *rdev;
struct radeon_ttm_tt *gtt;
enum ttm_caching caching;
struct radeon_bo *rbo;
-
-   rbo = container_of(bo, struct radeon_bo, tbo);
+#if IS_ENABLED(CONFIG_AGP)
+   struct radeon_device *rdev;
 
rdev = radeon_get_rdev(bo->bdev);
-#if IS_ENABLED(CONFIG_AGP)
if (rdev->flags & RADEON_IS_AGP) {
return ttm_agp_tt_create(bo, rdev->ddev->agp->bridge,
 page_flags);
}
 #endif
 
+   rbo = container_of(bo, struct radeon_bo, tbo);
+
gtt = kzalloc(sizeof(struct radeon_ttm_tt), GFP_KERNEL);
if (gtt == NULL) {
return NULL;
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 10/20] drm/radeon/radeon_ring: Add missing function parameters 'rdev' and 'data'

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_ring.c:226: warning: Function parameter or 
member 'rdev' not described in 'radeon_ring_unlock_undo'
 drivers/gpu/drm/radeon/radeon_ring.c:240: warning: Function parameter or 
member 'rdev' not described in 'radeon_ring_lockup_update'
 drivers/gpu/drm/radeon/radeon_ring.c:283: warning: Function parameter or 
member 'data' not described in 'radeon_ring_backup'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_ring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_ring.c 
b/drivers/gpu/drm/radeon/radeon_ring.c
index 37093cea24c59..c3304c977a0a5 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -218,6 +218,7 @@ void radeon_ring_undo(struct radeon_ring *ring)
 /**
  * radeon_ring_unlock_undo - reset the wptr and unlock the ring
  *
+ * @rdev:   radeon device structure
  * @ring: radeon_ring structure holding ring information
  *
  * Call radeon_ring_undo() then unlock the ring (all asics).
@@ -231,6 +232,7 @@ void radeon_ring_unlock_undo(struct radeon_device *rdev, 
struct radeon_ring *rin
 /**
  * radeon_ring_lockup_update - update lockup variables
  *
+ * @rdev:   radeon device structure
  * @ring: radeon_ring structure holding ring information
  *
  * Update the last rptr value and timestamp (all asics).
@@ -275,6 +277,7 @@ bool radeon_ring_test_lockup(struct radeon_device *rdev, 
struct radeon_ring *rin
  *
  * @rdev: radeon_device pointer
  * @ring: the ring we want to back up
+ * @data: placeholder for returned commit data
  *
  * Saves all unprocessed commits from a ring, returns the number of dwords 
saved.
  */
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 16/20] drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/dce3_1_afmt.c:30:6: warning: no previous prototype for 
‘dce3_2_afmt_hdmi_write_speaker_allocation’ [-Wmissing-prototypes]
 30 | void dce3_2_afmt_hdmi_write_speaker_allocation(struct drm_encoder 
*encoder,
 | ^
 drivers/gpu/drm/radeon/dce3_1_afmt.c:48:6: warning: no previous prototype for 
‘dce3_2_afmt_dp_write_speaker_allocation’ [-Wmissing-prototypes]
 48 | void dce3_2_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
 | ^~~
 drivers/gpu/drm/radeon/dce3_1_afmt.c:66:6: warning: no previous prototype for 
‘dce3_2_afmt_write_sad_regs’ [-Wmissing-prototypes]
 66 | void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder,
 | ^~
 drivers/gpu/drm/radeon/dce3_1_afmt.c:116:6: warning: no previous prototype for 
‘dce3_2_audio_set_dto’ [-Wmissing-prototypes]
 116 | void dce3_2_audio_set_dto(struct radeon_device *rdev,
 | ^~~~
 drivers/gpu/drm/radeon/dce3_1_afmt.c:170:6: warning: no previous prototype for 
‘dce3_2_hdmi_update_acr’ [-Wmissing-prototypes]
 170 | void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset,
 | ^~
 drivers/gpu/drm/radeon/dce3_1_afmt.c:202:6: warning: no previous prototype for 
‘dce3_2_set_audio_packet’ [-Wmissing-prototypes]
 202 | void dce3_2_set_audio_packet(struct drm_encoder *encoder, u32 offset)
 | ^~~
 drivers/gpu/drm/radeon/dce3_1_afmt.c:223:6: warning: no previous prototype for 
‘dce3_2_set_mute’ [-Wmissing-prototypes]
 223 | void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
 | ^~~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Slava Grigorev 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_audio.c | 12 
 drivers/gpu/drm/radeon/radeon_audio.h | 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
b/drivers/gpu/drm/radeon/radeon_audio.c
index a2be60aa3cec4..18228b366752e 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -39,16 +39,10 @@ void dce6_audio_enable(struct radeon_device *rdev, struct 
r600_audio_pin *pin,
 u32 dce6_endpoint_rreg(struct radeon_device *rdev, u32 offset, u32 reg);
 void dce6_endpoint_wreg(struct radeon_device *rdev,
u32 offset, u32 reg, u32 v);
-void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder,
-   struct cea_sad *sads, int sad_count);
 void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder,
struct cea_sad *sads, int sad_count);
 void dce6_afmt_write_sad_regs(struct drm_encoder *encoder,
struct cea_sad *sads, int sad_count);
-void dce3_2_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
-   u8 *sadb, int sad_count);
-void dce3_2_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
-   u8 *sadb, int sad_count);
 void dce4_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
u8 *sadb, int sad_count);
 void dce4_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
@@ -64,8 +58,6 @@ void dce6_afmt_write_latency_fields(struct drm_encoder 
*encoder,
 struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev);
 struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev);
 void dce6_afmt_select_pin(struct drm_encoder *encoder);
-void dce3_2_audio_set_dto(struct radeon_device *rdev,
-   struct radeon_crtc *crtc, unsigned int clock);
 void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock);
 void dce4_dp_audio_set_dto(struct radeon_device *rdev,
@@ -76,16 +68,12 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock);
 void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset,
unsigned char *buffer, size_t size);
-void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset,
-   const struct radeon_hdmi_acr *acr);
 void evergreen_hdmi_update_acr(struct drm_encoder *encoder, long offset,
const struct radeon_hdmi_acr *acr);
 void dce4_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
 void dce4_hdmi_set_color_depth(struct drm_encoder *encoder,
u32 offset, int bpc);
-void dce3_2_set_audio_packet(struct drm_encoder *encoder, u32 offset);
 void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset);
-void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
 void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
 static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode);
diff --git 

[PATCH 02/20] drm/radeon: Move radeon_ttm{init, fini} to shared location

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_ttm.c: At top level:
 drivers/gpu/drm/radeon/radeon_ttm.c:817:5: warning: no previous prototype for 
‘radeon_ttm_init’ [-Wmissing-prototypes]
 817 | int radeon_ttm_init(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/radeon_ttm.c:878:6: warning: no previous prototype for 
‘radeon_ttm_fini’ [-Wmissing-prototypes]
 878 | void radeon_ttm_fini(struct radeon_device *rdev)
 | ^~~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon.h| 4 
 drivers/gpu/drm/radeon/radeon_object.c | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 53d9898e9871e..a0c2497cd4cf4 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -451,6 +451,10 @@ struct radeon_surface_reg {
 /*
  * TTM.
  */
+
+int radeon_ttm_init(struct radeon_device *rdev);
+void radeon_ttm_fini(struct radeon_device *rdev);
+
 struct radeon_mman {
struct ttm_bo_devicebdev;
boolinitialized;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index ab81e35cb0606..048d83d0ca996 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -41,8 +41,6 @@
 #include "radeon.h"
 #include "radeon_trace.h"
 
-int radeon_ttm_init(struct radeon_device *rdev);
-void radeon_ttm_fini(struct radeon_device *rdev);
 static void radeon_bo_clear_surface_reg(struct radeon_bo *bo);
 
 /*
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 18/20] drm/radeon/radeon_display: Fix function doc formatting and missing param issues

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_display.c:264: warning: Function parameter or 
member '__work' not described in 'radeon_unpin_work_func'
 drivers/gpu/drm/radeon/radeon_display.c:406: warning: Function parameter or 
member '__work' not described in 'radeon_flip_work_func'
 drivers/gpu/drm/radeon/radeon_display.c:956: warning: Function parameter or 
member 'freq' not described in 'radeon_compute_pll_avivo'
 drivers/gpu/drm/radeon/radeon_display.c:956: warning: Function parameter or 
member 'fb_div_p' not described in 'radeon_compute_pll_avivo'
 drivers/gpu/drm/radeon/radeon_display.c:956: warning: Function parameter or 
member 'frac_fb_div_p' not described in 'radeon_compute_pll_avivo'
 drivers/gpu/drm/radeon/radeon_display.c:956: warning: Function parameter or 
member 'ref_div_p' not described in 'radeon_compute_pll_avivo'
 drivers/gpu/drm/radeon/radeon_display.c:956: warning: Function parameter or 
member 'post_div_p' not described in 'radeon_compute_pll_avivo'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: report to 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_display.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 78fceedfd9255..eb0d4cb95f0a6 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -256,7 +256,7 @@ static void radeon_crtc_destroy(struct drm_crtc *crtc)
 /**
  * radeon_unpin_work_func - unpin old buffer object
  *
- * @__work - kernel work item
+ * @__work: kernel work item
  *
  * Unpin the old frame buffer object outside of the interrupt handler
  */
@@ -398,7 +398,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, 
int crtc_id)
 /**
  * radeon_flip_work_func - page flip framebuffer
  *
- * @work - kernel work item
+ * @__work: kernel work item
  *
  * Wait for the buffer object to become idle and do the actual page flip
  */
@@ -937,11 +937,12 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned 
den, unsigned post_div,
  * radeon_compute_pll_avivo - compute PLL paramaters
  *
  * @pll: information about the PLL
+ * @freq: target frequency
  * @dot_clock_p: resulting pixel clock
- * fb_div_p: resulting feedback divider
- * frac_fb_div_p: fractional part of the feedback divider
- * ref_div_p: resulting reference divider
- * post_div_p: resulting reference divider
+ * @fb_div_p: resulting feedback divider
+ * @frac_fb_div_p: fractional part of the feedback divider
+ * @ref_div_p: resulting reference divider
+ * @post_div_p: resulting reference divider
  *
  * Try to calculate the PLL parameters to generate the given frequency:
  * dot_clock = (ref_freq * feedback_div) / (ref_div * post_div)
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 19/20] drm/radeon/r600: Fix a misnamed parameter description and a formatting issue

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/r600.c:2965: warning: Function parameter or member 
'resv' not described in 'r600_copy_cpdma'
 drivers/gpu/drm/radeon/r600.c:2965: warning: Excess function parameter 'fence' 
description in 'r600_copy_cpdma'
 drivers/gpu/drm/radeon/r600.c:4382: warning: Function parameter or member 
'rdev' not described in 'r600_mmio_hdp_flush'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/r600.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9587792503525..0a085b85f559d 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2952,7 +2952,7 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev,
  * @src_offset: src GPU address
  * @dst_offset: dst GPU address
  * @num_gpu_pages: number of GPU pages to xfer
- * @fence: radeon fence object
+ * @resv: DMA reservation object to manage fences
  *
  * Copy GPU paging using the CP DMA engine (r6xx+).
  * Used by the radeon ttm implementation to move pages if
@@ -4371,7 +4371,7 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
 
 /**
  * r600_mmio_hdp_flush - flush Host Data Path cache via MMIO
- * rdev: radeon device structure
+ * @rdev: radeon device structure
  *
  * Some R6XX/R7XX don't seem to take into account HDP flushes performed
  * through the ring buffer. This leads to corruption in rendering, see
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 06/20] drm/radeon/radeon_connectors: Strip out set but unused variable 'ret'

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_connectors.c: In function 
‘radeon_setup_mst_connector’:
 drivers/gpu/drm/radeon/radeon_connectors.c:2574:7: warning: variable ‘ret’ set 
but not used [-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index e308344344425..607ad5620bd99 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -2571,13 +2571,11 @@ void radeon_setup_mst_connector(struct drm_device *dev)
return;
 
list_for_each_entry(connector, >mode_config.connector_list, head) {
-   int ret;
-
radeon_connector = to_radeon_connector(connector);
 
if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort)
continue;
 
-   ret = radeon_dp_mst_init(radeon_connector);
+   radeon_dp_mst_init(radeon_connector);
}
 }
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 03/20] drm/radeon/radeon_fence: Demote some non-conformant kernel-doc headers and fix another

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_fence.c:168: warning: Function parameter or 
member 'wait' not described in 'radeon_fence_check_signaled'
 drivers/gpu/drm/radeon/radeon_fence.c:168: warning: Function parameter or 
member 'mode' not described in 'radeon_fence_check_signaled'
 drivers/gpu/drm/radeon/radeon_fence.c:168: warning: Function parameter or 
member 'flags' not described in 'radeon_fence_check_signaled'
 drivers/gpu/drm/radeon/radeon_fence.c:168: warning: Function parameter or 
member 'key' not described in 'radeon_fence_check_signaled'
 drivers/gpu/drm/radeon/radeon_fence.c:393: warning: Function parameter or 
member 'f' not described in 'radeon_fence_enable_signaling'
 drivers/gpu/drm/radeon/radeon_fence.c:393: warning: Excess function parameter 
'fence' description in 'radeon_fence_enable_signaling'
 drivers/gpu/drm/radeon/radeon_fence.c:1010: warning: Function parameter or 
member 'm' not described in 'radeon_debugfs_gpu_reset'
 drivers/gpu/drm/radeon/radeon_fence.c:1010: warning: Function parameter or 
member 'data' not described in 'radeon_debugfs_gpu_reset'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: Jerome Glisse 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_fence.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fence.c 
b/drivers/gpu/drm/radeon/radeon_fence.c
index 8735bf2bb8b5c..9ee6e599ef83b 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -157,7 +157,7 @@ int radeon_fence_emit(struct radeon_device *rdev,
return 0;
 }
 
-/**
+/*
  * radeon_fence_check_signaled - callback from fence_queue
  *
  * this function is called with fence_queue lock held, which is also used
@@ -383,7 +383,7 @@ static bool radeon_fence_is_signaled(struct dma_fence *f)
 
 /**
  * radeon_fence_enable_signaling - enable signalling on fence
- * @fence: fence
+ * @f: fence
  *
  * This function is called with fence_queue lock held, and adds a callback
  * to fence_queue that checks if this fence is signaled, and if so it
@@ -1001,7 +1001,7 @@ static int radeon_debugfs_fence_info(struct seq_file *m, 
void *data)
return 0;
 }
 
-/**
+/*
  * radeon_debugfs_gpu_reset - manually trigger a gpu reset
  *
  * Manually trigger a gpu reset at the next fence wait.
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 15/20] drm/radeon/r600d: Move 'rc600_*' prototypes into shared header

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/r600_hdmi.c:177:6: warning: no previous prototype for 
‘r600_hdmi_update_acr’ [-Wmissing-prototypes]
 177 | void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
 | ^~~~
 drivers/gpu/drm/radeon/r600_hdmi.c:217:6: warning: no previous prototype for 
‘r600_set_avi_packet’ [-Wmissing-prototypes]
 217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
 | ^~~
 drivers/gpu/drm/radeon/r600_hdmi.c:314:6: warning: no previous prototype for 
‘r600_hdmi_audio_set_dto’ [-Wmissing-prototypes]
 314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
 | ^~~
 drivers/gpu/drm/radeon/r600_hdmi.c:340:6: warning: no previous prototype for 
‘r600_set_vbi_packet’ [-Wmissing-prototypes]
 340 | void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset)
 | ^~~
 drivers/gpu/drm/radeon/r600_hdmi.c:351:6: warning: no previous prototype for 
‘r600_set_audio_packet’ [-Wmissing-prototypes]
 351 | void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset)
 | ^
 drivers/gpu/drm/radeon/r600_hdmi.c:393:6: warning: no previous prototype for 
‘r600_set_mute’ [-Wmissing-prototypes]
 393 | void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
 | ^
 drivers/gpu/drm/radeon/r600_hdmi.c:469:6: warning: no previous prototype for 
‘r600_hdmi_enable’ [-Wmissing-prototypes]
 469 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
 | ^~~~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/r600d.h| 14 ++
 drivers/gpu/drm/radeon/radeon_audio.c | 11 +--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 2e00a5287bd2d..db4bcc8bee4e5 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -27,6 +27,20 @@
 #ifndef R600D_H
 #define R600D_H
 
+struct radeon_crtc;
+struct radeon_hdmi_acr;
+
+void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset);
+void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
+void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
+   struct radeon_crtc *crtc, unsigned int clock);
+void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
+   unsigned char *buffer, size_t size);
+void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
+   const struct radeon_hdmi_acr *acr);
+void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
+void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
+
 #define CP_PACKET2 0x8000
 #definePACKET2_PAD_SHIFT   0
 #definePACKET2_PAD_MASK(0x3fff << 0)
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
b/drivers/gpu/drm/radeon/radeon_audio.c
index 8c63ccb8b6235..a2be60aa3cec4 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -27,6 +27,7 @@
 #include 
 #include "radeon.h"
 #include "atom.h"
+#include "r600d.h"
 #include "radeon_audio.h"
 
 void r600_audio_enable(struct radeon_device *rdev, struct r600_audio_pin *pin,
@@ -63,8 +64,6 @@ void dce6_afmt_write_latency_fields(struct drm_encoder 
*encoder,
 struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev);
 struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev);
 void dce6_afmt_select_pin(struct drm_encoder *encoder);
-void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
-   struct radeon_crtc *crtc, unsigned int clock);
 void dce3_2_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock);
 void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
@@ -75,31 +74,23 @@ void dce6_hdmi_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock);
 void dce6_dp_audio_set_dto(struct radeon_device *rdev,
struct radeon_crtc *crtc, unsigned int clock);
-void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
-   unsigned char *buffer, size_t size);
 void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset,
unsigned char *buffer, size_t size);
-void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
-   const struct radeon_hdmi_acr *acr);
 void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset,
const struct radeon_hdmi_acr *acr);
 void evergreen_hdmi_update_acr(struct drm_encoder *encoder, long offset,
const struct radeon_hdmi_acr *acr);
-void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
 void dce4_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
 void 

[PATCH 12/20] drm/radeon/radeon_cs: Fix a bunch of doc-rot issues

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_cs.c:416: warning: Function parameter or member 
'backoff' not described in 'radeon_cs_parser_fini'
 drivers/gpu/drm/radeon/radeon_cs.c:735: warning: Function parameter or member 
'p' not described in 'radeon_cs_packet_parse'
 drivers/gpu/drm/radeon/radeon_cs.c:735: warning: Function parameter or member 
'idx' not described in 'radeon_cs_packet_parse'
 drivers/gpu/drm/radeon/radeon_cs.c:735: warning: Excess function parameter 
'parser' description in 'radeon_cs_packet_parse'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Function parameter or member 
'p' not described in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Function parameter or member 
'cs_reloc' not described in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Function parameter or member 
'nomm' not described in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Excess function parameter 
'parser' description in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Excess function parameter 
'data' description in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Excess function parameter 
'offset_start' description in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Excess function parameter 
'offset_mask' description in 'radeon_cs_packet_next_reloc'
 drivers/gpu/drm/radeon/radeon_cs.c:844: warning: Excess function parameter 
'reloc' description in 'radeon_cs_packet_next_reloc'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: Jerome Glisse 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_cs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c 
b/drivers/gpu/drm/radeon/radeon_cs.c
index 21ce2f9502c09..729939df29cc5 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -408,6 +408,7 @@ static int cmp_size_smaller_first(void *priv, struct 
list_head *a,
  * cs_parser_fini() - clean parser states
  * @parser:parser structure holding parsing context.
  * @error: error number
+ * @backoff:   indicator to backoff the reservation
  *
  * If error is set than unvalidate buffer, otherwise just free memory
  * used by parsing context.
@@ -723,8 +724,9 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
 
 /**
  * radeon_cs_packet_parse() - parse cp packet and point ib index to next packet
- * @parser:parser structure holding parsing context.
+ * @p: parser structure holding parsing context.
  * @pkt:   where to store packet information
+ * @idx:   packet index
  *
  * Assume that chunk_ib_index is properly set. Will return -EINVAL
  * if packet is bigger than remaining ib size. or if packets is unknown.
@@ -829,11 +831,9 @@ void radeon_cs_dump_packet(struct radeon_cs_parser *p,
 
 /**
  * radeon_cs_packet_next_reloc() - parse next (should be reloc) packet
- * @parser:parser structure holding parsing context.
- * @data:  pointer to relocation data
- * @offset_start:  starting offset
- * @offset_mask:   offset mask (to align start offset on)
- * @reloc: reloc informations
+ * @p: parser structure holding parsing context.
+ * @cs_reloc:  reloc informations
+ * @nomm:  never actually used
  *
  * Check if next packet is relocation packet3, do bo validation and compute
  * GPU offset using the provided start.
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 00/20] [Set 3] Rid W=1 warnings from GPU

2020-11-09 Thread Lee Jones
This set is part of a larger effort attempting to clean-up W=1
kernel builds, which are currently overwhelmingly riddled with
niggly little warnings.

This set takes the running (decreasing) total from 5000 before
[Set 1] down to 2300.

Lee Jones (20):
  drm/radeon/radeon_ttm: Place declaration of 'rdev' in same clause as
its use
  drm/radeon: Move radeon_ttm{init,fini} to shared location
  drm/radeon/radeon_fence: Demote some non-conformant kernel-doc headers
and fix another
  drm/radeon: Move 'radeon_add_legacy_encoder' prototype to shared
header
  drm/radeon: Move 'radeon_add_legacy_encoder's prototype to shared
location
  drm/radeon/radeon_connectors: Strip out set but unused variable 'ret'
  drm/radeon/radeon_display: Remove unused variable 'mod'
  drm/radeon/radeon_i2c: Remove pointless function header
  drm/radeon/radeon_irq_kms: Demote non-conformant kernel-doc fix
another
  drm/radeon/radeon_ring: Add missing function parameters 'rdev' and
'data'
  drm/radeon/r600: Strip out set but unused 'tmp' variables
  drm/radeon/radeon_cs: Fix a bunch of doc-rot issues
  drm/radeon/evergreen: Move 'rv770_set_clk_bypass_mode' prototype to
shared location
  drm/radeon: Move 'radeon_pm_acpi_event_handler' prototype into shared
header
  drm/radeon/r600d: Move 'rc600_*' prototypes into shared header
  drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location
  drm/radeon/evergreend: Move 'evergreen_*' and 'sumo_*' prototypes out
to shared location
  drm/radeon/radeon_display: Fix function doc formatting and missing
param issues
  drm/radeon/r600: Fix a misnamed parameter description and a formatting
issue
  drm/radeon/cik: Fix a bunch of function parameter descriptions

 drivers/gpu/drm/radeon/cik.c   | 10 +++
 drivers/gpu/drm/radeon/evergreen.c |  1 -
 drivers/gpu/drm/radeon/ni.c| 16 --
 drivers/gpu/drm/radeon/r600.c  | 11 +++
 drivers/gpu/drm/radeon/r600d.h | 14 +
 drivers/gpu/drm/radeon/radeon.h| 34 ++
 drivers/gpu/drm/radeon/radeon_acpi.c   |  2 --
 drivers/gpu/drm/radeon/radeon_atombios.c   |  5 
 drivers/gpu/drm/radeon/radeon_audio.c  | 23 +--
 drivers/gpu/drm/radeon/radeon_audio.h  | 12 
 drivers/gpu/drm/radeon/radeon_combios.c|  5 
 drivers/gpu/drm/radeon/radeon_connectors.c |  4 +--
 drivers/gpu/drm/radeon/radeon_cs.c | 12 
 drivers/gpu/drm/radeon/radeon_display.c| 17 +--
 drivers/gpu/drm/radeon/radeon_encoders.c   |  3 --
 drivers/gpu/drm/radeon/radeon_fence.c  |  6 ++--
 drivers/gpu/drm/radeon/radeon_i2c.c|  4 ---
 drivers/gpu/drm/radeon/radeon_irq_kms.c|  6 ++--
 drivers/gpu/drm/radeon/radeon_object.c |  2 --
 drivers/gpu/drm/radeon/radeon_ring.c   |  3 ++
 drivers/gpu/drm/radeon/radeon_ttm.c|  8 ++---
 drivers/gpu/drm/radeon/si.c|  6 
 22 files changed, 96 insertions(+), 108 deletions(-)

Cc: Alex Deucher 
Cc: amd-gfx@lists.freedesktop.org
Cc: "Christian König" 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: Jerome Glisse 
Cc: linaro-mm-...@lists.linaro.org
Cc: linux-me...@vger.kernel.org
Cc: report to 
Cc: Slava Grigorev 
Cc: Sumit Semwal 
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 08/20] drm/radeon/radeon_i2c: Remove pointless function header

2020-11-09 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/radeon/radeon_i2c.c:46: warning: Function parameter or member 
'radeon_connector' not described in 'radeon_ddc_probe'
 drivers/gpu/drm/radeon/radeon_i2c.c:46: warning: Function parameter or member 
'use_aux' not described in 'radeon_ddc_probe'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/radeon_i2c.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 545e31e6cc3a9..aa61b3cb4049c 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -38,10 +38,6 @@ extern int radeon_atom_hw_i2c_xfer(struct i2c_adapter 
*i2c_adap,
   struct i2c_msg *msgs, int num);
 extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap);
 
-/**
- * radeon_ddc_probe
- *
- */
 bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux)
 {
u8 out = 0x0;
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drivers: amdgpu: amdgpu_display: Fixed the spelling of falg to flag

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 4:16 PM Bhaskar Chowdhury  wrote:
>
> s/falg/flag/p
>
> Signed-off-by: Bhaskar Chowdhury 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 2e8a8b57639f..9223502c1e5b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -509,7 +509,7 @@ uint32_t amdgpu_display_supported_domains(struct 
> amdgpu_device *adev,
>  * to avoid hang caused by placement of scanout BO in GTT on certain
>  * APUs. So force the BO placement to VRAM in case this architecture
>  * will not allow USWC mappings.
> -* Also, don't allow GTT domain if the BO doens't have USWC falg set.
> +* Also, don't allow GTT domain if the BO doens't have USWC flag set.
>  */
> if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
> amdgpu_bo_support_uswc(bo_flags) &&
> --
> 2.26.2
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drivers: amdgpu: amdgpu_display: Fixed the spelling of falg to flag

2020-11-09 Thread Bhaskar Chowdhury
s/falg/flag/p

Signed-off-by: Bhaskar Chowdhury 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 2e8a8b57639f..9223502c1e5b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -509,7 +509,7 @@ uint32_t amdgpu_display_supported_domains(struct 
amdgpu_device *adev,
 * to avoid hang caused by placement of scanout BO in GTT on certain
 * APUs. So force the BO placement to VRAM in case this architecture
 * will not allow USWC mappings.
-* Also, don't allow GTT domain if the BO doens't have USWC falg set.
+* Also, don't allow GTT domain if the BO doens't have USWC flag set.
 */
if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
amdgpu_bo_support_uswc(bo_flags) &&
--
2.26.2

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Sam Ravnborg wrote:

> On Mon, Nov 09, 2020 at 08:10:13PM +, Lee Jones wrote:
> > On Mon, 09 Nov 2020, Sam Ravnborg wrote:
> > 
> > > Hi Alex,
> > > On Mon, Nov 09, 2020 at 02:50:35PM -0500, Alex Deucher wrote:
> > > > On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> > > > >
> > > > > Fixes the following W=1 kernel build warning(s):
> > > > >
> > > > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter 
> > > > > or member 'dev' not described in 'radeon_info_ioctl'
> > > > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > > > > parameter 'rdev' description in 'radeon_info_ioctl'
> > > > >
> > > > > Cc: Alex Deucher 
> > > > > Cc: "Christian König" 
> > > > > Cc: David Airlie 
> > > > > Cc: Daniel Vetter 
> > > > > Cc: amd-gfx@lists.freedesktop.org
> > > > > Cc: dri-de...@lists.freedesktop.org
> > > > > Signed-off-by: Lee Jones 
> > > > > ---
> > > > >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > > > > b/drivers/gpu/drm/radeon/radeon_kms.c
> > > > > index 0d8fbabffcead..21c206795c364 100644
> > > > > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > > > > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > > > > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct 
> > > > > drm_device *dev,
> > > > >  /**
> > > > >   * radeon_info_ioctl - answer a device specific request.
> > > > >   *
> > > > > - * @rdev: radeon device pointer
> > > > > + * @dev: radeon device pointer
> > > > 
> > > > This should be:
> > > > + * @dev: drm device pointer
> > > 
> > > good spot. I am continuing the work on radeon and will post a patchset
> > > that contains only radeon fixes with Lee's patches and a few more by me.
> > > I will fix the above.
> > 
> > What do you mean by "continuing on"?
> > 
> > How will you prevent your work from conflicting with my current effort?
> 
> Quoting from previous mail in this thread:
> 
>   "
>   > > How would you like me to move forward?
>   >
>   > Fix the thousand of warnings in other places :-)
>   > I will take a look at radeon and post a new series based on your work
>   > with all W=1 warnings fixed.
> 
>   I'll drop this patch and carry on ploughing through the rest of them.
> "
> 
> Here I promised you to fix all warnings in the radeon driver.
> And despite this being more work than anticipated a promise is a
> promise. So therefore I started working on this.
> 
> If you want to do the rest of the radeon driver you are welcome and I
> will gladly drop this again. Just let me know your preference.

That was the plan.  To continue on and solve as many warnings as I can
before I start bumping into more serious issues like the one mentioned
above.  If you'd like to solve the radeon_init() issue right away;
however, that would be super helpful.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drivers: amdgpu: amdgpu_display.c: Fix a spelling doens\'t to doesn\'t

2020-11-09 Thread Bhaskar Chowdhury

On 14:47 Mon 09 Nov 2020, Alex Deucher wrote:

On Mon, Nov 9, 2020 at 3:52 AM Bhaskar Chowdhury  wrote:


s/doens't/doesn't/p

Signed-off-by: Bhaskar Chowdhury 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 7cc7af2a6822..a92cb137293a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -512,7 +512,7 @@ uint32_t amdgpu_display_supported_domains(struct 
amdgpu_device *adev,
 * to avoid hang caused by placement of scanout BO in GTT on certain
 * APUs. So force the BO placement to VRAM in case this architecture
 * will not allow USWC mappings.
-* Also, don't allow GTT domain if the BO doens't have USWC falg set.
+* Also, don't allow GTT domain if the BO doesn't have USWC falg set.


Applied. Care to send a patch to also fix the spelling of "flag"?

Thanks,

Alex


Ah, good catch ..my bad ..should have move vigilant...another patch on the
way



 */
if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
amdgpu_bo_support_uswc(bo_flags) &&
--
2.26.2

___
dri-devel mailing list
dri-de...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


signature.asc
Description: PGP signature
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Sam Ravnborg
On Mon, Nov 09, 2020 at 08:10:13PM +, Lee Jones wrote:
> On Mon, 09 Nov 2020, Sam Ravnborg wrote:
> 
> > Hi Alex,
> > On Mon, Nov 09, 2020 at 02:50:35PM -0500, Alex Deucher wrote:
> > > On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> > > >
> > > > Fixes the following W=1 kernel build warning(s):
> > > >
> > > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter 
> > > > or member 'dev' not described in 'radeon_info_ioctl'
> > > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > > > parameter 'rdev' description in 'radeon_info_ioctl'
> > > >
> > > > Cc: Alex Deucher 
> > > > Cc: "Christian König" 
> > > > Cc: David Airlie 
> > > > Cc: Daniel Vetter 
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-de...@lists.freedesktop.org
> > > > Signed-off-by: Lee Jones 
> > > > ---
> > > >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > > > b/drivers/gpu/drm/radeon/radeon_kms.c
> > > > index 0d8fbabffcead..21c206795c364 100644
> > > > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > > > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > > > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct 
> > > > drm_device *dev,
> > > >  /**
> > > >   * radeon_info_ioctl - answer a device specific request.
> > > >   *
> > > > - * @rdev: radeon device pointer
> > > > + * @dev: radeon device pointer
> > > 
> > > This should be:
> > > + * @dev: drm device pointer
> > 
> > good spot. I am continuing the work on radeon and will post a patchset
> > that contains only radeon fixes with Lee's patches and a few more by me.
> > I will fix the above.
> 
> What do you mean by "continuing on"?
> 
> How will you prevent your work from conflicting with my current effort?

Quoting from previous mail in this thread:

  "
  > > How would you like me to move forward?
  >
  > Fix the thousand of warnings in other places :-)
  > I will take a look at radeon and post a new series based on your work
  > with all W=1 warnings fixed.

  I'll drop this patch and carry on ploughing through the rest of them.
"

Here I promised you to fix all warnings in the radeon driver.
And despite this being more work than anticipated a promise is a
promise. So therefore I started working on this.

If you want to do the rest of the radeon driver you are welcome and I
will gladly drop this again. Just let me know your preference.

Sam
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH v2 1/8] drm: Add dummy page per device or GEM object

2020-11-09 Thread Andrey Grodzovsky


On 6/22/20 1:50 PM, Daniel Vetter wrote:

On Mon, Jun 22, 2020 at 7:45 PM Christian König
 wrote:

Am 22.06.20 um 16:32 schrieb Andrey Grodzovsky:

On 6/22/20 9:18 AM, Christian König wrote:

Am 21.06.20 um 08:03 schrieb Andrey Grodzovsky:

Will be used to reroute CPU mapped BO's page faults once
device is removed.

Signed-off-by: Andrey Grodzovsky 
---
   drivers/gpu/drm/drm_file.c  |  8 
   drivers/gpu/drm/drm_prime.c | 10 ++
   include/drm/drm_file.h  |  2 ++
   include/drm/drm_gem.h   |  2 ++
   4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index c4c704e..67c0770 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -188,6 +188,12 @@ struct drm_file *drm_file_alloc(struct
drm_minor *minor)
   goto out_prime_destroy;
   }
   +file->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+if (!file->dummy_page) {
+ret = -ENOMEM;
+goto out_prime_destroy;
+}
+
   return file;
 out_prime_destroy:
@@ -284,6 +290,8 @@ void drm_file_free(struct drm_file *file)
   if (dev->driver->postclose)
   dev->driver->postclose(dev, file);
   +__free_page(file->dummy_page);
+
   drm_prime_destroy_file_private(>prime);
 WARN_ON(!list_empty(>event_list));
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 1de2cde..c482e9c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -335,6 +335,13 @@ int drm_gem_prime_fd_to_handle(struct
drm_device *dev,
 ret = drm_prime_add_buf_handle(_priv->prime,
   dma_buf, *handle);
+
+if (!ret) {
+obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+if (!obj->dummy_page)
+ret = -ENOMEM;
+}
+

While the per file case still looks acceptable this is a clear NAK
since it will massively increase the memory needed for a prime
exported object.

I think that this is quite overkill in the first place and for the
hot unplug case we can just use the global dummy page as well.

Christian.


Global dummy page is good for read access, what do you do on write
access ? My first approach was indeed to map at first global dummy
page as read only and mark the vma->vm_flags as !VM_SHARED assuming
that this would trigger Copy On Write flow in core mm
(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.7-rc7%2Fsource%2Fmm%2Fmemory.c%23L3977data=02%7C01%7CAndrey.Grodzovsky%40amd.com%7C3753451d037544e7495408d816d4c4ee%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637284450384586120sdata=ZpRaQgqA5K4jRfidOiedey0AleeYQ97WNUkGA29ERA0%3Dreserved=0)
on the next page fault to same address triggered by a write access but
then i realized a new COW page will be allocated for each such mapping
and this is much more wasteful then having a dedicated page per GEM
object.

Yeah, but this is only for a very very small corner cases. What we need
to prevent is increasing the memory usage during normal operation to much.

Using memory during the unplug is completely unproblematic because we
just released quite a bunch of it by releasing all those system memory
buffers.

And I'm pretty sure that COWed pages are correctly accounted towards the
used memory of a process.

So I think if that approach works as intended and the COW pages are
released again on unmapping it would be the perfect solution to the problem.

Daniel what do you think?

If COW works, sure sounds reasonable. And if we can make sure we
managed to drop all the system allocations (otherwise suddenly 2x
memory usage, worst case). But I have no idea whether we can
retroshoehorn that into an established vma, you might have fun stuff
like a mkwrite handler there (which I thought is the COW handler
thing, but really no idea).



Can you clarify your concern here ? I see no DRM driver besides vmwgfx
who installs a handler for vm_operations_struct.page_mkwrite and in any
case, since I will be turning off VM_SHARED flag for the faulting vm_area_struct
making it a COW, page_mkwrite will not be called on any subsequent vm fault.

Andrey




If we need to massively change stuff then I think rw dummy page,
allocated on first fault after hotunplug (maybe just make it one per
object, that's simplest) seems like the much safer option. Much less
code that can go wrong.
-Daniel


Regards,
Christian.


We can indeed optimize by allocating this dummy page on the first page
fault after device disconnect instead on GEM object creation.

Andrey



mutex_unlock(_priv->prime.lock);
   if (ret)
   goto fail;
@@ -1006,6 +1013,9 @@ void drm_prime_gem_destroy(struct
drm_gem_object *obj, struct sg_table *sg)
   dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL);
   dma_buf = attach->dmabuf;
   dma_buf_detach(attach->dmabuf, attach);
+
+__free_page(obj->dummy_page);
+
   /* remove the reference */
   dma_buf_put(dma_buf);
   }

Re: [PATCH v2 1/8] drm: Add dummy page per device or GEM object

2020-11-09 Thread Andrey Grodzovsky


On 6/22/20 5:35 AM, Daniel Vetter wrote:

On Sun, Jun 21, 2020 at 02:03:01AM -0400, Andrey Grodzovsky wrote:

Will be used to reroute CPU mapped BO's page faults once
device is removed.

Signed-off-by: Andrey Grodzovsky 
---
  drivers/gpu/drm/drm_file.c  |  8 
  drivers/gpu/drm/drm_prime.c | 10 ++
  include/drm/drm_file.h  |  2 ++
  include/drm/drm_gem.h   |  2 ++
  4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index c4c704e..67c0770 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -188,6 +188,12 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
goto out_prime_destroy;
}
  
+	file->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);

+   if (!file->dummy_page) {
+   ret = -ENOMEM;
+   goto out_prime_destroy;
+   }
+
return file;
  
  out_prime_destroy:

@@ -284,6 +290,8 @@ void drm_file_free(struct drm_file *file)
if (dev->driver->postclose)
dev->driver->postclose(dev, file);
  
+	__free_page(file->dummy_page);

+
drm_prime_destroy_file_private(>prime);
  
  	WARN_ON(!list_empty(>event_list));

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 1de2cde..c482e9c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -335,6 +335,13 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
  
  	ret = drm_prime_add_buf_handle(_priv->prime,

dma_buf, *handle);
+
+   if (!ret) {
+   obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+   if (!obj->dummy_page)
+   ret = -ENOMEM;
+   }
+
mutex_unlock(_priv->prime.lock);
if (ret)
goto fail;
@@ -1006,6 +1013,9 @@ void drm_prime_gem_destroy(struct drm_gem_object *obj, 
struct sg_table *sg)
dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL);
dma_buf = attach->dmabuf;
dma_buf_detach(attach->dmabuf, attach);
+
+   __free_page(obj->dummy_page);
+
/* remove the reference */
dma_buf_put(dma_buf);
  }
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 19df802..349a658 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -335,6 +335,8 @@ struct drm_file {
 */
struct drm_prime_file_private prime;
  

Kerneldoc for these please, including why we need them and when. E.g. the
one in gem_bo should say it's only for exported buffers, so that we're not
colliding security spaces.


+   struct page *dummy_page;
+
/* private: */
  #if IS_ENABLED(CONFIG_DRM_LEGACY)
unsigned long lock_count; /* DRI1 legacy lock count */
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 0b37506..47460d1 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -310,6 +310,8 @@ struct drm_gem_object {
 *
 */
const struct drm_gem_object_funcs *funcs;
+
+   struct page *dummy_page;
  };

I think amdgpu doesn't care, but everyone else still might care somewhat
about flink. That also shares buffers, so also needs to allocate the
per-bo dummy page.



Hi, back to this topic after a long context switch for internal project.

I don't see why for FLINK we can't use same dummy page from struct 
drm_gem_object - looking
at drm_gem_flink_ioctl I see that the underlying object we look up is still of 
type drm_gem_object.

Why we need per BO (TTM BO  I assume?) dummy page for this ?

Andrey




I also wonder whether we shouldn't have a helper to look up the dummy
page, just to encode in core code how it's supposedo to cascade.
-Daniel

  
  /**

--
2.7.4


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Sam Ravnborg wrote:

> Hi Alex,
> On Mon, Nov 09, 2020 at 02:50:35PM -0500, Alex Deucher wrote:
> > On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> > >
> > > Fixes the following W=1 kernel build warning(s):
> > >
> > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> > > member 'dev' not described in 'radeon_info_ioctl'
> > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > > parameter 'rdev' description in 'radeon_info_ioctl'
> > >
> > > Cc: Alex Deucher 
> > > Cc: "Christian König" 
> > > Cc: David Airlie 
> > > Cc: Daniel Vetter 
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-de...@lists.freedesktop.org
> > > Signed-off-by: Lee Jones 
> > > ---
> > >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > > b/drivers/gpu/drm/radeon/radeon_kms.c
> > > index 0d8fbabffcead..21c206795c364 100644
> > > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device 
> > > *dev,
> > >  /**
> > >   * radeon_info_ioctl - answer a device specific request.
> > >   *
> > > - * @rdev: radeon device pointer
> > > + * @dev: radeon device pointer
> > 
> > This should be:
> > + * @dev: drm device pointer
> 
> good spot. I am continuing the work on radeon and will post a patchset
> that contains only radeon fixes with Lee's patches and a few more by me.
> I will fix the above.

What do you mean by "continuing on"?

How will you prevent your work from conflicting with my current effort?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 2:56 PM Sam Ravnborg  wrote:
>
> Hi Alex,
> On Mon, Nov 09, 2020 at 02:50:35PM -0500, Alex Deucher wrote:
> > On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> > >
> > > Fixes the following W=1 kernel build warning(s):
> > >
> > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> > > member 'dev' not described in 'radeon_info_ioctl'
> > >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > > parameter 'rdev' description in 'radeon_info_ioctl'
> > >
> > > Cc: Alex Deucher 
> > > Cc: "Christian König" 
> > > Cc: David Airlie 
> > > Cc: Daniel Vetter 
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-de...@lists.freedesktop.org
> > > Signed-off-by: Lee Jones 
> > > ---
> > >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > > b/drivers/gpu/drm/radeon/radeon_kms.c
> > > index 0d8fbabffcead..21c206795c364 100644
> > > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device 
> > > *dev,
> > >  /**
> > >   * radeon_info_ioctl - answer a device specific request.
> > >   *
> > > - * @rdev: radeon device pointer
> > > + * @dev: radeon device pointer
> >
> > This should be:
> > + * @dev: drm device pointer
>
> good spot. I am continuing the work on radeon and will post a patchset
> that contains only radeon fixes with Lee's patches and a few more by me.
> I will fix the above.

Awesome.  Thanks!

Alex
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Alex Deucher wrote:

> On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> >
> > Fixes the following W=1 kernel build warning(s):
> >
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> > member 'dev' not described in 'radeon_info_ioctl'
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > parameter 'rdev' description in 'radeon_info_ioctl'
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > b/drivers/gpu/drm/radeon/radeon_kms.c
> > index 0d8fbabffcead..21c206795c364 100644
> > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device 
> > *dev,
> >  /**
> >   * radeon_info_ioctl - answer a device specific request.
> >   *
> > - * @rdev: radeon device pointer
> > + * @dev: radeon device pointer
> 
> This should be:
> + * @dev: drm device pointer

Makes sense.  If you don't fancy fixing this up, I'll send out a
fix-up in a few days.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 16/19] drm/amd/amdgpu/amdgpu_kms: Remove 'struct drm_amdgpu_info_device dev_info' from the stack

2020-11-09 Thread Alex Deucher
On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
>
> Place it on the heap instead.
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c: In function ‘amdgpu_info_ioctl’:
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:979:1: warning: the frame size of 
> 1128 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 104 +---
>  1 file changed, 55 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 918d4e9c6461a..ef6fa5007d135 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -721,38 +721,42 @@ static int amdgpu_info_ioctl(struct drm_device *dev, 
> void *data, struct drm_file
> return n ? -EFAULT : 0;
> }
> case AMDGPU_INFO_DEV_INFO: {
> -   struct drm_amdgpu_info_device dev_info;
> +   struct drm_amdgpu_info_device *dev_info;
> uint64_t vm_size;
> +   int ret;
> +
> +   dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL);
> +   if (!dev_info)
> +   return -ENOMEM;
>
> -   memset(_info, 0, sizeof(dev_info));
> -   dev_info.device_id = dev->pdev->device;
> -   dev_info.chip_rev = adev->rev_id;
> -   dev_info.external_rev = adev->external_rev_id;
> -   dev_info.pci_rev = dev->pdev->revision;
> -   dev_info.family = adev->family;
> -   dev_info.num_shader_engines = 
> adev->gfx.config.max_shader_engines;
> -   dev_info.num_shader_arrays_per_engine = 
> adev->gfx.config.max_sh_per_se;
> +   dev_info->device_id = dev->pdev->device;
> +   dev_info->chip_rev = adev->rev_id;
> +   dev_info->external_rev = adev->external_rev_id;
> +   dev_info->pci_rev = dev->pdev->revision;
> +   dev_info->family = adev->family;
> +   dev_info->num_shader_engines = 
> adev->gfx.config.max_shader_engines;
> +   dev_info->num_shader_arrays_per_engine = 
> adev->gfx.config.max_sh_per_se;
> /* return all clocks in KHz */
> -   dev_info.gpu_counter_freq = amdgpu_asic_get_xclk(adev) * 10;
> +   dev_info->gpu_counter_freq = amdgpu_asic_get_xclk(adev) * 10;
> if (adev->pm.dpm_enabled) {
> -   dev_info.max_engine_clock = amdgpu_dpm_get_sclk(adev, 
> false) * 10;
> -   dev_info.max_memory_clock = amdgpu_dpm_get_mclk(adev, 
> false) * 10;
> +   dev_info->max_engine_clock = 
> amdgpu_dpm_get_sclk(adev, false) * 10;
> +   dev_info->max_memory_clock = 
> amdgpu_dpm_get_mclk(adev, false) * 10;
> } else {
> -   dev_info.max_engine_clock = adev->clock.default_sclk 
> * 10;
> -   dev_info.max_memory_clock = adev->clock.default_mclk 
> * 10;
> +   dev_info->max_engine_clock = adev->clock.default_sclk 
> * 10;
> +   dev_info->max_memory_clock = adev->clock.default_mclk 
> * 10;
> }
> -   dev_info.enabled_rb_pipes_mask = 
> adev->gfx.config.backend_enable_mask;
> -   dev_info.num_rb_pipes = adev->gfx.config.max_backends_per_se *
> +   dev_info->enabled_rb_pipes_mask = 
> adev->gfx.config.backend_enable_mask;
> +   dev_info->num_rb_pipes = adev->gfx.config.max_backends_per_se 
> *
> adev->gfx.config.max_shader_engines;
> -   dev_info.num_hw_gfx_contexts = 
> adev->gfx.config.max_hw_contexts;
> -   dev_info._pad = 0;
> -   dev_info.ids_flags = 0;
> +   dev_info->num_hw_gfx_contexts = 
> adev->gfx.config.max_hw_contexts;
> +   dev_info->_pad = 0;
> +   dev_info->ids_flags = 0;
> if (adev->flags & AMD_IS_APU)
> -   dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
> +   dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
> if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
> -   dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
> +   dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
> if (amdgpu_is_tmz(adev))
> -   dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
> +   dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>
> vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
> vm_size -= AMDGPU_VA_RESERVED_SIZE;
> @@ -762,45 

Re: [PATCH 12/19] drm/amd/display/dc/basics/fixpt31_32: Move variables to where they're used

2020-11-09 Thread Alex Deucher
On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
>
> Also rid some unused ones.
>
> This patch solves 2000 warnings!
>
> Fixes the following W=1 kernel build warning(s):
>
>  In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:33,
>  from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30,
>  from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
>  from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:35:
>  At top level:
>  drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:76:32: warning: 
> ‘dc_fixpt_ln2_div_2’ defined but not used [-Wunused-const-variable=]
>  76 | static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
>  | ^~
>  drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:75:32: warning: 
> ‘dc_fixpt_ln2’ defined but not used [-Wunused-const-variable=]
>  75 | static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
>  | ^~~~
>  drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:74:32: warning: 
> ‘dc_fixpt_e’ defined but not used [-Wunused-const-variable=]
>  74 | static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
>  | ^~
>  drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:73:32: warning: 
> ‘dc_fixpt_two_pi’ defined but not used [-Wunused-const-variable=]
>  73 | static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
>  | ^~~
>  drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:72:32: warning: 
> ‘dc_fixpt_pi’ defined but not used [-Wunused-const-variable=]
>  72 | static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
>  | ^~~
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c | 5 +
>  drivers/gpu/drm/amd/display/include/fixed31_32.h   | 6 --
>  2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c 
> b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
> index 1e9a2d3520684..59f37563704ad 100644
> --- a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
> +++ b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
> @@ -26,6 +26,11 @@
>  #include "dm_services.h"
>  #include "include/fixed31_32.h"
>
> +static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
> +static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
> +static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
> +static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
> +
>  static inline unsigned long long abs_i64(
> long long arg)
>  {
> diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h 
> b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> index 16df2a485dd0d..22053d7ea6ced 100644
> --- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
> +++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> @@ -69,12 +69,6 @@ static const struct fixed31_32 dc_fixpt_epsilon = { 1LL };
>  static const struct fixed31_32 dc_fixpt_half = { 0x8000LL };
>  static const struct fixed31_32 dc_fixpt_one = { 0x1LL };
>
> -static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
> -static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
> -static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
> -static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
> -static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
> -
>  /*
>   * @brief
>   * Initialization routines
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Sam Ravnborg
Hi Alex,
On Mon, Nov 09, 2020 at 02:50:35PM -0500, Alex Deucher wrote:
> On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
> >
> > Fixes the following W=1 kernel build warning(s):
> >
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> > member 'dev' not described in 'radeon_info_ioctl'
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > parameter 'rdev' description in 'radeon_info_ioctl'
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > b/drivers/gpu/drm/radeon/radeon_kms.c
> > index 0d8fbabffcead..21c206795c364 100644
> > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device 
> > *dev,
> >  /**
> >   * radeon_info_ioctl - answer a device specific request.
> >   *
> > - * @rdev: radeon device pointer
> > + * @dev: radeon device pointer
> 
> This should be:
> + * @dev: drm device pointer

good spot. I am continuing the work on radeon and will post a patchset
that contains only radeon fixes with Lee's patches and a few more by me.
I will fix the above.

Sam
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 14/19] drm/amd/amdgpu/amdgpu_device: Provide documentation for 'reg_addr' params

2020-11-09 Thread Alex Deucher
On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:594: warning: Function parameter 
> or member 'reg_addr' not described in 'amdgpu_device_indirect_rreg'
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:624: warning: Function parameter 
> or member 'reg_addr' not described in 'amdgpu_device_indirect_rreg64'
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 300fcade4a2b1..63374d12e00fe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -585,6 +585,7 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, 
> u32 index, u64 v)
>   * @adev: amdgpu_device pointer
>   * @pcie_index: mmio register offset
>   * @pcie_data: mmio register offset
> + * @reg_addr: indirect register address to read from
>   *
>   * Returns the value of indirect register @reg_addr
>   */
> @@ -615,6 +616,7 @@ u32 amdgpu_device_indirect_rreg(struct amdgpu_device 
> *adev,
>   * @adev: amdgpu_device pointer
>   * @pcie_index: mmio register offset
>   * @pcie_data: mmio register offset
> + * @reg_addr: indirect register address to read from
>   *
>   * Returns the value of indirect register @reg_addr
>   */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Alex Deucher
On Fri, Nov 6, 2020 at 4:50 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> member 'dev' not described in 'radeon_info_ioctl'
>  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function parameter 
> 'rdev' description in 'radeon_info_ioctl'
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> b/drivers/gpu/drm/radeon/radeon_kms.c
> index 0d8fbabffcead..21c206795c364 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device *dev,
>  /**
>   * radeon_info_ioctl - answer a device specific request.
>   *
> - * @rdev: radeon device pointer
> + * @dev: radeon device pointer

This should be:
+ * @dev: drm device pointer

Alex

>   * @data: request object
>   * @filp: drm filp
>   *
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drivers: amdgpu: amdgpu_display.c: Fix a spelling doens\'t to doesn\'t

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 3:52 AM Bhaskar Chowdhury  wrote:
>
> s/doens't/doesn't/p
>
> Signed-off-by: Bhaskar Chowdhury 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 7cc7af2a6822..a92cb137293a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -512,7 +512,7 @@ uint32_t amdgpu_display_supported_domains(struct 
> amdgpu_device *adev,
>  * to avoid hang caused by placement of scanout BO in GTT on certain
>  * APUs. So force the BO placement to VRAM in case this architecture
>  * will not allow USWC mappings.
> -* Also, don't allow GTT domain if the BO doens't have USWC falg set.
> +* Also, don't allow GTT domain if the BO doesn't have USWC falg set.

Applied. Care to send a patch to also fix the spelling of "flag"?

Thanks,

Alex


>  */
> if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
> amdgpu_bo_support_uswc(bo_flags) &&
> --
> 2.26.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail

2020-11-09 Thread Sonny Jiang
The SI UVD firmware validate key is stored at the end of firmware,
which is changed during resume while playing video. So get the key
at sw_init and store it for fw validate using.

Signed-off-by: Sonny Jiang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c   | 20 +++-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
index 5eb63288d157..edbb8194ee81 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
@@ -67,6 +67,7 @@ struct amdgpu_uvd {
unsignedharvest_config;
/* store image width to adjust nb memory state */
unsigneddecode_image_width;
+   uint32_tkeyselect;
 };
 
 int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
index 7cf4b11a65c5..3a5dce634cda 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
@@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct amdgpu_device *adev)
  */
 static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
 {
-   void *ptr;
-   uint32_t ucode_len, i;
-   uint32_t keysel;
-
-   ptr = adev->uvd.inst[0].cpu_addr;
-   ptr += 192 + 16;
-   memcpy(_len, ptr, 4);
-   ptr += ucode_len;
-   memcpy(, ptr, 4);
+   int i;
+   uint32_t keysel = adev->uvd.keyselect;
 
WREG32(mmUVD_FW_START, keysel);
 
@@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle)
struct amdgpu_ring *ring;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
int r;
+   void *ptr;
+   uint32_t ucode_len;
 
/* UVD TRAP */
r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, 
>uvd.inst->irq);
@@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle)
if (r)
return r;
 
+   /* Retrieval firmware validate key */
+   ptr = adev->uvd.inst[0].cpu_addr;
+   ptr += 192 + 16;
+   memcpy(_len, ptr, 4);
+   ptr += ucode_len;
+   memcpy(>uvd.keyselect, ptr, 4);
+
ring = >uvd.inst->ring;
sprintf(ring->name, "uvd");
r = amdgpu_ring_init(adev, ring, 512, >uvd.inst->irq, 0,
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 3/3] drm/amdgpu: enable only one compute queue for raven

2020-11-09 Thread Alex Deucher
On Mon, Nov 9, 2020 at 1:12 PM Nirmoy Das  wrote:
>
> Because of firmware bug, Raven asics can't handle jobs
> scheduled to multiple compute queues. So enable only one
> compute queue till we have a firmware fix.
>
> Signed-off-by: Nirmoy Das 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 97a8f786cf85..9352fcb77fe9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -812,6 +812,13 @@ void amdgpu_kiq_wreg(struct amdgpu_device *adev, 
> uint32_t reg, uint32_t v)
>  int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)
>  {
> if (amdgpu_num_kcq == -1) {
> +   /* raven firmware currently can not load balance jobs
> +* among multiple compute queues. Enable only one
> +* compute queue till we have a firmware fix.
> +*/
> +   if (adev->asic_type == CHIP_RAVEN)
> +   return 1;
> +

I think this is fine as a workaround for now, but it would be worth
checking is the issues are only between queues on the same pipe or
pipes on an MEC.  E.g., can we safely enable one queue per MEC?  What
about one queue per pipe?

Alex


> return 8;
> } else if (amdgpu_num_kcq > 8 || amdgpu_num_kcq < 0) {
> dev_warn(adev->dev, "set kernel compute queue number to 8 due 
> to invalid parameter provided by user\n");
> --
> 2.29.0
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 3/3] drm/amdgpu: enable only one compute queue for raven

2020-11-09 Thread Nirmoy Das
Because of firmware bug, Raven asics can't handle jobs
scheduled to multiple compute queues. So enable only one
compute queue till we have a firmware fix.

Signed-off-by: Nirmoy Das 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 97a8f786cf85..9352fcb77fe9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -812,6 +812,13 @@ void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t 
reg, uint32_t v)
 int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)
 {
if (amdgpu_num_kcq == -1) {
+   /* raven firmware currently can not load balance jobs
+* among multiple compute queues. Enable only one
+* compute queue till we have a firmware fix.
+*/
+   if (adev->asic_type == CHIP_RAVEN)
+   return 1;
+
return 8;
} else if (amdgpu_num_kcq > 8 || amdgpu_num_kcq < 0) {
dev_warn(adev->dev, "set kernel compute queue number to 8 due 
to invalid parameter provided by user\n");
-- 
2.29.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/3] drm/amdgpu: fix compute queue priority if num_kcq is less than 4

2020-11-09 Thread Nirmoy Das
Compute queues are configurable with module param, num_kcq.
amdgpu_gfx_is_high_priority_compute_queue was setting 1st 4 queues to
high priority queue leaving a null drm scheduler in
adev->gpu_sched[hw_ip]["normal_prio"].sched if num_kcq < 5.

This patch tries to fix it by alternating compute queue priority between
normal and high priority.

Fixes: 33abcb1f5a1719b1c (drm/amdgpu: set compute queue priority at mqd_init)

Signed-off-by: Nirmoy Das 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 10 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  |  6 --
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   |  6 --
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   |  7 +--
 5 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index e584f48f3b54..97a8f786cf85 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -193,10 +193,14 @@ static bool amdgpu_gfx_is_multipipe_capable(struct 
amdgpu_device *adev)
 }
 
 bool amdgpu_gfx_is_high_priority_compute_queue(struct amdgpu_device *adev,
-  int queue)
+  int pipe, int queue)
 {
-   /* Policy: make queue 0 of each pipe as high priority compute queue */
-   return (queue == 0);
+   bool multipipe_policy = amdgpu_gfx_is_multipipe_capable(adev);
+   int cond;
+   /* Policy: alternate between normal and high priority */
+   cond = multipipe_policy ? pipe : queue;
+
+   return ((cond % 2) != 0);
 
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index 786eb4aa7314..671d4b37c397 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -374,7 +374,7 @@ void amdgpu_queue_mask_bit_to_mec_queue(struct 
amdgpu_device *adev, int bit,
 bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev, int mec,
 int pipe, int queue);
 bool amdgpu_gfx_is_high_priority_compute_queue(struct amdgpu_device *adev,
-  int queue);
+  int pipe, int queue);
 int amdgpu_gfx_me_queue_to_bit(struct amdgpu_device *adev, int me,
   int pipe, int queue);
 void amdgpu_gfx_bit_to_me_queue(struct amdgpu_device *adev, int bit,
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 8c3bad3dfc01..da5a139c7022 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -4472,7 +4472,8 @@ static int gfx_v10_0_compute_ring_init(struct 
amdgpu_device *adev, int ring_id,
irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ((ring->me - 1) * adev->gfx.mec.num_pipe_per_mec)
+ ring->pipe;
-   hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue) ?
+   hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe,
+   ring->queue) ?
AMDGPU_GFX_PIPE_PRIO_HIGH : AMDGPU_GFX_PIPE_PRIO_NORMAL;
/* type-2 packets are deprecated on MEC, use type-3 instead */
r = amdgpu_ring_init(adev, ring, 1024,
@@ -6507,7 +6508,8 @@ static void gfx_v10_0_compute_mqd_set_priority(struct 
amdgpu_ring *ring, struct
struct amdgpu_device *adev = ring->adev;
 
if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) {
-   if (amdgpu_gfx_is_high_priority_compute_queue(adev, 
ring->queue)) {
+   if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe,
+ ring->queue)) {
mqd->cp_hqd_pipe_priority = AMDGPU_GFX_PIPE_PRIO_HIGH;
mqd->cp_hqd_queue_priority =
AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index c3fff49e6514..5e6d15f44560 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1923,7 +1923,8 @@ static int gfx_v8_0_compute_ring_init(struct 
amdgpu_device *adev, int ring_id,
+ ((ring->me - 1) * adev->gfx.mec.num_pipe_per_mec)
+ ring->pipe;
 
-   hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue) ?
+   hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe,
+   ring->queue) ?
AMDGPU_GFX_PIPE_PRIO_HIGH : AMDGPU_RING_PRIO_DEFAULT;
/* type-2 packets are deprecated on MEC, use type-3 instead */
r = amdgpu_ring_init(adev, ring, 1024,
@@ -4441,7 +4442,8 @@ static void 

[PATCH 1/3] drm:amdgpu: check before setting hw priority

2020-11-09 Thread Nirmoy Das
Check validity of drm_gpu_scheduler before setting hw priority.
Also fix a minor indentation issue.

Signed-off-by: Nirmoy Das 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 0350205c4897..5e099f635040 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -504,9 +504,9 @@ struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx 
*ctx,
 }
 
 static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx,
-   struct amdgpu_ctx_entity *aentity,
-   int hw_ip,
-   enum drm_sched_priority priority)
+  struct amdgpu_ctx_entity *aentity,
+  int hw_ip,
+  enum drm_sched_priority priority)
 {
struct amdgpu_device *adev = ctx->adev;
unsigned int hw_prio;
@@ -523,6 +523,9 @@ static void amdgpu_ctx_set_entity_priority(struct 
amdgpu_ctx *ctx,
hw_prio = array_index_nospec(hw_prio, AMDGPU_RING_PRIO_MAX);
scheds = adev->gpu_sched[hw_ip][hw_prio].sched;
num_scheds = adev->gpu_sched[hw_ip][hw_prio].num_scheds;
+   if (!scheds || !num_scheds)
+   return;
+
drm_sched_entity_modify_sched(>entity, scheds,
  num_scheds);
}
-- 
2.29.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> > > 
> > > Other public functions in radeon_device.c have their prototype in
> > > radeon.h - for example radeon_is_px()
> > > 
> > > Add radeon_device_is_virtual() there so we avoiid this new header.
> > 
> > Oh yes, I remember why this wasn't a suitable solution now:
> > 
> > The macro "radeon_init" in radeon.h clashes with the init function of
> > the same name in radeon_drv.c:
> > 
> >   In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
> >   drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or 
> > ‘(’ before ‘void’
> >   620 | static int __init radeon_init(void)
> ...
> > 
> > How would you like me to move forward?
> 
> Fix the thousand of warnings in other places :-)
> I will take a look at radeon and post a new series based on your work
> with all W=1 warnings fixed.

I'll drop this patch and carry on ploughing through the rest of them.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/amdgpu: Update mmio read/write access via debugfs

2020-11-09 Thread Tom St Denis
This patch adds support for wide MMIO addresses (upto 32-bits wide)
at the expense of dropping bank switching support for these addresses.

The patch also moves the PG guard bit to bit 59 which breaks compatibility
with older versions of umr but only if they are running the "--top" command.

Signed-off-by: Tom St Denis 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 68 +++--
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 41ca13f0acd5..dd9df90a3bff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -171,13 +171,14 @@ static void amdgpu_debugfs_autodump_init(struct 
amdgpu_device *adev)
  * Bit 62:  Indicates a GRBM bank switch is needed
  * Bit 61:  Indicates a SRBM bank switch is needed (implies bit 62 is
  * zero)
+ * Bit 60:  Indicates wide MMIO (32-bit address), disables other features
+ * Bit 59:  Indicates that the PM power gating lock should be held
+ * This is necessary to read registers that might be
+ * unreliable during a power gating transistion.
  * Bits 24..33: The SE or ME selector if needed
  * Bits 34..43: The SH (or SA) or PIPE selector if needed
  * Bits 44..53: The INSTANCE (or CU/WGP) or QUEUE selector if needed
  *
- * Bit 23:  Indicates that the PM power gating lock should be held
- * This is necessary to read registers that might be
- * unreliable during a power gating transistion.
  *
  * The lower bits are the BYTE offset of the register to read.  This
  * allows reading multiple registers in a single call and having
@@ -189,45 +190,50 @@ static int  amdgpu_debugfs_process_reg_op(bool read, 
struct file *f,
struct amdgpu_device *adev = file_inode(f)->i_private;
ssize_t result = 0;
int r;
-   bool pm_pg_lock, use_bank, use_ring;
+   bool pm_pg_lock, use_bank, use_ring, use_wide;
unsigned instance_bank, sh_bank, se_bank, me, pipe, queue, vmid;
 
-   pm_pg_lock = use_bank = use_ring = false;
+   use_wide = pm_pg_lock = use_bank = use_ring = false;
instance_bank = sh_bank = se_bank = me = pipe = queue = vmid = 0;
 
if (size & 0x3 || *pos & 0x3 ||
((*pos & (1ULL << 62)) && (*pos & (1ULL << 61
return -EINVAL;
 
-   /* are we reading registers for which a PG lock is necessary? */
-   pm_pg_lock = (*pos >> 23) & 1;
-
-   if (*pos & (1ULL << 62)) {
-   se_bank = (*pos & GENMASK_ULL(33, 24)) >> 24;
-   sh_bank = (*pos & GENMASK_ULL(43, 34)) >> 34;
-   instance_bank = (*pos & GENMASK_ULL(53, 44)) >> 44;
-
-   if (se_bank == 0x3FF)
-   se_bank = 0x;
-   if (sh_bank == 0x3FF)
-   sh_bank = 0x;
-   if (instance_bank == 0x3FF)
-   instance_bank = 0x;
-   use_bank = true;
-   } else if (*pos & (1ULL << 61)) {
-
-   me = (*pos & GENMASK_ULL(33, 24)) >> 24;
-   pipe = (*pos & GENMASK_ULL(43, 34)) >> 34;
-   queue = (*pos & GENMASK_ULL(53, 44)) >> 44;
-   vmid = (*pos & GENMASK_ULL(58, 54)) >> 54;
-
-   use_ring = true;
+   /* is this a wide request? */
+   use_wide = (*pos >> 60) & 1;
+
+   if (!use_wide) {
+   /* are we reading registers for which a PG lock is necessary? */
+   pm_pg_lock = (*pos >> 59) & 1;
+
+   if (*pos & (1ULL << 62)) {
+   se_bank = (*pos & GENMASK_ULL(33, 24)) >> 24;
+   sh_bank = (*pos & GENMASK_ULL(43, 34)) >> 34;
+   instance_bank = (*pos & GENMASK_ULL(53, 44)) >> 44;
+
+   if (se_bank == 0x3FF)
+   se_bank = 0x;
+   if (sh_bank == 0x3FF)
+   sh_bank = 0x;
+   if (instance_bank == 0x3FF)
+   instance_bank = 0x;
+   use_bank = true;
+   } else if (*pos & (1ULL << 61)) {
+   me = (*pos & GENMASK_ULL(33, 24)) >> 24;
+   pipe = (*pos & GENMASK_ULL(43, 34)) >> 34;
+   queue = (*pos & GENMASK_ULL(53, 44)) >> 44;
+   vmid = (*pos & GENMASK_ULL(58, 54)) >> 54;
+   use_ring = true;
+   } else {
+   use_bank = use_ring = false;
+   }
+
+   *pos &= (1ULL << 22) - 1ULL;
} else {
-   use_bank = use_ring = false;
+   *pos &= (1ULL << 32) - 1ULL;
}
 
-   *pos &= (1UL << 22) - 1;
-
r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
if (r < 0) {

Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Sam Ravnborg
Hi Lee,
> > 
> > Other public functions in radeon_device.c have their prototype in
> > radeon.h - for example radeon_is_px()
> > 
> > Add radeon_device_is_virtual() there so we avoiid this new header.
> 
> Oh yes, I remember why this wasn't a suitable solution now:
> 
> The macro "radeon_init" in radeon.h clashes with the init function of
> the same name in radeon_drv.c:
> 
>   In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
>   drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or 
> ‘(’ before ‘void’
>   620 | static int __init radeon_init(void)
...
> 
> How would you like me to move forward?

Fix the thousand of warnings in other places :-)
I will take a look at radeon and post a new series based on your work
with all W=1 warnings fixed.

Sam
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> 
> On Fri, Nov 06, 2020 at 09:49:40PM +, Lee Jones wrote:
> > Unfortunately, a suitable one didn't already exist.
> > 
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous 
> > prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> >  637 | bool radeon_device_is_virtual(void)
> >  | ^~~~
> > 
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_device.c |  1 +
> >  drivers/gpu/drm/radeon/radeon_device.h | 32 ++
> >  drivers/gpu/drm/radeon/radeon_drv.c|  3 +--
> >  3 files changed, 34 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
> 
> Other public functions in radeon_device.c have their prototype in
> radeon.h - for example radeon_is_px()
> 
> Add radeon_device_is_virtual() there so we avoiid this new header.

Oh yes, I remember why this wasn't a suitable solution now:

The macro "radeon_init" in radeon.h clashes with the init function of
the same name in radeon_drv.c:

  In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
  drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or ‘(’ 
before ‘void’
  620 | static int __init radeon_init(void)
  | ^~~~
  drivers/gpu/drm/radeon/radeon.h:2705:28: note: in definition of macro 
‘radeon_init’
  2705 | #define radeon_init(rdev) (rdev)->asic->init((rdev))
  | ^~~~
  In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
  drivers/gpu/drm/radeon/radeon_drv.c: In function ‘__inittest’:
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared 
(first use in this function); did you mean ‘radeon_exit’?
  653 | module_init(radeon_init);
  | ^~~
  include/linux/module.h:133:11: note: in definition of macro ‘module_init’
  133 | { return initfn; } | ^~
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: note: each undeclared identifier 
is reported only once for each function it appears in
  653 | module_init(radeon_init);
  | ^~~
  include/linux/module.h:133:11: note: in definition of macro ‘module_init’
  133 | { return initfn; } | ^~
  In file included from include/linux/compiler_types.h:65,
  from :
  drivers/gpu/drm/radeon/radeon_drv.c: At top level:
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared 
here (not in a function); did you mean ‘radeon_exit’?
  653 | module_init(radeon_init);
  | ^~~
  include/linux/compiler_attributes.h:109:65: note: in definition of macro 
‘__copy’
  109 | # define __copy(symbol) __attribute__((__copy__(symbol)))
  | ^~
  drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro 
‘module_init’
  653 | module_init(radeon_init);
  | ^~~
  In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
  include/linux/module.h:134:6: error: ‘init_module’ aliased to undefined 
symbol ‘radeon_init’
  134 | int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
  | ^~~
  drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro 
‘module_init’
  653 | module_init(radeon_init);
  | ^~~

How would you like me to move forward?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: update connector num_modes

2020-11-09 Thread Lee Starnes
In amdgpu_dm.c, amdgpu_dm_update_connector_after_detect calls
drm_add_edid_modes, but it doesn't update the struct
amdgpu_dm_connector's num_modes like other places that call
drm_add_edid_modes do, so drm_display_modes allocated by
drm_add_edid_modes will never get freed. This causes a memleak which was
reported as https://bugzilla.kernel.org/show_bug.cgi?id=209987. It's
severe enough that it caused my system to OOM and have to be rebooted
several times.

The commit that causes this was backported to 5.9 and 5.4.

Fixes: b24bdc37d03a ("drm/amd/display: Fix EDID parsing after resume from 
suspend")
Cc: sta...@vger.kernel.org
Signed-off-by: Lee Starnes 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 e93e18c06..06fe24a9d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2281,7 +2281,7 @@ void amdgpu_dm_update_connector_after_detect(
 
drm_connector_update_edid_property(connector,
   aconnector->edid);
-   drm_add_edid_modes(connector, aconnector->edid);
+   aconnector->num_modes = drm_add_edid_modes(connector, 
aconnector->edid);
 
if (aconnector->dc_link->aux_mode)
drm_dp_cec_set_edid(>dm_dp_aux.aux,
-- 
2.29.2

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/mediatek: Use struct dma_buf_map in GEM vmap ops

2020-11-09 Thread Thomas Zimmermann
Fixes a build failure with mediatek.

This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
mediatek was forgotten.

Signed-off-by: Thomas Zimmermann 
Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and 
convert GEM backends")
Cc: Thomas Zimmermann 
Cc: Christian König 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Dave Airlie 
Cc: Lucas Stach 
Cc: Russell King 
Cc: Christian Gmeiner 
Cc: Qiang Yu 
Cc: Ben Skeggs 
Cc: Rob Herring 
Cc: Tomeu Vizoso 
Cc: Steven Price 
Cc: Alyssa Rosenzweig 
Cc: Gerd Hoffmann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Sandy Huang 
Cc: "Heiko Stübner" 
Cc: Hans de Goede 
Cc: Sean Paul 
Cc: Eric Anholt 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: Haneen Mohammed 
Cc: Oleksandr Andrushchenko 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Marek Szyprowski 
Cc: Arunpravin 
Cc: Huang Rui 
Cc: Luben Tuikov 
Cc: Madhav Chauhan 
Cc: Nirmoy Das 
Cc: Jason Gunthorpe 
Cc: Sam Ravnborg 
Cc: Chris Wilson 
Cc: dri-de...@lists.freedesktop.org
Cc: etna...@lists.freedesktop.org
Cc: l...@lists.freedesktop.org
Cc: nouv...@lists.freedesktop.org
Cc: virtualizat...@lists.linux-foundation.org
Cc: spice-de...@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-rockc...@lists.infradead.org
Cc: xen-de...@lists.xenproject.org
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 
 drivers/gpu/drm/mediatek/mtk_drm_gem.h |  4 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index cdd1a6e61564..28a2ee1336ef 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -240,23 +240,25 @@ struct drm_gem_object 
*mtk_gem_prime_import_sg_table(struct drm_device *dev,
return _gem->base;
 }
 
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
-   struct sg_table *sgt;
+   struct sg_table *sgt = NULL;
unsigned int npages;
 
if (mtk_gem->kvaddr)
-   return mtk_gem->kvaddr;
+   goto out;
 
sgt = mtk_gem_prime_get_sg_table(obj);
if (IS_ERR(sgt))
-   return NULL;
+   return PTR_ERR(sgt);
 
npages = obj->size >> PAGE_SHIFT;
mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
-   if (!mtk_gem->pages)
-   goto out;
+   if (!mtk_gem->pages) {
+   kfree(sgt);
+   return -ENOMEM;
+   }
 
drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages);
 
@@ -265,13 +267,15 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
 
 out:
kfree(sgt);
+   dma_buf_map_set_vaddr(map, mtk_gem->kvaddr);
 
-   return mtk_gem->kvaddr;
+   return 0;
 }
 
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
*map)
 {
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
+   void *vaddr = map->vaddr;
 
if (!mtk_gem->pages)
return;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h 
b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
index ff9f976d9807..6da5ccb4b933 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
@@ -45,7 +45,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
 struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
 struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map 
*map);
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
*map);
 
 #endif
-- 
2.29.2

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 1/2] drm/msm: Use struct dma_buf_map in GEM vmap ops

2020-11-09 Thread Thomas Zimmermann
Fixes a build failure with msm.

This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
msm was forgotten.

Signed-off-by: Thomas Zimmermann 
Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and 
convert GEM backends")
Cc: Thomas Zimmermann 
Cc: Christian König 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Dave Airlie 
Cc: Lucas Stach 
Cc: Russell King 
Cc: Christian Gmeiner 
Cc: Qiang Yu 
Cc: Ben Skeggs 
Cc: Rob Herring 
Cc: Tomeu Vizoso 
Cc: Steven Price 
Cc: Alyssa Rosenzweig 
Cc: Gerd Hoffmann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Sandy Huang 
Cc: "Heiko Stübner" 
Cc: Hans de Goede 
Cc: Sean Paul 
Cc: Eric Anholt 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: Haneen Mohammed 
Cc: Oleksandr Andrushchenko 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Luben Tuikov 
Cc: Marek Szyprowski 
Cc: Arunpravin 
Cc: Huang Rui 
Cc: Madhav Chauhan 
Cc: Jason Gunthorpe 
Cc: Sam Ravnborg 
Cc: Chris Wilson 
Cc: Qinglang Miao 
Cc: dri-de...@lists.freedesktop.org
Cc: etna...@lists.freedesktop.org
Cc: l...@lists.freedesktop.org
Cc: nouv...@lists.freedesktop.org
Cc: virtualizat...@lists.linux-foundation.org
Cc: spice-de...@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-rockc...@lists.infradead.org
Cc: xen-de...@lists.xenproject.org
---
 drivers/gpu/drm/msm/msm_drv.h   |  4 ++--
 drivers/gpu/drm/msm/msm_gem_prime.c | 13 ++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index c45789f36e48..a6aef687bc6e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -295,8 +295,8 @@ int msm_gem_dumb_create(struct drm_file *file, struct 
drm_device *dev,
 int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
uint32_t handle, uint64_t *offset);
 struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
-void *msm_gem_prime_vmap(struct drm_gem_object *obj);
-void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int msm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
+void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
 int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
 struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c 
b/drivers/gpu/drm/msm/msm_gem_prime.c
index 515ef80816a0..9880348a4dc7 100644
--- a/drivers/gpu/drm/msm/msm_gem_prime.c
+++ b/drivers/gpu/drm/msm/msm_gem_prime.c
@@ -22,12 +22,19 @@ struct sg_table *msm_gem_prime_get_sg_table(struct 
drm_gem_object *obj)
return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages);
 }
 
-void *msm_gem_prime_vmap(struct drm_gem_object *obj)
+int msm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
-   return msm_gem_get_vaddr(obj);
+   void *vaddr;
+
+   vaddr = msm_gem_get_vaddr(obj);
+   if (IS_ERR(vaddr))
+   return PTR_ERR(vaddr);
+   dma_buf_map_set_vaddr(map, vaddr);
+
+   return 0;
 }
 
-void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
msm_gem_put_vaddr(obj);
 }
-- 
2.29.2

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: fix SI UVD firmware validate resume fail

2020-11-09 Thread Christian König

Am 08.11.20 um 16:09 schrieb Sonny Jiang:

The SI UVD firmware validate key is stored at the end of firmware,
which is changed during resume while playing video. So only to get
the key at device initialization and save it for later using.

Signed-off-by: Sonny Jiang 
---
  drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c | 17 ++---
  1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
index 7cf4b11a65c5..aab7415c1a32 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
@@ -279,13 +279,16 @@ static int uvd_v3_1_fw_validate(struct amdgpu_device 
*adev)
  {
void *ptr;
uint32_t ucode_len, i;
-   uint32_t keysel;
-
-   ptr = adev->uvd.inst[0].cpu_addr;
-   ptr += 192 + 16;
-   memcpy(_len, ptr, 4);
-   ptr += ucode_len;
-   memcpy(, ptr, 4);
+   static uint32_t keysel = 0;


Well, that is a really big NAK.

You can't just make a variable static and hope that we don't have 
multiple instances of the device driver loaded.


If you need to keep the value around put it into adev somehow.

Christian.


+
+   /* Only get the validate key at device initialization*/
+   if (!keysel) {
+   ptr = adev->uvd.inst[0].cpu_addr;
+   ptr += 192 + 16;
+   memcpy(_len, ptr, 4);
+   ptr += ucode_len;
+   memcpy(, ptr, 4);
+   }
  
  	WREG32(mmUVD_FW_START, keysel);
  


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 00/19] [Set 2] Rid W=1 warnings from GPU

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Christian König wrote:

> Well that's quite a patch set.
> 
> First of all can you separate this a bit more by driver? I'm assuming we
> maintainers are supposed to pick that up and apply it.

I'm not sure what would achieve?  It's not a pull-request.

Either way, patches should be applied individually.

> radeon and amdgpu can stick together since that is mostly Alex and me, but
> I'm not sure if we want to do some of the suggested changes to radeon.

That's fine.  Just review, providing your reasons as to why they are
not suitable and we'll work through the issues together, patch by
patch.

> Going to pick up the single TTM change for upstreaming.

Thanks.

> Am 06.11.20 um 22:49 schrieb Lee Jones:
> > This set is part of a larger effort attempting to clean-up W=1
> > kernel builds, which are currently overwhelmingly riddled with
> > niggly little warnings.
> > 
> > There are 5000 warnings to work through.  It will take a couple more
> > sets.  Although, ("drm/amd/display/dc/basics/fixpt31_32: Move
> > variables to where they're used") does take care of 2000 of them!
> > 
> > Lee Jones (19):
> >drm/ttm/ttm_range_manager: Demote non-conformant kernel-doc header
> >drm/r128/ati_pcigart: Source file headers are not good candidates for
> >  kernel-doc
> >drm/selftests/test-drm_dp_mst_helper: Move
> >  'sideband_msg_req_encode_decode' onto the heap
> >drm/mga/mga_dma: Demote kernel-doc abusers to standard comment blocks
> >drm/mga/mga_state: Remove unused variable 'buf_priv'
> >drm/radeon/atom: Move prototype into shared location
> >drm/radeon/radeon_kms: Include header containing our own prototypes
> >drm/omapdrm/omap_gem: Fix misnamed and missing parameter descriptions
> >drm/omapdrm/omap_dmm_tiler: Demote abusive use of kernel-doc format
> >drm/radeon/radeon: Move prototype into shared header
> >drm/radeon/radeon_drv: Source file headers are not good candidates for
> >  kernel-doc
> >drm/amd/display/dc/basics/fixpt31_32: Move variables to where they're
> >  used
> >drm/radeon/radeon_drv: Move prototypes to a shared headerfile
> >drm/amd/amdgpu/amdgpu_device: Provide documentation for 'reg_addr'
> >  params
> >drm/radeon: Move prototypes to shared header
> >drm/amd/amdgpu/amdgpu_kms: Remove 'struct drm_amdgpu_info_device
> >  dev_info' from the stack
> >drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param
> >drm/radeon/atombios_crtc: Remove description of non-existent function
> >  param 'encoder'
> >drm/v3d/v3d_drv: Remove unused static variable 'v3d_v3d_pm_ops'
> > 
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c|   2 +
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 104 +-
> >   .../drm/amd/display/dc/basics/fixpt31_32.c|   5 +
> >   .../gpu/drm/amd/display/include/fixed31_32.h  |   6 -
> >   drivers/gpu/drm/mga/mga_dma.c |  10 +-
> >   drivers/gpu/drm/mga/mga_state.c   |   2 -
> >   drivers/gpu/drm/omapdrm/omap_dmm_tiler.c  |   6 +-
> >   drivers/gpu/drm/omapdrm/omap_gem.c|   3 +-
> >   drivers/gpu/drm/r128/ati_pcigart.c|   2 +-
> >   drivers/gpu/drm/radeon/atom.h |   6 +
> >   drivers/gpu/drm/radeon/atombios_crtc.c|   1 -
> >   drivers/gpu/drm/radeon/atombios_encoders.c|   4 -
> >   drivers/gpu/drm/radeon/radeon.h   |   6 +
> >   drivers/gpu/drm/radeon/radeon_device.c|   1 +
> >   drivers/gpu/drm/radeon/radeon_device.h|  32 ++
> >   drivers/gpu/drm/radeon/radeon_display.c   |   4 -
> >   drivers/gpu/drm/radeon/radeon_drv.c   |  11 +-
> >   drivers/gpu/drm/radeon/radeon_drv.h   |   7 ++
> >   drivers/gpu/drm/radeon/radeon_kms.c   |   3 +-
> >   .../drm/selftests/test-drm_dp_mst_helper.c|  11 +-
> >   drivers/gpu/drm/ttm/ttm_range_manager.c   |   2 +-
> >   drivers/gpu/drm/v3d/v3d_drv.c |  36 --
> >   22 files changed, 138 insertions(+), 126 deletions(-)
> >   create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
> > 
> > Cc: Alex Deucher 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: Andy Gross 
> > Cc: by 
> > Cc: Christian Koenig 
> > Cc: "Christian König" 
> > Cc: Daniel Vetter 
> > Cc: David Airlie 
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: Eric Anholt 
> > Cc: Faith 
> > Cc: Gareth Hughes 
> > Cc: Harry Wentland 
> > Cc: Huang Rui 
> > Cc: Jeff Hartmann 
> > Cc: Keith Whitwell 
> > Cc: Leo Li 
> > Cc: linaro-mm-...@lists.linaro.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: Philipp Zabel 
> > Cc: Rob Clark 
> > Cc: Rob Clark 
> > Cc: Sumit Semwal 
> > Cc: Tomi Valkeinen 
> 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org

Re: [PATCH 00/19] [Set 2] Rid W=1 warnings from GPU

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Sam Ravnborg wrote:

> Hi Christian.
> 
> > I'm not sure if we want to do some of the suggested changes to radeon.
> 
> All patches for radeon looks good to me except "drm/radeon/radeon: Move
> prototype into shared header".

Was that the one where the prototype needs moving to radeon.h?

> Acked-by: Sam Ravnborg 
> from me to have them applied (except the shared header one).

Thanks Sam.

> I can reply to the individual patches if you like.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drivers: amdgpu: amdgpu_display.c: Fix a spelling doens\'t to doesn\'t

2020-11-09 Thread Bhaskar Chowdhury
s/doens't/doesn't/p

Signed-off-by: Bhaskar Chowdhury 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 7cc7af2a6822..a92cb137293a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -512,7 +512,7 @@ uint32_t amdgpu_display_supported_domains(struct 
amdgpu_device *adev,
 * to avoid hang caused by placement of scanout BO in GTT on certain
 * APUs. So force the BO placement to VRAM in case this architecture
 * will not allow USWC mappings.
-* Also, don't allow GTT domain if the BO doens't have USWC falg set.
+* Also, don't allow GTT domain if the BO doesn't have USWC falg set.
 */
if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
amdgpu_bo_support_uswc(bo_flags) &&
--
2.26.2

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> 
> On Fri, Nov 06, 2020 at 09:49:40PM +, Lee Jones wrote:
> > Unfortunately, a suitable one didn't already exist.
> > 
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous 
> > prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> >  637 | bool radeon_device_is_virtual(void)
> >  | ^~~~
> > 
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_device.c |  1 +
> >  drivers/gpu/drm/radeon/radeon_device.h | 32 ++
> >  drivers/gpu/drm/radeon/radeon_drv.c|  3 +--
> >  3 files changed, 34 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
> 
> Other public functions in radeon_device.c have their prototype in
> radeon.h - for example radeon_is_px()
> 
> Add radeon_device_is_virtual() there so we avoiid this new header.

I'm happy to do that, if it's deemed better.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 17/19] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> 
> On Fri, Nov 06, 2020 at 09:49:47PM +, Lee Jones wrote:
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> > member 'dev' not described in 'radeon_info_ioctl'
> >  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function 
> > parameter 'rdev' description in 'radeon_info_ioctl'
> > 
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > b/drivers/gpu/drm/radeon/radeon_kms.c
> > index 0d8fbabffcead..21c206795c364 100644
> > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > @@ -213,7 +213,7 @@ static void radeon_set_filp_rights(struct drm_device 
> > *dev,
> >  /**
> >   * radeon_info_ioctl - answer a device specific request.
> >   *
> > - * @rdev: radeon device pointer
> > + * @dev: radeon device pointer
> >   * @data: request object
> >   * @filp: drm filp
> >   *
> 
> Delete all the kernel-doc annotation as we do not pull this file into
> the kernel-doc anyway.
> 
> Keep the /* Answer a device specific request */ part.
> 
> At least thats what I see as the best way to deal with it.

Demoting all headers, even if they are conformant, it not the way to
go.  Some contributors/maintainers prefer to keep the kernel-doc
(pretty colours, automated checking [a la, this patch!] and the-like)
formatting, even if they are not directly referenced from
/Documentation.

For now, so long as the build is happy, I am happy.

If you wish to make the build unhappy about this, you should take up
the argument to encompass `scripts/find-unused-docs.sh` into it.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/5] drm/amdgpu: implement smuio v9_0 callbacks

2020-11-09 Thread Hawking Zhang
Vega10/12 will use smuio v9_0 callbacks

Signed-off-by: Hawking Zhang 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/Makefile |  4 ++
 drivers/gpu/drm/amd/amdgpu/smuio_v9_0.c | 77 +
 drivers/gpu/drm/amd/amdgpu/smuio_v9_0.h | 30 +
 3 files changed, 111 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v9_0.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v9_0.h

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index 6fde9a9..2d60a5b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -167,6 +167,10 @@ amdgpu-y += \
athub_v2_0.o \
athub_v2_1.o
 
+# add SMUIO block
+amdgpu-y += \
+   smuio_v9_0.o
+
 # add amdkfd interfaces
 amdgpu-y += amdgpu_amdkfd.o
 
diff --git a/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.c
new file mode 100644
index 000..c9c3e30
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2020 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "amdgpu.h"
+#include "smuio_v9_0.h"
+#include "smuio/smuio_9_0_offset.h"
+#include "smuio/smuio_9_0_sh_mask.h"
+
+static u32 smuio_v9_0_get_rom_index_offset(struct amdgpu_device *adev)
+{
+   return SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
+}
+
+static u32 smuio_v9_0_get_rom_data_offset(struct amdgpu_device *adev)
+{
+   return SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
+}
+
+void smuio_v9_0_update_rom_clock_gating(struct amdgpu_device *adev, bool 
enable)
+{
+   u32 def, data;
+
+   /* enable/disable ROM CG is not supported on APU */
+   if (adev->flags & AMD_IS_APU)
+   return;
+
+   def = data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
+
+   if (enable && (adev->cg_flags & AMD_CG_SUPPORT_ROM_MGCG))
+   data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
+   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK);
+   else
+   data |= CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
+   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK;
+
+   if (def != data)
+   WREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0, data);
+}
+
+void smuio_v9_0_get_clock_gating_state(struct amdgpu_device *adev, u32 *flags)
+{
+   u32 data;
+
+   /* CGTT_ROM_CLK_CTRL0 is not availabe for APUs */
+   if (adev->flags & AMD_IS_APU)
+   return;
+
+   data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
+   if (!(data & CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK))
+   *flags |= AMD_CG_SUPPORT_ROM_MGCG;
+}
+
+const struct amdgpu_smuio_funcs smuio_v9_0_funcs = {
+   .get_rom_index_offset = smuio_v9_0_get_rom_index_offset,
+   .get_rom_data_offset = smuio_v9_0_get_rom_data_offset,
+   .update_rom_clock_gating = smuio_v9_0_update_rom_clock_gating,
+   .get_clock_gating_state = smuio_v9_0_get_clock_gating_state,
+};
diff --git a/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.h 
b/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.h
new file mode 100644
index 000..fc265ce
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/smuio_v9_0.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2020 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS 

[PATCH 5/5] drm/amdgpu: disable rom clock gating support for APUs

2020-11-09 Thread Hawking Zhang
ROM clock gating enable/disable is not supported
on APU platform. (i.e. CGTT_ROM_CLK_CTRL0 register
is not availabe on APU). SMUIO callbacks will check
APU flag before enable/disable rom clock gating, and
skip the programming. Accordingly, query clock gating
status through CGTT_ROM_CLK_CTRL0 also doesn't support
on APU platform.

The change applies to RAVEN/RAVEN2/PICASSO/RENOIR.

Signed-off-by: Hawking Zhang 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 7d3788c..8a23636 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -1169,7 +1169,6 @@ static int soc15_common_early_init(void *handle)
AMD_CG_SUPPORT_GFX_CGLS |
AMD_CG_SUPPORT_BIF_LS |
AMD_CG_SUPPORT_HDP_LS |
-   AMD_CG_SUPPORT_ROM_MGCG |
AMD_CG_SUPPORT_MC_MGCG |
AMD_CG_SUPPORT_MC_LS |
AMD_CG_SUPPORT_SDMA_MGCG |
@@ -1187,7 +1186,6 @@ static int soc15_common_early_init(void *handle)
AMD_CG_SUPPORT_GFX_CGLS |
AMD_CG_SUPPORT_BIF_LS |
AMD_CG_SUPPORT_HDP_LS |
-   AMD_CG_SUPPORT_ROM_MGCG |
AMD_CG_SUPPORT_MC_MGCG |
AMD_CG_SUPPORT_MC_LS |
AMD_CG_SUPPORT_SDMA_MGCG |
@@ -1211,7 +1209,6 @@ static int soc15_common_early_init(void *handle)
AMD_CG_SUPPORT_HDP_LS |
AMD_CG_SUPPORT_DRM_MGCG |
AMD_CG_SUPPORT_DRM_LS |
-   AMD_CG_SUPPORT_ROM_MGCG |
AMD_CG_SUPPORT_MC_MGCG |
AMD_CG_SUPPORT_MC_LS |
AMD_CG_SUPPORT_SDMA_MGCG |
@@ -1264,7 +1261,6 @@ static int soc15_common_early_init(void *handle)
 AMD_CG_SUPPORT_SDMA_LS |
 AMD_CG_SUPPORT_BIF_LS |
 AMD_CG_SUPPORT_HDP_LS |
-AMD_CG_SUPPORT_ROM_MGCG |
 AMD_CG_SUPPORT_VCN_MGCG |
 AMD_CG_SUPPORT_JPEG_MGCG |
 AMD_CG_SUPPORT_IH_CG |
-- 
2.7.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 4/5] drm/amdgpu: switch to use smuio callbacks for AI family

2020-11-09 Thread Hawking Zhang
Switch to smuio callbacks: use smuio v9_0 callbacks
for Vega10/12, smuio v11_0 callbacks for Vega20/Arcturus.
APUs don't support enable/disable rom clock gating and
also don't support read bios from rom. So APU flag check
is needed in clock gating callbacks and asic funciton
for read bios from rom to prevent access unknown offset
on APU.

Signed-off-by: Hawking Zhang 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 57 ++
 1 file changed, 14 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 5b79ce9..7d3788c 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -42,8 +42,6 @@
 #include "sdma1/sdma1_4_0_offset.h"
 #include "hdp/hdp_4_0_offset.h"
 #include "hdp/hdp_4_0_sh_mask.h"
-#include "smuio/smuio_9_0_offset.h"
-#include "smuio/smuio_9_0_sh_mask.h"
 #include "nbio/nbio_7_0_default.h"
 #include "nbio/nbio_7_0_offset.h"
 #include "nbio/nbio_7_0_sh_mask.h"
@@ -71,6 +69,8 @@
 #include "jpeg_v2_0.h"
 #include "vcn_v2_5.h"
 #include "jpeg_v2_5.h"
+#include "smuio_v9_0.h"
+#include "smuio_v11_0.h"
 #include "dce_virtual.h"
 #include "mxgpu_ai.h"
 #include "amdgpu_smu.h"
@@ -91,12 +91,6 @@
 #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK0x0002L
 #define mmHDP_MEM_POWER_CTRL_BASE_IDX  0
 
-/* for Vega20/arcturus regiter offset change */
-#definemmROM_INDEX_VG200x00e4
-#definemmROM_INDEX_VG20_BASE_IDX   0
-#definemmROM_DATA_VG20 0x00e5
-#definemmROM_DATA_VG20_BASE_IDX0
-
 /*
  * Indirect registers accessor
  */
@@ -296,17 +290,10 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device 
*adev,
dw_ptr = (u32 *)bios;
length_dw = ALIGN(length_bytes, 4) / 4;
 
-   switch (adev->asic_type) {
-   case CHIP_VEGA20:
-   case CHIP_ARCTURUS:
-   rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX_VG20);
-   rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA_VG20);
-   break;
-   default:
-   rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
-   rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
-   break;
-   }
+   rom_index_offset =
+   adev->smuio.funcs->get_rom_index_offset(adev);
+   rom_data_offset =
+   adev->smuio.funcs->get_rom_data_offset(adev);
 
/* set rom index to 0 */
WREG32(rom_index_offset, 0);
@@ -718,6 +705,12 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
else
adev->df.funcs = _v1_7_funcs;
 
+   if (adev->asic_type == CHIP_VEGA20 ||
+   adev->asic_type == CHIP_ARCTURUS)
+   adev->smuio.funcs = _v11_0_funcs;
+   else
+   adev->smuio.funcs = _v9_0_funcs;
+
adev->rev_id = soc15_get_rev_id(adev);
 
switch (adev->asic_type) {
@@ -1511,24 +1504,6 @@ static void soc15_update_drm_light_sleep(struct 
amdgpu_device *adev, bool enable
WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_LIGHT_SLEEP_CTRL), 
data);
 }
 
-static void soc15_update_rom_medium_grain_clock_gating(struct amdgpu_device 
*adev,
-  bool enable)
-{
-   uint32_t def, data;
-
-   def = data = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0));
-
-   if (enable && (adev->cg_flags & AMD_CG_SUPPORT_ROM_MGCG))
-   data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
-   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK);
-   else
-   data |= CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
-   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK;
-
-   if (def != data)
-   WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0), data);
-}
-
 static int soc15_common_set_clockgating_state(void *handle,
enum amd_clockgating_state state)
 {
@@ -1551,7 +1526,7 @@ static int soc15_common_set_clockgating_state(void 
*handle,
state == AMD_CG_STATE_GATE);
soc15_update_drm_light_sleep(adev,
state == AMD_CG_STATE_GATE);
-   soc15_update_rom_medium_grain_clock_gating(adev,
+   adev->smuio.funcs->update_rom_clock_gating(adev,
state == AMD_CG_STATE_GATE);
adev->df.funcs->update_medium_grain_clock_gating(adev,
state == AMD_CG_STATE_GATE);
@@ -1568,8 +1543,6 @@ static int soc15_common_set_clockgating_state(void 
*handle,
state == AMD_CG_STATE_GATE);
soc15_update_drm_light_sleep(adev,
state == AMD_CG_STATE_GATE);
-   

[PATCH 3/5] drm/amdgpu: implement smuio v11_0 callbacks

2020-11-09 Thread Hawking Zhang
Vega20/Arcturus will use smuio v11_0 callbacks

Signed-off-by: Hawking Zhang 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  3 +-
 drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c | 77 
 drivers/gpu/drm/amd/amdgpu/smuio_v11_0.h | 30 +
 3 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v11_0.h

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index 2d60a5b8..6bf6cfa 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -169,7 +169,8 @@ amdgpu-y += \
 
 # add SMUIO block
 amdgpu-y += \
-   smuio_v9_0.o
+   smuio_v9_0.o \
+   smuio_v11_0.o
 
 # add amdkfd interfaces
 amdgpu-y += amdgpu_amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c
new file mode 100644
index 000..137b410
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2020 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "amdgpu.h"
+#include "smuio_v11_0.h"
+#include "smuio/smuio_11_0_0_offset.h"
+#include "smuio/smuio_11_0_0_sh_mask.h"
+
+static u32 smuio_v11_0_get_rom_index_offset(struct amdgpu_device *adev)
+{
+   return SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
+}
+
+static u32 smuio_v11_0_get_rom_data_offset(struct amdgpu_device *adev)
+{
+   return SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
+}
+
+void smuio_v11_0_update_rom_clock_gating(struct amdgpu_device *adev, bool 
enable)
+{
+   u32 def, data;
+
+   /* enable/disable ROM CG is not supported on APU */
+   if (adev->flags & AMD_IS_APU)
+   return;
+
+   def = data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
+
+   if (enable && (adev->cg_flags & AMD_CG_SUPPORT_ROM_MGCG))
+   data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
+   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK);
+   else
+   data |= CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
+   CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK;
+
+   if (def != data)
+   WREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0, data);
+}
+
+void smuio_v11_0_get_clock_gating_state(struct amdgpu_device *adev, u32 *flags)
+{
+   u32 data;
+
+   /* CGTT_ROM_CLK_CTRL0 is not available for APU */
+   if (adev->flags & AMD_IS_APU)
+   return;
+
+   data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
+   if (!(data & CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK))
+   *flags |= AMD_CG_SUPPORT_ROM_MGCG;
+}
+
+const struct amdgpu_smuio_funcs smuio_v11_0_funcs = {
+   .get_rom_index_offset = smuio_v11_0_get_rom_index_offset,
+   .get_rom_data_offset = smuio_v11_0_get_rom_data_offset,
+   .update_rom_clock_gating = smuio_v11_0_update_rom_clock_gating,
+   .get_clock_gating_state = smuio_v11_0_get_clock_gating_state,
+};
diff --git a/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.h 
b/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.h
new file mode 100644
index 000..43c4262
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/smuio_v11_0.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2020 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the 

[PATCH 1/5] drm/amdgpu: add amdgpu_smuio structure

2020-11-09 Thread Hawking Zhang
Add amdgpu_smuio structure in amdgpu_device to
provide various callback functions to support
smuio ip funcitonality

Signed-off-by: Hawking Zhang 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  4 
 drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 37 +++
 2 files changed, 41 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index ba65d4f..696e491 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -106,6 +106,7 @@
 #include "amdgpu_mmhub.h"
 #include "amdgpu_gfxhub.h"
 #include "amdgpu_df.h"
+#include "amdgpu_smuio.h"
 
 #define MAX_GPU_INSTANCE   16
 
@@ -923,6 +924,9 @@ struct amdgpu_device {
/* nbio */
struct amdgpu_nbio  nbio;
 
+   /* smuio */
+   struct amdgpu_smuio smuio;
+
/* mmhub */
struct amdgpu_mmhub mmhub;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h
new file mode 100644
index 000..0300915
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2020 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef __AMDGPU_SMUIO_H__
+#define __AMDGPU_SMUIO_H__
+
+struct amdgpu_smuio_funcs {
+   u32 (*get_rom_index_offset)(struct amdgpu_device *adev);
+   u32 (*get_rom_data_offset)(struct amdgpu_device *adev);
+   void (*update_rom_clock_gating)(struct amdgpu_device *adev, bool 
enable);
+   void (*get_clock_gating_state)(struct amdgpu_device *adev, u32 *flags);
+};
+
+struct amdgpu_smuio {
+   const struct amdgpu_smuio_funcs *funcs;
+};
+
+#endif /* __AMDGPU_SMUIO_H__ */
-- 
2.7.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx