Re: [PATCH -next] drm/amdkfd: Fix -Wunused-const-variable warning

2020-09-10 Thread Huang Rui
On Thu, Sep 10, 2020 at 10:55:32AM +0800, YueHaibing wrote:
> If KFD_SUPPORT_IOMMU_V2 is not set, gcc warns:
> 
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:121:37: warning: 
> ‘raven_device_info’ defined but not used [-Wunused-const-variable=]
>  static const struct kfd_device_info raven_device_info = {
>  ^
> 
> Move it to ifdef block.
> 
> Signed-off-by: YueHaibing 
> ---

Raven already has the fallback path, so it should be out of IOMMU v2 flag.

You may want to move raven_device_info out of IOMMU v2 flag in 
kfd_supported_devices[][2] as well.

Thanks,
Ray

>  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 0e71a0543f98..cae4df259e26 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -116,7 +116,6 @@ static const struct kfd_device_info carrizo_device_info = 
> {
>   .num_xgmi_sdma_engines = 0,
>   .num_sdma_queues_per_engine = 2,
>  };
> -#endif
>  
>  static const struct kfd_device_info raven_device_info = {
>   .asic_family = CHIP_RAVEN,
> @@ -135,6 +134,7 @@ static const struct kfd_device_info raven_device_info = {
>   .num_xgmi_sdma_engines = 0,
>   .num_sdma_queues_per_engine = 2,
>  };
> +#endif
>  
>  static const struct kfd_device_info hawaii_device_info = {
>   .asic_family = CHIP_HAWAII,
> -- 
> 2.17.1
> 
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cray.huang%40amd.com%7Ce8805fd43e9a4ad33cd008d8555a567a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637353193795034052&sdata=HqUGjUpQtfCkZ3wA1%2F6HTCZrn%2F4%2BuQORTobzaIYa%2BNs%3D&reserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 1/2] drm/radeon: Don't use WC for VRAM if !RADEON_GEM_GTT_WC

2020-09-10 Thread Tiezhu Yang

On 09/09/2020 12:21 PM, Huacai Chen wrote:

Though RADEON_GEM_GTT_WC is initially used for GTT, but this flag is
bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then
VRAM should not use WC.


+cc RADEON and AMDGPU DRM DRIVERS maintainer
Alex Deucher 
Christian König 
amd-gfx@lists.freedesktop.org

Hi all,

In the current code, if CONFIG_CPU_LOONGSON64 is set, 
drm_arch_can_wc_memory()

returns false, and then bo->flags clears the flag RADEON_GEM_GTT_WC, so with
this patch, TTM_PL_FLAG_WC of VRAM is removed on the Loongson platform,
the writecombine issue for Loongson64 can be fixed [1].

I find this is done by commit 221004c66a58 ("drm: Loongson-3 doesn't fully
support wc memory"), but I want to know why drm_arch_can_wc_memory() returns
false for Loongson64, is there some historical reasons?

include/drm/drm_cache.h
static inline bool drm_arch_can_wc_memory(void)
{
#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
return false;
#elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON64)
return false;
#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
...
}

drivers/gpu/drm/radeon/radeon_object.c
int radeon_bo_create()
{
...
if (!drm_arch_can_wc_memory())
bo->flags &= ~RADEON_GEM_GTT_WC;
...
}

[1] https://lore.kernel.org/patchwork/patch/1285542/
gpu/drm: Remove TTM_PL_FLAG_WC of VRAM to fix writecombine issue for 
Loongson64
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=221004c66a58


Thanks,
Tiezhu



Signed-off-by: Huacai Chen 
---
  drivers/gpu/drm/radeon/radeon_object.c | 14 ++
  1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index f3dee01..07b82d9 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -117,10 +117,16 @@ void radeon_ttm_placement_from_domain(struct radeon_bo 
*rbo, u32 domain)
 TTM_PL_FLAG_VRAM;
}
  
-		rbo->placements[c].fpfn = 0;

-   rbo->placements[c++].flags = TTM_PL_FLAG_WC |
-TTM_PL_FLAG_UNCACHED |
-TTM_PL_FLAG_VRAM;
+   if (rbo->flags & RADEON_GEM_GTT_WC) {
+   rbo->placements[c].fpfn = 0;
+   rbo->placements[c++].flags = TTM_PL_FLAG_WC |
+TTM_PL_FLAG_UNCACHED |
+TTM_PL_FLAG_VRAM;
+   } else {
+   rbo->placements[c].fpfn = 0;
+   rbo->placements[c++].flags = TTM_PL_FLAG_UNCACHED |
+TTM_PL_FLAG_VRAM;
+   }
}
  
  	if (domain & RADEON_GEM_DOMAIN_GTT) {


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


[PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2805:5-11: WARNING: Comparison to bool

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

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index fed2690d1380..20d8a03ca866 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -2802,7 +2802,7 @@ static void pwr_10_0_gfxip_control_over_cgpg(struct 
amdgpu_device *adev,
uint32_t default_data = 0;

default_data = data = RREG32(SOC15_REG_OFFSET(PWR, 0, 
mmPWR_MISC_CNTL_STATUS));
-   if (enable == true) {
+   if (enable) {
/* enable GFXIP control over CGPG */
data |= PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN_MASK;
if(default_data != data)
--
2.26.0.106.g9fadedd

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


[PATCH -next 8/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1003:4-9: WARNING: Comparison to bool
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1083:5-11: WARNING: Comparison to bool

Signed-off-by: Zheng Bin 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index f975dc4b143a..e8e7d4228b92 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -1000,7 +1000,7 @@ static void sdma_v4_0_page_stop(struct amdgpu_device 
*adev)
sdma[i] = &adev->sdma.instance[i].page;

if ((adev->mman.buffer_funcs_ring == sdma[i]) &&
-   (unset == false)) {
+   (!unset)) {
amdgpu_ttm_set_buffer_funcs_status(adev, false);
unset = true;
}
@@ -1080,7 +1080,7 @@ static void sdma_v4_0_enable(struct amdgpu_device *adev, 
bool enable)
u32 f32_cntl;
int i;

-   if (enable == false) {
+   if (!enable) {
sdma_v4_0_gfx_stop(adev);
sdma_v4_0_rlc_stop(adev);
if (adev->sdma.has_page_queue)
--
2.26.0.106.g9fadedd

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


[PATCH -next] drm/amd/display: Create trigger_hotplug entry

2020-09-10 Thread YueHaibing
Add trigger_hotplug debugfs entry.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 94fcb086154c..83da24aced45 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -2098,6 +2098,7 @@ static const struct {
const struct file_operations *fops;
 } dp_debugfs_entries[] = {
{"link_settings", &dp_link_settings_debugfs_fops},
+   {"trigger_hotplug", &dp_trigger_hotplug_debugfs_fops},
{"phy_settings", &dp_phy_settings_debugfs_fop},
{"test_pattern", &dp_phy_test_pattern_fops},
 #ifdef CONFIG_DRM_AMD_DC_HDCP
-- 
2.17.1


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


[PATCH -next] drm/ttm/agp: Fix Wunused-variable warning

2020-09-10 Thread YueHaibing
If CONFIG_AGP is not set, gcc warns:

drivers/gpu/drm/radeon/radeon_ttm.c: In function ‘radeon_ttm_tt_bind’:
drivers/gpu/drm/radeon/radeon_ttm.c:692:24: warning: unused variable ‘rdev’ 
[-Wunused-variable]
  struct radeon_device *rdev = radeon_get_rdev(bdev);
^~~~

Move it to ifdef block to fix this.

Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index 31c63d339629..449e77eb75f9 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -689,9 +689,9 @@ static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev,
  struct ttm_tt *ttm,
  struct ttm_resource *bo_mem)
 {
+#if IS_ENABLED(CONFIG_AGP)
struct radeon_device *rdev = radeon_get_rdev(bdev);
 
-#if IS_ENABLED(CONFIG_AGP)
if (rdev->flags & RADEON_IS_AGP)
return ttm_agp_bind(ttm, bo_mem);
 #endif
-- 
2.17.1


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


[PATCH -next] drm/amd/display: Fix possible memleak in dp_trigger_hotplug()

2020-09-10 Thread YueHaibing
If parse_write_buffer_into_params() fails, we should free
wr_buf before return.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 83da24aced45..11e16fbe484d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -1089,8 +1089,10 @@ static ssize_t dp_trigger_hotplug(struct file *f, const 
char __user *buf,
if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
(long *)param, buf,
max_param_num,
-   ¶m_nums))
+   ¶m_nums)) {
+   kfree(wr_buf);
return -EINVAL;
+   }
 
if (param_nums <= 0) {
DRM_DEBUG_DRIVER("user data not be read\n");
-- 
2.17.1


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


[PATCH -next] drm/amdkfd: Fix -Wunused-const-variable warning

2020-09-10 Thread YueHaibing
If KFD_SUPPORT_IOMMU_V2 is not set, gcc warns:

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:121:37: warning: 
‘raven_device_info’ defined but not used [-Wunused-const-variable=]
 static const struct kfd_device_info raven_device_info = {
 ^

Move it to ifdef block.

Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 0e71a0543f98..cae4df259e26 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -116,7 +116,6 @@ static const struct kfd_device_info carrizo_device_info = {
.num_xgmi_sdma_engines = 0,
.num_sdma_queues_per_engine = 2,
 };
-#endif
 
 static const struct kfd_device_info raven_device_info = {
.asic_family = CHIP_RAVEN,
@@ -135,6 +134,7 @@ static const struct kfd_device_info raven_device_info = {
.num_xgmi_sdma_engines = 0,
.num_sdma_queues_per_engine = 2,
 };
+#endif
 
 static const struct kfd_device_info hawaii_device_info = {
.asic_family = CHIP_HAWAII,
-- 
2.17.1


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


[PATCH] drm/amd/display: optimize code runtime a bit

2020-09-10 Thread Bernard Zhao
In fnction is_cr_done & is_ch_eq_done, when done = false
happened once, no need to circle left ln_count.
This change is to make the code run a bit fast.

Signed-off-by: Bernard Zhao 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index b2be6ad5101d..53e30be8b66a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -373,34 +373,30 @@ static void dpcd_set_lt_pattern_and_lane_settings(
 static bool is_cr_done(enum dc_lane_count ln_count,
union lane_status *dpcd_lane_status)
 {
-   bool done = true;
uint32_t lane;
/*LANEx_CR_DONE bits All 1's?*/
for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
if (!dpcd_lane_status[lane].bits.CR_DONE_0)
-   done = false;
+   return false;
}
-   return done;
-
+   return true;
 }
 
 static bool is_ch_eq_done(enum dc_lane_count ln_count,
union lane_status *dpcd_lane_status,
union lane_align_status_updated *lane_status_updated)
 {
-   bool done = true;
uint32_t lane;
if (!lane_status_updated->bits.INTERLANE_ALIGN_DONE)
-   done = false;
+   return false;
else {
for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
if (!dpcd_lane_status[lane].bits.SYMBOL_LOCKED_0 ||
!dpcd_lane_status[lane].bits.CHANNEL_EQ_DONE_0)
-   done = false;
+   return false;
}
}
-   return done;
-
+   return true;
 }
 
 static void update_drive_settings(
-- 
2.28.0

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


[PATCH -next 5/8] drm/amd/amdgpu: fix comparison pointer to bool warning in si.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/si.c:1342:5-10: WARNING: Comparison to bool

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

diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index 455d5e366c69..e5e336fd9e94 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -1339,7 +1339,7 @@ static void si_vga_set_state(struct amdgpu_device *adev, 
bool state)
uint32_t temp;

temp = RREG32(CONFIG_CNTL);
-   if (state == false) {
+   if (!state) {
temp &= ~(1<<0);
temp |= (1<<1);
} else {
--
2.26.0.106.g9fadedd

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


[PATCH -next 4/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:562:5-11: WARNING: Comparison to bool

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

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 46a9617fee5f..34ccf376ee45 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -559,7 +559,7 @@ static void sdma_v5_2_enable(struct amdgpu_device *adev, 
bool enable)
u32 f32_cntl;
int i;

-   if (enable == false) {
+   if (!enable) {
sdma_v5_2_gfx_stop(adev);
sdma_v5_2_rlc_stop(adev);
}
--
2.26.0.106.g9fadedd

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


[PATCH -next 6/8] drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1243:14-25: WARNING: Comparison to bool

Signed-off-by: Zheng Bin 
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 0a880bc101b8..ed30fb48b9db 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -1240,8 +1240,8 @@ static int uvd_v6_0_process_interrupt(struct 
amdgpu_device *adev,
break;
}

-   if (false == int_handled)
-   DRM_ERROR("Unhandled interrupt: %d %d\n",
+   if (!int_handled)
+   DRM_ERROR("Unhandled interrupt: %d %d\n",
  entry->src_id, entry->src_data[0]);

return 0;
--
2.26.0.106.g9fadedd

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


[PATCH -next 3/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:619:5-11: WARNING: Comparison to bool

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

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index e2232dd12d8e..48c95a78a173 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -616,7 +616,7 @@ static void sdma_v5_0_enable(struct amdgpu_device *adev, 
bool enable)
u32 f32_cntl;
int i;

-   if (enable == false) {
+   if (!enable) {
sdma_v5_0_gfx_stop(adev);
sdma_v5_0_rlc_stop(adev);
}
--
2.26.0.106.g9fadedd

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


[PATCH -next 2/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3563:5-31: WARNING: Comparison to bool

Signed-off-by: Zheng Bin 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 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 2db195ec8d0c..a78c0dbda968 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3560,7 +3560,7 @@ static void gfx_v10_0_check_fw_write_wait(struct 
amdgpu_device *adev)
break;
}

-   if (adev->gfx.cp_fw_write_wait == false)
+   if (!adev->gfx.cp_fw_write_wait)
DRM_WARN_ONCE("CP firmware version too old, please update!");
 }

--
2.26.0.106.g9fadedd

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


[PATCH -next 7/8] drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c

2020-09-10 Thread Zheng Bin
Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:619:15-49: WARNING: Comparison 
to bool
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:629:15-49: WARNING: Comparison 
to bool

Signed-off-by: Zheng Bin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
index 3e35a8f2c5e5..7abe9500c0c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -616,7 +616,7 @@ static bool amdgpu_atpx_detect(void)
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != 
NULL) {
vga_count++;

-   has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
+   has_atpx |= amdgpu_atpx_pci_probe_handle(pdev);

parent_pdev = pci_upstream_bridge(pdev);
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
@@ -626,7 +626,7 @@ static bool amdgpu_atpx_detect(void)
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != 
NULL) {
vga_count++;

-   has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
+   has_atpx |= amdgpu_atpx_pci_probe_handle(pdev);

parent_pdev = pci_upstream_bridge(pdev);
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
--
2.26.0.106.g9fadedd

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


[PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning

2020-09-10 Thread Zheng Bin
Zheng Bin (8):
  drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in si.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
  drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c

 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c| 2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/si.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c| 4 ++--
 8 files changed, 11 insertions(+), 11 deletions(-)

--
2.26.0.106.g9fadedd

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


Re: [PATCH v2 -next] drm/amdkfd: Fix -Wunused-const-variable warning

2020-09-10 Thread Huang Rui
On Thu, Sep 10, 2020 at 03:50:06PM +0800, YueHaibing wrote:
> If KFD_SUPPORT_IOMMU_V2 is not set, gcc warns:
> 
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:121:37: warning: 
> ‘raven_device_info’ defined but not used [-Wunused-const-variable=]
>  static const struct kfd_device_info raven_device_info = {
>  ^
> 
> As Huang Rui suggested, Raven already has the fallback path,
> so it should be out of IOMMU v2 flag.
> 
> Suggested-by: Huang Rui 
> Signed-off-by: YueHaibing 

Acked-by: Huang Rui 

> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 0e71a0543f98..e3fc6ed7b79c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -503,8 +503,8 @@ static const struct kfd_device_info 
> *kfd_supported_devices[][2] = {
>  #ifdef KFD_SUPPORT_IOMMU_V2
>   [CHIP_KAVERI] = {&kaveri_device_info, NULL},
>   [CHIP_CARRIZO] = {&carrizo_device_info, NULL},
> - [CHIP_RAVEN] = {&raven_device_info, NULL},
>  #endif
> + [CHIP_RAVEN] = {&raven_device_info, NULL},
>   [CHIP_HAWAII] = {&hawaii_device_info, NULL},
>   [CHIP_TONGA] = {&tonga_device_info, NULL},
>   [CHIP_FIJI] = {&fiji_device_info, &fiji_vf_device_info},
> -- 
> 2.17.1
> 
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 1/1] drm/amdgpu: fix a typo

2020-09-10 Thread Nirmoy

ping.

On 9/8/20 5:57 PM, Nirmoy Das wrote:

Fixes: 9a0154630e958a2f (drm/amdgpu: Bring back support for non-upstream 
FreeSync)

Signed-off-by: Nirmoy Das 
---
  include/uapi/drm/amdgpu_drm.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index b826f2d6efe1..d3dadf10b13d 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -1096,7 +1096,7 @@ struct drm_amdgpu_info_vce_clock_table {
  
  struct drm_amdgpu_freesync {

__u32 op;   /* AMDGPU_FREESYNC_FULLSCREEN_ENTER or 
*/
-   /* AMDGPU_FREESYNC_FULLSCREEN_ENTER */
+   /* AMDGPU_FREESYNC_FULLSCREEN_EXIT */
__u32 spare[7];
  };
  

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


[PATCH] drm/amd/pm: update driver if file for sienna cichlid

2020-09-10 Thread Likun Gao
From: Likun Gao 

Update drive if file for sienna_cichlid.

Signed-off-by: Likun Gao 
Change-Id: I53e5210acb760901622cd50aaf81193e9699feba
---
 .../pm/inc/smu11_driver_if_sienna_cichlid.h   | 20 ++-
 drivers/gpu/drm/amd/pm/inc/smu_v11_0.h|  2 +-
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   |  5 -
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h 
b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
index 5ef9c92f57c4..11a6cf96fe0c 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
@@ -27,9 +27,9 @@
 // *** IMPORTANT ***
 // SMU TEAM: Always increment the interface version if 
 // any structure is changed in this file
-#define SMU11_DRIVER_IF_VERSION 0x35
+#define SMU11_DRIVER_IF_VERSION 0x37
 
-#define PPTABLE_Sienna_Cichlid_SMU_VERSION 5
+#define PPTABLE_Sienna_Cichlid_SMU_VERSION 6
 
 #define NUM_GFXCLK_DPM_LEVELS  16
 #define NUM_SMNCLK_DPM_LEVELS  2
@@ -169,7 +169,7 @@ typedef enum {
 #define DPM_OVERRIDE_DISABLE_DFLL_PLL_SHUTDOWN   0x0200
 #define DPM_OVERRIDE_DISABLE_MEMORY_TEMPERATURE_READ 0x0400
 #define DPM_OVERRIDE_DISABLE_VOLT_LINK_VCN_DCEFCLK   0x0800
-#define DPM_OVERRIDE_ENABLE_FAST_FCLK_TIMER  0x1000
+#define DPM_OVERRIDE_DISABLE_FAST_FCLK_TIMER 0x1000
 #define DPM_OVERRIDE_DISABLE_VCN_PG  0x2000
 #define DPM_OVERRIDE_DISABLE_FMAX_VMAX   0x4000
 
@@ -793,8 +793,18 @@ typedef struct {
 
   // SECTION: Sku Reserved
   uint8_t  CustomerVariant;
-  uint8_t  Spare[3];
-  uint32_t SkuReserved[14];
+
+  //VC BTC parameters are only applicable to VDD_GFX domain
+  uint8_t  VcBtcEnabled;
+  uint16_t VcBtcVminT0; // T0_VMIN
+  uint16_t VcBtcFixedVminAgingOffset;   // FIXED_VMIN_AGING_OFFSET 
+  uint16_t VcBtcVmin2PsmDegrationGb;// VMIN_TO_PSM_DEGRADATION_GB 
+  uint32_t VcBtcPsmA;   // A_PSM
+  uint32_t VcBtcPsmB;   // B_PSM
+  uint32_t VcBtcVminA;  // A_VMIN
+  uint32_t VcBtcVminB;  // B_VMIN  
+  
+  uint32_t SkuReserved[9];
 
 
   // MAJOR SECTION: BOARD PARAMETERS
diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
index 2a3f1ee4a50b..9dfc1c87b6dd 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
@@ -30,7 +30,7 @@
 #define SMU11_DRIVER_IF_VERSION_NV10 0x36
 #define SMU11_DRIVER_IF_VERSION_NV12 0x36
 #define SMU11_DRIVER_IF_VERSION_NV14 0x36
-#define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x35
+#define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x37
 #define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x4
 
 /* MP Apertures */
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index b67931fd64b4..194abaca6948 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -2295,11 +2295,6 @@ static void sienna_cichlid_dump_pptable(struct 
smu_context *smu)
dev_info(smu->adev->dev, "SkuReserved[6] = 0x%x\n", 
pptable->SkuReserved[6]);
dev_info(smu->adev->dev, "SkuReserved[7] = 0x%x\n", 
pptable->SkuReserved[7]);
dev_info(smu->adev->dev, "SkuReserved[8] = 0x%x\n", 
pptable->SkuReserved[8]);
-   dev_info(smu->adev->dev, "SkuReserved[9] = 0x%x\n", 
pptable->SkuReserved[9]);
-   dev_info(smu->adev->dev, "SkuReserved[10] = 0x%x\n", 
pptable->SkuReserved[10]);
-   dev_info(smu->adev->dev, "SkuReserved[11] = 0x%x\n", 
pptable->SkuReserved[11]);
-   dev_info(smu->adev->dev, "SkuReserved[12] = 0x%x\n", 
pptable->SkuReserved[12]);
-   dev_info(smu->adev->dev, "SkuReserved[13] = 0x%x\n", 
pptable->SkuReserved[13]);
 
dev_info(smu->adev->dev, "GamingClk[0] = 0x%x\n", 
pptable->GamingClk[0]);
dev_info(smu->adev->dev, "GamingClk[1] = 0x%x\n", 
pptable->GamingClk[1]);
-- 
2.25.1

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


RE: [PATCH] drm/amd/pm: update driver if file for sienna cichlid

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

Reviewed-by: Jiansong Chen 

-Original Message-
From: Gao, Likun 
Sent: Thursday, September 10, 2020 4:27 PM
To: amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking ; Feng, Kenneth 
; Chen, Jiansong (Simon) ; Gao, 
Likun 
Subject: [PATCH] drm/amd/pm: update driver if file for sienna cichlid

From: Likun Gao 

Update drive if file for sienna_cichlid.

Signed-off-by: Likun Gao 
Change-Id: I53e5210acb760901622cd50aaf81193e9699feba
---
 .../pm/inc/smu11_driver_if_sienna_cichlid.h   | 20 ++-
 drivers/gpu/drm/amd/pm/inc/smu_v11_0.h|  2 +-
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   |  5 -
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h 
b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
index 5ef9c92f57c4..11a6cf96fe0c 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h
@@ -27,9 +27,9 @@
 // *** IMPORTANT ***
 // SMU TEAM: Always increment the interface version if  // any structure is 
changed in this file -#define SMU11_DRIVER_IF_VERSION 0x35
+#define SMU11_DRIVER_IF_VERSION 0x37

-#define PPTABLE_Sienna_Cichlid_SMU_VERSION 5
+#define PPTABLE_Sienna_Cichlid_SMU_VERSION 6

 #define NUM_GFXCLK_DPM_LEVELS  16
 #define NUM_SMNCLK_DPM_LEVELS  2
@@ -169,7 +169,7 @@ typedef enum {
 #define DPM_OVERRIDE_DISABLE_DFLL_PLL_SHUTDOWN   0x0200
 #define DPM_OVERRIDE_DISABLE_MEMORY_TEMPERATURE_READ 0x0400
 #define DPM_OVERRIDE_DISABLE_VOLT_LINK_VCN_DCEFCLK   0x0800
-#define DPM_OVERRIDE_ENABLE_FAST_FCLK_TIMER  0x1000
+#define DPM_OVERRIDE_DISABLE_FAST_FCLK_TIMER 0x1000
 #define DPM_OVERRIDE_DISABLE_VCN_PG  0x2000
 #define DPM_OVERRIDE_DISABLE_FMAX_VMAX   0x4000

@@ -793,8 +793,18 @@ typedef struct {

   // SECTION: Sku Reserved
   uint8_t  CustomerVariant;
-  uint8_t  Spare[3];
-  uint32_t SkuReserved[14];
+
+  //VC BTC parameters are only applicable to VDD_GFX domain
+  uint8_t  VcBtcEnabled;
+  uint16_t VcBtcVminT0; // T0_VMIN
+  uint16_t VcBtcFixedVminAgingOffset;   // FIXED_VMIN_AGING_OFFSET
+  uint16_t VcBtcVmin2PsmDegrationGb;// VMIN_TO_PSM_DEGRADATION_GB
+  uint32_t VcBtcPsmA;   // A_PSM
+  uint32_t VcBtcPsmB;   // B_PSM
+  uint32_t VcBtcVminA;  // A_VMIN
+  uint32_t VcBtcVminB;  // B_VMIN
+
+  uint32_t SkuReserved[9];


   // MAJOR SECTION: BOARD PARAMETERS
diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
index 2a3f1ee4a50b..9dfc1c87b6dd 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
@@ -30,7 +30,7 @@
 #define SMU11_DRIVER_IF_VERSION_NV10 0x36  #define 
SMU11_DRIVER_IF_VERSION_NV12 0x36  #define SMU11_DRIVER_IF_VERSION_NV14 0x36 
-#define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x35
+#define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x37
 #define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x4

 /* MP Apertures */
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index b67931fd64b4..194abaca6948 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -2295,11 +2295,6 @@ static void sienna_cichlid_dump_pptable(struct 
smu_context *smu)
 dev_info(smu->adev->dev, "SkuReserved[6] = 0x%x\n", pptable->SkuReserved[6]);
 dev_info(smu->adev->dev, "SkuReserved[7] = 0x%x\n", pptable->SkuReserved[7]);
 dev_info(smu->adev->dev, "SkuReserved[8] = 0x%x\n", pptable->SkuReserved[8]);
-dev_info(smu->adev->dev, "SkuReserved[9] = 0x%x\n", pptable->SkuReserved[9]);
-dev_info(smu->adev->dev, "SkuReserved[10] = 0x%x\n", pptable->SkuReserved[10]);
-dev_info(smu->adev->dev, "SkuReserved[11] = 0x%x\n", pptable->SkuReserved[11]);
-dev_info(smu->adev->dev, "SkuReserved[12] = 0x%x\n", pptable->SkuReserved[12]);
-dev_info(smu->adev->dev, "SkuReserved[13] = 0x%x\n", pptable->SkuReserved[13]);

 dev_info(smu->adev->dev, "GamingClk[0] = 0x%x\n", pptable->GamingClk[0]);
 dev_info(smu->adev->dev, "GamingClk[1] = 0x%x\n", pptable->GamingClk[1]);
--
2.25.1

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


Re: [PATCH -next] drm/ttm/agp: Fix Wunused-variable warning

2020-09-10 Thread Christian König

Am 10.09.20 um 04:33 schrieb YueHaibing:

If CONFIG_AGP is not set, gcc warns:

drivers/gpu/drm/radeon/radeon_ttm.c: In function ‘radeon_ttm_tt_bind’:
drivers/gpu/drm/radeon/radeon_ttm.c:692:24: warning: unused variable ‘rdev’ 
[-Wunused-variable]
   struct radeon_device *rdev = radeon_get_rdev(bdev);
 ^~~~

Move it to ifdef block to fix this.

Signed-off-by: YueHaibing 


Reviewed-by: Christian König 


---
  drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index 31c63d339629..449e77eb75f9 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -689,9 +689,9 @@ static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev,
  struct ttm_tt *ttm,
  struct ttm_resource *bo_mem)
  {
+#if IS_ENABLED(CONFIG_AGP)
struct radeon_device *rdev = radeon_get_rdev(bdev);
  
-#if IS_ENABLED(CONFIG_AGP)

if (rdev->flags & RADEON_IS_AGP)
return ttm_agp_bind(ttm, bo_mem);
  #endif


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


[PATCH] drm/amd/pm: update driver if version for navy_flounder

2020-09-10 Thread Jiansong Chen
It's in accordance with pmfw 65.8.0 for navy_flounder.

Signed-off-by: Jiansong Chen 
Change-Id: Iddb07c2123c0fd5dedff68f9a3a2f43685600117
---
 drivers/gpu/drm/amd/pm/inc/smu_v11_0.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
index 1f9575a4dfe7..21d65d20e569 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
@@ -31,7 +31,7 @@
 #define SMU11_DRIVER_IF_VERSION_NV12 0x36
 #define SMU11_DRIVER_IF_VERSION_NV14 0x36
 #define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x35
-#define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x4
+#define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x5
 
 /* MP Apertures */
 #define MP0_Public 0x0380
-- 
2.25.1

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


RE: [PATCH] drm/amd/pm: update driver if version for navy_flounder

2020-09-10 Thread Zhou1, Tao
[AMD Public Use]

Reviewed-by: Tao Zhou 

> -Original Message-
> From: Jiansong Chen 
> Sent: Thursday, September 10, 2020 5:26 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Zhou1, Tao ; Chen, Jiansong (Simon)
> 
> Subject: [PATCH] drm/amd/pm: update driver if version for navy_flounder
> 
> It's in accordance with pmfw 65.8.0 for navy_flounder.
> 
> Signed-off-by: Jiansong Chen 
> Change-Id: Iddb07c2123c0fd5dedff68f9a3a2f43685600117
> ---
>  drivers/gpu/drm/amd/pm/inc/smu_v11_0.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
> b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
> index 1f9575a4dfe7..21d65d20e569 100644
> --- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
> +++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
> @@ -31,7 +31,7 @@
>  #define SMU11_DRIVER_IF_VERSION_NV12 0x36  #define
> SMU11_DRIVER_IF_VERSION_NV14 0x36  #define
> SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x35 -#define
> SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x4
> +#define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0x5
> 
>  /* MP Apertures */
>  #define MP0_Public   0x0380
> --
> 2.25.1
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: add ta DTM/HDCP print in amdgpu_firmware_info for apu

2020-09-10 Thread Huang Rui
On Wed, Sep 09, 2020 at 01:50:27PM +0800, Zhu, Changfeng wrote:
> From: changzhu 
> 
> From: Changfeng 
> 
> It needs to add ta DTM/HDCP print to get HDCP/DTM version info when cat
> amdgpu_firmware_info
> 
> Change-Id: I05f20d6868ce2cac06a8496890b766dbb61de671
> Signed-off-by: Changfeng 

Reviewed-by: Huang Rui 

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 43 +
>  1 file changed, 36 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 4f6b167fef26..d7f37cb92a97 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -282,14 +282,25 @@ static int amdgpu_firmware_info(struct 
> drm_amdgpu_info_firmware *fw_info,
>   fw_info->feature = 0;
>   break;
>   case AMDGPU_INFO_FW_TA:
> - if (query_fw->index > 1)
> - return -EINVAL;
> - if (query_fw->index == 0) {
> + switch (query_fw->index) {
> + case 0:
>   fw_info->ver = adev->psp.ta_fw_version;
>   fw_info->feature = adev->psp.ta_xgmi_ucode_version;
> - } else {
> + break;
> + case 1:
>   fw_info->ver = adev->psp.ta_fw_version;
>   fw_info->feature = adev->psp.ta_ras_ucode_version;
> + break;
> + case 2:
> + fw_info->ver = adev->psp.ta_fw_version;
> + fw_info->feature = adev->psp.ta_hdcp_ucode_version;
> + break;
> + case 3:
> + fw_info->ver = adev->psp.ta_fw_version;
> + fw_info->feature = adev->psp.ta_dtm_ucode_version;
> + break;
> + default:
> + return -EINVAL;
>   }
>   break;
>   case AMDGPU_INFO_FW_SDMA:
> @@ -1383,13 +1394,31 @@ static int amdgpu_debugfs_firmware_info(struct 
> seq_file *m, void *data)
>  fw_info.feature, fw_info.ver);
>  
>   query_fw.fw_type = AMDGPU_INFO_FW_TA;
> - for (i = 0; i < 2; i++) {
> + for (i = 0; i < 4; i++) {
>   query_fw.index = i;
>   ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
>   if (ret)
>   continue;
> - seq_printf(m, "TA %s feature version: %u, firmware version: 
> 0x%08x\n",
> - i ? "RAS" : "XGMI", fw_info.feature, 
> fw_info.ver);
> + switch (query_fw.index) {
> + case 0:
> + seq_printf(m, "TA %s feature version: 0x%08x, firmware 
> version: 0x%08x\n",
> + "RAS", fw_info.feature, fw_info.ver);
> + break;
> + case 1:
> + seq_printf(m, "TA %s feature version: 0x%08x, firmware 
> version: 0x%08x\n",
> + "XGMI", fw_info.feature, fw_info.ver);
> + break;
> + case 2:
> + seq_printf(m, "TA %s feature version: 0x%08x, firmware 
> version: 0x%08x\n",
> + "HDCP", fw_info.feature, fw_info.ver);
> + break;
> + case 3:
> + seq_printf(m, "TA %s feature version: 0x%08x, firmware 
> version: 0x%08x\n",
> + "DTM", fw_info.feature, fw_info.ver);
> + break;
> + default:
> + return -EINVAL;
> + }
>   }
>  
>   /* SMC */
> -- 
> 2.17.1
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 4/4] drm/amdgpu: add xgmi perfmons for arcturus

2020-09-10 Thread Kim, Jonathan
[AMD Official Use Only - Internal Distribution Only]

Ping.

Thanks,

Jon

> -Original Message-
> From: Kim, Jonathan 
> Sent: Tuesday, September 8, 2020 9:07 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix ; Kim, Jonathan
> ; Kim, Jonathan 
> Subject: [PATCH 4/4] drm/amdgpu: add xgmi perfmons for arcturus
>
> Add xgmi perfmons for Arcturus.
>
> Signed-off-by: Jonathan Kim 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 55
> +
>  drivers/gpu/drm/amd/amdgpu/df_v3_6.c|  3 ++
>  2 files changed, 58 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 82f57bd38716..4adf9c6e3944 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -34,6 +34,8 @@
>  #define NUM_EVENTS_DF_LEGACY8
>  #define NUM_EVENTS_VEGA20_XGMI2
>  #define NUM_EVENTS_VEGA20_MAX2
> +#define NUM_EVENTS_ARCTURUS_XGMI6
> +#define NUM_EVENTS_ARCTURUS_MAX6
>
>  /* record to keep track of pmu entry per pmu type per device */  struct
> amdgpu_pmu_entry { @@ -95,6 +97,27 @@ const struct attribute_group
> *vega20_attr_groups[] = {
>  NULL
>  };
>
> +/* Arcturus events */
> +static const char *arcturus_events[NUM_EVENTS_ARCTURUS_MAX][2] = {
> +{ "xgmi_link0_data_outbound",
> "event=0x7,instance=0x4b,umask=0x2" },
> +{ "xgmi_link1_data_outbound",
> "event=0x7,instance=0x4c,umask=0x2" },
> +{ "xgmi_link2_data_outbound",
> "event=0x7,instance=0x4d,umask=0x2" },
> +{ "xgmi_link3_data_outbound",
> "event=0x7,instance=0x4e,umask=0x2" },
> +{ "xgmi_link4_data_outbound",
> "event=0x7,instance=0x4f,umask=0x2" },
> +{ "xgmi_link5_data_outbound",
> "event=0x7,instance=0x50,umask=0x2" } };
> +
> +static struct attribute_group arcturus_event_attr_group = {
> +.name = "events",
> +.attrs = NULL
> +};
> +
> +const struct attribute_group *arcturus_attr_groups[] = {
> +&amdgpu_pmu_format_attr_group,
> +&arcturus_event_attr_group,
> +NULL
> +};
> +
>  /* All df_vega20_* items are DEPRECATED. Use vega20_ items above
> instead. */  static const char
> *df_vega20_formats[NUM_FORMATS_DF_LEGACY][2] = {
>  { "event", "config:0-7" },
> @@ -380,6 +403,16 @@ static int init_pmu_by_type(struct amdgpu_device
> *adev,
>
>  pmu_entry->pmu.attr_groups = vega20_attr_groups;
>  break;
> +case CHIP_ARCTURUS:
> +amdgpu_pmu_create_attributes(evt_attr_group, evt_attr,
> +arcturus_events, 0,
> NUM_EVENTS_ARCTURUS_XGMI,
> +PERF_TYPE_AMDGPU_XGMI);
> +num_events += NUM_EVENTS_ARCTURUS_XGMI;
> +
> +/* other events can be added here */
> +
> +pmu_entry->pmu.attr_groups = arcturus_attr_groups;
> +break;
>  default:
>  return -ENODEV;
>  };
> @@ -510,6 +543,28 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>  goto err_pmu;
>  }
>
> +break;
> +case CHIP_ARCTURUS:
> +ret =
> amdgpu_pmu_alloc_pmu_attrs(&amdgpu_pmu_format_attr_group,
> +&fmt_attr,
> +
> NUM_FORMATS_AMDGPU_PMU,
> +&arcturus_event_attr_group,
> +&evt_attr,
> +
> NUM_EVENTS_ARCTURUS_MAX);
> +
> +if (ret)
> +goto err_alloc;
> +
> +ret = init_pmu_by_type(adev,
> +&amdgpu_pmu_format_attr_group,
> fmt_attr,
> +&arcturus_event_attr_group, evt_attr,
> +"Event", "amdgpu",
> PERF_TYPE_AMDGPU_MAX);
> +
> +if (ret) {
> +kfree(arcturus_event_attr_group.attrs);
> +goto err_pmu;
> +}
> +
>  break;
>  default:
>  return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
> b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
> index 569c40be6e75..23af431de997 100644
> --- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
> +++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
> @@ -512,6 +512,7 @@ static int df_v3_6_pmc_start(struct amdgpu_device
> *adev, uint64_t config,
>
>  switch (adev->asic_type) {
>  case CHIP_VEGA20:
> +case CHIP_ARCTURUS:
>  if (is_add)
>  return df_v3_6_pmc_add_cntr(adev, config);
>
> @@ -553,6 +554,7 @@ static int df_v3_6_pmc_stop(struct amdgpu_device
> *adev, uint64_t config,
>
>  switch (adev->asic_type) {
>  case CHIP_VEGA20:
> +case CHIP_ARCTURUS:
>  ret = df_v3_6_pmc_get_ctrl_settings(adev,
>  config,
>  counter_idx,
> @@ -589,6 +591,7 @@ static void df_v3_6_pmc_get_count(struct
> amdgpu_device *adev,
>
>  switch (adev->asic_type) {
>  case CHIP_VEGA20:
> +case CHIP_ARCTURUS:
>  df_v3_6_pmc_get_read_settings(adev, config, counter_idx,
>  &lo_base_addr,
> &hi_base_addr);
>
> --
> 2.17.1

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


[PATCH 23/42] drm/amd/display: Disable idle optimization when PSR is enabled

2020-09-10 Thread Aurabindo Pillai
From: Zhan Liu 

[Why]
Idle optimization and PSR conflict each other. If both enabled
at the same time, display flickering will be observed.

[How]
Disable idle optimization when PSR is enabled.

Signed-off-by: Zhan Liu 
Acked-by: Aurabindo Pillai 
---
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c| 25 ---
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
index 1390ff1ce7be..7886c32d8315 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
@@ -690,26 +690,23 @@ void dcn30_program_dmdata_engine(struct pipe_ctx 
*pipe_ctx)
 
 bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable)
 {
-   unsigned int surface_size;
-
if (!dc->ctx->dmub_srv)
return false;
 
if (enable) {
-   if (dc->current_state
-   && dc->current_state->stream_count == 1 // 
single display only
-   && 
dc->current_state->stream_status[0].plane_count == 1 // single surface only
-   && 
dc->current_state->stream_status[0].plane_states[0]->address.page_table_base.quad_part
 == 0 // no VM
-   // Only 8 and 16 bit formats
-   && 
dc->current_state->stream_status[0].plane_states[0]->format <= 
SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F
-   && 
dc->current_state->stream_status[0].plane_states[0]->format >= 
SURFACE_PIXEL_FORMAT_GRPH_ARGB) {
-
-   surface_size = 
dc->current_state->stream_status[0].plane_states[0]->plane_size.surface_pitch *
-   
dc->current_state->stream_status[0].plane_states[0]->plane_size.surface_size.height
 *
-   
(dc->current_state->stream_status[0].plane_states[0]->format >= 
SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4);
-
+   if (dc->current_state) {
+   int i;
+
+   /* First, check no-memory-requests case */
+   for (i = 0; i < dc->current_state->stream_count; i++) {
+   if (dc->current_state->stream_status[i]
+   .plane_count)
+   /* Fail eligibility on a visible stream 
*/
+   break;
+   }
}
 
+   /* No applicable optimizations */
return false;
}
 
-- 
2.25.1

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


[PATCH 29/42] drm/amd/display: [FW Promotion] Release 0.0.32

2020-09-10 Thread Aurabindo Pillai
From: Anthony Koo 

| [Header Changes]
|   - Add debug flag to log line numbers for PSR debug

Signed-off-by: Anthony Koo 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h 
b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index 3f84060d79c0..a0bd502dc7d7 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -36,10 +36,10 @@
 
 /* Firmware versioning. */
 #ifdef DMUB_EXPOSE_VERSION
-#define DMUB_FW_VERSION_GIT_HASH 0x08aa15e57
+#define DMUB_FW_VERSION_GIT_HASH 0x82f998da6
 #define DMUB_FW_VERSION_MAJOR 0
 #define DMUB_FW_VERSION_MINOR 0
-#define DMUB_FW_VERSION_REVISION 31
+#define DMUB_FW_VERSION_REVISION 32
 #define DMUB_FW_VERSION_TEST 0
 #define DMUB_FW_VERSION_VBIOS 0
 #define DMUB_FW_VERSION_HOTFIX 0
@@ -97,6 +97,7 @@ union dmub_psr_debug_flags {
struct {
uint32_t visual_confirm : 1;
uint32_t use_hw_lock_mgr : 1;
+   uint32_t log_line_nums : 1;
} bitfields;
 
uint32_t u32All;
-- 
2.25.1

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


[PATCH 18/42] drm/amd/display: Rename set_mst_bandwidth to align with DP spec

2020-09-10 Thread Aurabindo Pillai
From: George Shen 

[Why]
The function set_mst_bandwidth is poorly name since it isn't clear what
it does, and it also does not reflect any part of the allocation sequence
described in the DP spec.

[How]
Rename the function set_mst_bandwidth to set_throttled_vcp_size.

(cherry picked from commit 9a630236f857562ae8a8af9c6b2a5ce79b409795)
Signed-off-by: George Shen 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c| 4 ++--
 drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c  | 6 +++---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c  | 6 +++---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h  | 2 +-
 .../gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c  | 4 ++--
 .../drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c  | 4 ++--
 drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h   | 2 +-
 .../drm/amd/display/dc/virtual/virtual_stream_encoder.c  | 9 +
 8 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 437d1a7a16fe..1871ff6119ae 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -2946,7 +2946,7 @@ enum dc_status dc_link_allocate_mst_payload(struct 
pipe_ctx *pipe_ctx)
pbn = get_pbn_from_timing(pipe_ctx);
avg_time_slots_per_mtp = dc_fixpt_div(pbn, pbn_per_slot);
 
-   stream_encoder->funcs->set_mst_bandwidth(
+   stream_encoder->funcs->set_throttled_vcp_size(
stream_encoder,
avg_time_slots_per_mtp);
 
@@ -2974,7 +2974,7 @@ static enum dc_status deallocate_mst_payload(struct 
pipe_ctx *pipe_ctx)
 */
 
/* slot X.Y */
-   stream_encoder->funcs->set_mst_bandwidth(
+   stream_encoder->funcs->set_throttled_vcp_size(
stream_encoder,
avg_time_slots_per_mtp);
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c 
b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
index 4cdaaf4d881c..5054bb567b74 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
@@ -710,7 +710,7 @@ static void dce110_stream_encoder_lvds_set_stream_attribute(
ASSERT(crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB);
 }
 
-static void dce110_stream_encoder_set_mst_bandwidth(
+static void dce110_stream_encoder_set_throttled_vcp_size(
struct stream_encoder *enc,
struct fixed31_32 avg_time_slots_per_mtp)
 {
@@ -1621,8 +1621,8 @@ static const struct stream_encoder_funcs 
dce110_str_enc_funcs = {
dce110_stream_encoder_dvi_set_stream_attribute,
.lvds_set_stream_attribute =
dce110_stream_encoder_lvds_set_stream_attribute,
-   .set_mst_bandwidth =
-   dce110_stream_encoder_set_mst_bandwidth,
+   .set_throttled_vcp_size =
+   dce110_stream_encoder_set_throttled_vcp_size,
.update_hdmi_info_packets =
dce110_stream_encoder_update_hdmi_info_packets,
.stop_hdmi_info_packets =
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c
index 842abb4c475b..9cf139be3f40 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c
@@ -619,7 +619,7 @@ void enc1_stream_encoder_dvi_set_stream_attribute(
enc1_stream_encoder_set_stream_attribute_helper(enc1, crtc_timing);
 }
 
-void enc1_stream_encoder_set_mst_bandwidth(
+void enc1_stream_encoder_set_throttled_vcp_size(
struct stream_encoder *enc,
struct fixed31_32 avg_time_slots_per_mtp)
 {
@@ -1616,8 +1616,8 @@ static const struct stream_encoder_funcs 
dcn10_str_enc_funcs = {
enc1_stream_encoder_hdmi_set_stream_attribute,
.dvi_set_stream_attribute =
enc1_stream_encoder_dvi_set_stream_attribute,
-   .set_mst_bandwidth =
-   enc1_stream_encoder_set_mst_bandwidth,
+   .set_throttled_vcp_size =
+   enc1_stream_encoder_set_throttled_vcp_size,
.update_hdmi_info_packets =
enc1_stream_encoder_update_hdmi_info_packets,
.stop_hdmi_info_packets =
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h
index 30eae7459d50..b99d2527cf03 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h
@@ -588,7 +588,7 @@ void enc1_stream_encoder_dvi_set_stream_attribute(
struct dc_crtc_timing *crtc_timing,
bool is_dual_link);
 
-void enc1_stream_encoder_set_mst_bandwidth(
+void enc1_stream_encoder_set_throttled_vcp_size(
struct stream_encoder *enc,
struct fixed31_32 avg_time_slots_per_mtp)

[PATCH 02/42] drm/amd/display: 3.2.100

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 1d9c8e09c08b..7416fd37e7d8 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -42,7 +42,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.99"
+#define DC_VER "3.2.100"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
-- 
2.25.1

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


[PATCH 27/42] drm/amd/display: Add trigger connector unplug

2020-09-10 Thread Aurabindo Pillai
From: Eryk Brol 

[why]
We need a virtual tool that would emulate a physical
connector unplug to usermode, while connector is
still physically plugged in.

[how]
Added a new option to debugfs entry "trigger_hotplug".
It emulates hotplug irq handling scenario by clearing
DC and DM connector states.
It can be triggered with the following command:

echo 0 > /sys/kernel/debug/dri/0/DP-X/trigger_hotplug

Signed-off-by: Eryk Brol 
Signed-off-by: Mikita Lipski 
Acked-by: Aurabindo Pillai 
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 5cf3ba3ec5da..7c7f937166dc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -1058,12 +1058,17 @@ static int dp_dsc_fec_support_show(struct seq_file *m, 
void *data)
  *
  * echo 1 > /sys/kernel/debug/dri/0/DP-X/trigger_hotplug
  *
+ * This function can perform HPD unplug:
+ *
+ * echo 0 > /sys/kernel/debug/dri/0/DP-X/trigger_hotplug
+ *
  */
 static ssize_t dp_trigger_hotplug(struct file *f, const char __user *buf,
size_t size, loff_t 
*pos)
 {
struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private;
struct drm_connector *connector = &aconnector->base;
+   struct dc_link *link = NULL;
struct drm_device *dev = connector->dev;
enum dc_connection_type new_connection_type = dc_connection_none;
char *wr_buf = NULL;
@@ -1114,11 +1119,33 @@ static ssize_t dp_trigger_hotplug(struct file *f, const 
char __user *buf,
drm_modeset_unlock_all(dev);
 
drm_kms_helper_hotplug_event(dev);
+   } else if (param[0] == 0) {
+   if (!aconnector->dc_link)
+   goto unlock;
 
-unlock:
-   mutex_unlock(&aconnector->hpd_lock);
+   link = aconnector->dc_link;
+
+   if (link->local_sink) {
+   dc_sink_release(link->local_sink);
+   link->local_sink = NULL;
+   }
+
+   link->dpcd_sink_count = 0;
+   link->type = dc_connection_none;
+   link->dongle_max_pix_clk = 0;
+
+   amdgpu_dm_update_connector_after_detect(aconnector);
+
+   drm_modeset_lock_all(dev);
+   dm_restore_drm_connector_state(dev, connector);
+   drm_modeset_unlock_all(dev);
+
+   drm_kms_helper_hotplug_event(dev);
}
 
+unlock:
+   mutex_unlock(&aconnector->hpd_lock);
+
kfree(wr_buf);
return size;
 }
-- 
2.25.1

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


[PATCH 22/42] drm/amd/display: Don't use DRM_ERROR() for DTM add topology

2020-09-10 Thread Aurabindo Pillai
From: Bhawanpreet Lakha 

[Why]
Previously we were only calling add_topology when hdcp was being enabled.
Now we call add_topology by default so the ERROR messages are printed if
the firmware is not loaded.

This error message is not relevant for normal display functionality so
no need to print a ERROR message.

[How]
Change DRM_ERROR to DRM_INFO

Signed-off-by: Bhawanpreet Lakha 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
index fb1161dd7ea8..3a367a5968ae 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
@@ -88,7 +88,7 @@ enum mod_hdcp_status mod_hdcp_add_display_to_topology(struct 
mod_hdcp *hdcp,
enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
if (!psp->dtm_context.dtm_initialized) {
-   DRM_ERROR("Failed to add display topology, DTM TA is not 
initialized.");
+   DRM_INFO("Failed to add display topology, DTM TA is not 
initialized.");
display->state = MOD_HDCP_DISPLAY_INACTIVE;
return MOD_HDCP_STATUS_FAILURE;
}
-- 
2.25.1

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


[PATCH 30/42] drm/amd/display: 3.2.102

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 464f2c657597..8631d290afee 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -42,7 +42,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.101"
+#define DC_VER "3.2.102"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
-- 
2.25.1

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


[PATCH 08/42] drm/amd/display: Triplebuffering should not be used by default

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

Disable triplebuffering by default.

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c   |  3 ---
 drivers/gpu/drm/amd/display/dc/core/dc.c|  9 +++--
 drivers/gpu/drm/amd/display/dc/dc.h |  2 +-
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c  | 13 ++---
 .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c   |  2 +-
 .../gpu/drm/amd/display/dc/dcn21/dcn21_resource.c   |  2 ++
 .../gpu/drm/amd/display/dc/dcn30/dcn30_resource.c   |  1 +
 7 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index cb624ee70545..a7f08a8199e7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3336,9 +3336,6 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)
goto fail;
}
 
-   /* No userspace support. */
-   dm->dc->debug.disable_tri_buf = true;
-
return 0;
 fail:
kfree(aencoder);
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index dc463d99ef50..511ab25b3f1a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -2415,8 +2415,7 @@ static void commit_planes_for_stream(struct dc *dc,
plane_state->triplebuffer_flips = false;
if (update_type == UPDATE_TYPE_FAST &&
dc->hwss.program_triplebuffer != NULL &&
-   !plane_state->flip_immediate &&
-   !dc->debug.disable_tri_buf) {
+   !plane_state->flip_immediate && 
dc->debug.enable_tri_buf) {
/*triple buffer for VUpdate  
only*/
plane_state->triplebuffer_flips 
= true;
}
@@ -2443,8 +2442,7 @@ static void commit_planes_for_stream(struct dc *dc,
 
ASSERT(!pipe_ctx->plane_state->triplebuffer_flips);
 
-   if (dc->hwss.program_triplebuffer != NULL &&
-   !dc->debug.disable_tri_buf) {
+   if (dc->hwss.program_triplebuffer != NULL && 
dc->debug.enable_tri_buf) {
/*turn off triple buffer for full update*/
dc->hwss.program_triplebuffer(
dc, pipe_ctx, 
pipe_ctx->plane_state->triplebuffer_flips);
@@ -2509,8 +2507,7 @@ static void commit_planes_for_stream(struct dc *dc,
if (pipe_ctx->plane_state != plane_state)
continue;
/*program triple buffer after lock based on 
flip type*/
-   if (dc->hwss.program_triplebuffer != NULL &&
-   !dc->debug.disable_tri_buf) {
+   if (dc->hwss.program_triplebuffer != NULL && 
dc->debug.enable_tri_buf) {
/*only enable triplebuffer for  
fast_update*/
dc->hwss.program_triplebuffer(
dc, pipe_ctx, 
plane_state->triplebuffer_flips);
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 7416fd37e7d8..0607122e04de 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -476,7 +476,7 @@ struct dc_debug_options {
unsigned int force_odm_combine_4to1; //bit vector based on otg inst
 #endif
unsigned int force_fclk_khz;
-   bool disable_tri_buf;
+   bool enable_tri_buf;
bool dmub_offload_enabled;
bool dmcub_emulation;
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index ee3348711abe..ee56060943f1 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -1642,16 +1642,15 @@ void dcn20_program_front_end_for_ctx(
struct dce_hwseq *hws = dc->hwseq;
DC_LOGGER_INIT(dc->ctx->logger);
 
-   for (i = 0; i < dc->res_pool->pipe_count; i++) {
-   struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
+   if (dc->hwss.program_triplebuffer != NULL && dc->debug.enable_tri_buf) {
+   for (i = 0; i < dc->res_pool->pipe_count; i++) {
+   struct pipe_ctx *pipe_ctx = 
&context->res_ctx.pipe_ctx[i];
 
-   if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && 
pipe_ctx->plane_state) {
-   ASSERT(!pip

[PATCH 19/42] drm/amd/display: remove early return from dm_late_init

2020-09-10 Thread Aurabindo Pillai
From: Roman Li 

[Why]
ABM feature initialization was not executed due to early return.

dm_late_init() had an early return in case if DMCU is not used.
With the implementation of ABM on DMUB, DMCU can be disabled
but ABM still needs to be initialized.

[How]
Remove verification for DMCU from the top of the function.
The existing logic will handle the case when DMCU is not used.

Signed-off-by: Roman Li 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index a7f08a8199e7..9fb0dca839a5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1389,9 +1389,6 @@ static int dm_late_init(void *handle)
struct dmcu *dmcu = NULL;
bool ret = true;
 
-   if (!adev->dm.fw_dmcu && !adev->dm.dmub_fw)
-   return detect_mst_link_for_all_connectors(adev_to_drm(adev));
-
dmcu = adev->dm.dc->res_pool->dmcu;
 
for (i = 0; i < 16; i++)
-- 
2.25.1

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


[PATCH 07/42] drm/amd/display: add option to override cr training pattern

2020-09-10 Thread Aurabindo Pillai
From: Wenjing Liu 

Signed-off-by: Wenjing Liu 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/dc/core/dc_link_dp.c  | 33 ---
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  |  1 +
 .../amd/display/include/link_service_types.h  |  1 +
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index d1d95d3e248a..2334ec428098 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -101,7 +101,16 @@ static void dpcd_set_training_pattern(
dpcd_pattern.v1_4.TRAINING_PATTERN_SET);
 }
 
-static enum dc_dp_training_pattern get_supported_tp(struct dc_link *link)
+static enum dc_dp_training_pattern decide_cr_training_pattern(
+   const struct dc_link_settings *link_settings)
+{
+   enum dc_dp_training_pattern pattern = DP_TRAINING_PATTERN_SEQUENCE_1;
+
+   return pattern;
+}
+
+static enum dc_dp_training_pattern decide_eq_training_pattern(struct dc_link 
*link,
+   const struct dc_link_settings *link_settings)
 {
enum dc_dp_training_pattern highest_tp = DP_TRAINING_PATTERN_SEQUENCE_2;
struct encoder_feature_support *features = &link->link_enc->features;
@@ -132,7 +141,6 @@ static void dpcd_set_link_settings(
 
union down_spread_ctrl downspread = { {0} };
union lane_count_set lane_count_set = { {0} };
-   enum dc_dp_training_pattern dp_tr_pattern;
 
downspread.raw = (uint8_t)
(lt_settings->link_settings.link_spread);
@@ -143,9 +151,8 @@ static void dpcd_set_link_settings(
lane_count_set.bits.ENHANCED_FRAMING = lt_settings->enhanced_framing;
lane_count_set.bits.POST_LT_ADJ_REQ_GRANTED = 0;
 
-   dp_tr_pattern = get_supported_tp(link);
 
-   if (dp_tr_pattern != DP_TRAINING_PATTERN_SEQUENCE_4) {
+   if (lt_settings->pattern_for_eq < DP_TRAINING_PATTERN_SEQUENCE_4) {
lane_count_set.bits.POST_LT_ADJ_REQ_GRANTED =

link->dpcd_caps.max_ln_count.bits.POST_LT_ADJ_REQ_SUPPORTED;
}
@@ -979,7 +986,7 @@ static void start_clock_recovery_pattern_early(struct 
dc_link *link,
 {
DC_LOG_HW_LINK_TRAINING("%s\n GPU sends TPS1. Wait 400us.\n",
__func__);
-   dp_set_hw_training_pattern(link, DP_TRAINING_PATTERN_SEQUENCE_1, 
offset);
+   dp_set_hw_training_pattern(link, lt_settings->pattern_for_cr, offset);
dp_set_hw_lane_settings(link, lt_settings, offset);
udelay(400);
 }
@@ -994,7 +1001,6 @@ static enum link_training_result 
perform_clock_recovery_sequence(
uint32_t wait_time_microsec;
struct link_training_settings req_settings;
enum dc_lane_count lane_count = lt_settings->link_settings.lane_count;
-   enum dc_dp_training_pattern tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_1;
union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX];
union lane_align_status_updated dpcd_lane_status_updated;
 
@@ -1002,7 +1008,7 @@ static enum link_training_result 
perform_clock_recovery_sequence(
retry_count = 0;
 
if (!link->ctx->dc->work_arounds.lt_early_cr_pattern)
-   dp_set_hw_training_pattern(link, tr_pattern, offset);
+   dp_set_hw_training_pattern(link, lt_settings->pattern_for_cr, 
offset);
 
/* najeeb - The synaptics MST hub can put the LT in
* infinite loop by switching the VS
@@ -1029,7 +1035,7 @@ static enum link_training_result 
perform_clock_recovery_sequence(
dpcd_set_lt_pattern_and_lane_settings(
link,
lt_settings,
-   tr_pattern,
+   lt_settings->pattern_for_cr,
offset);
else
dpcd_set_lane_settings(
@@ -1113,7 +1119,7 @@ static inline enum link_training_result 
perform_link_training_int(
 * TPS4 must be used instead of POST_LT_ADJ_REQ.
 */
if (link->dpcd_caps.max_ln_count.bits.POST_LT_ADJ_REQ_SUPPORTED != 1 ||
-   get_supported_tp(link) == 
DP_TRAINING_PATTERN_SEQUENCE_4)
+   lt_settings->pattern_for_eq == 
DP_TRAINING_PATTERN_SEQUENCE_4)
return status;
 
if (status == LINK_TRAINING_SUCCESS &&
@@ -1252,10 +1258,14 @@ static void initialize_training_settings(
else
lt_settings->eq_pattern_time = 
get_training_aux_rd_interval(link, 400);
 
+   if (overrides->pattern_for_cr != NULL)
+   lt_settings->pattern_for_cr = *overrides->pattern_for_cr;
+   else
+   lt_settings->pattern_for_cr = 
decide_cr_training_pattern(link_setting);
if (overrides->pattern_for_eq != NULL)
lt_settings->pattern_for_eq = *over

[PATCH 14/42] drm/amd/display: Fix CP_IRQ clear bit and logic

2020-09-10 Thread Aurabindo Pillai
From: Harmanprit Tatla 

[Why]
Currently clearing the wrong bit for CP_IRQ, and logic on when to
clear needs to be fixed.

[How]
Corrected bit to clear and improved logic for decision to clear.

Signed-off-by: Harmanprit Tatla 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c  |  3 +--
 .../gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c  | 16 +++-
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
index a82975970e87..20e554e771d1 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
@@ -472,8 +472,7 @@ enum mod_hdcp_status mod_hdcp_process_event(struct mod_hdcp 
*hdcp,
}
 
/* Clear CP_IRQ status if needed */
-   if (event_ctx.event == MOD_HDCP_EVENT_CPIRQ &&
-   event_ctx.unexpected_event == 0) {
+   if (event_ctx.event == MOD_HDCP_EVENT_CPIRQ) {
status = mod_hdcp_clear_cp_irq_status(hdcp);
if (status != MOD_HDCP_STATUS_SUCCESS)
push_error_status(hdcp, status);
diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
index 9dd8c854fd81..f7b5583ee609 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
@@ -30,6 +30,8 @@
 #define KSV_READ_SIZE 0xf  /* 0x6803b - 0x6802c */
 #define HDCP_MAX_AUX_TRANSACTION_SIZE 16
 
+#define DP_CP_IRQ (1 << 2)
+
 enum mod_hdcp_ddc_message_id {
MOD_HDCP_MESSAGE_ID_INVALID = -1,
 
@@ -648,18 +650,14 @@ enum mod_hdcp_status mod_hdcp_write_content_type(struct 
mod_hdcp *hdcp)
 
 enum mod_hdcp_status mod_hdcp_clear_cp_irq_status(struct mod_hdcp *hdcp)
 {
-   uint8_t clear_cp_irq_bit = 2;
+   uint8_t clear_cp_irq_bit = DP_CP_IRQ;
uint32_t size = 1;
 
if (is_dp_hdcp(hdcp)) {
-   if (hdcp->connection.link.dp.rev >= 0x14)
-   return 
hdcp->config.ddc.funcs.write_dpcd(hdcp->config.ddc.handle,
-   DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0, 
&clear_cp_irq_bit, size)
-   ? MOD_HDCP_STATUS_SUCCESS : 
MOD_HDCP_STATUS_DDC_FAILURE;
-   else
-   return 
hdcp->config.ddc.funcs.write_dpcd(hdcp->config.ddc.handle,
-   DP_DEVICE_SERVICE_IRQ_VECTOR, 
&clear_cp_irq_bit, size)
-   ? MOD_HDCP_STATUS_SUCCESS : 
MOD_HDCP_STATUS_DDC_FAILURE;
+   uint32_t cp_irq_addrs = (hdcp->connection.link.dp.rev >= 0x14)
+   ? 
DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0:DP_DEVICE_SERVICE_IRQ_VECTOR;
+   return 
hdcp->config.ddc.funcs.write_dpcd(hdcp->config.ddc.handle, cp_irq_addrs,
+   &clear_cp_irq_bit, size) ? 
MOD_HDCP_STATUS_SUCCESS : MOD_HDCP_STATUS_DDC_FAILURE;
}
 
return MOD_HDCP_STATUS_INVALID_OPERATION;
-- 
2.25.1

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


[PATCH 10/42] drm/amd/display: [FW Promotion] Release 0.0.31

2020-09-10 Thread Aurabindo Pillai
From: Anthony Koo 

Signed-off-by: Anthony Koo 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h 
b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index 5eb642fe9315..3f84060d79c0 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -36,10 +36,10 @@
 
 /* Firmware versioning. */
 #ifdef DMUB_EXPOSE_VERSION
-#define DMUB_FW_VERSION_GIT_HASH 0xb18f2464d
+#define DMUB_FW_VERSION_GIT_HASH 0x08aa15e57
 #define DMUB_FW_VERSION_MAJOR 0
 #define DMUB_FW_VERSION_MINOR 0
-#define DMUB_FW_VERSION_REVISION 30
+#define DMUB_FW_VERSION_REVISION 31
 #define DMUB_FW_VERSION_TEST 0
 #define DMUB_FW_VERSION_VBIOS 0
 #define DMUB_FW_VERSION_HOTFIX 0
-- 
2.25.1

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


[PATCH 12/42] drm/amd/display: always use 100us for cr aux rd interval

2020-09-10 Thread Aurabindo Pillai
From: Wenjing Liu 

[why]
It is a regression caused by below commit.
I1654c11ba3e229e17483959e0f66319d7de9e320
In this commit the cr training aux rd interval is
modified without following specs requirements.
According to the commit message the change was not intended to modify the value.
Therefore it looks like it is caused by a typo in the change.

Signed-off-by: Wenjing Liu 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 2334ec428098..e4b3b71dad03 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -49,14 +49,14 @@ static struct dc_link_settings 
get_common_supported_link_settings(
struct dc_link_settings link_setting_a,
struct dc_link_settings link_setting_b);
 
-static uint32_t get_training_aux_rd_interval(
+static uint32_t get_eq_training_aux_rd_interval(
struct dc_link *link,
-   uint32_t default_wait_in_micro_secs)
+   const struct dc_link_settings *link_settings)
 {
union training_aux_rd_interval training_rd_interval;
+   uint32_t wait_in_micro_secs = 400;
 
memset(&training_rd_interval, 0, sizeof(training_rd_interval));
-
/* overwrite the delay if rev > 1.1*/
if (link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) {
/* DP 1.2 or later - retrieve delay through
@@ -68,10 +68,10 @@ static uint32_t get_training_aux_rd_interval(
sizeof(training_rd_interval));
 
if (training_rd_interval.bits.TRAINIG_AUX_RD_INTERVAL)
-   default_wait_in_micro_secs = 
training_rd_interval.bits.TRAINIG_AUX_RD_INTERVAL * 4000;
+   wait_in_micro_secs = 
training_rd_interval.bits.TRAINIG_AUX_RD_INTERVAL * 4000;
}
 
-   return default_wait_in_micro_secs;
+   return wait_in_micro_secs;
 }
 
 static void wait_for_training_aux_rd_interval(
@@ -1251,12 +1251,12 @@ static void initialize_training_settings(
if (overrides->cr_pattern_time != NULL)
lt_settings->cr_pattern_time = *overrides->cr_pattern_time;
else
-   lt_settings->cr_pattern_time = 
get_training_aux_rd_interval(link, 100);
+   lt_settings->cr_pattern_time = 100;
 
if (overrides->eq_pattern_time != NULL)
lt_settings->eq_pattern_time = *overrides->eq_pattern_time;
else
-   lt_settings->eq_pattern_time = 
get_training_aux_rd_interval(link, 400);
+   lt_settings->eq_pattern_time = 
get_eq_training_aux_rd_interval(link, link_setting);
 
if (overrides->pattern_for_cr != NULL)
lt_settings->pattern_for_cr = *overrides->pattern_for_cr;
-- 
2.25.1

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


[PATCH 16/42] drm/amd/display: Increase Max EDID Size Constant

2020-09-10 Thread Aurabindo Pillai
From: Aidan Gratton 

[HOW & WHY]
Change max EDID size constant to 1280 to support
10-block EDIDs.

Signed-off-by: Aidan Gratton 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dc_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc_types.h 
b/drivers/gpu/drm/amd/display/dc/dc_types.h
index aa8e0955db48..c47a19719de2 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_types.h
@@ -122,7 +122,7 @@ struct dc_context {
 };
 
 
-#define DC_MAX_EDID_BUFFER_SIZE 1024
+#define DC_MAX_EDID_BUFFER_SIZE 1280
 #define DC_EDID_BLOCK_SIZE 128
 #define MAX_SURFACE_NUM 4
 #define NUM_PIXEL_FORMATS 10
-- 
2.25.1

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


[PATCH 31/42] drm/amd/display: implement notify stream mask

2020-09-10 Thread Aurabindo Pillai
From: Eric Yang 

[Why]
Send stream active state info to DMUB

[How]
Implement GPINT to notify stream mask

Signed-off-by: Eric Yang 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c   | 18 ++
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c   | 16 
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h   |  2 ++
 .../gpu/drm/amd/display/dc/inc/core_types.h|  1 +
 4 files changed, 37 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index ce5303c76b11..1190c58275c3 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1246,6 +1246,19 @@ void dc_trigger_sync(struct dc *dc, struct dc_state 
*context)
}
 }
 
+static uint8_t get_stream_mask(struct dc *dc, struct dc_state *context)
+{
+   int i;
+   unsigned int stream_mask = 0;
+
+   for (i = 0; i < dc->res_pool->pipe_count; i++) {
+   if (context->res_ctx.pipe_ctx[i].stream)
+   stream_mask |= 1 << i;
+   }
+
+   return stream_mask;
+}
+
 /*
  * Applies given context to HW and copy it into current context.
  * It's up to the user to release the src context afterwards.
@@ -1362,6 +1375,11 @@ static enum dc_status dc_commit_state_no_check(struct dc 
*dc, struct dc_state *c
dc->hwss.optimize_bandwidth(dc, context);
}
 
+   context->stream_mask = get_stream_mask(dc, context);
+
+   if (context->stream_mask != dc->current_state->stream_mask)
+   dc_dmub_srv_notify_stream_mask(dc->ctx->dmub_srv, 
context->stream_mask);
+
for (i = 0; i < context->stream_count; i++)
context->streams[i]->mode_changed = false;
 
diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c 
b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
index eea2429ac67d..b98754811977 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
@@ -132,3 +132,19 @@ void dc_dmub_srv_wait_phy_init(struct dc_dmub_srv 
*dc_dmub_srv)
/* Continue spinning so we don't hang the ASIC. */
}
 }
+
+bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv,
+   unsigned int stream_mask)
+{
+   struct dmub_srv *dmub;
+   const uint32_t timeout = 30;
+
+   if (!dc_dmub_srv || !dc_dmub_srv->dmub)
+   return false;
+
+   dmub = dc_dmub_srv->dmub;
+
+   return dmub_srv_send_gpint_command(
+  dmub, DMUB_GPINT__IDLE_OPT_NOTIFY_STREAM_MASK,
+  stream_mask, timeout) == DMUB_STATUS_OK;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h 
b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h
index a3a09ccb6d26..bb4ab61887e4 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h
@@ -56,4 +56,6 @@ void dc_dmub_srv_wait_idle(struct dc_dmub_srv *dc_dmub_srv);
 
 void dc_dmub_srv_wait_phy_init(struct dc_dmub_srv *dc_dmub_srv);
 
+bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv,
+   unsigned int stream_mask);
 #endif /* _DMUB_DC_SRV_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h 
b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 3ec1d9dd1670..1daa563c8ff4 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -397,6 +397,7 @@ struct dc_state {
struct dc_stream_state *streams[MAX_PIPES];
struct dc_stream_status stream_status[MAX_PIPES];
uint8_t stream_count;
+   uint8_t stream_mask;
 
struct resource_context res_ctx;
 
-- 
2.25.1

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


[PATCH 20/42] drm/amd/display: Enabling PSR on DCN30 on driver side

2020-09-10 Thread Aurabindo Pillai
From: Zhan Liu 

[Why]
PSR needs to be enabled on DCN30. This is the driver part of PSR
enablement.

Also disabled retired DMCU on driver side, since DMCU is
not supported on DCN30 anymore.

[How]
Add necessary changes to enable PSR on DCN30.

Signed-off-by: Zhan Liu 
Acked-by: Aurabindo Pillai 
---
 .../drm/amd/display/dc/dcn30/dcn30_resource.c  | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
index 6746d582d723..88f23f12aeb8 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
@@ -79,6 +79,7 @@
 
 #include "reg_helper.h"
 #include "dce/dmub_abm.h"
+#include "dce/dmub_psr.h"
 #include "dce/dce_aux.h"
 #include "dce/dce_i2c.h"
 
@@ -832,7 +833,7 @@ static const struct dc_plane_cap plane_cap = {
 };
 
 static const struct dc_debug_options debug_defaults_drv = {
-   .disable_dmcu = true,
+   .disable_dmcu = true, //No DMCU on DCN30
.force_abm_enable = false,
.timing_trace = false,
.clock_trace = true,
@@ -849,10 +850,11 @@ static const struct dc_debug_options debug_defaults_drv = 
{
.underflow_assert_delay_us = 0x,
.dwb_fi_phase = -1, // -1 = disable,
.dmub_command_table = true,
+   .disable_psr = false,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
-   .disable_dmcu = true,
+   .disable_dmcu = true, //No dmcu on DCN30
.force_abm_enable = false,
.timing_trace = true,
.clock_trace = true,
@@ -865,6 +867,7 @@ static const struct dc_debug_options debug_defaults_diags = 
{
.scl_reset_length10 = true,
.dwb_fi_phase = -1, // -1 = disable
.dmub_command_table = true,
+   .disable_psr = true,
.enable_tri_buf = true,
 };
 
@@ -1313,6 +1316,9 @@ static void dcn30_resource_destruct(struct 
dcn30_resource_pool *pool)
dce_abm_destroy(&pool->base.multiple_abms[i]);
}
 
+   if (pool->base.psr != NULL)
+   dmub_psr_destroy(&pool->base.psr);
+
if (pool->base.dccg != NULL)
dcn_dccg_destroy(&pool->base.dccg);
 }
@@ -2624,6 +2630,14 @@ static bool dcn30_resource_construct(
}
}
pool->base.timing_generator_count = i;
+   /* PSR */
+   pool->base.psr = dmub_psr_create(ctx);
+
+   if (pool->base.psr == NULL) {
+   dm_error("DC: failed to create PSR obj!\n");
+   BREAK_TO_DEBUGGER();
+   goto create_fail;
+   }
 
/* ABM */
for (i = 0; i < pool->base.res_cap->num_timing_generator; i++) {
-- 
2.25.1

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


[PATCH 25/42] drm/amd/display: make dcn20 stream_gating use a pointer for dsc_pg_control

2020-09-10 Thread Aurabindo Pillai
From: Dmytro Laktyushkin 

This allows us to reuse these on different asics.

Signed-off-by: Dmytro Laktyushkin 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index ee56060943f1..5720b6e5d321 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -1918,9 +1918,9 @@ void dcn20_disable_stream_gating(struct dc *dc, struct 
pipe_ctx *pipe_ctx)
if (pipe_ctx->stream_res.dsc) {
struct pipe_ctx *odm_pipe = pipe_ctx->next_odm_pipe;
 
-   dcn20_dsc_pg_control(hws, pipe_ctx->stream_res.dsc->inst, true);
+   hws->funcs.dsc_pg_control(hws, pipe_ctx->stream_res.dsc->inst, 
true);
while (odm_pipe) {
-   dcn20_dsc_pg_control(hws, 
odm_pipe->stream_res.dsc->inst, true);
+   hws->funcs.dsc_pg_control(hws, 
odm_pipe->stream_res.dsc->inst, true);
odm_pipe = odm_pipe->next_odm_pipe;
}
}
@@ -1933,9 +1933,9 @@ void dcn20_enable_stream_gating(struct dc *dc, struct 
pipe_ctx *pipe_ctx)
if (pipe_ctx->stream_res.dsc) {
struct pipe_ctx *odm_pipe = pipe_ctx->next_odm_pipe;
 
-   dcn20_dsc_pg_control(hws, pipe_ctx->stream_res.dsc->inst, 
false);
+   hws->funcs.dsc_pg_control(hws, pipe_ctx->stream_res.dsc->inst, 
false);
while (odm_pipe) {
-   dcn20_dsc_pg_control(hws, 
odm_pipe->stream_res.dsc->inst, false);
+   hws->funcs.dsc_pg_control(hws, 
odm_pipe->stream_res.dsc->inst, false);
odm_pipe = odm_pipe->next_odm_pipe;
}
}
-- 
2.25.1

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


[PATCH 11/42] drm/amd/display: 3.2.101

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 0607122e04de..464f2c657597 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -42,7 +42,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.100"
+#define DC_VER "3.2.101"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
-- 
2.25.1

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


[PATCH 33/42] drm/amd/display: Return the number of bytes parsed than allocated

2020-09-10 Thread Aurabindo Pillai
From: Eryk Brol 

[why & how]
Previously we were returning the number of bytes allocated
for a write buffer from debugfs and when manually used it wouldn't
rise any errors, but it wouldn't match the size of the parameters
passed from userspace.

In successful case return the size passed by usermode otherwise
the error code is returned. That simplifies the parser helper
and removes a potential error of returning mismatched input size.

Signed-off-by: Eryk Brol 
Signed-off-by: Mikita Lipski 
Acked-by: Aurabindo Pillai 
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c| 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 7c7f937166dc..240a4fc403df 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -264,7 +264,7 @@ static ssize_t dp_link_settings_write(struct file *f, const 
char __user *buf,
if (!wr_buf)
return -ENOSPC;
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
   (long *)param, buf,
   max_param_num,
   ¶m_nums)) {
@@ -423,7 +423,7 @@ static ssize_t dp_phy_settings_write(struct file *f, const 
char __user *buf,
if (!wr_buf)
return -ENOSPC;
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
   (long *)param, buf,
   max_param_num,
   ¶m_nums)) {
@@ -575,7 +575,7 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct 
file *f, const char __us
if (!wr_buf)
return -ENOSPC;
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
   (long *)param, buf,
   max_param_num,
   ¶m_nums)) {
@@ -1090,7 +1090,7 @@ static ssize_t dp_trigger_hotplug(struct file *f, const 
char __user *buf,
return -ENOSPC;
}
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
¶m_nums))
@@ -1269,7 +1269,7 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, 
const char __user *buf,
return -ENOSPC;
}
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
¶m_nums)) {
@@ -1423,7 +1423,7 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, 
const char __user *buf,
return -ENOSPC;
}
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
¶m_nums)) {
@@ -1572,7 +1572,7 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, 
const char __user *buf,
return -ENOSPC;
}
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
¶m_nums)) {
@@ -1714,7 +1714,7 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file 
*f, const char __user *bu
return -ENOSPC;
}
 
-   if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
+   if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
¶m_nums)) {
-- 
2.25.1

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


[PATCH 09/42] drm/amd/display: Check clock table return

2020-09-10 Thread Aurabindo Pillai
From: Rodrigo Siqueira 

During the load processes for Renoir, our display code needs to retrieve
the SMU clock and voltage table, however, this operation can fail which
means that we have to check this scenario. Currently, we are not
handling this case properly and as a result, we have seen the following
dmesg log during the boot:

RIP: 0010:rn_clk_mgr_construct+0x129/0x3d0 [amdgpu]
...
Call Trace:
 dc_clk_mgr_create+0x16a/0x1b0 [amdgpu]
 dc_create+0x231/0x760 [amdgpu]

This commit fixes this issue by checking the return status retrieved
from the clock table before try to populate any bandwidth.

Signed-off-by: Rodrigo Siqueira 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c 
b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
index 543afa34d87a..136ae6d70c80 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
@@ -761,6 +761,7 @@ void rn_clk_mgr_construct(
 {
struct dc_debug_options *debug = &ctx->dc->debug;
struct dpm_clocks clock_table = { 0 };
+   enum pp_smu_status status = 0;
 
clk_mgr->base.ctx = ctx;
clk_mgr->base.funcs = &dcn21_funcs;
@@ -818,8 +819,10 @@ void rn_clk_mgr_construct(
clk_mgr->base.bw_params = &rn_bw_params;
 
if (pp_smu && pp_smu->rn_funcs.get_dpm_clock_table) {
-   pp_smu->rn_funcs.get_dpm_clock_table(&pp_smu->rn_funcs.pp_smu, 
&clock_table);
-   if (ctx->dc_bios && ctx->dc_bios->integrated_info) {
+   status = 
pp_smu->rn_funcs.get_dpm_clock_table(&pp_smu->rn_funcs.pp_smu, &clock_table);
+
+   if (status == PP_SMU_RESULT_OK &&
+   ctx->dc_bios && ctx->dc_bios->integrated_info) {
rn_clk_mgr_helper_populate_bw_params 
(clk_mgr->base.bw_params, &clock_table, ctx->dc_bios->integrated_info);
}
}
-- 
2.25.1

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


[PATCH 24/42] drm/amd/display: Multi display cause system lag on mode change

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

[Why]
DCValidator is created/destroyed repeatedly for cofunctional validation
which causes a lot of memory thrashing, particularly when Driver Verifer
is enabled.

[How]
Implement a basic caching algorithm that will cache DCValidator with a
matching topology.  When a match is found, the DCValidator can be
reused.  If there is no match, a new one will be created and inserted
into the cache if there is space or an unreference entry can be evicted.

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 511ab25b3f1a..ce5303c76b11 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1481,13 +1481,8 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
return true;
 }
 
-struct dc_state *dc_create_state(struct dc *dc)
+static void init_state(struct dc *dc, struct dc_state *context)
 {
-   struct dc_state *context = kvzalloc(sizeof(struct dc_state),
-   GFP_KERNEL);
-
-   if (!context)
-   return NULL;
/* Each context must have their own instance of VBA and in order to
 * initialize and obtain IP and SOC the base DML instance from DC is
 * initially copied into every context
@@ -1495,6 +1490,17 @@ struct dc_state *dc_create_state(struct dc *dc)
 #ifdef CONFIG_DRM_AMD_DC_DCN
memcpy(&context->bw_ctx.dml, &dc->dml, sizeof(struct display_mode_lib));
 #endif
+}
+
+struct dc_state *dc_create_state(struct dc *dc)
+{
+   struct dc_state *context = kzalloc(sizeof(struct dc_state),
+  GFP_KERNEL);
+
+   if (!context)
+   return NULL;
+
+   init_state(dc, context);
 
kref_init(&context->refcount);
 
-- 
2.25.1

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


[PATCH 01/42] drm/amd/display: [FW Promotion] Release 0.0.30

2020-09-10 Thread Aurabindo Pillai
From: Anthony Koo 

Signed-off-by: Anthony Koo 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h 
b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index d7e7f2eda92f..5eb642fe9315 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -36,10 +36,10 @@
 
 /* Firmware versioning. */
 #ifdef DMUB_EXPOSE_VERSION
-#define DMUB_FW_VERSION_GIT_HASH 0x4e5b2f46f
+#define DMUB_FW_VERSION_GIT_HASH 0xb18f2464d
 #define DMUB_FW_VERSION_MAJOR 0
 #define DMUB_FW_VERSION_MINOR 0
-#define DMUB_FW_VERSION_REVISION 29
+#define DMUB_FW_VERSION_REVISION 30
 #define DMUB_FW_VERSION_TEST 0
 #define DMUB_FW_VERSION_VBIOS 0
 #define DMUB_FW_VERSION_HOTFIX 0
-- 
2.25.1

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


[PATCH 13/42] drm/amd/display: Only use offset for first ODM pipe

2020-09-10 Thread Aurabindo Pillai
From: Wesley Chalmers 

[WHY]
Only the first pipe in ODM combine group should have nonzero recout
offset. All other pipes should have recout offset 0;
otherwise there will be gaps in the image.

[HOW]
Set recout.x to 0 if the pipe is not the leftmost ODM pipe.

When computing viewports, calculate the horizontal offset of a pipe's src
based on the current pipe's position in the ODM group, plus whatever offset the
leftmost ODM pipe has; otherwise there will be discontinuity in the image.

Since ODM combine can only combine pipes horizontally, nothing needs to
be done for recout.y.

Signed-off-by: Wesley Chalmers 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/dc/core/dc_resource.c | 29 ---
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index c6b737dd8425..4cea9344d8aa 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -782,7 +782,13 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)
 
calculate_split_count_and_index(pipe_ctx, &split_count, &split_idx);
 
-   data->recout.x = stream->dst.x;
+   /*
+* Only the leftmost ODM pipe should be offset by a nonzero distance
+*/
+   if (!pipe_ctx->prev_odm_pipe)
+   data->recout.x = stream->dst.x;
+   else
+   data->recout.x = 0;
if (stream->src.x < surf_clip.x)
data->recout.x += (surf_clip.x - stream->src.x) * 
stream->dst.width
/ stream->src.width;
@@ -957,7 +963,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx 
*pipe_ctx)
 {
const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
const struct dc_stream_state *stream = pipe_ctx->stream;
-   struct pipe_ctx *odm_pipe = pipe_ctx->prev_odm_pipe;
+   struct pipe_ctx *odm_pipe = pipe_ctx;
struct scaler_data *data = &pipe_ctx->plane_res.scl_data;
struct rect src = pipe_ctx->plane_state->src_rect;
int recout_skip_h, recout_skip_v, surf_size_h, surf_size_v;
@@ -988,21 +994,24 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx 
*pipe_ctx)
swap(src.width, src.height);
}
 
+   /*modified recout_skip_h calculation due to odm having no recout 
offset*/
+   while (odm_pipe->prev_odm_pipe) {
+   odm_idx++;
+   odm_pipe = odm_pipe->prev_odm_pipe;
+   }
+   /*odm_pipe is the leftmost pipe in the ODM group*/
+   recout_skip_h = odm_idx * data->recout.width;
+
/* Recout matching initial vp offset = recout_offset - (stream dst 
offset +
 *  ((surf dst offset - stream src offset) * 1/ 
stream scaling ratio)
 *  - (surf surf_src offset * 1/ full scl ratio))
 */
-   recout_skip_h = data->recout.x - (stream->dst.x + 
(plane_state->dst_rect.x - stream->src.x)
+   recout_skip_h += odm_pipe->plane_res.scl_data.recout.x
+   - (stream->dst.x + (plane_state->dst_rect.x - 
stream->src.x)
* stream->dst.width / stream->src.width 
-
src.x * plane_state->dst_rect.width / 
src.width
* stream->dst.width / 
stream->src.width);
-   /*modified recout_skip_h calculation due to odm having no recout 
offset*/
-   while (odm_pipe) {
-   odm_idx++;
-   odm_pipe = odm_pipe->prev_odm_pipe;
-   }
-   if (odm_idx)
-   recout_skip_h += odm_idx * data->recout.width;
+
 
recout_skip_v = data->recout.y - (stream->dst.y + 
(plane_state->dst_rect.y - stream->src.y)
* stream->dst.height / 
stream->src.height -
-- 
2.25.1

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


[PATCH 05/42] drm/amd/display: Add CP_IRQ clear capability

2020-09-10 Thread Aurabindo Pillai
From: Harmanprit Tatla 

[Why]
Currently we do not clear the CP_IRQ bit upon receiving it.

[How]
Added a function to clear CP_IRQ bit.

Signed-off-by: Harmanprit Tatla 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/modules/hdcp/hdcp.c   |  9 +
 .../gpu/drm/amd/display/modules/hdcp/hdcp.h   |  1 +
 .../drm/amd/display/modules/hdcp/hdcp_ddc.c   | 19 +++
 3 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
index e9fbd94f8635..a82975970e87 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
@@ -470,6 +470,15 @@ enum mod_hdcp_status mod_hdcp_process_event(struct 
mod_hdcp *hdcp,
if (reset_status != MOD_HDCP_STATUS_SUCCESS)
push_error_status(hdcp, reset_status);
}
+
+   /* Clear CP_IRQ status if needed */
+   if (event_ctx.event == MOD_HDCP_EVENT_CPIRQ &&
+   event_ctx.unexpected_event == 0) {
+   status = mod_hdcp_clear_cp_irq_status(hdcp);
+   if (status != MOD_HDCP_STATUS_SUCCESS)
+   push_error_status(hdcp, status);
+   }
+
return status;
 }
 
diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h
index b0cefed2eb02..6c678cfb82e3 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h
@@ -386,6 +386,7 @@ enum mod_hdcp_status mod_hdcp_write_eks(struct mod_hdcp 
*hdcp);
 enum mod_hdcp_status mod_hdcp_write_repeater_auth_ack(struct mod_hdcp *hdcp);
 enum mod_hdcp_status mod_hdcp_write_stream_manage(struct mod_hdcp *hdcp);
 enum mod_hdcp_status mod_hdcp_write_content_type(struct mod_hdcp *hdcp);
+enum mod_hdcp_status mod_hdcp_clear_cp_irq_status(struct mod_hdcp *hdcp);
 
 /* hdcp version helpers */
 static inline uint8_t is_dp_hdcp(struct mod_hdcp *hdcp)
diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
index bb5130f4228d..9dd8c854fd81 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
@@ -645,3 +645,22 @@ enum mod_hdcp_status mod_hdcp_write_content_type(struct 
mod_hdcp *hdcp)
status = MOD_HDCP_STATUS_INVALID_OPERATION;
return status;
 }
+
+enum mod_hdcp_status mod_hdcp_clear_cp_irq_status(struct mod_hdcp *hdcp)
+{
+   uint8_t clear_cp_irq_bit = 2;
+   uint32_t size = 1;
+
+   if (is_dp_hdcp(hdcp)) {
+   if (hdcp->connection.link.dp.rev >= 0x14)
+   return 
hdcp->config.ddc.funcs.write_dpcd(hdcp->config.ddc.handle,
+   DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0, 
&clear_cp_irq_bit, size)
+   ? MOD_HDCP_STATUS_SUCCESS : 
MOD_HDCP_STATUS_DDC_FAILURE;
+   else
+   return 
hdcp->config.ddc.funcs.write_dpcd(hdcp->config.ddc.handle,
+   DP_DEVICE_SERVICE_IRQ_VECTOR, 
&clear_cp_irq_bit, size)
+   ? MOD_HDCP_STATUS_SUCCESS : 
MOD_HDCP_STATUS_DDC_FAILURE;
+   }
+
+   return MOD_HDCP_STATUS_INVALID_OPERATION;
+}
-- 
2.25.1

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


[PATCH 03/42] drm/amd/display: Fixed Intermittent blue screen on OLED panel

2020-09-10 Thread Aurabindo Pillai
From: Naveed Ashfaq 

[why]
Changing to smaller modes on OLED panel caused a blue screen crash
as driver reported dram change during vactive when it shouldn't

[how]
Added an extra condition to prevent incorrect dram change timing

Signed-off-by: Naveed Ashfaq 
Acked-by: Aurabindo Pillai 
---
 .../amd/display/dc/dml/dcn20/display_mode_vba_20v2.c  | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
index 80170f9721ce..860e72a51534 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
@@ -2635,15 +2635,14 @@ static void 
dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
}
 
if (mode_lib->vba.DRAMClockChangeSupportsVActive &&
-   mode_lib->vba.MinActiveDRAMClockChangeMargin > 60) {
+   mode_lib->vba.MinActiveDRAMClockChangeMargin > 60 &&
+   
mode_lib->vba.PrefetchMode[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb]
 == 0) {
mode_lib->vba.DRAMClockChangeWatermark += 25;
 
for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
-   if 
(mode_lib->vba.PrefetchMode[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb]
 == 0) {
-   if (mode_lib->vba.DRAMClockChangeWatermark >
-   
dml_max(mode_lib->vba.StutterEnterPlusExitWatermark, 
mode_lib->vba.UrgentWatermark))
-   mode_lib->vba.MinTTUVBlank[k] += 25;
-   }
+   if (mode_lib->vba.DRAMClockChangeWatermark >
+   dml_max(mode_lib->vba.StutterEnterPlusExitWatermark, 
mode_lib->vba.UrgentWatermark))
+   mode_lib->vba.MinTTUVBlank[k] += 25;
}
 
mode_lib->vba.DRAMClockChangeSupport[0][0] = 
dm_dram_clock_change_vactive;
-- 
2.25.1

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


[PATCH 34/42] drm/amd/display: Calculate DSC number of slices in debugfs when forced

2020-09-10 Thread Aurabindo Pillai
From: Eryk Brol 

[why]
When comparing current DSC timing settings with enforced through
debugfs we have to calculate number of both vertical and horisontal
slices. So instead of doing that every time we should just
use number of slices rather than setting its dimensions.

[how]
In connector's dsc preferred settings structure change slice height
and slice width parameters to number of slices vertical and horisontal.
Also calculate number of slices in debugfs rather in create_stream_for_sink.

Signed-off-by: Eryk Brol 
Signed-off-by: Mikita Lipski 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 --
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  4 ++--
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 14 +++--
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 20 ---
 4 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e70e46764e61..11afdb28eeda 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4735,13 +4735,11 @@ create_stream_for_sink(struct amdgpu_dm_connector 
*aconnector,
if (aconnector->dsc_settings.dsc_force_enable == 
DSC_CLK_FORCE_ENABLE)
stream->timing.flags.DSC = 1;
 
-   if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_slice_width)
-   stream->timing.dsc_cfg.num_slices_h = 
DIV_ROUND_UP(stream->timing.h_addressable,
-   
aconnector->dsc_settings.dsc_slice_width);
+   if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_num_slices_h)
+   stream->timing.dsc_cfg.num_slices_h = 
aconnector->dsc_settings.dsc_num_slices_h;
 
-   if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_slice_height)
-   stream->timing.dsc_cfg.num_slices_v = 
DIV_ROUND_UP(stream->timing.v_addressable,
-   
aconnector->dsc_settings.dsc_slice_height);
+   if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_num_slices_v)
+   stream->timing.dsc_cfg.num_slices_v = 
aconnector->dsc_settings.dsc_num_slices_v;
 
if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_bits_per_pixel)
stream->timing.dsc_cfg.bits_per_pixel = 
aconnector->dsc_settings.dsc_bits_per_pixel;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index c805c61ef84f..87471f4c8cd1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -351,8 +351,8 @@ enum dsc_clock_force_state {
 
 struct dsc_preferred_settings {
enum dsc_clock_force_state dsc_force_enable;
-   uint32_t dsc_slice_width;
-   uint32_t dsc_slice_height;
+   uint32_t dsc_num_slices_v;
+   uint32_t dsc_num_slices_h;
uint32_t dsc_bits_per_pixel;
 };
 
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 240a4fc403df..9be2f291382d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -1447,7 +1447,12 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, 
const char __user *buf,
if (!pipe_ctx || !pipe_ctx->stream)
goto done;
 
-   aconnector->dsc_settings.dsc_slice_width = param[0];
+   if (param[0] > 0)
+   aconnector->dsc_settings.dsc_num_slices_h = DIV_ROUND_UP(
+   pipe_ctx->stream->timing.h_addressable,
+   param[0]);
+   else
+   aconnector->dsc_settings.dsc_num_slices_h = 0;
 
 done:
kfree(wr_buf);
@@ -1596,7 +1601,12 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, 
const char __user *buf,
if (!pipe_ctx || !pipe_ctx->stream)
goto done;
 
-   aconnector->dsc_settings.dsc_slice_height = param[0];
+   if (param[0] > 0)
+   aconnector->dsc_settings.dsc_num_slices_v = DIV_ROUND_UP(
+   pipe_ctx->stream->timing.v_addressable,
+   param[0]);
+   else
+   aconnector->dsc_settings.dsc_num_slices_v = 0;
 
 done:
kfree(wr_buf);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index be6b88e4c570..0b9a4fc642ae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_m

[PATCH 32/42] drm/amd/display: Update idle optimization handling

2020-09-10 Thread Aurabindo Pillai
From: Joshua Aberback 

[How]
 - use dc interface instead of hwss interface in cursor functions, to keep
dc->idle_optimizations_allowed updated
 - add dc interface to check if idle optimizations might apply to a plane

Signed-off-by: Joshua Aberback 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c|  6 ++
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 11 +--
 drivers/gpu/drm/amd/display/dc/dc.h |  3 +++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 1190c58275c3..7ab82d6a5630 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -3039,4 +3039,10 @@ void dc_lock_memory_clock_frequency(struct dc *dc)
if (dc->current_state->res_ctx.pipe_ctx[i].plane_state)
core_link_enable_stream(dc->current_state, 
&dc->current_state->res_ctx.pipe_ctx[i]);
 }
+
+bool dc_is_plane_eligible_for_idle_optimizaitons(struct dc *dc,
+struct dc_plane_state *plane)
+{
+   return false;
+}
 #endif
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index f42a17d765e3..6fef9078f3d1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -298,7 +298,7 @@ bool dc_stream_set_cursor_attributes(
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
/* disable idle optimizations while updating cursor */
if (dc->idle_optimizations_allowed) {
-   dc->hwss.apply_idle_power_optimizations(dc, false);
+   dc_allow_idle_optimizations(dc, false);
reset_idle_optimizations = true;
}
 
@@ -326,7 +326,7 @@ bool dc_stream_set_cursor_attributes(
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
/* re-enable idle optimizations if necessary */
if (reset_idle_optimizations)
-   dc->hwss.apply_idle_power_optimizations(dc, true);
+   dc_allow_idle_optimizations(dc, true);
 
 #endif
return true;
@@ -359,9 +359,8 @@ bool dc_stream_set_cursor_position(
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
 
/* disable idle optimizations if enabling cursor */
-   if (dc->idle_optimizations_allowed &&
-   !stream->cursor_position.enable && position->enable) {
-   dc->hwss.apply_idle_power_optimizations(dc, false);
+   if (dc->idle_optimizations_allowed && !stream->cursor_position.enable 
&& position->enable) {
+   dc_allow_idle_optimizations(dc, false);
reset_idle_optimizations = true;
}
 
@@ -392,7 +391,7 @@ bool dc_stream_set_cursor_position(
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
/* re-enable idle optimizations if necessary */
if (reset_idle_optimizations)
-   dc->hwss.apply_idle_power_optimizations(dc, true);
+   dc_allow_idle_optimizations(dc, true);
 
 #endif
return true;
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 8631d290afee..9d7d5dd9e820 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1250,6 +1250,9 @@ enum dc_status dc_set_clock(struct dc *dc, enum 
dc_clock_type clock_type, uint32
 void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct 
dc_clock_config *clock_cfg);
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
 
+bool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc,
+struct dc_plane_state *plane);
+
 void dc_allow_idle_optimizations(struct dc *dc, bool allow);
 
 /*
-- 
2.25.1

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


[PATCH 15/42] drm/amd/display: Power eDP panel back ON before link training retry

2020-09-10 Thread Aurabindo Pillai
From: Ashley Thomas 

[why]
When link training failures occur for eDP, dp_disable_link_phy
is called which powers OFF eDP panel. After link training retry
delay, the next retry begins by calling dp_enable_link_phy
which does not issue a correspnding eDP panel power ON, leaving
panel powered OFF which leads to display OFF/dark.

[how]
Power ON eDP before next link training retry.

Signed-off-by: Ashley Thomas 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/dc/core/dc_link_dp.c  |  6 ++
 .../drm/amd/display/dc/core/dc_link_hwss.c|  6 ++
 .../display/dc/dce110/dce110_hw_sequencer.c   | 84 ++-
 3 files changed, 74 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index e4b3b71dad03..47fb09f41bfb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -1619,6 +1619,9 @@ bool perform_link_training_with_retries(
 
for (j = 0; j < attempts; ++j) {
 
+   DC_LOG_HW_LINK_TRAINING("%s: Beginning link training attempt %u 
of %d\n",
+   __func__, (unsigned int)j + 1, attempts);
+
dp_enable_link_phy(
link,
signal,
@@ -1647,6 +1650,9 @@ bool perform_link_training_with_retries(
if (j == (attempts - 1))
break;
 
+   DC_LOG_WARNING("%s: Link training attempt %u of %d failed\n",
+   __func__, (unsigned int)j + 1, attempts);
+
dp_disable_link_phy(link, signal);
 
msleep(delay_between_attempts);
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
index dd88eb348dfa..81c026319ccd 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
@@ -104,6 +104,12 @@ void dp_enable_link_phy(
struct clock_source *dp_cs =
link->dc->res_pool->dp_clock_source;
unsigned int i;
+
+   if (link->connector_signal == SIGNAL_TYPE_EDP) {
+   link->dc->hwss.edp_power_control(link, true);
+   link->dc->hwss.edp_wait_for_hpd_ready(link, true);
+   }
+
/* If the current pixel clock source is not DTO(happens after
 * switching from HDMI passive dongle to DP on the same connector),
 * switch the pixel clock source to DTO.
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 0603ddca7bd0..1002ce9979dc 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -810,37 +810,66 @@ void dce110_edp_power_control(
 
if (power_up !=
link->panel_cntl->funcs->is_panel_powered_on(link->panel_cntl)) 
{
+
+   unsigned long long current_ts = dm_get_timestamp(ctx);
+   unsigned long long time_since_edp_poweroff_ms =
+   div64_u64(dm_get_elapse_time_in_ns(
+   ctx,
+   current_ts,
+   
link->link_trace.time_stamp.edp_poweroff), 100);
+   unsigned long long time_since_edp_poweron_ms =
+   div64_u64(dm_get_elapse_time_in_ns(
+   ctx,
+   current_ts,
+   
link->link_trace.time_stamp.edp_poweron), 100);
+   DC_LOG_HW_RESUME_S3(
+   "%s: transition: power_up=%d current_ts=%llu 
edp_poweroff=%llu edp_poweron=%llu time_since_edp_poweroff_ms=%llu 
time_since_edp_poweron_ms=%llu",
+   __func__,
+   power_up,
+   current_ts,
+   link->link_trace.time_stamp.edp_poweroff,
+   link->link_trace.time_stamp.edp_poweron,
+   time_since_edp_poweroff_ms,
+   time_since_edp_poweron_ms);
+
/* Send VBIOS command to prompt eDP panel power */
if (power_up) {
-   unsigned long long current_ts = dm_get_timestamp(ctx);
-   unsigned long long duration_in_ms =
-   div64_u64(dm_get_elapse_time_in_ns(
-   ctx,
-   current_ts,
-   
link->link_trace.time_stamp.edp_poweroff), 100);
-   unsigned long long wait_time_ms = 0;
-
-  

[PATCH 38/42] drm/amd/display: update nv1x stutter latencies

2020-09-10 Thread Aurabindo Pillai
From: Jun Lei 

[why]
Recent characterization shows increased stutter latencies on some SKUs,
leading to underflow.

[how]
Update SOC params to account for this worst case latency.

Signed-off-by: Jun Lei 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
index 55ce2c7df84e..18b9465057ff 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
@@ -409,8 +409,8 @@ static struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc 
= {
},
},
.num_states = 5,
-   .sr_exit_time_us = 8.6,
-   .sr_enter_plus_exit_time_us = 10.9,
+   .sr_exit_time_us = 11.6,
+   .sr_enter_plus_exit_time_us = 13.9,
.urgent_latency_us = 4.0,
.urgent_latency_pixel_data_only_us = 4.0,
.urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
-- 
2.25.1

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


[PATCH 37/42] drm/amd/display: fix compile warning in dml

2020-09-10 Thread Aurabindo Pillai
From: Roman Li 

[Why]
gcc version 5.4.0 fails compilation with:
‘PixelPTEReqHeightPTEs’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]

[How]
Initialized variable explicitly with 0

Signed-off-by: Roman Li 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
index a576eed94d9b..367c82b5ab4c 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
@@ -1294,7 +1294,7 @@ static unsigned int CalculateVMAndRowBytes(
unsigned int MacroTileHeight;
unsigned int ExtraDPDEBytesFrame;
unsigned int PDEAndMetaPTEBytesFrame;
-   unsigned int PixelPTEReqHeightPTEs;
+   unsigned int PixelPTEReqHeightPTEs = 0;
 
if (DCCEnable == true) {
*MetaRequestHeight = 8 * BlockHeight256Bytes;
-- 
2.25.1

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


[PATCH 39/42] drm/amd/display: Further fix of psr eDP p-state warning

2020-09-10 Thread Aurabindo Pillai
From: Fangzhi Zuo 

[Why]
psr doesn't get fully disabled before hitting hubbub1_wm_change_req_wa.

[How]
Pass TRUE to "wait" parameter to get psr fully disabled.

Follow-Up fix to:
dc: PSR eDP p-state warning occurs intermittently after unplug DP

Signed-off-by: Fangzhi Zuo 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 7ab82d6a5630..f01610df8045 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -2986,7 +2986,7 @@ bool dc_set_psr_allow_active(struct dc *dc, bool enable)
if (enable && !link->psr_settings.psr_allow_active)
return dc_link_set_psr_allow_active(link, true, 
false);
else if (!enable && link->psr_settings.psr_allow_active)
-   return dc_link_set_psr_allow_active(link, 
false, false);
+   return dc_link_set_psr_allow_active(link, 
false, true);
}
}
 
-- 
2.25.1

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


[PATCH 00/42] DC Patches Septemper 14, 2020

2020-09-10 Thread Aurabindo Pillai
This DC patchset brings improvements in multiple areas. In summary, we 
highlight:

* DC Version 3.2.102
* DMUB Firmware release 0.0.32
* DSC improvements
* PSR enablement for DCN3
* Various bug fixes and improvements for eDP, OLED panel and others

--

Aidan Gratton (1):
  drm/amd/display: Increase Max EDID Size Constant

Alvin Lee (1):
  drm/amd/display: Compare plane when looking for pipe split being lost

Anthony Koo (3):
  drm/amd/display: [FW Promotion] Release 0.0.30
  drm/amd/display: [FW Promotion] Release 0.0.31
  drm/amd/display: [FW Promotion] Release 0.0.32

Aric Cyr (6):
  drm/amd/display: 3.2.100
  drm/amd/display: Triplebuffering should not be used by default
  drm/amd/display: 3.2.101
  drm/amd/display: Flip pending check timeout due to disabled hubp
  drm/amd/display: Multi display cause system lag on mode change
  drm/amd/display: 3.2.102

Ashley Thomas (1):
  drm/amd/display: Power eDP panel back ON before link training retry

Bhawanpreet Lakha (1):
  drm/amd/display: Don't use DRM_ERROR() for DTM add topology

Dmytro Laktyushkin (2):
  drm/amd/display: make dcn20 stream_gating use a pointer for
dsc_pg_control
  drm/amd/display: update dcn30_optc header with missing declarations

Eric Yang (1):
  drm/amd/display: implement notify stream mask

Eryk Brol (5):
  drm/amd/display: Add DSC force disable to dsc_clock_en debugfs entry
  drm/amd/display: Add trigger connector unplug
  drm/amd/display: Return the number of bytes parsed than allocated
  drm/amd/display: Calculate DSC number of slices in debugfs when forced
  drm/amd/display: Add connector to the state if DSC debugfs is set

Fangzhi Zuo (1):
  drm/amd/display: Further fix of psr eDP p-state warning

George Shen (1):
  drm/amd/display: Rename set_mst_bandwidth to align with DP spec

Harmanprit Tatla (2):
  drm/amd/display: Add CP_IRQ clear capability
  drm/amd/display: Fix CP_IRQ clear bit and logic

JinZe.Xu (1):
  drm/amd/display: Detect plane change when detect pipe change.

Joshua Aberback (2):
  drm/amd/display: Compare mpcc_inst to mpcc_count instead of a constant
  drm/amd/display: Update idle optimization handling

Josip Pavic (1):
  drm/amd/display: remove dc context from transfer function

Jun Lei (2):
  drm/amd/display: update nv1x stutter latencies
  drm/amd/display: get socBB from VBIOS

Lewis Huang (1):
  drm/amd/display: update clock when non-seamless boot stream exist

Martin Leung (1):
  drm/amd/display: adding pathway to retrieve stutter period

Naveed Ashfaq (1):
  drm/amd/display: Fixed Intermittent blue screen on OLED panel

Rodrigo Siqueira (1):
  drm/amd/display: Check clock table return

Roman Li (2):
  drm/amd/display: remove early return from dm_late_init
  drm/amd/display: fix compile warning in dml

Wenjing Liu (2):
  drm/amd/display: add option to override cr training pattern
  drm/amd/display: always use 100us for cr aux rd interval

Wesley Chalmers (1):
  drm/amd/display: Only use offset for first ODM pipe

Zhan Liu (2):
  drm/amd/display: Enabling PSR on DCN30 on driver side
  drm/amd/display: Disable idle optimization when PSR is enabled

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 64 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 +++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 76 +
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 30 +++
 .../drm/amd/display/dc/bios/bios_parser2.c| 71 +++-
 .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |  7 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c  | 57 +
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  4 +-
 .../gpu/drm/amd/display/dc/core/dc_link_dp.c  | 53 +++-
 .../drm/amd/display/dc/core/dc_link_hwss.c|  6 ++
 .../gpu/drm/amd/display/dc/core/dc_resource.c | 29 ---
 .../gpu/drm/amd/display/dc/core/dc_stream.c   | 12 ++-
 .../gpu/drm/amd/display/dc/core/dc_surface.c  |  7 +-
 drivers/gpu/drm/amd/display/dc/dc.h   |  9 +-
 .../gpu/drm/amd/display/dc/dc_bios_types.h|  4 +
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  | 16 
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h  |  2 +
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  |  1 +
 drivers/gpu/drm/amd/display/dc/dc_types.h |  2 +-
 .../amd/display/dc/dce/dce_stream_encoder.c   |  6 +-
 .../display/dc/dce110/dce110_hw_sequencer.c   | 84 ++-
 .../amd/display/dc/dcn10/dcn10_cm_common.c|  4 -
 .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c |  3 +
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 14 ++--
 .../display/dc/dcn10/dcn10_stream_encoder.c   |  6 +-
 .../display/dc/dcn10/dcn10_stream_encoder.h   |  2 +-
 .../gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c |  3 +
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c| 33 +---
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |  6 +-
 .../display/dc/dcn20/dcn20_stream_encoder.c   |  4 +-
 .../drm/amd/display/dc/dcn21/dcn21_resource.c |  2 +
 .../amd/display/dc/dcn30/dcn30_cm_common.c|  4 -
 .../dc/dcn30/dcn30_dio_stream_encoder.c

[PATCH 06/42] drm/amd/display: Compare mpcc_inst to mpcc_count instead of a constant

2020-09-10 Thread Aurabindo Pillai
From: Joshua Aberback 

[Why]
This assert triggers a false negative because there are more than 4 MPCCs
on many asics.

[How]
 - change assert comparisson
 - remove unused variable

Signed-off-by: Joshua Aberback 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
index a5d750ed569e..1390ff1ce7be 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
@@ -220,15 +220,13 @@ static void dcn30_set_writeback(
struct dc_writeback_info *wb_info,
struct dc_state *context)
 {
-   struct dwbc *dwb;
struct mcif_wb *mcif_wb;
struct mcif_buf_params *mcif_buf_params;
 
ASSERT(wb_info->dwb_pipe_inst < MAX_DWB_PIPES);
ASSERT(wb_info->wb_enabled);
ASSERT(wb_info->mpcc_inst >= 0);
-   ASSERT(wb_info->mpcc_inst < 4);
-   dwb = dc->res_pool->dwbc[wb_info->dwb_pipe_inst];
+   ASSERT(wb_info->mpcc_inst < dc->res_pool->mpcc_count);
mcif_wb = dc->res_pool->mcif_wb[wb_info->dwb_pipe_inst];
mcif_buf_params = &wb_info->mcif_buf_params;
 
-- 
2.25.1

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


[PATCH 04/42] drm/amd/display: Detect plane change when detect pipe change.

2020-09-10 Thread Aurabindo Pillai
From: "JinZe.Xu" 

[Why]
If plane has changed, dcn20_detect_pipe_changes doesn't update 
dc_plane_state->update_flags, and the following dcn20_program_pipe can't 
reprogram hubp correctly.

[How]
Add a new flags bit "plane_changed" in pipe_ctx->update_flags.If old plane 
isn’t identical to new plane, this bit will be set and guide 
“dcn20_program_pipe” to programing HUBP correctly.

Signed-off-by: JinZe.Xu 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 12 +++-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h|  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index c8cfd3ba1c15..ee3348711abe 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -1251,6 +1251,11 @@ static void dcn20_detect_pipe_changes(struct pipe_ctx 
*old_pipe, struct pipe_ctx
return;
}
 
+   /* Detect plane change */
+   if (old_pipe->plane_state != new_pipe->plane_state) {
+   new_pipe->update_flags.bits.plane_changed = true;
+   }
+
/* Detect top pipe only changes */
if (!new_pipe->top_pipe && !new_pipe->prev_odm_pipe) {
/* Detect odm changes */
@@ -1392,6 +1397,7 @@ static void dcn20_update_dchubp_dpp(
&pipe_ctx->ttu_regs);
 
if (pipe_ctx->update_flags.bits.enable ||
+   pipe_ctx->update_flags.bits.plane_changed ||
plane_state->update_flags.bits.bpp_change ||
plane_state->update_flags.bits.input_csc_change ||
plane_state->update_flags.bits.color_space_change ||
@@ -1414,6 +1420,7 @@ static void dcn20_update_dchubp_dpp(
}
 
if (pipe_ctx->update_flags.bits.mpcc
+   || pipe_ctx->update_flags.bits.plane_changed
|| plane_state->update_flags.bits.global_alpha_change
|| 
plane_state->update_flags.bits.per_pixel_alpha_change) {
// MPCC inst is equal to pipe index in practice
@@ -1515,6 +1522,7 @@ static void dcn20_update_dchubp_dpp(
}
 
if (pipe_ctx->update_flags.bits.enable ||
+   pipe_ctx->update_flags.bits.plane_changed ||
pipe_ctx->update_flags.bits.opp_changed ||
plane_state->update_flags.bits.pixel_format_change ||
plane_state->update_flags.bits.horizontal_mirror_change 
||
@@ -1539,7 +1547,9 @@ static void dcn20_update_dchubp_dpp(
hubp->power_gated = false;
}
 
-   if (pipe_ctx->update_flags.bits.enable || 
plane_state->update_flags.bits.addr_update)
+   if (pipe_ctx->update_flags.bits.enable ||
+   pipe_ctx->update_flags.bits.plane_changed ||
+   plane_state->update_flags.bits.addr_update)
hws->funcs.update_plane_addr(dc, pipe_ctx);
 
 
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h 
b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 329395ee7461..cc5f053ef5a3 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -300,6 +300,7 @@ union pipe_update_flags {
uint32_t gamut_remap : 1;
uint32_t scaler : 1;
uint32_t viewport : 1;
+   uint32_t plane_changed : 1;
} bits;
uint32_t raw;
 };
-- 
2.25.1

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


[PATCH 21/42] drm/amd/display: Compare plane when looking for pipe split being lost

2020-09-10 Thread Aurabindo Pillai
From: Alvin Lee 

[Why]
There are situations where we go from 2 pipe to 1 pipe in MPO, but this
isn't a pipe split being lost -- it's a plane disappearing in (i.e. video 
overlay
goes away) so we lose one pipe. In these situations we don't want to
disable the pipe in a separate operation from the rest of the pipe
programming sequence. We only want to disable a pipe in a
separate operation when we're actually disabling pipe split.

[How]
Make sure the pipe being lost has the same stream AND plane
as the old top pipe to ensure.

Signed-off-by: Alvin Lee 
Acked-by: Aurabindo Pillai 
---
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index 8ca94f506195..d0f3bf953d02 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2765,7 +2765,7 @@ bool dcn10_disconnect_pipes(
struct dc *dc,
struct dc_state *context)
 {
-   bool found_stream = false;
+   bool found_pipe = false;
int i, j;
struct dce_hwseq *hws = dc->hwseq;
struct dc_state *old_ctx = dc->current_state;
@@ -2805,26 +2805,28 @@ bool dcn10_disconnect_pipes(
old_ctx->res_ctx.pipe_ctx[i].top_pipe) {
 
/* Find the top pipe in the new ctx for 
the bottom pipe that we
-* want to remove by comparing the 
streams. If both pipes are being
-* disabled then do it in the regular 
pipe programming sequence
+* want to remove by comparing the 
streams and planes. If both
+* pipes are being disabled then do it 
in the regular pipe
+* programming sequence
 */
for (j = 0; j < 
dc->res_pool->pipe_count; j++) {
if 
(old_ctx->res_ctx.pipe_ctx[i].top_pipe->stream == 
context->res_ctx.pipe_ctx[j].stream &&
+   
old_ctx->res_ctx.pipe_ctx[i].top_pipe->plane_state == 
context->res_ctx.pipe_ctx[j].plane_state &&

!context->res_ctx.pipe_ctx[j].top_pipe &&

!context->res_ctx.pipe_ctx[j].update_flags.bits.disable) {
-   found_stream = true;
+   found_pipe = true;
break;
}
}
 
// Disconnect if the top pipe lost it's 
pipe split
-   if (found_stream && 
!context->res_ctx.pipe_ctx[j].bottom_pipe) {
+   if (found_pipe && 
!context->res_ctx.pipe_ctx[j].bottom_pipe) {

hws->funcs.plane_atomic_disconnect(dc, &dc->current_state->res_ctx.pipe_ctx[i]);
DC_LOG_DC("Reset mpcc for pipe 
%d\n", dc->current_state->res_ctx.pipe_ctx[i].pipe_idx);
mpcc_disconnected = true;
}
}
-   found_stream = false;
+   found_pipe = false;
}
}
 
-- 
2.25.1

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


[PATCH 36/42] drm/amd/display: remove dc context from transfer function

2020-09-10 Thread Aurabindo Pillai
From: Josip Pavic 

[Why]
The ctx field of dc_transfer_func is not always populated and therefore
isn't reliable.

[How]
Remove dc context from dc_transfer_func

Signed-off-by: Josip Pavic 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c| 1 -
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   | 7 +--
 drivers/gpu/drm/amd/display/dc/dc.h| 2 --
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 4 
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 4 
 5 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 6fef9078f3d1..d48fd87d3b95 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -123,7 +123,6 @@ static bool dc_stream_construct(struct dc_stream_state 
*stream,
return false;
}
stream->out_transfer_func->type = TF_TYPE_BYPASS;
-   stream->out_transfer_func->ctx = stream->ctx;
 
stream->stream_id = stream->ctx->dc_stream_id_count;
stream->ctx->dc_stream_id_count++;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index ea1229a3e2b2..3d7d27435f15 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -48,22 +48,17 @@ static void dc_plane_construct(struct dc_context *ctx, 
struct dc_plane_state *pl
plane_state->in_transfer_func = dc_create_transfer_func();
if (plane_state->in_transfer_func != NULL) {
plane_state->in_transfer_func->type = TF_TYPE_BYPASS;
-   plane_state->in_transfer_func->ctx = ctx;
}
plane_state->in_shaper_func = dc_create_transfer_func();
if (plane_state->in_shaper_func != NULL) {
plane_state->in_shaper_func->type = TF_TYPE_BYPASS;
-   plane_state->in_shaper_func->ctx = ctx;
}
 
plane_state->lut3d_func = dc_create_3dlut_func();
-   if (plane_state->lut3d_func != NULL) {
-   plane_state->lut3d_func->ctx = ctx;
-   }
+
plane_state->blend_tf = dc_create_transfer_func();
if (plane_state->blend_tf != NULL) {
plane_state->blend_tf->type = TF_TYPE_BYPASS;
-   plane_state->blend_tf->ctx = ctx;
}
 
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 9d7d5dd9e820..d9b22d6a985a 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -745,7 +745,6 @@ struct dc_transfer_func {
enum dc_transfer_func_predefined tf;
/* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/
uint32_t sdr_ref_white_level;
-   struct dc_context *ctx;
union {
struct pwl_params pwl;
struct dc_transfer_func_distributed_points tf_pts;
@@ -772,7 +771,6 @@ struct dc_3dlut {
struct tetrahedral_params lut_3d;
struct fixed31_32 hdr_multiplier;
union dc_3dlut_state state;
-   struct dc_context *ctx;
 };
 /*
  * This structure is filled in by dc_surface_get_status and contains
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
index 47a39eb9400b..7a00fe525dfb 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
@@ -325,8 +325,6 @@ bool cm_helper_translate_curve_to_hw_format(
if (output_tf == NULL || lut_params == NULL || output_tf->type == 
TF_TYPE_BYPASS)
return false;
 
-   PERF_TRACE_CTX(output_tf->ctx);
-
corner_points = lut_params->corner_points;
rgb_resulted = lut_params->rgb_resulted;
hw_points = 0;
@@ -524,8 +522,6 @@ bool cm_helper_translate_curve_to_degamma_hw_format(
if (output_tf == NULL || lut_params == NULL || output_tf->type == 
TF_TYPE_BYPASS)
return false;
 
-   PERF_TRACE_CTX(output_tf->ctx);
-
corner_points = lut_params->corner_points;
rgb_resulted = lut_params->rgb_resulted;
hw_points = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
index a139a87a1a81..41a1d0e9b7e2 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
@@ -122,8 +122,6 @@ bool cm3_helper_translate_curve_to_hw_format(
if (output_tf == NULL || lut_params == NULL || output_tf->type == 
TF_TYPE_BYPASS)
return false;
 
-   PERF_TRACE_CTX(output_tf->ctx);
-
corner_points = lut_params->corner_points;
rgb_resulted = lut_params->rgb_resulted;
hw_points = 0;
@@ -314,8 +312,6 @@ bool cm3_helper_tr

[PATCH 28/42] drm/amd/display: adding pathway to retrieve stutter period

2020-09-10 Thread Aurabindo Pillai
From: Martin Leung 

why:
some functions may need be dependent on stutter period in the future

how:
Extract from stutter calculations and place into perf_params structure

Signed-off-by: Martin Leung 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/dc/dcn30/dcn30_resource.c|  3 +++
 .../amd/display/dc/dml/dcn30/display_mode_vba_30.c   | 12 +---
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  |  4 
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
index 88f23f12aeb8..168e6e4efaf4 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
@@ -2210,6 +2210,9 @@ static void dcn30_calculate_wm(
context->bw_ctx.bw.dcn.watermarks.a.frac_urg_bw_flip = 
get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, 
pipe_cnt) * 1000;
context->bw_ctx.bw.dcn.watermarks.a.urgent_latency_ns = 
get_urgent_latency(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;
 
+   context->perf_params.stutter_period_us =
+   context->bw_ctx.dml.vba.StutterPeriod;
+
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
if (!context->res_ctx.pipe_ctx[i].stream)
continue;
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
index 2beb284f89b0..8f8bf83a60a1 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -597,7 +597,8 @@ static void CalculateStutterEfficiency(
double meta_row_bw[],
double dpte_row_bw[],
double *StutterEfficiencyNotIncludingVBlank,
-   double *StutterEfficiency);
+   double *StutterEfficiency,
+   double *StutterPeriodOut);
 
 static void CalculateSwathAndDETConfiguration(
bool ForceSingleDPP,
@@ -3134,7 +3135,8 @@ static void 
DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
v->meta_row_bw,
v->dpte_row_bw,
&v->StutterEfficiencyNotIncludingVBlank,
-   &v->StutterEfficiency);
+   &v->StutterEfficiency,
+   &v->StutterPeriod);
 }
 
 static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
@@ -6151,7 +6153,8 @@ static void CalculateStutterEfficiency(
double meta_row_bw[],
double dpte_row_bw[],
double *StutterEfficiencyNotIncludingVBlank,
-   double *StutterEfficiency)
+   double *StutterEfficiency,
+   double *StutterPeriodOut)
 {
double FullDETBufferingTimeY[DC__NUM_DPP__MAX] = { 0 };
double FrameTimeForMinFullDETBufferingTime = 0;
@@ -6262,6 +6265,9 @@ static void CalculateStutterEfficiency(
}
 
*StutterEfficiency =  (*StutterEfficiencyNotIncludingVBlank / 100.0 * 
(FrameTimeForMinFullDETBufferingTime - SmallestVBlank) + SmallestVBlank) / 
FrameTimeForMinFullDETBufferingTime * 100;
+
+   if (StutterPeriodOut)
+   *StutterPeriodOut = StutterPeriod;
 }
 
 static void CalculateSwathAndDETConfiguration(
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h 
b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index cc5f053ef5a3..3ec1d9dd1670 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -411,6 +411,10 @@ struct dc_state {
struct clk_mgr *clk_mgr;
 
struct kref refcount;
+
+   struct {
+   unsigned int stutter_period_us;
+   } perf_params;
 };
 
 #endif /* _CORE_TYPES_H_ */
-- 
2.25.1

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


[PATCH 26/42] drm/amd/display: Add DSC force disable to dsc_clock_en debugfs entry

2020-09-10 Thread Aurabindo Pillai
From: Eryk Brol 

[why]
For debug purposes we want not to enable DSC on certain connectors
even if algorithm deesires to do so, instead it should enable DSC
on other capable connectors or fail the atomic check.

[how]
Adding the third option to connector's debugfs entry dsc_clock_en.

Accepted inputs:
 0x0 - connector is using default DSC enablement policy
 0x1 - force enable DSC on the connector, if it supports DSC
 0x2 - force disable DSC on the connector, if DSC is supported

Ex. # echo 0x2 > /sys/kernel/debug/dri/0/DP-1/dsc_clock_en

Signed-off-by: Eryk Brol 
Signed-off-by: Mikita Lipski 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  7 ---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 10 --
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 15 ---
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c   | 10 +-
 4 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9fb0dca839a5..e70e46764e61 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4719,9 +4719,10 @@ create_stream_for_sink(struct amdgpu_dm_connector 
*aconnector,
 
dc_link_get_link_cap(aconnector->dc_link));
 
 #if defined(CONFIG_DRM_AMD_DC_DCN)
-   if (dsc_caps.is_dsc_supported) {
+   if (aconnector->dsc_settings.dsc_force_enable != 
DSC_CLK_FORCE_DISABLE && dsc_caps.is_dsc_supported) {
/* Set DSC policy according to dsc_clock_en */
-   
dc_dsc_policy_set_enable_dsc_when_not_needed(aconnector->dsc_settings.dsc_clock_en);
+   dc_dsc_policy_set_enable_dsc_when_not_needed(
+   aconnector->dsc_settings.dsc_force_enable == 
DSC_CLK_FORCE_ENABLE);
 
if 
(dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0],
  &dsc_caps,
@@ -4731,7 +4732,7 @@ create_stream_for_sink(struct amdgpu_dm_connector 
*aconnector,
  &stream->timing.dsc_cfg))
stream->timing.flags.DSC = 1;
/* Overwrite the stream flag if DSC is enabled through 
debugfs */
-   if (aconnector->dsc_settings.dsc_clock_en)
+   if (aconnector->dsc_settings.dsc_force_enable == 
DSC_CLK_FORCE_ENABLE)
stream->timing.flags.DSC = 1;
 
if (stream->timing.flags.DSC && 
aconnector->dsc_settings.dsc_slice_width)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 4da7cd065ba0..c805c61ef84f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -340,11 +340,17 @@ struct amdgpu_display_manager {
 * fake encoders used for DP MST.
 */
struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC];
-bool force_timing_sync;
+   bool force_timing_sync;
+};
+
+enum dsc_clock_force_state {
+   DSC_CLK_FORCE_DEFAULT = 0,
+   DSC_CLK_FORCE_ENABLE,
+   DSC_CLK_FORCE_DISABLE,
 };
 
 struct dsc_preferred_settings {
-   bool dsc_clock_en;
+   enum dsc_clock_force_state dsc_force_enable;
uint32_t dsc_slice_width;
uint32_t dsc_slice_height;
uint32_t dsc_bits_per_pixel;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 94fcb086154c..5cf3ba3ec5da 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -111,7 +111,6 @@ static int parse_write_buffer_into_params(char *wr_buf, 
uint32_t wr_buf_size,
 
if (*param_nums > max_param_num)
*param_nums = max_param_num;
-;
 
wr_buf_ptr = wr_buf; /* reset buf pointer */
wr_buf_count = 0; /* number of char already checked */
@@ -1200,9 +1199,14 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char 
__user *buf,
  *
  * The write function: dp_dsc_clock_en_write
  * enables to force DSC on the connector.
- * User can write to either force enable DSC
+ * User can write to either force enable or force disable DSC
  * on the next modeset or set it to driver default
  *
+ * Accepted inputs:
+ * 0 - default DSC enablement policy
+ * 1 - force enable DSC on the connector
+ * 2 - force disable DSC on the connector (might cause fail in atomic_check)
+ *
  * Writing DSC settings is done with the following command:
  * - To force enable DSC (you need to specify
  * connector like DP-1):
@@ -1262,7 +1266,12 @@ static ssize_t dp_dsc_clock_en_write(struct fi

[PATCH 42/42] drm/amd/display: update clock when non-seamless boot stream exist

2020-09-10 Thread Aurabindo Pillai
From: Lewis Huang 

[Why]
Seamless boot skip porgram clock when set path mode.
It cause driverprogram clock after unblank stream.

[How]
update clock when non-seamless boot stream exist

Signed-off-by: Lewis Huang 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index f01610df8045..83ce55edb3aa 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1286,7 +1286,7 @@ static enum dc_status dc_commit_state_no_check(struct dc 
*dc, struct dc_state *c
dc->optimize_seamless_boot_streams++;
}
 
-   if (dc->optimize_seamless_boot_streams == 0)
+   if (context->stream_count > dc->optimize_seamless_boot_streams)
dc->hwss.prepare_bandwidth(dc, context);
 
disable_dangling_plane(dc, context);
@@ -1368,7 +1368,7 @@ static enum dc_status dc_commit_state_no_check(struct dc 
*dc, struct dc_state *c
 
dc_enable_stereo(dc, context, dc_streams, context->stream_count);
 
-   if (dc->optimize_seamless_boot_streams == 0) {
+   if (context->stream_count > dc->optimize_seamless_boot_streams) {
/* Must wait for no flips to be pending before doing optimize 
bw */
wait_for_no_pipes_pending(dc, context);
/* pplib is notified if disp_num changed */
-- 
2.25.1

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


[PATCH 17/42] drm/amd/display: Flip pending check timeout due to disabled hubp

2020-09-10 Thread Aurabindo Pillai
From: Aric Cyr 

[Why]
When pipe locks are being taken we wait for flip pending to clear first.
In some cases the pipe mapping is changed and the pending we're checking
for will never clear.

[How]
Don't check disabled pipes for flip pending.

Signed-off-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
index cedf359a00f5..db5615a51fea 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
@@ -734,6 +734,9 @@ bool hubp1_is_flip_pending(struct hubp *hubp)
struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
struct dc_plane_address earliest_inuse_address;
 
+   if (hubp && hubp->power_gated)
+   return false;
+
REG_GET(DCSURF_FLIP_CONTROL,
SURFACE_FLIP_PENDING, &flip_pending);
 
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c
index bb920d0e0b89..368818d2dfc6 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c
@@ -908,6 +908,9 @@ bool hubp2_is_flip_pending(struct hubp *hubp)
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
struct dc_plane_address earliest_inuse_address;
 
+   if (hubp && hubp->power_gated)
+   return false;
+
REG_GET(DCSURF_FLIP_CONTROL,
SURFACE_FLIP_PENDING, &flip_pending);
 
-- 
2.25.1

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


[PATCH 40/42] drm/amd/display: get socBB from VBIOS

2020-09-10 Thread Aurabindo Pillai
From: Jun Lei 

[why]
Some SOC BB paramters may vary per SKU, and it does
not make sense for driver to hardcode these values

[how]
Parse the values from VBIOS if available, and use
them if valid

Signed-off-by: Jun Lei 
Acked-by: Aurabindo Pillai 
---
 .../drm/amd/display/dc/bios/bios_parser2.c| 71 ++-
 .../gpu/drm/amd/display/dc/dc_bios_types.h|  4 ++
 .../drm/amd/display/dc/dcn30/dcn30_resource.c | 16 +
 .../amd/display/include/bios_parser_types.h   |  6 ++
 4 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c 
b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 2d5c7daaee23..29d64e7e304f 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -847,6 +847,73 @@ static enum bp_result bios_parser_get_spread_spectrum_info(
return result;
 }
 
+static enum bp_result get_soc_bb_info_v4_4(
+   struct bios_parser *bp,
+   struct bp_soc_bb_info *soc_bb_info)
+{
+   enum bp_result result = BP_RESULT_OK;
+   struct atom_display_controller_info_v4_4 *disp_cntl_tbl = NULL;
+
+   if (!soc_bb_info)
+   return BP_RESULT_BADINPUT;
+
+   if (!DATA_TABLES(dce_info))
+   return BP_RESULT_BADBIOSTABLE;
+
+   if (!DATA_TABLES(smu_info))
+   return BP_RESULT_BADBIOSTABLE;
+
+   disp_cntl_tbl =  GET_IMAGE(struct atom_display_controller_info_v4_4,
+   DATA_TABLES(dce_info));
+   if (!disp_cntl_tbl)
+   return BP_RESULT_BADBIOSTABLE;
+
+   soc_bb_info->dram_clock_change_latency_100ns = 
disp_cntl_tbl->max_mclk_chg_lat;
+   soc_bb_info->dram_sr_enter_exit_latency_100ns = 
disp_cntl_tbl->max_sr_enter_exit_lat;
+   soc_bb_info->dram_sr_exit_latency_100ns = 
disp_cntl_tbl->max_sr_exit_lat;
+
+   return result;
+}
+
+static enum bp_result bios_parser_get_soc_bb_info(
+   struct dc_bios *dcb,
+   struct bp_soc_bb_info *soc_bb_info)
+{
+   struct bios_parser *bp = BP_FROM_DCB(dcb);
+   enum bp_result result = BP_RESULT_UNSUPPORTED;
+   struct atom_common_table_header *header;
+   struct atom_data_revision tbl_revision;
+
+   if (!soc_bb_info) /* check for bad input */
+   return BP_RESULT_BADINPUT;
+
+   if (!DATA_TABLES(dce_info))
+   return BP_RESULT_UNSUPPORTED;
+
+   header = GET_IMAGE(struct atom_common_table_header,
+   DATA_TABLES(dce_info));
+   get_atom_data_table_revision(header, &tbl_revision);
+
+   switch (tbl_revision.major) {
+   case 4:
+   switch (tbl_revision.minor) {
+   case 1:
+   case 2:
+   case 3:
+   break;
+   case 4:
+   result = get_soc_bb_info_v4_4(bp, soc_bb_info);
+   default:
+   break;
+   }
+   break;
+   default:
+   break;
+   }
+
+   return result;
+}
+
 static enum bp_result get_embedded_panel_info_v2_1(
struct bios_parser *bp,
struct embedded_panel_info *info)
@@ -,7 +2289,9 @@ static const struct dc_vbios_funcs vbios_funcs = {
 
.get_atom_dc_golden_table = bios_get_atom_dc_golden_table,
 
-   .enable_lvtma_control = bios_parser_enable_lvtma_control
+   .enable_lvtma_control = bios_parser_enable_lvtma_control,
+
+   .get_soc_bb_info = bios_parser_get_soc_bb_info,
 };
 
 static bool bios_parser2_construct(
diff --git a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h 
b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
index 0811f941f430..e146e3cba8eb 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
@@ -140,6 +140,10 @@ struct dc_vbios_funcs {
enum bp_result (*enable_lvtma_control)(
struct dc_bios *bios,
uint8_t uc_pwr_on);
+
+   enum bp_result (*get_soc_bb_info)(
+   struct dc_bios *dcb,
+   struct bp_soc_bb_info *soc_bb_info);
 };
 
 struct bios_registers {
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
index 168e6e4efaf4..dde87baf1370 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
@@ -1828,6 +1828,22 @@ static bool init_soc_bounding_box(struct dc *dc,
loaded_ip->max_num_dpp = pool->base.pipe_count;
loaded_ip->clamp_min_dcfclk = dc->config.clamp_min_dcfclk;
dcn20_patch_bounding_box(dc, loaded_bb);
+
+   if (!bb && dc->ctx->dc_bios->funcs->get_soc_bb_info) {
+   struct bp_soc_bb_info bb_info = {0};
+
+   if (dc->ctx->dc_bios->funcs->get_soc_bb_info(dc->ctx->dc_bios, 
&bb_info) == BP_RESULT_OK) {
+   

[PATCH 35/42] drm/amd/display: Add connector to the state if DSC debugfs is set

2020-09-10 Thread Aurabindo Pillai
From: Eryk Brol 

[why]
We want to trigger atomic check on connector, which DSC debugfs
properties have changed.

[how]
Add a helper function that iterates through all active connectors
and add them to the state if DSC debugfs parameters have changed.

Signed-off-by: Eryk Brol 
Signed-off-by: Mikita Lipski 
Acked-by: Aurabindo Pillai 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 41 +++
 1 file changed, 41 insertions(+)

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 11afdb28eeda..ba18c7b0cc7d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -842,6 +842,45 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
return 0;
 }
 
+static void amdgpu_check_debugfs_connector_property_change(struct 
amdgpu_device *adev,
+  struct 
drm_atomic_state *state)
+{
+   struct drm_connector *connector;
+   struct drm_crtc *crtc;
+   struct amdgpu_dm_connector *amdgpu_dm_connector;
+   struct drm_connector_state *conn_state;
+   struct dm_crtc_state *acrtc_state;
+   struct drm_crtc_state *crtc_state;
+   struct dc_stream_state *stream;
+   struct drm_device *dev = adev_to_drm(adev);
+
+   list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+
+   amdgpu_dm_connector = to_amdgpu_dm_connector(connector);
+   conn_state = connector->state;
+
+   if (!(conn_state && conn_state->crtc))
+   continue;
+
+   crtc = conn_state->crtc;
+   acrtc_state = to_dm_crtc_state(crtc->state);
+
+   if (!(acrtc_state && acrtc_state->stream))
+   continue;
+
+   stream = acrtc_state->stream;
+
+   if (amdgpu_dm_connector->dsc_settings.dsc_force_enable ||
+   amdgpu_dm_connector->dsc_settings.dsc_num_slices_v ||
+   amdgpu_dm_connector->dsc_settings.dsc_num_slices_h ||
+   amdgpu_dm_connector->dsc_settings.dsc_bits_per_pixel) {
+   conn_state = drm_atomic_get_connector_state(state, 
connector);
+   crtc_state = drm_atomic_get_crtc_state(state, crtc);
+   crtc_state->mode_changed = true;
+   }
+   }
+}
+
 static int amdgpu_dm_init(struct amdgpu_device *adev)
 {
struct dc_init_data init_data;
@@ -8609,6 +8648,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
int ret, i;
bool lock_and_validation_needed = false;
 
+   amdgpu_check_debugfs_connector_property_change(adev, state);
+
ret = drm_atomic_helper_check_modeset(dev, state);
if (ret)
goto fail;
-- 
2.25.1

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


[PATCH 41/42] drm/amd/display: update dcn30_optc header with missing declarations

2020-09-10 Thread Aurabindo Pillai
From: Dmytro Laktyushkin 

Signed-off-by: Dmytro Laktyushkin 
Acked-by: Aurabindo Pillai 
---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c | 5 ++---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.h | 4 
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c
index 224c8d145eba..6d13431ff693 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c
@@ -179,8 +179,7 @@ void optc3_set_dsc_config(struct timing_generator *optc,
 
 }
 
-
-static void optc3_set_odm_bypass(struct timing_generator *optc,
+void optc3_set_odm_bypass(struct timing_generator *optc,
const struct dc_crtc_timing *dc_crtc_timing)
 {
struct optc *optc1 = DCN10TG_FROM_TG(optc);
@@ -277,7 +276,7 @@ static void optc3_set_odm_combine(struct timing_generator 
*optc, int *opp_id, in
  *
  * Options: any time,  start of frame, dp start of frame (range timing)
  */
-void optc3_set_timing_double_buffer(struct timing_generator *optc, bool enable)
+static void optc3_set_timing_double_buffer(struct timing_generator *optc, bool 
enable)
 {
struct optc *optc1 = DCN10TG_FROM_TG(optc);
uint32_t mode = enable ? 2 : 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.h 
b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.h
index 33f13c1e7520..379616831636 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.h
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.h
@@ -339,4 +339,8 @@ void optc3_set_dsc_config(struct timing_generator *optc,
 
 void optc3_set_timing_db_mode(struct timing_generator *optc, bool enable);
 
+void optc3_set_odm_bypass(struct timing_generator *optc,
+   const struct dc_crtc_timing *dc_crtc_timing);
+void optc3_tg_init(struct timing_generator *optc);
+
 #endif /* __DC_OPTC_DCN30_H__ */
-- 
2.25.1

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


Re: [PATCH v2 -next] drm/amdkfd: Fix -Wunused-const-variable warning

2020-09-10 Thread Felix Kuehling
Am 2020-09-10 um 3:50 a.m. schrieb YueHaibing:
> If KFD_SUPPORT_IOMMU_V2 is not set, gcc warns:
>
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:121:37: warning: 
> ‘raven_device_info’ defined but not used [-Wunused-const-variable=]
>  static const struct kfd_device_info raven_device_info = {
>  ^
>
> As Huang Rui suggested, Raven already has the fallback path,
> so it should be out of IOMMU v2 flag.
>
> Suggested-by: Huang Rui 
> Signed-off-by: YueHaibing 

Reviewed-by: Felix Kuehling 

I applied your patch to the amd-staging-drm-next branch.

Thank you,
  Felix

> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 0e71a0543f98..e3fc6ed7b79c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -503,8 +503,8 @@ static const struct kfd_device_info 
> *kfd_supported_devices[][2] = {
>  #ifdef KFD_SUPPORT_IOMMU_V2
>   [CHIP_KAVERI] = {&kaveri_device_info, NULL},
>   [CHIP_CARRIZO] = {&carrizo_device_info, NULL},
> - [CHIP_RAVEN] = {&raven_device_info, NULL},
>  #endif
> + [CHIP_RAVEN] = {&raven_device_info, NULL},
>   [CHIP_HAWAII] = {&hawaii_device_info, NULL},
>   [CHIP_TONGA] = {&tonga_device_info, NULL},
>   [CHIP_FIJI] = {&fiji_device_info, &fiji_vf_device_info},
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH -next] drm/amd/display: Fix possible memleak in dp_trigger_hotplug()

2020-09-10 Thread Harry Wentland

On 2020-09-09 11:26 p.m., YueHaibing wrote:

If parse_write_buffer_into_params() fails, we should free
wr_buf before return.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Signed-off-by: YueHaibing 


Reviewed-by: Harry Wentland 

Harry


---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 83da24aced45..11e16fbe484d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -1089,8 +1089,10 @@ static ssize_t dp_trigger_hotplug(struct file *f, const 
char __user *buf,
if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
(long *)param, buf,
max_param_num,
-   ¶m_nums))
+   ¶m_nums)) {
+   kfree(wr_buf);
return -EINVAL;
+   }
  
  	if (param_nums <= 0) {

DRM_DEBUG_DRIVER("user data not be read\n");


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


Re: [PATCH -next] drm/amd/display: Create trigger_hotplug entry

2020-09-10 Thread Harry Wentland

On 2020-09-09 11:13 p.m., YueHaibing wrote:

Add trigger_hotplug debugfs entry.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Signed-off-by: YueHaibing 


Reviewed-by: Harry Wentland 

Harry


---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 94fcb086154c..83da24aced45 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -2098,6 +2098,7 @@ static const struct {
const struct file_operations *fops;
  } dp_debugfs_entries[] = {
{"link_settings", &dp_link_settings_debugfs_fops},
+   {"trigger_hotplug", &dp_trigger_hotplug_debugfs_fops},
{"phy_settings", &dp_phy_settings_debugfs_fop},
{"test_pattern", &dp_phy_test_pattern_fops},
  #ifdef CONFIG_DRM_AMD_DC_HDCP


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


[PATCH] drm/amdgpu: Include sienna_cichlid in USBC PD FW support.

2020-09-10 Thread Andrey Grodzovsky
Create sysfs interface also for sienna_cichlid.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index a7771aa..600015e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -178,7 +178,7 @@ static int psp_sw_init(void *handle)
return ret;
}
 
-   if (adev->asic_type == CHIP_NAVI10) {
+   if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == 
CHIP_SIENNA_CICHLID) {
ret= psp_sysfs_init(adev);
if (ret) {
return ret;
-- 
2.7.4

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


RE: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs

2020-09-10 Thread Deucher, Alexander
[AMD Public Use]



> -Original Message-
> From: amd-gfx  On Behalf Of
> Daniel Vetter
> Sent: Monday, September 7, 2020 3:15 AM
> To: Jan Kiszka ; amd-gfx list  g...@lists.freedesktop.org>; Wentland, Harry ;
> Kazlauskas, Nicholas 
> Cc: dri-devel ; intel-gfx  g...@lists.freedesktop.org>; Thomas Zimmermann
> ; Ville Syrjala 
> Subject: Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
> 
> On Sun, Sep 6, 2020 at 1:19 PM Jan Kiszka  wrote:
> >
> > On 11.02.20 18:04, Daniel Vetter wrote:
> > > On Tue, Feb 11, 2020 at 06:22:07PM +0200, Ville Syrjala wrote:
> > >> From: Ville Syrjälä 
> > >>
> > >> WARN if the encoder possible_crtcs is effectively empty or contains
> > >> bits for non-existing crtcs.
> > >>
> > >> v2: Move to drm_mode_config_validate() (Daniel)
> > >> Make the docs say we WARN when this is wrong (Daniel)
> > >> Extract full_crtc_mask()
> > >>
> > >> Cc: Thomas Zimmermann 
> > >> Cc: Daniel Vetter 
> > >> Signed-off-by: Ville Syrjälä 
> > >
> > > When pushing the fixup needs to be applied before the validation
> > > patch here, because we don't want to anger the bisect gods.
> > >
> > > Reviewed-by: Daniel Vetter 
> > >
> > > I think with the fixup we should be good enough with the existing
> > > nonsense in drivers. Fingers crossed.
> > > -Daniel
> > >
> > >
> > >> ---
> > >>  drivers/gpu/drm/drm_mode_config.c | 27
> ++-
> > >>  include/drm/drm_encoder.h |  2 +-
> > >>  2 files changed, 27 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/drm_mode_config.c
> > >> b/drivers/gpu/drm/drm_mode_config.c
> > >> index afc91447293a..4c1b350ddb95 100644
> > >> --- a/drivers/gpu/drm/drm_mode_config.c
> > >> +++ b/drivers/gpu/drm/drm_mode_config.c
> > >> @@ -581,6 +581,29 @@ static void
> validate_encoder_possible_clones(struct drm_encoder *encoder)
> > >>   encoder->possible_clones, encoder_mask);  }
> > >>
> > >> +static u32 full_crtc_mask(struct drm_device *dev) {
> > >> +struct drm_crtc *crtc;
> > >> +u32 crtc_mask = 0;
> > >> +
> > >> +drm_for_each_crtc(crtc, dev)
> > >> +crtc_mask |= drm_crtc_mask(crtc);
> > >> +
> > >> +return crtc_mask;
> > >> +}
> > >> +
> > >> +static void validate_encoder_possible_crtcs(struct drm_encoder
> > >> +*encoder) {
> > >> +u32 crtc_mask = full_crtc_mask(encoder->dev);
> > >> +
> > >> +WARN((encoder->possible_crtcs & crtc_mask) == 0 ||
> > >> + (encoder->possible_crtcs & ~crtc_mask) != 0,
> > >> + "Bogus possible_crtcs: "
> > >> + "[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n",
> > >> + encoder->base.id, encoder->name,
> > >> + encoder->possible_crtcs, crtc_mask); }
> > >> +
> > >>  void drm_mode_config_validate(struct drm_device *dev)  {
> > >>  struct drm_encoder *encoder;
> > >> @@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
> drm_device *dev)
> > >>  drm_for_each_encoder(encoder, dev)
> > >>  fixup_encoder_possible_clones(encoder);
> > >>
> > >> -drm_for_each_encoder(encoder, dev)
> > >> +drm_for_each_encoder(encoder, dev) {
> > >>  validate_encoder_possible_clones(encoder);
> > >> +validate_encoder_possible_crtcs(encoder);
> > >> +}
> > >>  }
> > >> diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
> > >> index 3741963b9587..b236269f41ac 100644
> > >> --- a/include/drm/drm_encoder.h
> > >> +++ b/include/drm/drm_encoder.h
> > >> @@ -142,7 +142,7 @@ struct drm_encoder {
> > >>   * the bits for all &drm_crtc objects this encoder can be connected 
> > >> to
> > >>   * before calling drm_dev_register().
> > >>   *
> > >> - * In reality almost every driver gets this wrong.
> > >> + * You will get a WARN if you get this wrong in the driver.
> > >>   *
> > >>   * Note that since CRTC objects can't be hotplugged the assigned
> indices
> > >>   * are stable and hence known before registering all objects.
> > >> --
> > >> 2.24.1
> > >>
> > >
> >
> > Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
> 
> Adding amdgpu display folks.

I took a quick look at this and it looks like we limit the number of crtcs 
later in the mode init process if the number of physical displays can't 
actually use more crtcs.  E.g., the physical board configuration would only 
allow for 3 active displays even if the hardware technically supports 4 crtcs.  
I presume that way we can just leave the additional hardware power gated all 
the time.

Alex


> -Daniel
> 
> >
> > [   14.033246] [ cut here ]
> > [   14.033248] Bogus possible_crtcs: [ENCODER:65:TMDS-65]
> possible_crtcs=0xf (full crtc mask=0x7)
> > [   14.033279] WARNING: CPU: 0 PID: 282 at
> ../drivers/gpu/drm/drm_mode_config.c:622
> drm_mode_config_validate+0x17d/0x200 [drm]
> > [   14.033279] Modules linked in: amdgpu(E+) mfd_core(E)
> snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E)
> snd_hda_co

[PATCH 1/3] drm/amdkfd: Add some eveiction debugging code

2020-09-10 Thread Philip Cox
Extending the module parameter debug_evictions to also print a stack
trace when the eviction code path is called.

Signed-off-by: Philip Cox 
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 +
 drivers/gpu/drm/amd/amdkfd/kfd_process.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 20ef048d6a03..cafbc3aa980a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1966,6 +1966,7 @@ int kfd_process_vm_fault(struct device_queue_manager *dqm,
 
if (!p)
return -EINVAL;
+   WARN(debug_evictions, "Evicting pid %d", p->lead_thread->pid);
pdd = kfd_get_process_device_data(dqm->dev, p);
if (pdd)
ret = dqm->ops.evict_process_queues(dqm, &pdd->qpd);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index a0e12a79ab7d..1e15aa7d8ae8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -1488,6 +1488,7 @@ void kfd_suspend_all_processes(void)
unsigned int temp;
int idx = srcu_read_lock(&kfd_processes_srcu);
 
+   WARN(debug_evictions, "Evicting all processes");
hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
cancel_delayed_work_sync(&p->eviction_work);
cancel_delayed_work_sync(&p->restore_work);
-- 
2.17.1

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


[PATCH 3/3] drm/amdkfd: Reduce eviction/restore message levels

2020-09-10 Thread Philip Cox
Reduce the eviction and restore messages from INFO level to DEBUG level.

Signed-off-by: Philip Cox 
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index cafbc3aa980a..0d2bb20b49b7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -650,7 +650,7 @@ static int evict_process_queues_nocpsch(struct 
device_queue_manager *dqm,
goto out;
 
pdd = qpd_to_pdd(qpd);
-   pr_info_ratelimited("Evicting PASID 0x%x queues\n",
+   pr_debug_ratelimited("Evicting PASID 0x%x queues\n",
pdd->process->pasid);
 
/* Mark all queues as evicted. Deactivate all active queues on
@@ -700,7 +700,7 @@ static int evict_process_queues_cpsch(struct 
device_queue_manager *dqm,
goto out;
 
pdd = qpd_to_pdd(qpd);
-   pr_info_ratelimited("Evicting PASID 0x%x queues\n",
+   pr_debug_ratelimited("Evicting PASID 0x%x queues\n",
pdd->process->pasid);
 
/* Mark all queues as evicted. Deactivate all active queues on
@@ -746,7 +746,7 @@ static int restore_process_queues_nocpsch(struct 
device_queue_manager *dqm,
goto out;
}
 
-   pr_info_ratelimited("Restoring PASID 0x%x queues\n",
+   pr_debug_ratelimited("Restoring PASID 0x%x queues\n",
pdd->process->pasid);
 
/* Update PD Base in QPD */
@@ -826,7 +826,7 @@ static int restore_process_queues_cpsch(struct 
device_queue_manager *dqm,
goto out;
}
 
-   pr_info_ratelimited("Restoring PASID 0x%x queues\n",
+   pr_debug_ratelimited("Restoring PASID 0x%x queues\n",
pdd->process->pasid);
 
/* Update PD Base in QPD */
-- 
2.17.1

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


[PATCH 2/3] drm/amdkfd: Add process eviction counters to sysfs

2020-09-10 Thread Philip Cox
Add per-process eviction counters to sysfs to keep track of
how many eviction events have happened for each process.

Signed-off-by: Philip Cox 
---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h|  15 ++-
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 117 +++
 2 files changed, 130 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 023629f28495..f6902e9c6077 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -631,7 +631,7 @@ enum kfd_pdd_bound {
PDD_BOUND_SUSPENDED,
 };
 
-#define MAX_SYSFS_FILENAME_LEN 11
+#define MAX_SYSFS_FILENAME_LEN 15
 
 /*
  * SDMA counter runs at 100MHz frequency.
@@ -692,10 +692,19 @@ struct kfd_process_device {
uint64_t sdma_past_activity_counter;
struct attribute attr_sdma;
char sdma_filename[MAX_SYSFS_FILENAME_LEN];
+
+   /* Eviction activity tracking */
+   atomic64_t evict_duration_counter;
+   struct attribute attr_evict;
+   char evict_filename[MAX_SYSFS_FILENAME_LEN];
 };
 
 #define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)
 
+struct kobj_counters_list {
+   struct list_head counters_list;
+   struct kobject *kobj;
+};
 /* Process data */
 struct kfd_process {
/*
@@ -766,13 +775,15 @@ struct kfd_process {
/* seqno of the last scheduled eviction */
unsigned int last_eviction_seqno;
/* Approx. the last timestamp (in jiffies) when the process was
-* restored after an eviction
+* restored or evicted.
 */
unsigned long last_restore_timestamp;
+   unsigned long last_evict_timestamp;
 
/* Kobj for our procfs */
struct kobject *kobj;
struct kobject *kobj_queues;
+   struct kobj_counters_list counters;
struct attribute attr_pasid;
 };
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 1e15aa7d8ae8..2a81d5a790a0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -344,6 +344,26 @@ static ssize_t kfd_procfs_queue_show(struct kobject *kobj,
 
return 0;
 }
+static ssize_t kfd_procfs_counters_show(struct kobject *kobj,
+struct attribute *attr, char *buffer)
+{
+   if (strcmp(attr->name, "evictions") == 0) {
+   struct kfd_process_device *pdd = container_of(attr,
+   struct kfd_process_device,
+   attr_evict);
+   uint64_t evict_jiffies;
+
+   evict_jiffies = atomic64_read(&pdd->evict_duration_counter);
+
+   return snprintf(buffer,
+   PAGE_SIZE,
+   "%llu\n",
+   jiffies64_to_msecs(evict_jiffies));
+   } else
+   pr_err("Invalid attribute");
+
+   return 0;
+}
 
 static struct attribute attr_queue_size = {
.name = "size",
@@ -376,6 +396,19 @@ static struct kobj_type procfs_queue_type = {
.default_attrs = procfs_queue_attrs,
 };
 
+static const struct sysfs_ops procfs_counters_ops = {
+   .show = kfd_procfs_counters_show,
+};
+
+static struct attribute *procfs_counters_attrs[] = {
+   NULL
+};
+
+static struct kobj_type procfs_counters_type = {
+   .sysfs_ops = &procfs_counters_ops,
+   .default_attrs = procfs_counters_attrs,
+};
+
 int kfd_procfs_add_queue(struct queue *q)
 {
struct kfd_process *proc;
@@ -417,6 +450,70 @@ static int kfd_sysfs_create_file(struct kfd_process *p, 
struct attribute *attr,
return ret;
 }
 
+static int kfd_procfs_add_sysfs_counters(struct kfd_process *p)
+{
+   int ret = 0;
+   struct kfd_process_device *pdd;
+   char counter_dir_filename[MAX_SYSFS_FILENAME_LEN];
+
+   if (!p)
+   return -EINVAL;
+
+   if (!p->kobj)
+   return -EFAULT;
+
+   INIT_LIST_HEAD(&p->counters.counters_list);
+   /*
+* Create sysfs files for each GPU:
+* - proc//counters_/
+* - proc//counters_/evictions
+*/
+   list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
+   struct kobj_counters_list *kobj_counter;
+
+   kobj_counter = kzalloc(sizeof(*kobj_counter),
+   GFP_KERNEL);
+   if (!kobj_counter)
+   return -ENOMEM;
+
+   snprintf(counter_dir_filename, MAX_SYSFS_FILENAME_LEN,
+   "counters_%u", pdd->dev->id);
+   kobj_counter->kobj = kfd_alloc_struct(kobj_counter->kobj);
+   if (!kobj_counter->kobj) {
+   kfree(kobj_counter);
+   return -ENOMEM;
+   }
+
+   ret = kobject_init_and_add(kobj_counter->kobj,
+   &procfs_cou

[PATCH 1/1] drm/amdkfd: Use a new capability bit for SRAM ECC

2020-09-10 Thread Felix Kuehling
Existing, buggy user mode breaks when SRAM ECC is correctly reported as
"enabled". To avoid breaking existing user mode, deprecate that bit and
leave it as 0. Define a new bit to report the actual SRAM ECC mode that
new, correct user mode can use in the future.

Fixes: 7ec177bdcfc1 ("drm/amdkfd: fix set kfd node ras properties value")
Signed-off-by: Felix Kuehling 
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index 326d9b26b7aa..690cc561955c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -47,13 +47,14 @@
 #define HSA_CAP_DOORBELL_TYPE_2_0  0x2
 #define HSA_CAP_AQL_QUEUE_DOUBLE_MAP   0x4000
 
-#define HSA_CAP_SRAM_EDCSUPPORTED  0x0008
+#define HSA_CAP_RESERVED_WAS_SRAM_EDCSUPPORTED 0x0008 /* Old buggy user 
mode depends on this being O */
 #define HSA_CAP_MEM_EDCSUPPORTED   0x0010
 #define HSA_CAP_RASEVENTNOTIFY 0x0020
 #define HSA_CAP_ASIC_REVISION_MASK 0x03c0
 #define HSA_CAP_ASIC_REVISION_SHIFT22
+#define HSA_CAP_SRAM_EDCSUPPORTED  0x0400
 
-#define HSA_CAP_RESERVED   0xfc078000
+#define HSA_CAP_RESERVED   0xf80f8000
 
 struct kfd_node_properties {
uint64_t hive_id;
-- 
2.17.1

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


Re: [PATCH 1/3] drm/amdkfd: Add some eveiction debugging code

2020-09-10 Thread Felix Kuehling


Am 2020-09-10 um 2:54 p.m. schrieb Philip Cox:
> Extending the module parameter debug_evictions to also print a stack
> trace when the eviction code path is called.
>
> Signed-off-by: Philip Cox 

This patch is

Reviewed-by: Felix Kuehling 


> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 +
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c  | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 20ef048d6a03..cafbc3aa980a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -1966,6 +1966,7 @@ int kfd_process_vm_fault(struct device_queue_manager 
> *dqm,
>  
>   if (!p)
>   return -EINVAL;
> + WARN(debug_evictions, "Evicting pid %d", p->lead_thread->pid);
>   pdd = kfd_get_process_device_data(dqm->dev, p);
>   if (pdd)
>   ret = dqm->ops.evict_process_queues(dqm, &pdd->qpd);
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index a0e12a79ab7d..1e15aa7d8ae8 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -1488,6 +1488,7 @@ void kfd_suspend_all_processes(void)
>   unsigned int temp;
>   int idx = srcu_read_lock(&kfd_processes_srcu);
>  
> + WARN(debug_evictions, "Evicting all processes");
>   hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
>   cancel_delayed_work_sync(&p->eviction_work);
>   cancel_delayed_work_sync(&p->restore_work);
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 3/3] drm/amdkfd: Reduce eviction/restore message levels

2020-09-10 Thread Felix Kuehling
Am 2020-09-10 um 2:54 p.m. schrieb Philip Cox:
> Reduce the eviction and restore messages from INFO level to DEBUG level.
>
> Signed-off-by: Philip Cox 

This patch is

Reviewed-by: Felix Kuehling 


> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index cafbc3aa980a..0d2bb20b49b7 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -650,7 +650,7 @@ static int evict_process_queues_nocpsch(struct 
> device_queue_manager *dqm,
>   goto out;
>  
>   pdd = qpd_to_pdd(qpd);
> - pr_info_ratelimited("Evicting PASID 0x%x queues\n",
> + pr_debug_ratelimited("Evicting PASID 0x%x queues\n",
>   pdd->process->pasid);
>  
>   /* Mark all queues as evicted. Deactivate all active queues on
> @@ -700,7 +700,7 @@ static int evict_process_queues_cpsch(struct 
> device_queue_manager *dqm,
>   goto out;
>  
>   pdd = qpd_to_pdd(qpd);
> - pr_info_ratelimited("Evicting PASID 0x%x queues\n",
> + pr_debug_ratelimited("Evicting PASID 0x%x queues\n",
>   pdd->process->pasid);
>  
>   /* Mark all queues as evicted. Deactivate all active queues on
> @@ -746,7 +746,7 @@ static int restore_process_queues_nocpsch(struct 
> device_queue_manager *dqm,
>   goto out;
>   }
>  
> - pr_info_ratelimited("Restoring PASID 0x%x queues\n",
> + pr_debug_ratelimited("Restoring PASID 0x%x queues\n",
>   pdd->process->pasid);
>  
>   /* Update PD Base in QPD */
> @@ -826,7 +826,7 @@ static int restore_process_queues_cpsch(struct 
> device_queue_manager *dqm,
>   goto out;
>   }
>  
> - pr_info_ratelimited("Restoring PASID 0x%x queues\n",
> + pr_debug_ratelimited("Restoring PASID 0x%x queues\n",
>   pdd->process->pasid);
>  
>   /* Update PD Base in QPD */
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/3] drm/amdkfd: Add process eviction counters to sysfs

2020-09-10 Thread Felix Kuehling

Am 2020-09-10 um 2:54 p.m. schrieb Philip Cox:
> Add per-process eviction counters to sysfs to keep track of
> how many eviction events have happened for each process.
>
> Signed-off-by: Philip Cox 
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h|  15 ++-
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c | 117 +++
>  2 files changed, 130 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h 
> b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index 023629f28495..f6902e9c6077 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -631,7 +631,7 @@ enum kfd_pdd_bound {
>   PDD_BOUND_SUSPENDED,
>  };
>  
> -#define MAX_SYSFS_FILENAME_LEN 11
> +#define MAX_SYSFS_FILENAME_LEN 15
>  
>  /*
>   * SDMA counter runs at 100MHz frequency.
> @@ -692,10 +692,19 @@ struct kfd_process_device {
>   uint64_t sdma_past_activity_counter;
>   struct attribute attr_sdma;
>   char sdma_filename[MAX_SYSFS_FILENAME_LEN];
> +
> + /* Eviction activity tracking */
> + atomic64_t evict_duration_counter;
> + struct attribute attr_evict;
> + char evict_filename[MAX_SYSFS_FILENAME_LEN];

I don't think this name needs to be in a per-pdd variable, because it's
the same for all pdds. see below.


>  };
>  
>  #define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)
>  
> +struct kobj_counters_list {
> + struct list_head counters_list;
> + struct kobject *kobj;
> +};
>  /* Process data */
>  struct kfd_process {
>   /*
> @@ -766,13 +775,15 @@ struct kfd_process {
>   /* seqno of the last scheduled eviction */
>   unsigned int last_eviction_seqno;
>   /* Approx. the last timestamp (in jiffies) when the process was
> -  * restored after an eviction
> +  * restored or evicted.
>*/
>   unsigned long last_restore_timestamp;
> + unsigned long last_evict_timestamp;
>  
>   /* Kobj for our procfs */
>   struct kobject *kobj;
>   struct kobject *kobj_queues;
> + struct kobj_counters_list counters;
>   struct attribute attr_pasid;
>  };
>  
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 1e15aa7d8ae8..2a81d5a790a0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -344,6 +344,26 @@ static ssize_t kfd_procfs_queue_show(struct kobject 
> *kobj,
>  
>   return 0;
>  }
> +static ssize_t kfd_procfs_counters_show(struct kobject *kobj,
> +  struct attribute *attr, char *buffer)
> +{
> + if (strcmp(attr->name, "evictions") == 0) {
> + struct kfd_process_device *pdd = container_of(attr,
> + struct kfd_process_device,
> + attr_evict);
> + uint64_t evict_jiffies;
> +
> + evict_jiffies = atomic64_read(&pdd->evict_duration_counter);
> +
> + return snprintf(buffer,
> + PAGE_SIZE,
> + "%llu\n",
> + jiffies64_to_msecs(evict_jiffies));
> + } else
> + pr_err("Invalid attribute");
> +
> + return 0;
> +}
>  
>  static struct attribute attr_queue_size = {
>   .name = "size",
> @@ -376,6 +396,19 @@ static struct kobj_type procfs_queue_type = {
>   .default_attrs = procfs_queue_attrs,
>  };
>  
> +static const struct sysfs_ops procfs_counters_ops = {
> + .show = kfd_procfs_counters_show,
> +};
> +
> +static struct attribute *procfs_counters_attrs[] = {
> + NULL
> +};
> +
> +static struct kobj_type procfs_counters_type = {
> + .sysfs_ops = &procfs_counters_ops,
> + .default_attrs = procfs_counters_attrs,
> +};
> +
>  int kfd_procfs_add_queue(struct queue *q)
>  {
>   struct kfd_process *proc;
> @@ -417,6 +450,70 @@ static int kfd_sysfs_create_file(struct kfd_process *p, 
> struct attribute *attr,
>   return ret;
>  }
>  
> +static int kfd_procfs_add_sysfs_counters(struct kfd_process *p)
> +{
> + int ret = 0;
> + struct kfd_process_device *pdd;
> + char counter_dir_filename[MAX_SYSFS_FILENAME_LEN];
> +
> + if (!p)
> + return -EINVAL;
> +
> + if (!p->kobj)
> + return -EFAULT;
> +
> + INIT_LIST_HEAD(&p->counters.counters_list);
> + /*
> +  * Create sysfs files for each GPU:
> +  * - proc//counters_/
> +  * - proc//counters_/evictions
> +  */
> + list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
> + struct kobj_counters_list *kobj_counter;
> +
> + kobj_counter = kzalloc(sizeof(*kobj_counter),
> + GFP_KERNEL);
> + if (!kobj_counter)
> + return -ENOMEM;
> +
> + snprintf(counter_dir_filename, MAX_SYSFS_FILENAME_LEN,
> + "counters_%u", pdd->dev->id);

As discussed on another email th

[PATCH] drm/amdgpu: Update RAS init handling

2020-09-10 Thread Clements, John
[AMD Official Use Only - Internal Distribution Only]

Added RAS status check and tear down RAS context if RAS init fails


0001-drm-amdgpu-Update-RAS-init-handling.patch
Description: 0001-drm-amdgpu-Update-RAS-init-handling.patch
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH] drm/amdgpu: Update RAS init handling

2020-09-10 Thread Zhang, Hawking
[AMD Public Use]

+ {
+ dev_warn(psp->adev->dev, "RAS 
Init Status: 0x%X\n", ras_cmd->ras_status);
+ }
Please remove the redundant bracket.

Other than that, the patch is
Reviewed-by: Hawking Zhang 

In addition, please create another patch to move the nbio ras controller irq 
source registry to sw_init, which is the consistent as what we did for other ip 
blocks, register the irq source in IP sw_init funcs.

Regards,
Hawking
From: Clements, John 
Sent: Friday, September 11, 2020 12:03
To: amd-gfx list ; Chen, Guchun 
; Zhang, Hawking 
Subject: [PATCH] drm/amdgpu: Update RAS init handling


[AMD Official Use Only - Internal Distribution Only]

Added RAS status check and tear down RAS context if RAS init fails
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx