Re: [PATCH 35/40] drm/amd/amdgpu/amdgpu_cs: Repair some function naming disparity

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 11:54 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:685: warning: expecting prototype 
> > for cs_parser_fini(). Prototype was for amdgpu_cs_parser_fini() instead
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1502: warning: expecting prototype 
> > for amdgpu_cs_wait_all_fence(). Prototype was for 
> > amdgpu_cs_wait_all_fences() instead
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1656: warning: expecting prototype 
> > for amdgpu_cs_find_bo_va(). Prototype was for amdgpu_cs_find_mapping() 
> > instead
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: Jerome Glisse 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > index b5c7669980458..90136f9dedd65 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > @@ -672,7 +672,7 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser 
> > *p)
> >   }
> >
> >   /**
> > - * cs_parser_fini() - clean parser states
> > + * amdgpu_cs_parser_fini() - clean parser states
> >* @parser: parser structure holding parsing context.
> >* @error:  error number
> >* @backoff:indicator to backoff the reservation
> > @@ -1488,7 +1488,7 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device 
> > *dev, void *data,
> >   }
> >
> >   /**
> > - * amdgpu_cs_wait_all_fence - wait on all fences to signal
> > + * amdgpu_cs_wait_all_fences - wait on all fences to signal
> >*
> >* @adev: amdgpu device
> >* @filp: file private
> > @@ -1639,7 +1639,7 @@ int amdgpu_cs_wait_fences_ioctl(struct drm_device 
> > *dev, void *data,
> >   }
> >
> >   /**
> > - * amdgpu_cs_find_bo_va - find bo_va for VM address
> > + * amdgpu_cs_find_mapping - find bo_va for VM address
> >*
> >* @parser: command submission parser context
> >* @addr: VM address
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 33/40] drm/amd/amdgpu/amdgpu_ring: Provide description for 'sched_score'

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 11:54 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:169: warning: Function parameter 
> > or member 'sched_score' not described in 'amdgpu_ring_init'
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> > index 688624ebe4211..7b634a1517f9c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> > @@ -158,6 +158,7 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
> >* @irq_src: interrupt source to use for this ring
> >* @irq_type: interrupt type to use for this ring
> >* @hw_prio: ring priority (NORMAL/HIGH)
> > + * @sched_score: optional score atomic shared with other schedulers
> >*
> >* Initialize the driver information for the selected ring (all asics).
> >* Returns 0 on success, error on failure.
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 32/40] drm/amd/amdgpu/amdgpu_ttm: Fix incorrectly documented function 'amdgpu_ttm_copy_mem_to_mem()'

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 11:53 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:311: warning: expecting prototype 
> > for amdgpu_copy_ttm_mem_to_mem(). Prototype was for 
> > amdgpu_ttm_copy_mem_to_mem() instead
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: Jerome Glisse 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > index 3bef0432cac2f..859314c0d6a39 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > @@ -288,7 +288,7 @@ static int amdgpu_ttm_map_buffer(struct 
> > ttm_buffer_object *bo,
> >   }
> >
> >   /**
> > - * amdgpu_copy_ttm_mem_to_mem - Helper function for copy
> > + * amdgpu_ttm_copy_mem_to_mem - Helper function for copy
> >* @adev: amdgpu device
> >* @src: buffer/address where to read from
> >* @dst: buffer/address where to write to
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 31/40] drm/amd/amdgpu/amdgpu_gart: Correct a couple of function names in the docs

2021-04-20 Thread Alex Deucher
Applied.  thanks!

Alex

On Fri, Apr 16, 2021 at 11:53 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c:73: warning: expecting prototype 
> > for amdgpu_dummy_page_init(). Prototype was for 
> > amdgpu_gart_dummy_page_init() instead
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c:96: warning: expecting prototype 
> > for amdgpu_dummy_page_fini(). Prototype was for 
> > amdgpu_gart_dummy_page_fini() instead
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Nirmoy Das 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> > index c5a9a4fb10d2b..5562b5c90c032 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> > @@ -60,7 +60,7 @@
> >*/
> >
> >   /**
> > - * amdgpu_dummy_page_init - init dummy page used by the driver
> > + * amdgpu_gart_dummy_page_init - init dummy page used by the driver
> >*
> >* @adev: amdgpu_device pointer
> >*
> > @@ -86,7 +86,7 @@ static int amdgpu_gart_dummy_page_init(struct 
> > amdgpu_device *adev)
> >   }
> >
> >   /**
> > - * amdgpu_dummy_page_fini - free dummy page used by the driver
> > + * amdgpu_gart_dummy_page_fini - free dummy page used by the driver
> >*
> >* @adev: amdgpu_device pointer
> >*
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 29/40] drm/amd/amdgpu/amdgpu_fence: Provide description for 'sched_score'

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 11:52 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:444: warning: Function 
> > parameter or member 'sched_score' not described in 
> > 'amdgpu_fence_driver_init_ring'
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: Jerome Glisse 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> > index 47ea468596184..30772608eac6c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> > @@ -434,6 +434,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring 
> > *ring,
> >*
> >* @ring: ring to init the fence driver on
> >* @num_hw_submission: number of entries on the hardware queue
> > + * @sched_score: optional score atomic shared with other schedulers
> >*
> >* Init the fence driver for the requested ring (all asics).
> >* Helper function for amdgpu_fence_driver_init().
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 25/40] drm/radeon/radeon_device: Provide function name in kernel-doc header

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 11:51 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/radeon/radeon_device.c:1101: warning: This comment starts 
> > with '/**', but isn't a kernel-doc comment. Refer 
> > Documentation/doc-guide/kernel-doc.rst
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-de...@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/radeon/radeon_device.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
> > b/drivers/gpu/drm/radeon/radeon_device.c
> > index cc445c4cba2e3..46eea01950cb1 100644
> > --- a/drivers/gpu/drm/radeon/radeon_device.c
> > +++ b/drivers/gpu/drm/radeon/radeon_device.c
> > @@ -1098,7 +1098,8 @@ static bool radeon_check_pot_argument(int arg)
> >   }
> >
> >   /**
> > - * Determine a sensible default GART size according to ASIC family.
> > + * radeon_gart_size_auto - Determine a sensible default GART size
> > + * according to ASIC family.
> >*
> >* @family: ASIC family name
> >*/
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 26/40] drm/amd/amdgpu/amdgpu_device: Remove unused variable 'r'

2021-04-20 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Apr 16, 2021 at 10:38 AM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function 
> ‘amdgpu_device_suspend’:
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:3733:6: warning: variable ‘r’ set 
> but not used [-Wunused-but-set-variable]
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b4ad1c055c702..eef54b265ffdd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3730,7 +3730,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
>  int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
>  {
> struct amdgpu_device *adev = drm_to_adev(dev);
> -   int r;
>
> if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> return 0;
> @@ -3745,7 +3744,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool 
> fbcon)
>
> amdgpu_ras_suspend(adev);
>
> -   r = amdgpu_device_ip_suspend_phase1(adev);
> +   amdgpu_device_ip_suspend_phase1(adev);
>
> if (!adev->in_s0ix)
> amdgpu_amdkfd_suspend(adev, adev->in_runpm);
> @@ -3755,7 +3754,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool 
> fbcon)
>
> amdgpu_fence_driver_suspend(adev);
>
> -   r = amdgpu_device_ip_suspend_phase2(adev);
> +   amdgpu_device_ip_suspend_phase2(adev);
> /* evict remaining vram memory
>  * This second call to evict vram is to evict the gart page table
>  * using the CPU.
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 23/40] drm/ttm/ttm_bo: Fix incorrectly documented function 'ttm_bo_cleanup_refs'

2021-04-20 Thread Alex Deucher
On Fri, Apr 16, 2021 at 11:32 AM Christian König
 wrote:
>
> Am 16.04.21 um 16:37 schrieb Lee Jones:
> > Fixes the following W=1 kernel build warning(s):
> >
> >   drivers/gpu/drm/ttm/ttm_bo.c:293: warning: expecting prototype for 
> > function ttm_bo_cleanup_refs(). Prototype was for ttm_bo_cleanup_refs() 
> > instead
> >
> > Cc: Christian Koenig 
> > Cc: Huang Rui 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
>
> Reviewed-by: Christian König 

Can you push the ttm and sched fixes to drm-misc?

Alex


>
> > ---
> >   drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> > index cfd0b92923973..defec9487e1de 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> > @@ -274,7 +274,7 @@ static void ttm_bo_flush_all_fences(struct 
> > ttm_buffer_object *bo)
> >   }
> >
> >   /**
> > - * function ttm_bo_cleanup_refs
> > + * ttm_bo_cleanup_refs
> >* If bo idle, remove from lru lists, and unref.
> >* If not idle, block if possible.
> >*
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: linux-next: build warning after merge of the amdgpu tree

2021-04-15 Thread Alex Deucher
On Fri, Apr 16, 2021 at 1:47 AM Liang, Prike  wrote:
>
> [AMD Public Use]
>
> > From: Stephen Rothwell 
> > Sent: Friday, April 16, 2021 12:09 PM
> > To: Liang, Prike 
> > Cc: Alex Deucher ; S-k, Shyam-sundar  > sundar@amd.com>; Linux Kernel Mailing List  > ker...@vger.kernel.org>; Linux Next Mailing List 
> > 
> > Subject: Re: linux-next: build warning after merge of the amdgpu tree
> >
> > Hi,
> >
> > On Fri, 16 Apr 2021 03:12:12 + "Liang, Prike" 
> > wrote:
> > >
> > > Hi, Rothwell
> >
> > (Stephen, actually :-))
> >
> > > This fix solution hasn't locked down and still being discussed and roll-
> > updated in the NVMe mail group.
> > > Will update the patch once it refined done.
> >
> > In which case, this patch should not be in linux-next (or any branch that is
> > included by linux-next).
> >
> How about revert the patch temporally ? Once lock down the solution and will 
> land in the final latest patch.

I'll drop it for now.  I just have it in there temporarily while it
makes its way upstream because a lot of people use this branch and it
fixes an important bug.

Alex


Re: [Regression] amdgpu driver broken on AMD HD7770 GHz edition.

2021-04-15 Thread Alex Deucher
On Fri, Apr 16, 2021 at 12:48 AM David Niklas  wrote:
>
> Hey,
>
> I forgot to give you a bug tracker in case you want one.
> Here: https://bugzilla.kernel.org/show_bug.cgi?id=212691

I've followed up on the bug report.  Please take a look there.

Alex

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


Re: [PATCH] drm/radeon/si: Fix inconsistent indenting

2021-04-15 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Apr 15, 2021 at 5:30 AM Yang Li  wrote:
>
> Kernel test robot throws below warning ->
>
> smatch warnings:
> drivers/gpu/drm/radeon/si.c:4514 si_vm_packet3_cp_dma_check() warn:
> inconsistent indenting
>
> Fixed the inconsistent indenting.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 
> ---
>  drivers/gpu/drm/radeon/si.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index 88731b79..d0e94b1 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -4511,7 +4511,7 @@ static int si_vm_packet3_cp_dma_check(u32 *ib, u32 idx)
> } else {
> for (i = 0; i < (command & 0x1f); i++) {
> reg = start_reg + (4 * i);
> -   if (!si_vm_reg_valid(reg)) {
> +   if (!si_vm_reg_valid(reg)) {
> DRM_ERROR("CP DMA Bad DST 
> register\n");
> return -EINVAL;
> }
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] efifb: Check efifb_pci_dev before using it

2021-04-13 Thread Alex Deucher
On Tue, Apr 13, 2021 at 2:37 PM Daniel Vetter  wrote:
>
> On Tue, Apr 13, 2021 at 8:02 PM Alex Deucher  wrote:
> >
> > On Tue, Apr 13, 2021 at 1:05 PM Kai-Heng Feng
> >  wrote:
> > >
> > > On some platforms like Hyper-V and RPi4 with UEFI firmware, efifb is not
> > > a PCI device.
> > >
> > > So make sure efifb_pci_dev is found before using it.
> > >
> > > Fixes: a6c0fd3d5a8b ("efifb: Ensure graphics device for efifb stays at 
> > > PCI D0")
> > > BugLink: https://bugs.launchpad.net/bugs/1922403
> > > Signed-off-by: Kai-Heng Feng 
> >
> > Reviewed-by: Alex Deucher 
>
> fbdev is in drm-misc, so maybe you can push this one too?

Yes, pushed.  Thanks!

Alex

> -Daniel
>
> >
> > > ---
> > >  drivers/video/fbdev/efifb.c | 6 --
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
> > > index f58a545b3bf3..8ea8f079cde2 100644
> > > --- a/drivers/video/fbdev/efifb.c
> > > +++ b/drivers/video/fbdev/efifb.c
> > > @@ -575,7 +575,8 @@ static int efifb_probe(struct platform_device *dev)
> > > goto err_fb_dealoc;
> > > }
> > > fb_info(info, "%s frame buffer device\n", info->fix.id);
> > > -   pm_runtime_get_sync(_pci_dev->dev);
> > > +   if (efifb_pci_dev)
> > > +   pm_runtime_get_sync(_pci_dev->dev);
> > > return 0;
> > >
> > >  err_fb_dealoc:
> > > @@ -602,7 +603,8 @@ static int efifb_remove(struct platform_device *pdev)
> > > unregister_framebuffer(info);
> > > sysfs_remove_groups(>dev.kobj, efifb_groups);
> > > framebuffer_release(info);
> > > -   pm_runtime_put(_pci_dev->dev);
> > > +   if (efifb_pci_dev)
> > > +   pm_runtime_put(_pci_dev->dev);
> > >
> > > return 0;
> > >  }
> > > --
> > > 2.30.2
> > >
> > > ___
> > > dri-devel mailing list
> > > dri-de...@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > ___
> > dri-devel mailing list
> > dri-de...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


Re: [PATCH] efifb: Check efifb_pci_dev before using it

2021-04-13 Thread Alex Deucher
On Tue, Apr 13, 2021 at 1:05 PM Kai-Heng Feng
 wrote:
>
> On some platforms like Hyper-V and RPi4 with UEFI firmware, efifb is not
> a PCI device.
>
> So make sure efifb_pci_dev is found before using it.
>
> Fixes: a6c0fd3d5a8b ("efifb: Ensure graphics device for efifb stays at PCI 
> D0")
> BugLink: https://bugs.launchpad.net/bugs/1922403
> Signed-off-by: Kai-Heng Feng 

Reviewed-by: Alex Deucher 

> ---
>  drivers/video/fbdev/efifb.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
> index f58a545b3bf3..8ea8f079cde2 100644
> --- a/drivers/video/fbdev/efifb.c
> +++ b/drivers/video/fbdev/efifb.c
> @@ -575,7 +575,8 @@ static int efifb_probe(struct platform_device *dev)
> goto err_fb_dealoc;
> }
> fb_info(info, "%s frame buffer device\n", info->fix.id);
> -   pm_runtime_get_sync(_pci_dev->dev);
> +   if (efifb_pci_dev)
> +   pm_runtime_get_sync(_pci_dev->dev);
> return 0;
>
>  err_fb_dealoc:
> @@ -602,7 +603,8 @@ static int efifb_remove(struct platform_device *pdev)
> unregister_framebuffer(info);
> sysfs_remove_groups(>dev.kobj, efifb_groups);
> framebuffer_release(info);
> -   pm_runtime_put(_pci_dev->dev);
> +   if (efifb_pci_dev)
> +   pm_runtime_put(_pci_dev->dev);
>
> return 0;
>  }
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1] drm/radeon: Fix a missing check bug in radeon_dp_mst_detect()

2021-04-08 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Apr 7, 2021 at 2:23 AM  wrote:
>
> From: Yingjie Wang 
>
> In radeon_dp_mst_detect(), We should check whether or not @connector
> has been unregistered from userspace. If the connector is unregistered,
> we should return disconnected status.
>
> Fixes: 9843ead08f18 ("drm/radeon: add DisplayPort MST support (v2)")
> Signed-off-by: Yingjie Wang 
> ---
>  drivers/gpu/drm/radeon/radeon_dp_mst.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c 
> b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> index 2c32186c4acd..4e4c937c36c6 100644
> --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> @@ -242,6 +242,9 @@ radeon_dp_mst_detect(struct drm_connector *connector,
> to_radeon_connector(connector);
> struct radeon_connector *master = radeon_connector->mst_port;
>
> +   if (drm_connector_is_unregistered(connector))
> +   return connector_status_disconnected;
> +
> return drm_dp_mst_detect_port(connector, ctx, >mst_mgr,
>   radeon_connector->port);
>  }
> --
> 2.7.4
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/pm: convert sysfs snprintf to sysfs_emit

2021-04-07 Thread Alex Deucher
On Tue, Apr 6, 2021 at 10:13 AM Carlis  wrote:
>
> From: Xuezhi Zhang 
>
> Fix the following coccicheck warning:
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:1940:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:1978:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2022:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:294:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:154:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:496:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:512:9-17:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:1740:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:1667:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2074:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2047:9-17:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2768:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2738:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2442:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3246:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3253:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2458:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3047:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3133:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3209:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3216:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2410:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2496:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2470:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2426:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2965:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:2972:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3006:8-16:
> WARNING: use scnprintf or sprintf
> drivers/gpu/drm/amd/pm//amdgpu_pm.c:3013:8-16:
> WARNING: use scnprintf or sprintf
>
> Signed-off-by: Xuezhi Zhang 

I already applied a similar patch last week.

Thanks,

Alex


> ---
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 58 +++---
>  1 file changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
> b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index 5fa65f191a37..2777966ec1ca 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -151,7 +151,7 @@ static ssize_t amdgpu_get_power_dpm_state(struct device 
> *dev,
> pm_runtime_mark_last_busy(ddev->dev);
> pm_runtime_put_autosuspend(ddev->dev);
>
> -   return snprintf(buf, PAGE_SIZE, "%s\n",
> +   return sysfs_emit(buf, "%s\n",
> (pm == POWER_STATE_TYPE_BATTERY) ? "battery" :
> (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : 
> "performance");
>  }
> @@ -291,7 +291,7 @@ static ssize_t 
> amdgpu_get_power_dpm_force_performance_level(struct device *dev,
> pm_runtime_mark_last_busy(ddev->dev);
> pm_runtime_put_autosuspend(ddev->dev);
>
> -   return snprintf(buf, PAGE_SIZE, "%s\n",
> +   return sysfs_emit(buf, "%s\n",
> (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
> (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
> (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
> @@ -493,7 +493,7 @@ static ssize_t amdgpu_get_pp_cur_state(struct device *dev,
> if (i == data.nums)
> i = -EINVAL;
>
> -   return snprintf(buf, PAGE_SIZE, "%d\n", i);
> +   return sysfs_emit(buf, "%d\n", i);
>  }
>
>  static ssize_t amdgpu_get_pp_force_state(struct device *dev,
> @@ -509,7 +509,7 @@ static ssize_t amdgpu_get_pp_force_state(struct device 
> *dev,
> if (adev->pp_force_state_enabled)
> return amdgpu_get_pp_cur_state(dev, attr, buf);
> else
> -   return snprintf(buf, PAGE_SIZE, "\n");
> +   return sysfs_emit(buf, "\n");
>  }
>
>  static ssize_t amdgpu_set_pp_force_state(struct device *dev,
> @@ -1664,7 +1664,7 @@ static ssize_t amdgpu_get_pp_sclk_od(struct device *dev,
> pm_runtime_mark_last_busy(ddev->dev);
> pm_runtime_put_autosuspend(ddev->dev);
>
> -   return snprintf(buf, PAGE_SIZE, "%d\n", value);
> +   return sysfs_emit(buf, "%d\n", value);
>  }
>
>  static 

Re: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages

2021-04-06 Thread Alex Deucher
404
> >> [17359.806352] R10:  R11: 0202 R12: 
> >> 559416e4e2aa
> >> [17359.814251] R13:  R14: 0021 R15: 
> >> 
> >> [17359.822140] Modules linked in: ip6table_filter ip6_tables 
> >> iptable_filter amdgpu x86_pkg_temp_thermal drm_ttm_helper ttm iommu_v2 
> >> gpu_sched ip_tables x_tables
> >> [17359.837776] CR2: 
> >> [17359.841888] ---[ end trace a6f27d64475b28c8 ]---
> >> [17359.847318] RIP: 0010:amdgpu_ttm_backend_unbind+0x52/0x110 [amdgpu]
> >> [17359.854479] Code: 48 39 c6 74 1b 8b 53 0c 48 8d bd 80 a1 ff ff e8 24 62 
> >> 00 00 85 c0 0f 85 ab 00 00 00 c6 43 54 00 5b 5d c3 48 8b 46 10 8b 4e 50 
> >> <48> 8b 30 48 85 f6 74 ba 8b 50 0c 48 8b bf 80 a1 ff ff 83 e1 01 45
> >> [17359.874929] RSP: 0018:a4764971fc98 EFLAGS: 00010206
> >> [17359.881014] RAX:  RBX: 950e8d4edf00 RCX: 
> >> 
> >> [17359.889007] RDX:  RSI: 950e8d4edf00 RDI: 
> >> 950eadec5e80
> >> [17359.897008] RBP: 950eadec5e80 R08:  R09: 
> >> 
> >> [17359.905020] R10: 0246 R11: 0001 R12: 
> >> 950c03377800
> >> [17359.913034] R13: 950eadec5e80 R14: 950c03377858 R15: 
> >> 
> >> [17359.921050] FS:  7febb20cb740() GS:950ebfc0() 
> >> knlGS:
> >> [17359.930047] CS:  0010 DS:  ES:  CR0: 80050033
> >> [17359.936674] CR2:  CR3: 0006d700e005 CR4: 
> >> 001706e0
> >  From what I understand, the init_user_pages fails (returns EBUSY) and
> > the code goes to allocate_init_user_pages_failed where the unbind and
> > the userptr clear occurs.
> > Can we prevent this if we save the bounding status + userptr alloc? so
> > the function amdgpu_ttm_backend_unbind returns without trying to clear
> > the userptr memory?
> >
> > Something like:
> >
> > amdgpu_ttm_backend_bind:
> >  if (gtt->userptr) {
> >  r = amdgpu_ttm_tt_pin_userptr(bdev, ttm);
> >  if (r) ...
> > gtt->sg_table = true;
> > }
> >
> > amdgpu_ttm_backend_unbind:
> > if (gtt->sg_table) {
> >  if (gtt->user_ptr) ...
> > }
> >
> > If you agree, I'll send a v2 patch. Otherwise, maybe we could return
> > within amdgpu_ttm_tt_unpin_userptr if memory hasn't been allocated.
> >
> > Any other ideas?
> >
> > Regards,
> > Daniel
> >
> >> Reverting this patch fixes the problem for me.
> >>
> >> Regards,
> >> Felix
> >>
> >> On 2021-03-18 10:57 p.m., Alex Deucher wrote:
> >>> Applied.  Thanks!
> >>>
> >>> Alex
> >>>
> >>> On Thu, Mar 18, 2021 at 5:00 AM Koenig, Christian
> >>>  wrote:
> >>>> Reviewed-by: Christian König 
> >>>> 
> >>>> Von: Daniel Gomez 
> >>>> Gesendet: Donnerstag, 18. März 2021 09:32
> >>>> Cc: dag...@gmail.com ; Daniel Gomez ; 
> >>>> Deucher, Alexander ; Koenig, Christian 
> >>>> ; David Airlie ; Daniel 
> >>>> Vetter ; amd-...@lists.freedesktop.org 
> >>>> ; dri-de...@lists.freedesktop.org 
> >>>> ; linux-kernel@vger.kernel.org 
> >>>> 
> >>>> Betreff: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages
> >>>>
> >>>> If userptr pages have been pinned but not bounded,
> >>>> they remain uncleared.
> >>>>
> >>>> Signed-off-by: Daniel Gomez 
> >>>> ---
> >>>>drivers/gpu/drm/radeon/radeon_ttm.c | 5 +++--
> >>>>1 file changed, 3 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
> >>>> b/drivers/gpu/drm/radeon/radeon_ttm.c
> >>>> index e8c66d10478f..bbcc6264d48f 100644
> >>>> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> >>>> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> >>>> @@ -485,13 +485,14 @@ static void radeon_ttm_backend_unbind(struct 
> >>>> ttm_bo_device *bdev, struct ttm_tt
> >>>>struct radeon_ttm_tt *gtt = (void *)ttm;
> >>>>struct radeon_device *rdev = radeon_get_rdev(bdev);
> >>>>
> >>>> +   if (gtt->userptr)
> >>>> +   radeon_ttm_tt_unpin_userptr(bdev, ttm);
> >>>> +
> >>>>if (!gtt->bound)
> >>>>return;
> >>>>
> >>>>radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages);
> >>>>
> >>>> -   if (gtt->userptr)
> >>>> -   radeon_ttm_tt_unpin_userptr(bdev, ttm);
> >>>>gtt->bound = false;
> >>>>}
> >>>>
> >>>> --
> >>>> 2.30.2
> >>>>
> >>>> ___
> >>>> dri-devel mailing list
> >>>> dri-de...@lists.freedesktop.org
> >>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >>> ___
> >>> dri-devel mailing list
> >>> dri-de...@lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > ___
> > amd-gfx mailing list
> > amd-...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>


Re: [PATCH] drm/ttm: add __user annotation in radeon_ttm_vram_read

2021-04-01 Thread Alex Deucher
Current code already contains the fix.

Alex


On Thu, Apr 1, 2021 at 9:09 AM Christian König
 wrote:
>
> Am 24.10.20 um 02:47 schrieb Rasmus Villemoes:
> > Keep sparse happy by preserving the __user annotation when casting.
> >
> > Reported-by: kernel test robot 
> > Signed-off-by: Rasmus Villemoes 
>
> Reviewed-by: Christian König 
>
> Going over old patches and stumbled over that once.
>
> Alex did you missed to pick it up?
>
> Regards,
> Christian.
>
> > ---
> >
> > kernel test robot has already started spamming me due to 9c5743dff. If
> > I don't fix those warnings I'll keep getting those emails for
> > months, so let me do the easy ones.
> >
> >
> >   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 36150b7f31a90aa1eece..ecfe88b0a35d8f317712 100644
> > --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> > +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> > @@ -1005,7 +1005,7 @@ static ssize_t radeon_ttm_vram_read(struct file *f, 
> > char __user *buf,
> >   value = RREG32(RADEON_MM_DATA);
> >   spin_unlock_irqrestore(>mmio_idx_lock, flags);
> >
> > - r = put_user(value, (uint32_t *)buf);
> > + r = put_user(value, (uint32_t __user *)buf);
> >   if (r)
> >   return r;
> >
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] amd/amdgpu: code refactoring to clean code style a bit

2021-04-01 Thread Alex Deucher
This code has been dropped.

Alex

On Wed, Mar 31, 2021 at 9:36 AM Bernard Zhao  wrote:
>
> Fix checkpatch.pl warning:
> Too many leading tabs - consider code refactoring
> WARNING: Too many leading tabs - consider code refactoring
> +   for (j = 0; j < 
> profile->ucLeakageBinNum; j++) {
>
> WARNING: Too many leading tabs - consider code refactoring
> +   if (vbios_voltage_id 
> <= leakage_bin[j]) {
>
> WARNING: Too many leading tabs - consider code refactoring
> +   for (j = 0; j < 
> profile->ucLeakageBinNum; j++) {
>
> WARNING: Too many leading tabs - consider code refactoring
> +   if (vbios_voltage_id 
> <= leakage_bin[j]) {
>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 84 
>  1 file changed, 35 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> index 86add0f4ea4d..9968ff8ddc9c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> @@ -1283,65 +1283,51 @@ int 
> amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_devic
> profile = (ATOM_ASIC_PROFILING_INFO_V2_1 *)
> (adev->mode_info.atom_context->bios + data_offset);
>
> -   switch (frev) {
> -   case 1:
> +   if ((frev != 2) || (crev != 1)) {
> +   DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
> return -EINVAL;
> -   case 2:
> -   switch (crev) {
> -   case 1:
> -   if (size < sizeof(ATOM_ASIC_PROFILING_INFO_V2_1))
> -   return -EINVAL;
> -   leakage_bin = (u16 *)
> -   (adev->mode_info.atom_context->bios + 
> data_offset +
> -
> le16_to_cpu(profile->usLeakageBinArrayOffset));
> -   vddc_id_buf = (u16 *)
> -   (adev->mode_info.atom_context->bios + 
> data_offset +
> -
> le16_to_cpu(profile->usElbVDDC_IdArrayOffset));
> -   vddc_buf = (u16 *)
> -   (adev->mode_info.atom_context->bios + 
> data_offset +
> -
> le16_to_cpu(profile->usElbVDDC_LevelArrayOffset));
> -   vddci_id_buf = (u16 *)
> -   (adev->mode_info.atom_context->bios + 
> data_offset +
> -
> le16_to_cpu(profile->usElbVDDCI_IdArrayOffset));
> -   vddci_buf = (u16 *)
> -   (adev->mode_info.atom_context->bios + 
> data_offset +
> -
> le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset));
> -
> -   if (profile->ucElbVDDC_Num > 0) {
> -   for (i = 0; i < profile->ucElbVDDC_Num; i++) {
> -   if (vddc_id_buf[i] == 
> virtual_voltage_id) {
> -   for (j = 0; j < 
> profile->ucLeakageBinNum; j++) {
> -   if (vbios_voltage_id 
> <= leakage_bin[j]) {
> -   *vddc = 
> vddc_buf[j * profile->ucElbVDDC_Num + i];
> -   break;
> -   }
> -   }
> +   }
> +
> +   if (size < sizeof(ATOM_ASIC_PROFILING_INFO_V2_1))
> +   return -EINVAL;
> +
> +   leakage_bin = (u16 *)(adev->mode_info.atom_context->bios + 
> data_offset +
> +le16_to_cpu(profile->usLeakageBinArrayOffset));
> +   vddc_id_buf = (u16 *)(adev->mode_info.atom_context->bios + 
> data_offset +
> +le16_to_cpu(profile->usElbVDDC_IdArrayOffset));
> +   vddc_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset +
> +le16_to_cpu(profile->usElbVDDC_LevelArrayOffset));
> +   vddci_id_buf = (u16 *)(adev->mode_info.atom_context->bios + 
> data_offset +
> +le16_to_cpu(profile->usElbVDDCI_IdArrayOffset));
> +   vddci_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset +
> +le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset));
> +
> +   if (profile->ucElbVDDC_Num > 0) {
> +   for (i = 0; i < profile->ucElbVDDC_Num; i++) {
> +   if (vddc_id_buf[i] == virtual_voltage_id) {
> +   for (j = 0; j < profile->ucLeakageBinNum; 
> j++) {
> +   if (vbios_voltage_id <= 
> leakage_bin[j]) {
> +   

Re: [PATCH] drm/amd: cleanup coding style a bit

2021-04-01 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 31, 2021 at 9:36 AM Bernard Zhao  wrote:
>
> Fix patch check warning:
> WARNING: suspect code indent for conditional statements (8, 17)
> +   if (obj && obj->use < 0) {
> +DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", 
> obj->head.name);
>
> WARNING: braces {} are not necessary for single statement blocks
> +   if (obj && obj->use < 0) {
> +DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", 
> obj->head.name);
> +   }
>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 1fb2a91ad30a..43d17b72c265 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -449,11 +449,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev,
>
>  static inline void put_obj(struct ras_manager *obj)
>  {
> -   if (obj && --obj->use == 0)
> +   if (obj && (--obj->use == 0))
> list_del(>node);
> -   if (obj && obj->use < 0) {
> -DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", 
> obj->head.name);
> -   }
> +   if (obj && (obj->use < 0))
> +   DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", 
> obj->head.name);
>  }
>
>  /* make one obj and return it. */
> --
> 2.31.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd: use kmalloc_array over kmalloc with multiply

2021-04-01 Thread Alex Deucher
Applied.  Thanks!

On Wed, Mar 31, 2021 at 9:36 AM Bernard Zhao  wrote:
>
> Fix patch check warning:
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> +   buf = kmalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL);
>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> index 17d1736367ea..246522423559 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> @@ -81,7 +81,7 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char 
> __user *user,
> struct kfd_smi_client *client = filep->private_data;
> unsigned char *buf;
>
> -   buf = kmalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL);
> +   buf = kmalloc_array(MAX_KFIFO_SIZE, sizeof(*buf), GFP_KERNEL);
> if (!buf)
> return -ENOMEM;
>
> --
> 2.31.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 0/2] ensure alignment on CPU page for bo mapping

2021-03-30 Thread Alex Deucher
Applied.  Thanks!

Alex

On Tue, Mar 30, 2021 at 12:21 PM Christian König
 wrote:
>
> Reviewed-by: Christian König  for the entire
> series.
>
> Alex will probably pick them up for the next feature pull request.
>
> Regards,
> Christian.
>
> Am 30.03.21 um 17:33 schrieb Xℹ Ruoyao:
> > In AMDGPU driver, the bo mapping should always align to CPU page or
> > the page table is corrupted.
> >
> > The first patch is cherry-picked from Loongson community, which sets a
> > suitable dev_info.gart_page_size so Mesa will handle the alignment
> > correctly.
> >
> > The second patch is added to ensure an ioctl with unaligned parameter to
> > be rejected -EINVAL, instead of causing page table corruption.
> >
> > The patches should be applied for drm-next.
> >
> > Huacai Chen (1):
> >drm/amdgpu: Set a suitable dev_info.gart_page_size
> >
> > Xℹ Ruoyao (1):
> >drm/amdgpu: check alignment on CPU page for bo map
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++--
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 8 
> >   2 files changed, 6 insertions(+), 6 deletions(-)
> >
> >
> > base-commit: a0c8b193bfe81cc8e9c7c162bb8d777ba12596f0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: Re: [PATCH] amd: display: dc: struct dc_state is declared twice

2021-03-30 Thread Alex Deucher
On Mon, Mar 29, 2021 at 9:36 PM 万家兵  wrote:
>
>
> >On Sat, Mar 27, 2021 at 3:28 AM Wan Jiabing  wrote:
> >>
> >> struct dc_state has been declared at 273rd line.
> >> Remove the duplicate.
> >> Delete duplicate blank lines.
> >
> >Can you split these into separate patches?
> >
> >Alex
>
> OK. But in fact, what I did  is simple.
> The most important thing is removing the duplicate
> struct dc_state declaration at 585th line.
> Others are all deleting duplicate blank lines.
>
> So maybe I should send two patchs, one is removing
> duplicate declaration, the other is deleting blank lines?
>

Yes.  There are so many whitespace changes in the commit that it's
hard to see the functional change.

Alex


> >>
> >> Signed-off-by: Wan Jiabing 
> >> ---
> >>  drivers/gpu/drm/amd/display/dc/dc.h | 10 --
> >>  1 file changed, 10 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
> >> b/drivers/gpu/drm/amd/display/dc/dc.h
> >> index 18ed0d3f247e..dc667298ab5b 100644
> >> --- a/drivers/gpu/drm/amd/display/dc/dc.h
> >> +++ b/drivers/gpu/drm/amd/display/dc/dc.h
> >> @@ -234,7 +234,6 @@ struct dc_static_screen_params {
> >> unsigned int num_frames;
> >>  };
> >>
> >> -
> >>  /* Surface update type is used by dc_update_surfaces_and_stream
> >>   * The update type is determined at the very beginning of the function 
> >> based
> >>   * on parameters passed in and decides how much programming (or updating) 
> >> is
> >> @@ -272,7 +271,6 @@ struct dc;
> >>  struct dc_plane_state;
> >>  struct dc_state;
> >>
> >> -
> >>  struct dc_cap_funcs {
> >> bool (*get_dcc_compression_cap)(const struct dc *dc,
> >> const struct dc_dcc_surface_param *input,
> >> @@ -281,7 +279,6 @@ struct dc_cap_funcs {
> >>
> >>  struct link_training_settings;
> >>
> >> -
> >>  /* Structure to hold configuration flags set by dm at dc creation. */
> >>  struct dc_config {
> >> bool gpu_vm_support;
> >> @@ -581,7 +578,6 @@ struct dc_bounding_box_overrides {
> >> int min_dcfclk_mhz;
> >>  };
> >>
> >> -struct dc_state;
>
> Removing the duplicate is here.
> And others are all deleting duplicate blank line.
>
> I think they are in the same file. I want to remove the declaration first.
> By the way, I deleted the blank line.
>
> Yours,
> Wan Jiabing
>
> >>  struct resource_pool;
> >>  struct dce_hwseq;
> >>  struct gpu_info_soc_bounding_box_v1_0;
> >> @@ -757,7 +753,6 @@ enum dc_transfer_func_predefined {
> >> TRANSFER_FUNCTION_GAMMA26
> >>  };
> >>
> >> -
> >>  struct dc_transfer_func {
> >> struct kref refcount;
> >> enum dc_transfer_func_type type;
> >> @@ -770,7 +765,6 @@ struct dc_transfer_func {
> >> };
> >>  };
> >>
> >> -
> >>  union dc_3dlut_state {
> >> struct {
> >> uint32_t initialized:1; /*if 3dlut is went through 
> >> color module for initialization */
> >> @@ -784,7 +778,6 @@ union dc_3dlut_state {
> >> uint32_t raw;
> >>  };
> >>
> >> -
> >>  struct dc_3dlut {
> >> struct kref refcount;
> >> struct tetrahedral_params lut_3d;
> >> @@ -1014,7 +1007,6 @@ enum dc_status dc_validate_global_state(
> >> struct dc_state *new_ctx,
> >> bool fast_validate);
> >>
> >> -
> >>  void dc_resource_state_construct(
> >> const struct dc *dc,
> >> struct dc_state *dst_ctx);
> >> @@ -1167,7 +1159,6 @@ struct dc_container_id {
> >> unsigned short productCode;
> >>  };
> >>
> >> -
> >>  struct dc_sink_dsc_caps {
> >> // 'true' if these are virtual DPCD's DSC caps (immediately 
> >> upstream of sink in MST topology),
> >> // 'false' if they are sink's DSC caps
> >> @@ -1229,7 +1220,6 @@ struct dc_cursor {
> >> struct dc_cursor_attributes attributes;
> >>  };
> >>
> >> -
> >>  
> >> /***
> >>   * Interrupt interfaces
> >>   
> >> **/
> >> --
> >> 2.25.1
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-de...@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>


Re: [PATCH] amd: display: dc: struct dc_state is declared twice

2021-03-29 Thread Alex Deucher
On Sat, Mar 27, 2021 at 3:28 AM Wan Jiabing  wrote:
>
> struct dc_state has been declared at 273rd line.
> Remove the duplicate.
> Delete duplicate blank lines.

Can you split these into separate patches?

Alex

>
> Signed-off-by: Wan Jiabing 
> ---
>  drivers/gpu/drm/amd/display/dc/dc.h | 10 --
>  1 file changed, 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
> b/drivers/gpu/drm/amd/display/dc/dc.h
> index 18ed0d3f247e..dc667298ab5b 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc.h
> +++ b/drivers/gpu/drm/amd/display/dc/dc.h
> @@ -234,7 +234,6 @@ struct dc_static_screen_params {
> unsigned int num_frames;
>  };
>
> -
>  /* Surface update type is used by dc_update_surfaces_and_stream
>   * The update type is determined at the very beginning of the function based
>   * on parameters passed in and decides how much programming (or updating) is
> @@ -272,7 +271,6 @@ struct dc;
>  struct dc_plane_state;
>  struct dc_state;
>
> -
>  struct dc_cap_funcs {
> bool (*get_dcc_compression_cap)(const struct dc *dc,
> const struct dc_dcc_surface_param *input,
> @@ -281,7 +279,6 @@ struct dc_cap_funcs {
>
>  struct link_training_settings;
>
> -
>  /* Structure to hold configuration flags set by dm at dc creation. */
>  struct dc_config {
> bool gpu_vm_support;
> @@ -581,7 +578,6 @@ struct dc_bounding_box_overrides {
> int min_dcfclk_mhz;
>  };
>
> -struct dc_state;
>  struct resource_pool;
>  struct dce_hwseq;
>  struct gpu_info_soc_bounding_box_v1_0;
> @@ -757,7 +753,6 @@ enum dc_transfer_func_predefined {
> TRANSFER_FUNCTION_GAMMA26
>  };
>
> -
>  struct dc_transfer_func {
> struct kref refcount;
> enum dc_transfer_func_type type;
> @@ -770,7 +765,6 @@ struct dc_transfer_func {
> };
>  };
>
> -
>  union dc_3dlut_state {
> struct {
> uint32_t initialized:1; /*if 3dlut is went through 
> color module for initialization */
> @@ -784,7 +778,6 @@ union dc_3dlut_state {
> uint32_t raw;
>  };
>
> -
>  struct dc_3dlut {
> struct kref refcount;
> struct tetrahedral_params lut_3d;
> @@ -1014,7 +1007,6 @@ enum dc_status dc_validate_global_state(
> struct dc_state *new_ctx,
> bool fast_validate);
>
> -
>  void dc_resource_state_construct(
> const struct dc *dc,
> struct dc_state *dst_ctx);
> @@ -1167,7 +1159,6 @@ struct dc_container_id {
> unsigned short productCode;
>  };
>
> -
>  struct dc_sink_dsc_caps {
> // 'true' if these are virtual DPCD's DSC caps (immediately upstream 
> of sink in MST topology),
> // 'false' if they are sink's DSC caps
> @@ -1229,7 +1220,6 @@ struct dc_cursor {
> struct dc_cursor_attributes attributes;
>  };
>
> -
>  
> /***
>   * Interrupt interfaces
>   
> **/
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: linux-next: Signed-off-by missing for commit in the amdgpu tree

2021-03-29 Thread Alex Deucher
Hi Mark.  I've fixed this up in my tree.

Alex

On Mon, Mar 29, 2021 at 10:18 AM Mark Yacoub  wrote:
>
> oh this sucks. I'll look into my config and fix it. Thanks Stephen for
> bringing it to my attention!
>
> On Sun, Mar 28, 2021 at 5:24 PM Stephen Rothwell  
> wrote:
> >
> > Hi all,
> >
> > Commit
> >
> >   0ea5088407fa ("drm/amdgpu: Ensure that the modifier requested is 
> > supported by plane.")
> >
> > is missing a Signed-off-by from its author.
> >
> > The author is "Mark Yacoub ", but the SOB is
> > "default avatarMark Yacoub " :-(
> >
> > --
> > Cheers,
> > Stephen Rothwell


Re: [TRIVIAL] drm/amd/display: fix typo: liason -> liaison

2021-03-29 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sun, Mar 28, 2021 at 1:35 AM Diego Viola  wrote:
>
> Signed-off-by: Diego Viola 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 573cf17262da..1b4b4f508662 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -121,7 +121,7 @@ MODULE_FIRMWARE(FIRMWARE_NAVI12_DMCU);
>   * DOC: overview
>   *
>   * The AMDgpu display manager, **amdgpu_dm** (or even simpler,
> - * **dm**) sits between DRM and DC. It acts as a liason, converting DRM
> + * **dm**) sits between DRM and DC. It acts as a liaison, converting DRM
>   * requests into DC requests, and DC responses into DRM responses.
>   *
>   * The root control structure is  amdgpu_display_manager.
> --
> 2.31.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd: Fix a typo in two different sentences

2021-03-25 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 22, 2021 at 6:45 PM Randy Dunlap  wrote:
>
> On 3/22/21 2:06 PM, Bhaskar Chowdhury wrote:
> >
> > s/defintion/definition/ .two different places.
> >
> > Signed-off-by: Bhaskar Chowdhury 
>
> Acked-by: Randy Dunlap 
>
> > ---
> >  drivers/gpu/drm/amd/include/atombios.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/include/atombios.h 
> > b/drivers/gpu/drm/amd/include/atombios.h
> > index c1d7b1d0b952..47eb84598b96 100644
> > --- a/drivers/gpu/drm/amd/include/atombios.h
> > +++ b/drivers/gpu/drm/amd/include/atombios.h
> > @@ -1987,9 +1987,9 @@ typedef struct _PIXEL_CLOCK_PARAMETERS_V6
> >  #define PIXEL_CLOCK_V6_MISC_HDMI_BPP_MASK   0x0c
> >  #define PIXEL_CLOCK_V6_MISC_HDMI_24BPP  0x00
> >  #define PIXEL_CLOCK_V6_MISC_HDMI_36BPP  0x04
> > -#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP_V6   0x08//for V6, the 
> > correct defintion for 36bpp should be 2 for 36bpp(2:1)
> > +#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP_V6   0x08//for V6, the 
> > correct definition for 36bpp should be 2 for 36bpp(2:1)
> >  #define PIXEL_CLOCK_V6_MISC_HDMI_30BPP  0x08
> > -#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP_V6   0x04//for V6, the 
> > correct defintion for 30bpp should be 1 for 36bpp(5:4)
> > +#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP_V6   0x04//for V6, the 
> > correct definition for 30bpp should be 1 for 36bpp(5:4)
> >  #define PIXEL_CLOCK_V6_MISC_HDMI_48BPP  0x0c
> >  #define PIXEL_CLOCK_V6_MISC_REF_DIV_SRC 0x10
> >  #define PIXEL_CLOCK_V6_MISC_GEN_DPREFCLK0x40
> > --
>
>
> --
> ~Randy
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/amdgpu/gfx_v7_0: Trivial typo fixes

2021-03-25 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 25, 2021 at 5:26 AM Nirmoy  wrote:
>
>
> Reviewed-by: Nirmoy Das
>
> On 3/25/21 9:53 AM, Bhaskar Chowdhury wrote:
> > s/acccess/access/
> > s/inferface/interface/
> > s/sequnce/sequence/  .two different places.
> > s/retrive/retrieve/
> > s/sheduling/scheduling/
> > s/independant/independent/
> > s/wether/whether/ ..two different places.
> > s/emmit/emit/
> > s/synce/sync/
> >
> >
> > Signed-off-by: Bhaskar Chowdhury 
> > ---
> >   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 22 +++---
> >   1 file changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > index a368724c3dfc..4502b95ddf6b 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > @@ -1877,7 +1877,7 @@ static void gfx_v7_0_init_compute_vmid(struct 
> > amdgpu_device *adev)
> >   mutex_unlock(>srbm_mutex);
> >
> >   /* Initialize all compute VMIDs to have no GDS, GWS, or OA
> > -acccess. These should be enabled by FW for target VMIDs. */
> > +access. These should be enabled by FW for target VMIDs. */
> >   for (i = adev->vm_manager.first_kfd_vmid; i < AMDGPU_NUM_VMID; i++) {
> >   WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
> >   WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
> > @@ -2058,7 +2058,7 @@ static void gfx_v7_0_constants_init(struct 
> > amdgpu_device *adev)
> >* @adev: amdgpu_device pointer
> >*
> >* Set up the number and offset of the CP scratch registers.
> > - * NOTE: use of CP scratch registers is a legacy inferface and
> > + * NOTE: use of CP scratch registers is a legacy interface and
> >* is not used by default on newer asics (r6xx+).  On newer asics,
> >* memory buffers are used for fences rather than scratch regs.
> >*/
> > @@ -2172,7 +2172,7 @@ static void gfx_v7_0_ring_emit_vgt_flush(struct 
> > amdgpu_ring *ring)
> >* @seq: sequence number
> >* @flags: fence related flags
> >*
> > - * Emits a fence sequnce number on the gfx ring and flushes
> > + * Emits a fence sequence number on the gfx ring and flushes
> >* GPU caches.
> >*/
> >   static void gfx_v7_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 
> > addr,
> > @@ -2215,7 +2215,7 @@ static void gfx_v7_0_ring_emit_fence_gfx(struct 
> > amdgpu_ring *ring, u64 addr,
> >* @seq: sequence number
> >* @flags: fence related flags
> >*
> > - * Emits a fence sequnce number on the compute ring and flushes
> > + * Emits a fence sequence number on the compute ring and flushes
> >* GPU caches.
> >*/
> >   static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
> > @@ -2245,14 +2245,14 @@ static void gfx_v7_0_ring_emit_fence_compute(struct 
> > amdgpu_ring *ring,
> >* gfx_v7_0_ring_emit_ib - emit an IB (Indirect Buffer) on the ring
> >*
> >* @ring: amdgpu_ring structure holding ring information
> > - * @job: job to retrive vmid from
> > + * @job: job to retrieve vmid from
> >* @ib: amdgpu indirect buffer object
> >* @flags: options (AMDGPU_HAVE_CTX_SWITCH)
> >*
> >* Emits an DE (drawing engine) or CE (constant engine) IB
> >* on the gfx ring.  IBs are usually generated by userspace
> >* acceleration drivers and submitted to the kernel for
> > - * sheduling on the ring.  This function schedules the IB
> > + * scheduling on the ring.  This function schedules the IB
> >* on the gfx ring for execution by the GPU.
> >*/
> >   static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
> > @@ -2402,7 +2402,7 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring 
> > *ring, long timeout)
> >
> >   /*
> >* CP.
> > - * On CIK, gfx and compute now have independant command processors.
> > + * On CIK, gfx and compute now have independent command processors.
> >*
> >* GFX
> >* Gfx consists of a single ring and can process both gfx jobs and
> > @@ -2630,7 +2630,7 @@ static int gfx_v7_0_cp_gfx_resume(struct 
> > amdgpu_device *adev)
> >   ring->wptr = 0;
> >   WREG32(mmCP_RB0_WPTR, lower_32_bits(ring->wptr));
> >
> > - /* set the wb address wether it's enabled or not */
> > + /* set the wb address whether it's enabled or not */
> >   rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
> >   WREG32(mmCP_RB0_RPTR_ADDR, lower_32_bits(rptr_addr));
> >   WREG32(mmCP_RB0_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF);
> > @@ -2985,7 +2985,7 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device 
> > *adev,
> >   mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr & 0xfffc;
> >   mqd->cp_hqd_pq_wptr_poll_addr_hi = upper_32_bits(wb_gpu_addr) & 
> > 0x;
> >
> > - /* set the wb address wether it's enabled or not */
> > + /* set the wb address whether it's enabled or not */
> >   wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
> >   

Re: [PATCH V2] drm/radeon/r600_cs: Few typo fixes

2021-03-25 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 24, 2021 at 7:46 PM Randy Dunlap  wrote:
>
> On 3/24/21 4:29 PM, Bhaskar Chowdhury wrote:
> > s/miror/mirror/
> > s/needind/needing/
> > s/informations/information/
> >
> > Signed-off-by: Bhaskar Chowdhury 
>
> Acked-by: Randy Dunlap 
>
> Thanks.
>
> > ---
> >  Changes from V1:
> >  Randy's finding incorporated ,i.e in one place,informations->information
> >   Adjusted the subject line accordingly
> >
> >  drivers/gpu/drm/radeon/r600_cs.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/r600_cs.c 
> > b/drivers/gpu/drm/radeon/r600_cs.c
> > index 34b7c6f16479..8be4799a98ef 100644
> > --- a/drivers/gpu/drm/radeon/r600_cs.c
> > +++ b/drivers/gpu/drm/radeon/r600_cs.c
> > @@ -38,7 +38,7 @@ extern void r600_cs_legacy_get_tiling_conf(struct 
> > drm_device *dev, u32 *npipes,
> >
> >
> >  struct r600_cs_track {
> > - /* configuration we miror so that we use same code btw kms/ums */
> > + /* configuration we mirror so that we use same code btw kms/ums */
> >   u32 group_size;
> >   u32 nbanks;
> >   u32 npipes;
> > @@ -963,7 +963,7 @@ static int r600_cs_parse_packet0(struct 
> > radeon_cs_parser *p,
> >   *
> >   * This function will test against r600_reg_safe_bm and return 0
> >   * if register is safe. If register is not flag as safe this function
> > - * will test it against a list of register needind special handling.
> > + * will test it against a list of register needing special handling.
> >   */
> >  static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx)
> >  {
> > @@ -2336,7 +2336,7 @@ int r600_cs_parse(struct radeon_cs_parser *p)
> >  /**
> >   * r600_dma_cs_next_reloc() - parse next reloc
> >   * @p:   parser structure holding parsing context.
> > - * @cs_reloc:reloc informations
> > + * @cs_reloc:reloc information
> >   *
> >   * Return the next reloc, do bo validation and compute
> >   * GPU offset using the provided start.
> > --
>
>
> --
> ~Randy
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] amdgpu: securedisplay: simplify i2c hexdump output

2021-03-25 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 24, 2021 at 9:37 AM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> A previous fix I did left a rather complicated loop in
> amdgpu_securedisplay_debugfs_write() for what could be expressed in a
> simple sprintf, as Rasmus pointed out.
>
> This drops the leading 0x for each byte, but is otherwise
> much nicer.
>
> Suggested-by: Rasmus Villemoes 
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 11 +++
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 69d7f6bff5d4..fc3ddd7aa6f0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -92,9 +92,7 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct 
> file *f, const char __u
> struct drm_device *dev = adev_to_drm(adev);
> uint32_t phy_id;
> uint32_t op;
> -   int i;
> char str[64];
> -   char i2c_output[256];
> int ret;
>
> if (*pos || size > sizeof(str) - 1)
> @@ -136,12 +134,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct 
> file *f, const char __u
> ret = psp_securedisplay_invoke(psp, 
> TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);
> if (!ret) {
> if (securedisplay_cmd->status == 
> TA_SECUREDISPLAY_STATUS__SUCCESS) {
> -   int pos = 0;
> -   memset(i2c_output,  0, sizeof(i2c_output));
> -   for (i = 0; i < 
> TA_SECUREDISPLAY_I2C_BUFFER_SIZE; i++)
> -   pos += sprintf(i2c_output + pos, " 
> 0x%X",
> -   
> securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf[i]);
> -   dev_info(adev->dev, "SECUREDISPLAY: I2C 
> buffer out put is :%s\n", i2c_output);
> +   dev_info(adev->dev, "SECUREDISPLAY: I2C 
> buffer out put is: %*ph\n",
> +TA_SECUREDISPLAY_I2C_BUFFER_SIZE,
> +
> securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf);
> } else {
> psp_securedisplay_parse_resp_status(psp, 
> securedisplay_cmd->status);
> }
> --
> 2.29.2
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] amdgpu: fix gcc -Wrestrict warning

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Tue, Mar 23, 2021 at 9:04 AM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> gcc warns about an sprintf() that uses the same buffer as source
> and destination, which is undefined behavior in C99:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c: In function 
> 'amdgpu_securedisplay_debugfs_write':
> drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c:141:6: error: 'sprintf' 
> argument 3 overlaps destination object 'i2c_output' [-Werror=restrict]
>   141 |  sprintf(i2c_output, "%s 0x%X", i2c_output,
>   |  ^~
>   142 |   
> securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf[i]);
>   |   
> ~
> drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c:97:7: note: destination 
> object referenced by 'restrict'-qualified argument 1 was declared here
>97 |  char i2c_output[256];
>   |   ^~
>
> Rewrite it to remember the current offset into the buffer instead.
>
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 834440ab9ff7..69d7f6bff5d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -136,9 +136,10 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct 
> file *f, const char __u
> ret = psp_securedisplay_invoke(psp, 
> TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);
> if (!ret) {
> if (securedisplay_cmd->status == 
> TA_SECUREDISPLAY_STATUS__SUCCESS) {
> +   int pos = 0;
> memset(i2c_output,  0, sizeof(i2c_output));
> for (i = 0; i < 
> TA_SECUREDISPLAY_I2C_BUFFER_SIZE; i++)
> -   sprintf(i2c_output, "%s 0x%X", 
> i2c_output,
> +   pos += sprintf(i2c_output + pos, " 
> 0x%X",
> 
> securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf[i]);
> dev_info(adev->dev, "SECUREDISPLAY: I2C 
> buffer out put is :%s\n", i2c_output);
> } else {
> --
> 2.29.2
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] gpu: drm: amd: Remove duplicate includes

2021-03-23 Thread Alex Deucher
Same patch was already applied recently.

Thanks,

Alex

On Mon, Mar 22, 2021 at 9:19 PM Wan Jiabing  wrote:
>
> ../hw_ddc.h, ../hw_gpio.h and ../hw_hpd.h have been included
> at line 32, so remove them.
>
> Signed-off-by: Wan Jiabing 
> ---
>  .../gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c| 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c 
> b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> index 66e4841f41e4..ca335ea60412 100644
> --- a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> +++ b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> @@ -48,10 +48,6 @@
>  #define REGI(reg_name, block, id)\
> mm ## block ## id ## _ ## reg_name
>
> -#include "../hw_gpio.h"
> -#include "../hw_ddc.h"
> -#include "../hw_hpd.h"
> -
>  #include "reg_helper.h"
>  #include "../hpd_regs.h"
>
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] gpu: drm: amd: Remove duplicate include of dce110_resource.h

2021-03-23 Thread Alex Deucher
The same patch was already applied recently.  Thanks!

Alex

On Mon, Mar 22, 2021 at 9:10 PM Wan Jiabing  wrote:
>
> dce110/dce110_resource.h has been included at line 58, so remove
> the duplicate include at line 64.
>
> Signed-off-by: Wan Jiabing 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c 
> b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> index 4a3df13c9e49..c4fe21b3b23f 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> @@ -61,7 +61,6 @@
>  #include "dcn21/dcn21_dccg.h"
>  #include "dcn21_hubbub.h"
>  #include "dcn10/dcn10_resource.h"
> -#include "dce110/dce110_resource.h"
>  #include "dce/dce_panel_cntl.h"
>
>  #include "dcn20/dcn20_dwb.h"
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] amdgpu: avoid incorrect %hu format string

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 22, 2021 at 7:55 AM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> clang points out that the %hu format string does not match the type
> of the variables here:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:263:7: warning: format specifies type 
> 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
>   version_major, version_minor);
>   ^
> include/drm/drm_print.h:498:19: note: expanded from macro 'DRM_ERROR'
> __drm_err(fmt, ##__VA_ARGS__)
>   ~~~^~~
>
> Change it to a regular %u, the same way a previous patch did for
> another instance of the same warning.
>
> Fixes: 0b437e64e0af ("drm/amdgpu: remove h from printk format specifier")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index e2ed4689118a..c6dbc0801604 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -259,7 +259,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
> if ((adev->asic_type == CHIP_POLARIS10 ||
>  adev->asic_type == CHIP_POLARIS11) &&
> (adev->uvd.fw_version < FW_1_66_16))
> -   DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu 
> is too old.\n",
> +   DRM_ERROR("POLARIS10/11 UVD firmware version %u.%u is 
> too old.\n",
>   version_major, version_minor);
> } else {
> unsigned int enc_major, enc_minor, dec_minor;
> --
> 2.29.2
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drivers: gpu: Remove duplicate include of amdgpu_hdp.h

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 22, 2021 at 8:10 AM Christian König
 wrote:
>
>
>
> Am 22.03.21 um 13:02 schrieb Wan Jiabing:
> > amdgpu_hdp.h has been included at line 91, so remove
> > the duplicate include.
> >
> > Signed-off-by: Wan Jiabing 
>
> Acked-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index 49267eb64302..68836c22ef25 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -107,7 +107,6 @@
> >   #include "amdgpu_gfxhub.h"
> >   #include "amdgpu_df.h"
> >   #include "amdgpu_smuio.h"
> > -#include "amdgpu_hdp.h"
> >
> >   #define MAX_GPU_INSTANCE16
> >
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sun, Mar 21, 2021 at 5:33 AM Qu Huang  wrote:
>
> Here is the system crash log:
> [ 1272.884438] BUG: unable to handle kernel NULL pointer dereference at
> (null)
> [ 1272.88] IP: [<  (null)>]   (null)
> [ 1272.884447] PGD 825b09067 PUD 8267c8067 PMD 0
> [ 1272.884452] Oops: 0010 [#1] SMP
> [ 1272.884509] CPU: 13 PID: 3485 Comm: cat Kdump: loaded Tainted: G
> [ 1272.884515] task: 9a38dbd4d140 ti: 9a37cd3b8000 task.ti:
> 9a37cd3b8000
> [ 1272.884517] RIP: 0010:[<>]  [<  (null)>]
> (null)
> [ 1272.884520] RSP: 0018:9a37cd3bbe68  EFLAGS: 00010203
> [ 1272.884522] RAX:  RBX:  RCX:
> 00014d5f
> [ 1272.884524] RDX: fff4 RSI: 0001 RDI:
> 9a38aca4d200
> [ 1272.884526] RBP: 9a37cd3bbed0 R08: 9a38dcd5f1a0 R09:
> 9a31ffc07300
> [ 1272.884527] R10: 9a31ffc07300 R11: addd5e9d R12:
> 9a38b4e0fb00
> [ 1272.884529] R13: 0001 R14: 9a37cd3bbf18 R15:
> 9a38aca4d200
> [ 1272.884532] FS:  7feccaa67740() GS:9a38dcd4()
> knlGS:
> [ 1272.884534] CS:  0010 DS:  ES:  CR0: 80050033
> [ 1272.884536] CR2:  CR3: 0008267c CR4:
> 003407e0
> [ 1272.884537] Call Trace:
> [ 1272.884544]  [] ? seq_read+0x130/0x440
> [ 1272.884548]  [] vfs_read+0x9f/0x170
> [ 1272.884552]  [] SyS_read+0x7f/0xf0
> [ 1272.884557]  [] system_call_fastpath+0x22/0x27
> [ 1272.884558] Code:  Bad RIP value.
> [ 1272.884562] RIP  [<  (null)>]   (null)
> [ 1272.884564]  RSP 
> [ 1272.884566] CR2: 
>
> Signed-off-by: Qu Huang 
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
> index 511712c..673d5e3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
> @@ -33,6 +33,11 @@ static int kfd_debugfs_open(struct inode *inode, struct 
> file *file)
>
> return single_open(file, show, NULL);
>  }
> +static int kfd_debugfs_hang_hws_read(struct seq_file *m, void *data)
> +{
> +   seq_printf(m, "echo gpu_id > hang_hws\n");
> +   return 0;
> +}
>
>  static ssize_t kfd_debugfs_hang_hws_write(struct file *file,
> const char __user *user_buf, size_t size, loff_t *ppos)
> @@ -94,7 +99,7 @@ void kfd_debugfs_init(void)
> debugfs_create_file("rls", S_IFREG | 0444, debugfs_root,
> kfd_debugfs_rls_by_device, _debugfs_fops);
> debugfs_create_file("hang_hws", S_IFREG | 0200, debugfs_root,
> -   NULL, _debugfs_hang_hws_fops);
> +   kfd_debugfs_hang_hws_read, 
> _debugfs_hang_hws_fops);
>  }
>
>  void kfd_debugfs_fini(void)
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/atomic: Couple of typo fixes

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sat, Mar 20, 2021 at 3:10 PM Randy Dunlap
 wrote:
>
>
>
> On Sun, 21 Mar 2021, Bhaskar Chowdhury wrote:
>
> >
> > s/seralization/serialization/
> > s/parallism/parallelism/
> >
> > Signed-off-by: Bhaskar Chowdhury 
>
> Acked-by: Randy Dunlap 
>
>
> > ---
> > drivers/gpu/drm/drm_atomic.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index dda60051854b..e1e4500aaca4 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -1148,7 +1148,7 @@ EXPORT_SYMBOL(drm_atomic_add_encoder_bridges);
> >  * This function walks the current configuration and adds all connectors
> >  * currently using @crtc to the atomic configuration @state. Note that this
> >  * function must acquire the connection mutex. This can potentially cause
> > - * unneeded seralization if the update is just for the planes on one CRTC. 
> > Hence
> > + * unneeded serialization if the update is just for the planes on one 
> > CRTC. Hence
> >  * drivers and helpers should only call this when really needed (e.g. when a
> >  * full modeset needs to happen due to some change).
> >  *
> > @@ -1213,7 +1213,7 @@ EXPORT_SYMBOL(drm_atomic_add_affected_connectors);
> >  *
> >  * Since acquiring a plane state will always also acquire the w/w mutex of 
> > the
> >  * current CRTC for that plane (if there is any) adding all the plane 
> > states for
> > - * a CRTC will not reduce parallism of atomic updates.
> > + * a CRTC will not reduce parallelism of atomic updates.
> >  *
> >  * Returns:
> >  * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is 
> > EDEADLK
> > --
> > 2.26.2
> >
> >
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/radeon: don't evict if not initialized

2021-03-23 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 22, 2021 at 3:40 AM Christian König
 wrote:
>
> Am 21.03.21 um 16:19 schrieb Tong Zhang:
> > TTM_PL_VRAM may not initialized at all when calling
> > radeon_bo_evict_vram(). We need to check before doing eviction.
> >
> > [2.160837] BUG: kernel NULL pointer dereference, address: 
> > 0020
> > [2.161212] #PF: supervisor read access in kernel mode
> > [2.161490] #PF: error_code(0x) - not-present page
> > [2.161767] PGD 0 P4D 0
> > [2.163088] RIP: 0010:ttm_resource_manager_evict_all+0x70/0x1c0 [ttm]
> > [2.168506] Call Trace:
> > [2.168641]  radeon_bo_evict_vram+0x1c/0x20 [radeon]
> > [2.168936]  radeon_device_fini+0x28/0xf9 [radeon]
> > [2.169224]  radeon_driver_unload_kms+0x44/0xa0 [radeon]
> > [2.169534]  radeon_driver_load_kms+0x174/0x210 [radeon]
> > [2.169843]  drm_dev_register+0xd9/0x1c0 [drm]
> > [2.170104]  radeon_pci_probe+0x117/0x1a0 [radeon]
> >
> > Suggested-by: Christian König 
> > Signed-off-by: Tong Zhang 
>
> Reviewed-by: Christian König 
>
> > ---
> > v2: coding style fix
> >
> >   drivers/gpu/drm/radeon/radeon_object.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
> > b/drivers/gpu/drm/radeon/radeon_object.c
> > index 9b81786782de..499ce55e34cc 100644
> > --- a/drivers/gpu/drm/radeon/radeon_object.c
> > +++ b/drivers/gpu/drm/radeon/radeon_object.c
> > @@ -384,6 +384,8 @@ int radeon_bo_evict_vram(struct radeon_device *rdev)
> >   }
> >   #endif
> >   man = ttm_manager_type(bdev, TTM_PL_VRAM);
> > + if (!man)
> > + return 0;
> >   return ttm_resource_manager_evict_all(bdev, man);
> >   }
> >
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/display: Set AMDGPU_DM_DEFAULT_MIN_BACKLIGHT to 0

2021-03-22 Thread Alex Deucher
On Sun, Mar 21, 2021 at 8:12 PM Evan Benn  wrote:
>
> On Sat, Mar 20, 2021 at 8:36 AM Alex Deucher  wrote:
> >
> > On Fri, Mar 19, 2021 at 5:31 PM Evan Benn  wrote:
> > >
> > > On Sat, 20 Mar 2021 at 02:10, Harry Wentland  
> > > wrote:
> > > > On 2021-03-19 10:22 a.m., Alex Deucher wrote:
> > > > > On Fri, Mar 19, 2021 at 3:23 AM Evan Benn  
> > > > > wrote:
> > > > >>
> > > > >> AMDGPU_DM_DEFAULT_MIN_BACKLIGHT was set to the value of 12
> > > > >> to ensure no display backlight will flicker at low user brightness
> > > > >> settings. However this value is quite bright, so for devices that do 
> > > > >> not
> > > > >> implement the ACPI ATIF
> > > > >> ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
> > > > >> functionality the user cannot set the brightness to a low level even 
> > > > >> if
> > > > >> the display would support such a low PWM.
> > > > >>
> > > > >> This ATIF feature is not implemented on for example AMD grunt 
> > > > >> chromebooks.
> > > > >>
> > > > >> Signed-off-by: Evan Benn 
> > > > >>
> > > > >> ---
> > > > >> I could not find a justification for the reason for the value. It has
> > > > >> caused some noticable regression for users: 
> > > > >> https://bugzilla.kernel.org/show_bug.cgi?id=203439>>>
> > > > >> Maybe this can be either user controlled or userspace configured, but
> > > > >> preventing users from turning their backlight dim seems wrong.
> > > > >
> > > > > My understanding is that some panels flicker if you set the min to a
> > > > > value too low.  This was a safe minimum if the platform didn't specify
> > > > > it's own safe minimum.  I think we'd just be trading one bug for
> > > > > another (flickering vs not dim enough).  Maybe a whitelist or
> > > > > blacklist would be a better solution?
> > > > >
> > > >
> > > > Yeah, this is a NACK from me as-is for the reasons Alex described.
> > >
> > > Thanks Harry + Alex,
> > >
> > > I agree this solution is not the best.
> > >
> > > >
> > > > I agree a whitelist approach might be best.
> > >
> > > Do you have any idea what an allowlist could be keyed on?
> > > Is the flickering you observed here a function of the panel or the gpu
> > > or some other component?
> > > Maybe we could move the minimum level into the logic for that hardware.
> > >
> >
> > Maybe the panel string from the EDID?  Either that or something from
> > dmi data?  Harry would probably have a better idea.
>
> One problem with keying from panel EDID is that for example the grunt 
> chromebook
> platform has more than 100 different panels already shipped. Add to that that
> repair centers or people repairing their own device will use 'compatible'
> panels. I'm sure the AMD windows laptops have even more variety!
>

Do all of those "compatible" panels work with the min backlight level
of 0?  If so, maybe something platform specific like a DMI string
would make more sense.

Alex


> >
> > Alex
> >
> > > >
> > > > Is this fix perhaps for OLED panels? If so we could use a different
> > > > min-value for OLED panels that don't do PWM, but use 12 for everything 
> > > > else.
> > >
> > > All the chromebooks I have worked with LCD + LED backlight have been
> > > fine with a backlight set to 0.
> > > We do have OLED panels too, but I'm not aware of what they do.
> > >
> > > > Harry
> > > >
> > > > > Alex
> > > > >
> > > > >
> > > > >>
> > > > >> Also reviewed here: 
> > > > >> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2748377>>>
> > > > >>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
> > > > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >>
> > > > >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> > > > >> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > > >> index 573cf17262da..0129bd69b94e 100644
> > > > >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > > >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > > >> @@ -3151,7 +3151,7 @@ static int amdgpu_dm_mode_config_init(struct 
> > > > >> amdgpu_device *adev)
> > > > >>  return 0;
> > > > >>   }
> > > > >>
> > > > >> -#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 12
> > > > >> +#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 0
> > > > >>   #define AMDGPU_DM_DEFAULT_MAX_BACKLIGHT 255
> > > > >>   #define AUX_BL_DEFAULT_TRANSITION_TIME_MS 50
> > > > >>
> > > > >> --
> > > > >> 2.31.0.291.g576ba9dcdaf-goog
> > > > >>
> > > > >> ___
> > > > >> dri-devel mailing list
> > > > >> dri-de...@lists.freedesktop.org
> > > > >> https://lists.freedesktop.org/mailman/listinfo/dri-devel>> 
> > > > >> ___
> > > > > dri-devel mailing list
> > > > > dri-de...@lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel>>
> > > >


Re: [PATCH V2] drm/amdgpu: Fix a typo

2021-03-22 Thread Alex Deucher
On Sat, Mar 20, 2021 at 3:52 AM Randy Dunlap
 wrote:
>
>
>
> On Fri, 19 Mar 2021, Bhaskar Chowdhury wrote:
>
> > s/traing/training/
> >
> > ...Plus the entire sentence construction for better readability.
> >
> > Signed-off-by: Bhaskar Chowdhury 
> > ---
> > Changes from V1:
> >  Alex and Randy's suggestions incorporated.
> >
> > drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 8 
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > index c325d6f53a71..bf3857867f51 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > @@ -661,10 +661,10 @@ static int psp_v11_0_memory_training(struct 
> > psp_context *psp, uint32_t ops)
> >
> >   if (ops & PSP_MEM_TRAIN_SEND_LONG_MSG) {
> >   /*
> > -  * Long traing will encroach certain mount of bottom VRAM,
> > -  * saving the content of this bottom VRAM to system memory
> > -  * before training, and restoring it after training to avoid
> > -  * VRAM corruption.
> > +  * Long training will encroach a certain amount on the bottom 
> > of VRAM;
> > + * save the content from the bottom VRAM to system memory
> > + * before training, and restore it after training to avoid
> > + * VRAM corruption.
>
> These 3 new lines are indented with spaces instead of tabs. Oops.  :(
>
> (I may be too late with this comment -- sorry about that.)

I fixed that up when I applied it.

Thanks,

Alex


>
> >*/
> >   sz = GDDR6_MEM_TRAINING_ENCROACHED_SIZE;
> >
> > --
> > 2.26.2
> >
> >
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Set AMDGPU_DM_DEFAULT_MIN_BACKLIGHT to 0

2021-03-19 Thread Alex Deucher
On Fri, Mar 19, 2021 at 5:31 PM Evan Benn  wrote:
>
> On Sat, 20 Mar 2021 at 02:10, Harry Wentland  wrote:
> > On 2021-03-19 10:22 a.m., Alex Deucher wrote:
> > > On Fri, Mar 19, 2021 at 3:23 AM Evan Benn  wrote:
> > >>
> > >> AMDGPU_DM_DEFAULT_MIN_BACKLIGHT was set to the value of 12
> > >> to ensure no display backlight will flicker at low user brightness
> > >> settings. However this value is quite bright, so for devices that do not
> > >> implement the ACPI ATIF
> > >> ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
> > >> functionality the user cannot set the brightness to a low level even if
> > >> the display would support such a low PWM.
> > >>
> > >> This ATIF feature is not implemented on for example AMD grunt 
> > >> chromebooks.
> > >>
> > >> Signed-off-by: Evan Benn 
> > >>
> > >> ---
> > >> I could not find a justification for the reason for the value. It has
> > >> caused some noticable regression for users: 
> > >> https://bugzilla.kernel.org/show_bug.cgi?id=203439>>>
> > >> Maybe this can be either user controlled or userspace configured, but
> > >> preventing users from turning their backlight dim seems wrong.
> > >
> > > My understanding is that some panels flicker if you set the min to a
> > > value too low.  This was a safe minimum if the platform didn't specify
> > > it's own safe minimum.  I think we'd just be trading one bug for
> > > another (flickering vs not dim enough).  Maybe a whitelist or
> > > blacklist would be a better solution?
> > >
> >
> > Yeah, this is a NACK from me as-is for the reasons Alex described.
>
> Thanks Harry + Alex,
>
> I agree this solution is not the best.
>
> >
> > I agree a whitelist approach might be best.
>
> Do you have any idea what an allowlist could be keyed on?
> Is the flickering you observed here a function of the panel or the gpu
> or some other component?
> Maybe we could move the minimum level into the logic for that hardware.
>

Maybe the panel string from the EDID?  Either that or something from
dmi data?  Harry would probably have a better idea.

Alex

> >
> > Is this fix perhaps for OLED panels? If so we could use a different
> > min-value for OLED panels that don't do PWM, but use 12 for everything else.
>
> All the chromebooks I have worked with LCD + LED backlight have been
> fine with a backlight set to 0.
> We do have OLED panels too, but I'm not aware of what they do.
>
> > Harry
> >
> > > Alex
> > >
> > >
> > >>
> > >> Also reviewed here: 
> > >> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2748377>>>
> > >>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> > >> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> index 573cf17262da..0129bd69b94e 100644
> > >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> @@ -3151,7 +3151,7 @@ static int amdgpu_dm_mode_config_init(struct 
> > >> amdgpu_device *adev)
> > >>  return 0;
> > >>   }
> > >>
> > >> -#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 12
> > >> +#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 0
> > >>   #define AMDGPU_DM_DEFAULT_MAX_BACKLIGHT 255
> > >>   #define AUX_BL_DEFAULT_TRANSITION_TIME_MS 50
> > >>
> > >> --
> > >> 2.31.0.291.g576ba9dcdaf-goog
> > >>
> > >> ___
> > >> dri-devel mailing list
> > >> dri-de...@lists.freedesktop.org
> > >> https://lists.freedesktop.org/mailman/listinfo/dri-devel>> 
> > >> ___
> > > dri-devel mailing list
> > > dri-de...@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel>>
> >


Re: [PATCH 06/19] drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap

2021-03-19 Thread Alex Deucher
On Fri, Mar 19, 2021 at 2:47 PM Christian König
 wrote:
>
>
>
> Am 19.03.21 um 19:26 schrieb Harry Wentland:
> > On 2021-03-19 2:13 p.m., Alex Deucher wrote:
> >> + Harry, Nick
> >>
> >> On Fri, Mar 19, 2021 at 4:24 AM Lee Jones  wrote:
> >>>
> >>> Fixes the following W=1 kernel build warning(s):
> >>>
> >>>   drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In
> >>> function ‘calculate_bandwidth’:
> >>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2016:1:
> >>> warning: the frame size of 1216 bytes is larger than 1024 bytes
> >>> [-Wframe-larger-than=]
> >>>
> >>> Cc: Harry Wentland 
> >>> Cc: Leo Li 
> >>> Cc: Alex Deucher 
> >>> Cc: "Christian König" 
> >>> Cc: David Airlie 
> >>> Cc: Daniel Vetter 
> >>> Cc: Colin Ian King 
> >>> Cc: amd-...@lists.freedesktop.org
> >>> Cc: dri-de...@lists.freedesktop.org
> >>> Signed-off-by: Lee Jones 
> >>> ---
> >>>   .../gpu/drm/amd/display/dc/calcs/dce_calcs.c  | 32
> >>> ---
> >>>   1 file changed, 28 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >>> b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >>> index e633f8a51edb6..9d8f2505a61c2 100644
> >>> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >>> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >>> @@ -98,16 +98,16 @@ static void calculate_bandwidth(
> >>>  int32_t num_cursor_lines;
> >>>
> >>>  int32_t i, j, k;
> >>> -   struct bw_fixed yclk[3];
> >>> -   struct bw_fixed sclk[8];
> >>> +   struct bw_fixed *yclk;
> >>> +   struct bw_fixed *sclk;
> >>>  bool d0_underlay_enable;
> >>>  bool d1_underlay_enable;
> >>>  bool fbc_enabled;
> >>>  bool lpt_enabled;
> >>>  enum bw_defines sclk_message;
> >>>  enum bw_defines yclk_message;
> >>> -   enum bw_defines tiling_mode[maximum_number_of_surfaces];
> >>> -   enum bw_defines surface_type[maximum_number_of_surfaces];
> >>> +   enum bw_defines *tiling_mode;
> >>> +   enum bw_defines *surface_type;
> >>>  enum bw_defines voltage;
> >>>  enum bw_defines pipe_check;
> >>>  enum bw_defines hsr_check;
> >>> @@ -122,6 +122,22 @@ static void calculate_bandwidth(
> >>>  int32_t number_of_displays_enabled_with_margin = 0;
> >>>  int32_t number_of_aligned_displays_with_no_margin = 0;
> >>>
> >>> +   yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL);
> >>> +   if (!yclk)
> >>> +   return;
> >>> +
> >>> +   sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL);
> >>> +   if (!sclk)
> >>> +   goto free_yclk;
> >>> +
> >>> +   tiling_mode = kcalloc(maximum_number_of_surfaces,
> >>> sizeof(*tiling_mode), GFP_KERNEL);
> >>> +   if (!tiling_mode)
> >>> +   goto free_sclk;
> >>> +
> >>> +   surface_type = kcalloc(maximum_number_of_surfaces,
> >>> sizeof(*surface_type), GFP_KERNEL);
> >>> +   if (!surface_type)
> >>> +   goto free_tiling_mode;
> >>> +
> >>
> >>
> >> Harry or Nick can correct me if I'm wrong, but for this patch and the
> >> next one, I think this can be called from an atomic context.
> >>
> >
> > From what I can see this doesn't seem the case. If I'm missing
> > something someone please correct me.
>
> Have you taken into account that using FP functions require atomic
> context as well?
>
> We had quite a bunch of problems with that and had to replace some
> GFP_KERNEL with GFP_ATOMIC in the DC code because of this.
>
> Could of course be that this code here isn't affected by that, but
> better save than sorry.

DCE hardware uses fixed point math so that should be ok.  It's just
the newer DCN hardware that requires FP.

Alex


>
> Christian.
>
> >
> > This and the next (06/19) patch are both
> > Reviewed-by: Harry Wentland 
> >
> > Harry
> >
> >> Alex
> >>
> >>>  yclk[low] = vbios->low_yclk;
> >>>  yclk[mid] = vbios->mid_yclk;
> >>>  yclk[high] = vbios->high_yclk;
> >>> @@ -2013,6 +2029,14 @@ static void calculate_bandwidth(
> >>>  }
> >>>  }
> >>>  }
> >>> +
> >>> +   kfree(surface_type);
> >>> +free_tiling_mode:
> >>> +   kfree(tiling_mode);
> >>> +free_yclk:
> >>> +   kfree(yclk);
> >>> +free_sclk:
> >>> +   kfree(sclk);
> >>>   }
> >>>
> >>> /***
> >>> --
> >>> 2.27.0
> >>>
> >>> ___
> >>> dri-devel mailing list
> >>> dri-de...@lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/dri-devel>
>


Re: [PATCH 06/19] drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap

2021-03-19 Thread Alex Deucher
On Fri, Mar 19, 2021 at 2:26 PM Harry Wentland  wrote:
>
> On 2021-03-19 2:13 p.m., Alex Deucher wrote:
> > + Harry, Nick
> >
> > On Fri, Mar 19, 2021 at 4:24 AM Lee Jones  wrote:
> >>
> >> Fixes the following W=1 kernel build warning(s):
> >>
> >>   drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function 
> >> ‘calculate_bandwidth’:
> >>   drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2016:1: 
> >> warning: the frame size of 1216 bytes is larger than 1024 bytes 
> >> [-Wframe-larger-than=]
> >>
> >> Cc: Harry Wentland 
> >> Cc: Leo Li 
> >> Cc: Alex Deucher 
> >> Cc: "Christian König" 
> >> Cc: David Airlie 
> >> Cc: Daniel Vetter 
> >> Cc: Colin Ian King 
> >> Cc: amd-...@lists.freedesktop.org
> >> Cc: dri-de...@lists.freedesktop.org
> >> Signed-off-by: Lee Jones 
> >> ---
> >>   .../gpu/drm/amd/display/dc/calcs/dce_calcs.c  | 32 ---
> >>   1 file changed, 28 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c 
> >> b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >> index e633f8a51edb6..9d8f2505a61c2 100644
> >> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> >> @@ -98,16 +98,16 @@ static void calculate_bandwidth(
> >>  int32_t num_cursor_lines;
> >>
> >>  int32_t i, j, k;
> >> -   struct bw_fixed yclk[3];
> >> -   struct bw_fixed sclk[8];
> >> +   struct bw_fixed *yclk;
> >> +   struct bw_fixed *sclk;
> >>  bool d0_underlay_enable;
> >>  bool d1_underlay_enable;
> >>  bool fbc_enabled;
> >>  bool lpt_enabled;
> >>  enum bw_defines sclk_message;
> >>  enum bw_defines yclk_message;
> >> -   enum bw_defines tiling_mode[maximum_number_of_surfaces];
> >> -   enum bw_defines surface_type[maximum_number_of_surfaces];
> >> +   enum bw_defines *tiling_mode;
> >> +   enum bw_defines *surface_type;
> >>  enum bw_defines voltage;
> >>  enum bw_defines pipe_check;
> >>  enum bw_defines hsr_check;
> >> @@ -122,6 +122,22 @@ static void calculate_bandwidth(
> >>  int32_t number_of_displays_enabled_with_margin = 0;
> >>  int32_t number_of_aligned_displays_with_no_margin = 0;
> >>
> >> +   yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL);
> >> +   if (!yclk)
> >> +   return;
> >> +
> >> +   sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL);
> >> +   if (!sclk)
> >> +   goto free_yclk;
> >> +
> >> +   tiling_mode = kcalloc(maximum_number_of_surfaces, 
> >> sizeof(*tiling_mode), GFP_KERNEL);
> >> +   if (!tiling_mode)
> >> +   goto free_sclk;
> >> +
> >> +   surface_type = kcalloc(maximum_number_of_surfaces, 
> >> sizeof(*surface_type), GFP_KERNEL);
> >> +   if (!surface_type)
> >> +   goto free_tiling_mode;
> >> +
> >
> >
> > Harry or Nick can correct me if I'm wrong, but for this patch and the
> > next one, I think this can be called from an atomic context.
> >
>
>  From what I can see this doesn't seem the case. If I'm missing
> something someone please correct me.
>
> This and the next (06/19) patch are both
> Reviewed-by: Harry Wentland 

Thanks.  I've applied them.

Alex


>
> Harry
>
> > Alex
> >
> >>  yclk[low] = vbios->low_yclk;
> >>  yclk[mid] = vbios->mid_yclk;
> >>  yclk[high] = vbios->high_yclk;
> >> @@ -2013,6 +2029,14 @@ static void calculate_bandwidth(
> >>  }
> >>  }
> >>  }
> >> +
> >> +   kfree(surface_type);
> >> +free_tiling_mode:
> >> +   kfree(tiling_mode);
> >> +free_yclk:
> >> +   kfree(yclk);
> >> +free_sclk:
> >> +   kfree(sclk);
> >>   }
> >>
> >>   
> >> /***
> >> --
> >> 2.27.0
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-de...@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel>


Re: [PATCH 08/19] drm/amd/display/dc/dce80/dce80_resource: Make local functions static

2021-03-19 Thread Alex Deucher
On Fri, Mar 19, 2021 at 4:24 AM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:527:17: 
> warning: no previous prototype for ‘dce80_aux_engine_create’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:565:20: 
> warning: no previous prototype for ‘dce80_i2c_hw_create’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:581:20: 
> warning: no previous prototype for ‘dce80_i2c_sw_create’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:715:22: 
> warning: no previous prototype for ‘dce80_link_encoder_create’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:754:22: 
> warning: no previous prototype for ‘dce80_clock_source_create’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:778:6: 
> warning: no previous prototype for ‘dce80_clock_source_destroy’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:868:6: 
> warning: no previous prototype for ‘dce80_validate_bandwidth’ 
> [-Wmissing-prototypes]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.c:913:16: 
> warning: no previous prototype for ‘dce80_validate_global’ 
> [-Wmissing-prototypes]
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Anthony Koo 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  .../drm/amd/display/dc/dce80/dce80_resource.c| 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c 
> b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
> index 612450f992782..725d92e40cd30 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
> @@ -526,7 +526,7 @@ static struct output_pixel_processor *dce80_opp_create(
> return >base;
>  }
>
> -struct dce_aux *dce80_aux_engine_create(
> +static struct dce_aux *dce80_aux_engine_create(
> struct dc_context *ctx,
> uint32_t inst)
>  {
> @@ -564,7 +564,7 @@ static const struct dce_i2c_mask i2c_masks = {
> I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
>  };
>
> -struct dce_i2c_hw *dce80_i2c_hw_create(
> +static struct dce_i2c_hw *dce80_i2c_hw_create(
> struct dc_context *ctx,
> uint32_t inst)
>  {
> @@ -580,7 +580,7 @@ struct dce_i2c_hw *dce80_i2c_hw_create(
> return dce_i2c_hw;
>  }
>
> -struct dce_i2c_sw *dce80_i2c_sw_create(
> +static struct dce_i2c_sw *dce80_i2c_sw_create(
> struct dc_context *ctx)
>  {
> struct dce_i2c_sw *dce_i2c_sw =
> @@ -714,7 +714,7 @@ static const struct encoder_feature_support 
> link_enc_feature = {
> .flags.bits.IS_TPS3_CAPABLE = true
>  };
>
> -struct link_encoder *dce80_link_encoder_create(
> +static struct link_encoder *dce80_link_encoder_create(
> const struct encoder_init_data *enc_init_data)
>  {
> struct dce110_link_encoder *enc110 =
> @@ -753,7 +753,7 @@ static struct panel_cntl *dce80_panel_cntl_create(const 
> struct panel_cntl_init_d
> return _cntl->base;
>  }
>
> -struct clock_source *dce80_clock_source_create(
> +static struct clock_source *dce80_clock_source_create(
> struct dc_context *ctx,
> struct dc_bios *bios,
> enum clock_source_id id,
> @@ -777,7 +777,7 @@ struct clock_source *dce80_clock_source_create(
> return NULL;
>  }
>
> -void dce80_clock_source_destroy(struct clock_source **clk_src)
> +static void dce80_clock_source_destroy(struct clock_source **clk_src)
>  {
> kfree(TO_DCE110_CLK_SRC(*clk_src));
> *clk_src = NULL;
> @@ -867,7 +867,7 @@ static void dce80_resource_destruct(struct 
> dce110_resource_pool *pool)
> }
>  }
>
> -bool dce80_validate_bandwidth(
> +static bool dce80_validate_bandwidth(
> struct dc *dc,
> struct dc_state *context,
> bool fast_validate)
> @@ -912,7 +912,7 @@ static bool dce80_validate_surface_sets(
> return true;
>  }
>
> -enum dc_status dce80_validate_global(
> +static enum dc_status dce80_validate_global(
> struct dc *dc,
> struct dc_state *context)
>  {
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/19] drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap

2021-03-19 Thread Alex Deucher
+ Harry, Nick

On Fri, Mar 19, 2021 at 4:24 AM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function 
> ‘calculate_bandwidth’:
>  drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2016:1: warning: 
> the frame size of 1216 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Colin Ian King 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  .../gpu/drm/amd/display/dc/calcs/dce_calcs.c  | 32 ---
>  1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c 
> b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> index e633f8a51edb6..9d8f2505a61c2 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> @@ -98,16 +98,16 @@ static void calculate_bandwidth(
> int32_t num_cursor_lines;
>
> int32_t i, j, k;
> -   struct bw_fixed yclk[3];
> -   struct bw_fixed sclk[8];
> +   struct bw_fixed *yclk;
> +   struct bw_fixed *sclk;
> bool d0_underlay_enable;
> bool d1_underlay_enable;
> bool fbc_enabled;
> bool lpt_enabled;
> enum bw_defines sclk_message;
> enum bw_defines yclk_message;
> -   enum bw_defines tiling_mode[maximum_number_of_surfaces];
> -   enum bw_defines surface_type[maximum_number_of_surfaces];
> +   enum bw_defines *tiling_mode;
> +   enum bw_defines *surface_type;
> enum bw_defines voltage;
> enum bw_defines pipe_check;
> enum bw_defines hsr_check;
> @@ -122,6 +122,22 @@ static void calculate_bandwidth(
> int32_t number_of_displays_enabled_with_margin = 0;
> int32_t number_of_aligned_displays_with_no_margin = 0;
>
> +   yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL);
> +   if (!yclk)
> +   return;
> +
> +   sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL);
> +   if (!sclk)
> +   goto free_yclk;
> +
> +   tiling_mode = kcalloc(maximum_number_of_surfaces, 
> sizeof(*tiling_mode), GFP_KERNEL);
> +   if (!tiling_mode)
> +   goto free_sclk;
> +
> +   surface_type = kcalloc(maximum_number_of_surfaces, 
> sizeof(*surface_type), GFP_KERNEL);
> +   if (!surface_type)
> +   goto free_tiling_mode;
> +


Harry or Nick can correct me if I'm wrong, but for this patch and the
next one, I think this can be called from an atomic context.

Alex

> yclk[low] = vbios->low_yclk;
> yclk[mid] = vbios->mid_yclk;
> yclk[high] = vbios->high_yclk;
> @@ -2013,6 +2029,14 @@ static void calculate_bandwidth(
> }
> }
> }
> +
> +   kfree(surface_type);
> +free_tiling_mode:
> +   kfree(tiling_mode);
> +free_yclk:
> +   kfree(yclk);
> +free_sclk:
> +   kfree(sclk);
>  }
>
>  
> /***
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Set AMDGPU_DM_DEFAULT_MIN_BACKLIGHT to 0

2021-03-19 Thread Alex Deucher
On Fri, Mar 19, 2021 at 3:23 AM Evan Benn  wrote:
>
> AMDGPU_DM_DEFAULT_MIN_BACKLIGHT was set to the value of 12
> to ensure no display backlight will flicker at low user brightness
> settings. However this value is quite bright, so for devices that do not
> implement the ACPI ATIF
> ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
> functionality the user cannot set the brightness to a low level even if
> the display would support such a low PWM.
>
> This ATIF feature is not implemented on for example AMD grunt chromebooks.
>
> Signed-off-by: Evan Benn 
>
> ---
> I could not find a justification for the reason for the value. It has
> caused some noticable regression for users: 
> https://bugzilla.kernel.org/show_bug.cgi?id=203439
>
> Maybe this can be either user controlled or userspace configured, but
> preventing users from turning their backlight dim seems wrong.

My understanding is that some panels flicker if you set the min to a
value too low.  This was a safe minimum if the platform didn't specify
it's own safe minimum.  I think we'd just be trading one bug for
another (flickering vs not dim enough).  Maybe a whitelist or
blacklist would be a better solution?

Alex


>
> Also reviewed here: 
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2748377
>
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 573cf17262da..0129bd69b94e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3151,7 +3151,7 @@ static int amdgpu_dm_mode_config_init(struct 
> amdgpu_device *adev)
> return 0;
>  }
>
> -#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 12
> +#define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 0
>  #define AMDGPU_DM_DEFAULT_MAX_BACKLIGHT 255
>  #define AUX_BL_DEFAULT_TRANSITION_TIME_MS 50
>
> --
> 2.31.0.291.g576ba9dcdaf-goog
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu: Fix a typo

2021-03-18 Thread Alex Deucher
Applied both patches.  Thanks!

Alex

On Thu, Mar 18, 2021 at 7:20 PM Bhaskar Chowdhury  wrote:
>
>
> s/proces/process/
>
> Signed-off-by: Bhaskar Chowdhury 
> ---
>  drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c 
> b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> index bf3857867f51..c1d5a3085bae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> @@ -598,7 +598,7 @@ static int psp_v11_0_memory_training_send_msg(struct 
> psp_context *psp, int msg)
>  }
>
>  /*
> - * save and restore proces
> + * save and restore process
>   */
>  static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops)
>  {
> --
> 2.26.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages

2021-03-18 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 18, 2021 at 5:00 AM Koenig, Christian
 wrote:
>
> Reviewed-by: Christian König 
> 
> Von: Daniel Gomez 
> Gesendet: Donnerstag, 18. März 2021 09:32
> Cc: dag...@gmail.com ; Daniel Gomez ; 
> Deucher, Alexander ; Koenig, Christian 
> ; David Airlie ; Daniel Vetter 
> ; amd-...@lists.freedesktop.org 
> ; dri-de...@lists.freedesktop.org 
> ; linux-kernel@vger.kernel.org 
> 
> Betreff: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages
>
> If userptr pages have been pinned but not bounded,
> they remain uncleared.
>
> Signed-off-by: Daniel Gomez 
> ---
>  drivers/gpu/drm/radeon/radeon_ttm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
> b/drivers/gpu/drm/radeon/radeon_ttm.c
> index e8c66d10478f..bbcc6264d48f 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -485,13 +485,14 @@ static void radeon_ttm_backend_unbind(struct 
> ttm_bo_device *bdev, struct ttm_tt
>  struct radeon_ttm_tt *gtt = (void *)ttm;
>  struct radeon_device *rdev = radeon_get_rdev(bdev);
>
> +   if (gtt->userptr)
> +   radeon_ttm_tt_unpin_userptr(bdev, ttm);
> +
>  if (!gtt->bound)
>  return;
>
>  radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages);
>
> -   if (gtt->userptr)
> -   radeon_ttm_tt_unpin_userptr(bdev, ttm);
>  gtt->bound = false;
>  }
>
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu/ttm: Fix memory leak userptr pages

2021-03-18 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 17, 2021 at 12:09 PM Daniel Gomez  wrote:
>
> If userptr pages have been pinned but not bounded,
> they remain uncleared.
>
> Signed-off-by: Daniel Gomez 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 9fd2157b133a..50c2b4827c13 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct 
> ttm_bo_device *bdev,
> struct amdgpu_ttm_tt *gtt = (void *)ttm;
> int r;
>
> -   if (!gtt->bound)
> -   return;
> -
> /* if the pages have userptr pinning then clear that first */
> if (gtt->userptr)
> amdgpu_ttm_tt_unpin_userptr(bdev, ttm);
>
> +   if (!gtt->bound)
> +   return;
> +
> if (gtt->offset == AMDGPU_BO_INVALID_OFFSET)
> return;
>
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu: Fix a typo

2021-03-18 Thread Alex Deucher
On Thu, Mar 18, 2021 at 2:08 PM Randy Dunlap  wrote:
>
> On 3/18/21 4:33 AM, Bhaskar Chowdhury wrote:
> >
> > s/traing/training/
> >
> > Signed-off-by: Bhaskar Chowdhury 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > index c325d6f53a71..db18e4f6cf5f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> > @@ -661,7 +661,7 @@ static int psp_v11_0_memory_training(struct psp_context 
> > *psp, uint32_t ops)
> >
> >   if (ops & PSP_MEM_TRAIN_SEND_LONG_MSG) {
> >   /*
> > -  * Long traing will encroach certain mount of bottom VRAM,
> > +  * Long training will encroach certain mount of bottom VRAM,
>
>amount
> I think.

Yeah, I think it should read something like:

Long training will encroach a certain amount on the bottom of VRAM;
save the content from the bottom VRAM to system memory
before training, and restore it after training to avoid
VRAM corruption.

Alex

>
> >* saving the content of this bottom VRAM to system memory
> >* before training, and restoring it after training to avoid
> >* VRAM corruption.
> > --
> > 2.26.2
> >
>
>
> --
> ~Randy
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-17 Thread Alex Deucher
On Wed, Mar 17, 2021 at 10:37 PM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c:220:65-70:
> WARNING: conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks.  In general, you can just roll up most these bool
conversion patches into larger patches; no need to fix them all one at
a time.

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c
> index 8593145..3fe9e41 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c
> @@ -217,7 +217,7 @@ static bool dwb3_program_ogam_lut(
> else
> next_mode = LUT_RAM_A;
>
> -   dwb3_configure_ogam_lut(dwbc30, next_mode == LUT_RAM_A ? true : 
> false);
> +   dwb3_configure_ogam_lut(dwbc30, next_mode == LUT_RAM_A);
>
> if (next_mode == LUT_RAM_A)
> dwb3_program_ogam_luta_settings(dwbc30, params);
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-17 Thread Alex Deucher
On Tue, Mar 16, 2021 at 4:09 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c:721:65-70: WARNING:
> conversion to bool not needed here.
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c:1139:67-72: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c
> index 6e864b1..434d3c4 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c
> @@ -718,7 +718,7 @@ bool dpp3_program_blnd_lut(
> next_mode = LUT_RAM_B;
>
> dpp3_power_on_blnd_lut(dpp_base, true);
> -   dpp3_configure_blnd_lut(dpp_base, next_mode == LUT_RAM_A ? 
> true:false);
> +   dpp3_configure_blnd_lut(dpp_base, next_mode == LUT_RAM_A);
>
> if (next_mode == LUT_RAM_A)
> dpp3_program_blnd_luta_settings(dpp_base, params);
> @@ -1136,7 +1136,7 @@ bool dpp3_program_shaper(
> else
> next_mode = LUT_RAM_A;
>
> -   dpp3_configure_shaper_lut(dpp_base, next_mode == LUT_RAM_A ? 
> true:false);
> +   dpp3_configure_shaper_lut(dpp_base, next_mode == LUT_RAM_A);
>
> if (next_mode == LUT_RAM_A)
> dpp3_program_shaper_luta_settings(dpp_base, params);
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-15 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 15, 2021 at 4:22 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c:358:69-74: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
> index 3e6f760..e153109 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
> @@ -355,7 +355,7 @@ void mpc3_set_output_gamma(
> next_mode = LUT_RAM_A;
>
> mpc3_power_on_ogam_lut(mpc, mpcc_id, true);
> -   mpc3_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A ? 
> true:false);
> +   mpc3_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A);
>
> if (next_mode == LUT_RAM_A)
> mpc3_program_luta(mpc, mpcc_id, params);
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH V2] drm: amd: pm: Mundane typo fixes in the file amdgpu_pm.c

2021-03-15 Thread Alex Deucher
On Sun, Mar 14, 2021 at 11:22 PM Bhaskar Chowdhury
 wrote:
>
>
> s/"an minimum"/"a minimum"/
> s/"an maxmum"/"a maximum"/
>
> Signed-off-by: Bhaskar Chowdhury 

Applied.  Thanks!

Alex

> ---
>  Changes from V1:
>   Randy's suggestion to adjust the subject line text
>   And missed out a spell too,which now included
>
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
> b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index 5fa65f191a37..308249ae1a22 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -3315,9 +3315,9 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct 
> device *dev,
>   *
>   * - pwm1_max: pulse width modulation fan control maximum level (255)
>   *
> - * - fan1_min: an minimum value Unit: revolution/min (RPM)
> + * - fan1_min: a minimum value Unit: revolution/min (RPM)
>   *
> - * - fan1_max: an maxmum value Unit: revolution/max (RPM)
> + * - fan1_max: a maximum value Unit: revolution/max (RPM)
>   *
>   * - fan1_input: fan speed in RPM
>   *
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: remove redundant initialization of variable result

2021-03-15 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 11, 2021 at 11:34 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> The variable result is being initialized with a value that is
> never read and it is being updated later with a new value.  The
> initialization is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 099f43709060..47e6c33f73cb 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
> @@ -4281,7 +4281,7 @@ void dp_set_panel_mode(struct dc_link *link, enum 
> dp_panel_mode panel_mode)
>
> if (edp_config_set.bits.PANEL_MODE_EDP
> != panel_mode_edp) {
> -   enum dc_status result = DC_ERROR_UNEXPECTED;
> +   enum dc_status result;
>
> edp_config_set.bits.PANEL_MODE_EDP =
> panel_mode_edp;
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/amd/pm: Fix spelling mistake "disble" -> "disable"

2021-03-15 Thread Alex Deucher
Applied.  Thanks!

Alex

On Fri, Mar 12, 2021 at 5:08 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> There is a spelling mistake in an assert message. Fix it.
>
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> index 0d725b66fb78..7edafef095a3 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> @@ -1300,7 +1300,7 @@ static int smu7_start_dpm(struct pp_hwmgr *hwmgr)
> (0 == smum_send_msg_to_smc(hwmgr,
> PPSMC_MSG_PCIeDPM_Disable,
> NULL)),
> -   "Failed to disble pcie DPM during DPM Start 
> Function!",
> +   "Failed to disable pcie DPM during DPM Start 
> Function!",
> return -EINVAL);
> }
>
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/1] amdgpu: use MMIO to init atombios if device is Thunderbolt / USB4 attached

2021-03-15 Thread Alex Deucher
On Mon, Mar 15, 2021 at 4:04 AM Nicholas Johnson
 wrote:
>
> When using some Thunderbolt hosts using BIOS-assisted PCI enumeration
> with IO BAR assigned, we get an atombios timeout, such as:
>
> [drm:atom_op_jump [amdgpu]] *ERROR* atombios stuck in loop for more than 
> 20secs aborting
> [drm:amdgpu_atom_execute_table_locked [amdgpu]] *ERROR* atombios stuck 
> executing B456 (len 304, WS 4, PS 0) @ 0xB51B
> [drm:amdgpu_atom_execute_table_locked [amdgpu]] *ERROR* atombios stuck 
> executing B104 (len 183, WS 0, PS 8) @ 0xB17E
> amdgpu :08:00.0: amdgpu: gpu post error!
> amdgpu :08:00.0: amdgpu: Fatal error during GPU init
> amdgpu: probe of :08:00.0 failed with error -22
>
> A workaround is to use MMIO to access ATOMBIOS when device is
> Thunderbolt / USB4 attached.

Missing your signed-off-by.  Also, we can just remove the legacy IO
callbacks altogether.  They are leftover from radeon and not required
at all on amdgpu.

Alex


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> index 86add0f4e..5d16ec10d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> @@ -1999,11 +1999,15 @@ int amdgpu_atombios_init(struct amdgpu_device *adev)
> atom_card_info->reg_read = cail_reg_read;
> atom_card_info->reg_write = cail_reg_write;
> /* needed for iio ops */
> -   if (adev->rio_mem) {
> +   if (adev->rio_mem && !pci_is_thunderbolt_attached(adev->pdev)) {
> atom_card_info->ioreg_read = cail_ioreg_read;
> atom_card_info->ioreg_write = cail_ioreg_write;
> } else {
> -   DRM_DEBUG("PCI I/O BAR is not found. Using MMIO to access 
> ATOM BIOS\n");
> +   if (pci_is_thunderbolt_attached(adev->pdev))
> +   DRM_DEBUG("Device is attached via Thunderbolt / USB4. 
> Using MMIO to access ATOM BIOS\n");
> +   else
> +   DRM_DEBUG("PCI I/O BAR is not found. Using MMIO to 
> access ATOM BIOS\n");
> +
> atom_card_info->ioreg_read = cail_reg_read;
> atom_card_info->ioreg_write = cail_reg_write;
> }
> --
> 2.30.2
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH]] drm/amdgpu/gfx9: add gfxoff quirk

2021-03-11 Thread Alex Deucher
On Thu, Mar 11, 2021 at 10:02 AM Alexandre Desnoyers  wrote:
>
> On Thu, Mar 11, 2021 at 2:49 PM Daniel Gomez  wrote:
> >
> > On Thu, 11 Mar 2021 at 10:09, Daniel Gomez  wrote:
> > >
> > > On Wed, 10 Mar 2021 at 18:06, Alex Deucher  wrote:
> > > >
> > > > On Wed, Mar 10, 2021 at 11:37 AM Daniel Gomez  wrote:
> > > > >
> > > > > Disabling GFXOFF via the quirk list fixes a hardware lockup in
> > > > > Ryzen V1605B, RAVEN 0x1002:0x15DD rev 0x83.
> > > > >
> > > > > Signed-off-by: Daniel Gomez 
> > > > > ---
> > > > >
> > > > > This patch is a continuation of the work here:
> > > > > https://lkml.org/lkml/2021/2/3/122 where a hardware lockup was 
> > > > > discussed and
> > > > > a dma_fence deadlock was provoke as a side effect. To reproduce the 
> > > > > issue
> > > > > please refer to the above link.
> > > > >
> > > > > The hardware lockup was introduced in 5.6-rc1 for our particular 
> > > > > revision as it
> > > > > wasn't part of the new blacklist. Before that, in kernel v5.5, this 
> > > > > hardware was
> > > > > working fine without any hardware lock because the GFXOFF was 
> > > > > actually disabled
> > > > > by the if condition for the CHIP_RAVEN case. So this patch, adds the 
> > > > > 'Radeon
> > > > > Vega Mobile Series [1002:15dd] (rev 83)' to the blacklist to disable 
> > > > > the GFXOFF.
> > > > >
> > > > > But besides the fix, I'd like to ask from where this revision comes 
> > > > > from. Is it
> > > > > an ASIC revision or is it hardcoded in the VBIOS from our vendor? 
> > > > > From what I
> > > > > can see, it comes from the ASIC and I wonder if somehow we can get an 
> > > > > APU in the
> > > > > future, 'not blacklisted', with the same problem. Then, should this 
> > > > > table only
> > > > > filter for the vendor and device and not the revision? Do you know if 
> > > > > there are
> > > > > any revisions for the 1002:15dd validated, tested and functional?
> > > >
> > > > The pci revision id (RID) is used to specify the specific SKU within a
> > > > family.  GFXOFF is supposed to be working on all raven variants.  It
> > > > was tested and functional on all reference platforms and any OEM
> > > > platforms that launched with Linux support.  There are a lot of
> > > > dependencies on sbios in the early raven variants (0x15dd), so it's
> > > > likely more of a specific platform issue, but there is not a good way
> > > > to detect this so we use the DID/SSID/RID as a proxy.  The newer raven
> > > > variants (0x15d8) have much better GFXOFF support since they all
> > > > shipped with newer firmware and sbios.
> > >
> > > We took one of the first reference platform boards to design our
> > > custom board based on the V1605B and I assume it has one of the early 
> > > 'unstable'
> > > raven variants with RID 0x83. Also, as OEM we are in control of the bios
> > > (provided by insyde) but I wasn't sure about the RID so, thanks for the
> > > clarification. Is there anything we can do with the bios to have the 
> > > GFXOFF
> > > enabled and 'stable' for this particular revision? Otherwise we'd need to 
> > > add
> > > the 0x83 RID to the table. Also, there is an extra ']' in the patch
> > > subject. Sorry
> > > for that. Would you need a new patch in case you accept it with the ']' 
> > > removed?
> > >
> > > Good to hear that the newer raven versions have better GFXOFF support.
> >
> > Adding Alex Desnoyer to the loop as he is the electronic/hardware and
> > bios responsible so, he can
> > provide more information about this.
>
> Hello everyone,
>
> We, Qtechnology, are the OEM of the hardware platform where we
> originally discovered the bug.  Our platform is based on the AMD
> Dibbler V-1000 reference design, with the latest Insyde BIOS release
> available for the (now unsupported) Dibbler platform.  We have the
> Insyde BIOS source code internally, so we can make some modifications
> as needed.
>
> The last test that Daniel and myself performed was on a standard
> Dibbler PCB rev.B1 motherboard (NOT our platform), and using the
> corresponding latest AMD released BIOS "

Re: [PATCH][next] drm/amdgpu: Fix spelling mistake "disabed" -> "disabled"

2021-03-11 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 11, 2021 at 4:28 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> There is a spelling mistake in a drm debug message. Fix it.
>
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 617e62e1eff9..dcbae9237cfa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3464,7 +3464,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>   adev->ip_blocks[i].version->type == 
> AMD_IP_BLOCK_TYPE_COMMON ||
>   adev->ip_blocks[i].version->type == 
> AMD_IP_BLOCK_TYPE_IH ||
>   adev->ip_blocks[i].version->type == 
> AMD_IP_BLOCK_TYPE_SMC)) {
> -   DRM_DEBUG("IP %s disabed for 
> hw_init.\n",
> +   DRM_DEBUG("IP %s disabled for 
> hw_init.\n",
> 
> adev->ip_blocks[i].version->funcs->name);
> adev->ip_blocks[i].status.hw = true;
> }
> --
> 2.30.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH]] drm/amdgpu/gfx9: add gfxoff quirk

2021-03-10 Thread Alex Deucher
On Wed, Mar 10, 2021 at 11:37 AM Daniel Gomez  wrote:
>
> Disabling GFXOFF via the quirk list fixes a hardware lockup in
> Ryzen V1605B, RAVEN 0x1002:0x15DD rev 0x83.
>
> Signed-off-by: Daniel Gomez 
> ---
>
> This patch is a continuation of the work here:
> https://lkml.org/lkml/2021/2/3/122 where a hardware lockup was discussed and
> a dma_fence deadlock was provoke as a side effect. To reproduce the issue
> please refer to the above link.
>
> The hardware lockup was introduced in 5.6-rc1 for our particular revision as 
> it
> wasn't part of the new blacklist. Before that, in kernel v5.5, this hardware 
> was
> working fine without any hardware lock because the GFXOFF was actually 
> disabled
> by the if condition for the CHIP_RAVEN case. So this patch, adds the 'Radeon
> Vega Mobile Series [1002:15dd] (rev 83)' to the blacklist to disable the 
> GFXOFF.
>
> But besides the fix, I'd like to ask from where this revision comes from. Is 
> it
> an ASIC revision or is it hardcoded in the VBIOS from our vendor? From what I
> can see, it comes from the ASIC and I wonder if somehow we can get an APU in 
> the
> future, 'not blacklisted', with the same problem. Then, should this table only
> filter for the vendor and device and not the revision? Do you know if there 
> are
> any revisions for the 1002:15dd validated, tested and functional?

The pci revision id (RID) is used to specify the specific SKU within a
family.  GFXOFF is supposed to be working on all raven variants.  It
was tested and functional on all reference platforms and any OEM
platforms that launched with Linux support.  There are a lot of
dependencies on sbios in the early raven variants (0x15dd), so it's
likely more of a specific platform issue, but there is not a good way
to detect this so we use the DID/SSID/RID as a proxy.  The newer raven
variants (0x15d8) have much better GFXOFF support since they all
shipped with newer firmware and sbios.

Alex


>
> Logs:
> [   27.708348] [drm] initializing kernel modesetting (RAVEN
> 0x1002:0x15DD 0x1002:0x15DD 0x83).
> [   27.789156] amdgpu: ATOM BIOS: 113-RAVEN-115
>
> Thanks in advance,
> Daniel
>
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 65db88bb6cbc..319d4b99aec8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -1243,6 +1243,8 @@ static const struct amdgpu_gfxoff_quirk 
> amdgpu_gfxoff_quirk_list[] = {
> { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
> /* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */
> { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
> +   /* GFXOFF provokes a hw lockup on 83 parts with a VBIOS 113-RAVEN-115 
> */
> +   { 0x1002, 0x15dd, 0x1002, 0x15dd, 0x83 },
> { 0, 0, 0, 0, 0 },
>  };
>
> --
> 2.30.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/1] drm/amdkfd: fix build error with AMD_IOMMU_V2=m

2021-03-09 Thread Alex Deucher
On Tue, Mar 9, 2021 at 12:55 PM Jean-Philippe Brucker
 wrote:
>
> Hi Felix,
>
> On Tue, Mar 09, 2021 at 11:30:19AM -0500, Felix Kuehling wrote:
> > > I think the proper fix would be to not rely on custom hooks into a 
> > > particular
> > > IOMMU driver, but to instead ensure that the amdgpu driver can do 
> > > everything
> > > it needs through the regular linux/iommu.h interfaces. I realize this
> > > is more work,
> > > but I wonder if you've tried that, and why it didn't work out.
> >
> > As far as I know this hasn't been tried. I see that intel-iommu has its
> > own SVM thing, which seems to be similar to what our IOMMUv2 does. I
> > guess we'd have to abstract that into a common API.
>
> The common API was added in 26b25a2b98e4 and implemented by the Intel
> driver in 064a57d7ddfc. To support it an IOMMU driver implements new IOMMU
> ops:
> .dev_has_feat()
> .dev_feat_enabled()
> .dev_enable_feat()
> .dev_disable_feat()
> .sva_bind()
> .sva_unbind()
> .sva_get_pasid()
>
> And a device driver calls iommu_dev_enable_feature(IOMMU_DEV_FEAT_SVA)
> followed by iommu_sva_bind_device().
>
> If I remember correctly the biggest obstacle for KFD is the PASID
> allocation, done by the GPU driver instead of the IOMMU driver, but there
> may be others.

IIRC, we tried to make the original IOMMUv2 functionality generic but
other vendors were not interested at the time, so it ended up being
AMD specific and since nothing else was using the pasid allocations we
put them in the GPU driver.  I guess if this is generic now, it could
be moved to a common API and taken out of the driver.

Alex


Re: [PATCH] drm/amdgpu: Remove unnecessary conversion to bool

2021-03-08 Thread Alex Deucher
On Sun, Mar 7, 2021 at 10:14 PM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1600:40-45: WARNING: conversion
> to bool not needed here.
>
> ./drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1598:40-45: WARNING: conversion
> to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

This patch was already applied.

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> index 690a509..b39e7db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> @@ -1595,9 +1595,9 @@ static int sdma_v5_2_set_clockgating_state(void *handle,
> case CHIP_VANGOGH:
> case CHIP_DIMGREY_CAVEFISH:
> sdma_v5_2_update_medium_grain_clock_gating(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> +   state == AMD_CG_STATE_GATE);
> sdma_v5_2_update_medium_grain_light_sleep(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> +   state == AMD_CG_STATE_GATE);
> break;
> default:
> break;
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-08 Thread Alex Deucher
On Sun, Mar 7, 2021 at 10:00 PM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c:561:34-39: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

This patch was already applied.

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> index ae6484a..42a4177 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> @@ -558,7 +558,7 @@ bool dal_ddc_service_query_ddc_data(
> /* should not set mot (middle of transaction) to 0
>  * if there are pending read payloads
>  */
> -   payload.mot = read_size == 0 ? false : true;
> +   payload.mot = !(read_size == 0);
> payload.length = write_size;
> payload.data = write_buf;
>
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: remove duplicate include in dcn21 and gpio

2021-03-08 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sat, Mar 6, 2021 at 6:05 AM  wrote:
>
> From: Zhang Yunkai 
>
> 'dce110_resource.h' included in 'dcn21_resource.c' is duplicated.
> 'hw_gpio.h' included in 'hw_factory_dce110.c' is duplicated.
>
> Signed-off-by: Zhang Yunkai 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 -
>  .../gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c| 4 
>  2 files changed, 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c 
> b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> index 072f8c880924..8a6a965751e8 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> @@ -61,7 +61,6 @@
>  #include "dcn21/dcn21_dccg.h"
>  #include "dcn21_hubbub.h"
>  #include "dcn10/dcn10_resource.h"
> -#include "dce110/dce110_resource.h"
>  #include "dce/dce_panel_cntl.h"
>
>  #include "dcn20/dcn20_dwb.h"
> diff --git a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c 
> b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> index 66e4841f41e4..ca335ea60412 100644
> --- a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> +++ b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
> @@ -48,10 +48,6 @@
>  #define REGI(reg_name, block, id)\
> mm ## block ## id ## _ ## reg_name
>
> -#include "../hw_gpio.h"
> -#include "../hw_ddc.h"
> -#include "../hw_hpd.h"
> -
>  #include "reg_helper.h"
>  #include "../hpd_regs.h"
>
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: remove duplicate include in amdgpu_dm.c

2021-03-08 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sat, Mar 6, 2021 at 5:48 AM  wrote:
>
> From: Zhang Yunkai 
>
> 'drm/drm_hdcp.h' included in 'amdgpu_dm.c' is duplicated.
> It is also included in the 79th line.
>
> Signed-off-by: Zhang Yunkai 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 3e1fd1e7d09f..fee46fbcb0b7 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -44,7 +44,6 @@
>  #include "amdgpu_dm.h"
>  #ifdef CONFIG_DRM_AMD_DC_HDCP
>  #include "amdgpu_dm_hdcp.h"
> -#include 
>  #endif
>  #include "amdgpu_pm.h"
>
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask()

2021-03-08 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 4, 2021 at 11:02 PM Quan, Evan  wrote:
>
> [AMD Public Use]
>
> Thanks. Reviewed-by: Evan Quan 
>
> -Original Message-
> From: Jia-Ju Bai 
> Sent: Friday, March 5, 2021 11:54 AM
> To: Deucher, Alexander ; Koenig, Christian 
> ; airl...@linux.ie; dan...@ffwll.ch; Quan, Evan 
> ; Zhang, Hawking ; Wang, 
> Kevin(Yang) ; Gao, Likun 
> Cc: amd-...@lists.freedesktop.org; dri-de...@lists.freedesktop.org; 
> linux-kernel@vger.kernel.org; Jia-Ju Bai 
> Subject: [PATCH] gpu: drm: swsmu: fix error return code of 
> smu_v11_0_set_allowed_mask()
>
> When bitmap_empty() or feature->feature_num triggers an error, no error 
> return code of smu_v11_0_set_allowed_mask() is assigned.
> To fix this bug, ret is assigned with -EINVAL as error return code.
>
> Reported-by: TOTE Robot 
> Signed-off-by: Jia-Ju Bai 
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c 
> b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> index 90585461a56e..82731a932308 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> @@ -747,8 +747,10 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
> int ret = 0;
> uint32_t feature_mask[2];
>
> -   if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || 
> feature->feature_num < 64)
> +   if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || 
> feature->feature_num < 64) {
> +   ret = -EINVAL;
> goto failed;
> +   }
>
> bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64);
>
> --
> 2.17.1
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-05 Thread Alex Deucher
The same patch was already applied a while ago.

Thanks,

Alex

On Fri, Mar 5, 2021 at 1:41 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:8257:16-21: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 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 3e1fd1e..10de6c2 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -8307,8 +8307,7 @@ static void amdgpu_dm_atomic_commit_tail(struct 
> drm_atomic_state *state)
> hdcp_update_display(
> adev->dm.hdcp_workqueue, 
> aconnector->dc_link->link_index, aconnector,
> new_con_state->hdcp_content_type,
> -   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED ? true
> - 
>: false);
> +   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED);
> }
>  #endif
>
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE

2021-03-05 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 3, 2021 at 2:05 PM Gustavo A. R. Silva
 wrote:
>
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
>
> Refactor the code according to the use of a flexible-array member in
> struct SISLANDS_SMC_SWSTATE, instead of a one-element array, and use
> the struct_size() helper to calculate the size for the allocation.
>
> Also, this helps with the ongoing efforts to enable -Warray-bounds by
> fixing the following warnings:
>
> drivers/gpu/drm/radeon/si_dpm.c: In function ‘si_convert_power_state_to_smc’:
> drivers/gpu/drm/radeon/si_dpm.c:2350:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2350 |   smc_state->levels[i].dpm2.MaxPS = 
> (u8)((SISLANDS_DPM2_MAX_PULSE_SKIP * (max_sclk - min_sclk)) / max_sclk);
>   |   ~^~~
> drivers/gpu/drm/radeon/si_dpm.c:2351:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2351 |   smc_state->levels[i].dpm2.NearTDPDec = SISLANDS_DPM2_NEAR_TDP_DEC;
>   |   ~^~~
> drivers/gpu/drm/radeon/si_dpm.c:2352:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2352 |   smc_state->levels[i].dpm2.AboveSafeInc = 
> SISLANDS_DPM2_ABOVE_SAFE_INC;
>   |   ~^~~
> drivers/gpu/drm/radeon/si_dpm.c:2353:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2353 |   smc_state->levels[i].dpm2.BelowSafeInc = 
> SISLANDS_DPM2_BELOW_SAFE_INC;
>   |   ~^~~
> drivers/gpu/drm/radeon/si_dpm.c:2354:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2354 |   smc_state->levels[i].dpm2.PwrEfficiencyRatio = 
> cpu_to_be16(pwr_efficiency_ratio);
>   |   ~^~~
> drivers/gpu/drm/radeon/si_dpm.c:5105:20: warning: array subscript 1 is above 
> array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  5105 |   smc_state->levels[i + 1].aT = cpu_to_be32(a_t);
>   |   ~^~~
>
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
> [2] 
> https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/109
> Build-tested-by: kernel test robot 
> Link: https://lore.kernel.org/lkml/603f9a8f.adlrpmfzzsapzvyq%25...@intel.com/
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/gpu/drm/radeon/si_dpm.c   |  5 ++---
>  drivers/gpu/drm/radeon/sislands_smc.h | 10 +-
>  2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index 91bfc4762767..918609551804 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -5250,10 +5250,9 @@ static int si_upload_sw_state(struct radeon_device 
> *rdev,
> int ret;
> u32 address = si_pi->state_table_start +
> offsetof(SISLANDS_SMC_STATETABLE, driverState);
> -   u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) +
> -   ((new_state->performance_level_count - 1) *
> -sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> SISLANDS_SMC_SWSTATE *smc_state = _pi->smc_statetable.driverState;
> +   size_t state_size = struct_size(smc_state, levels,
> +   new_state->performance_level_count);
>
> memset(smc_state, 0, state_size);
>
> diff --git a/drivers/gpu/drm/radeon/sislands_smc.h 
> b/drivers/gpu/drm/radeon/sislands_smc.h
> index 966e3a556011..fbd6589bdab9 100644
> --- a/drivers/gpu/drm/radeon/sislands_smc.h
> +++ b/drivers/gpu/drm/radeon/sislands_smc.h
> @@ -182,11 +182,11 @@ typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL 
> SISLANDS_SMC_HW_PERFORMANCE_LEV
>
>  struct SISLANDS_SMC_SWSTATE
>  {
> -uint8_t flags;
> -uint8_t levelCount;
> -uint8_t padding2;
> -uint8_t padding3;
> -SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
> +   uint8_t flags;
> +   uint8_t levelCount;
> +   

Re: [PATCH][next] drm/amdgpu/display: remove redundant continue statement

2021-03-05 Thread Alex Deucher
Applied.  thanks.

Alex

On Wed, Mar 3, 2021 at 8:25 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> The continue statement in a for-loop is redudant and can be removed.
> Clean up the code to address this.
>
> Addresses-Coverity: ("Continue as no effect")
> Fixes: b6f91fc183f7 ("drm/amdgpu/display: buffer INTERRUPT_LOW_IRQ_CONTEXT 
> interrupt work")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> index 8ce10d0973c5..d3c687d07ee6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> @@ -520,9 +520,7 @@ static void amdgpu_dm_irq_schedule_work(struct 
> amdgpu_device *adev,
> return;
>
> list_for_each_entry (handler_data, handler_list, list) {
> -   if (!queue_work(system_highpri_wq, _data->work)) {
> -   continue;
> -   } else {
> +   if (queue_work(system_highpri_wq, _data->work)) {
> work_queued = true;
> break;
> }
> --
> 2.30.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/amd/display: remove redundant initialization of variable status

2021-03-05 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 3, 2021 at 9:07 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> The variable status is being initialized with a value that is never read
> and it is being updated later with a new value.  The initialization is
> redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c 
> b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> index 03741e170b61..15ed09b7a452 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> @@ -81,7 +81,7 @@ static void dmub_psr_get_state(struct dmub_psr *dmub, enum 
> dc_psr_state *state)
>  {
> struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub;
> uint32_t raw_state;
> -   enum dmub_status status = DMUB_STATUS_INVALID;
> +   enum dmub_status status;
>
> // Send gpint command and wait for ack
> status = dmub_srv_send_gpint_command(srv, DMUB_GPINT__GET_PSR_STATE, 
> 0, 30);
> --
> 2.30.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu/display: Remove unnecessary conversion to bool

2021-03-05 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Mar 4, 2021 at 3:02 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:956:52-57: WARNING:
> conversion to bool not needed here.
>
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:8311:16-21: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 3e1fd1e..0e6b7415 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -953,7 +953,7 @@ static void event_mall_stutter(struct work_struct *work)
>
>
> dc_allow_idle_optimizations(
> -   dm->dc, dm->active_vblank_irq_count == 0 ? true : false);
> +   dm->dc, dm->active_vblank_irq_count == 0);
>
> DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", 
> dm->active_vblank_irq_count == 0);
>
> @@ -8307,8 +8307,7 @@ static void amdgpu_dm_atomic_commit_tail(struct 
> drm_atomic_state *state)
> hdcp_update_display(
> adev->dm.hdcp_workqueue, 
> aconnector->dc_link->link_index, aconnector,
> new_con_state->hdcp_content_type,
> -   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED ? true
> - 
>: false);
> +   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED);
> }
>  #endif
>
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 10/53] drm/amd/display/dc/dce/dce_aux: Remove duplicate line causing 'field overwritten' issue

2021-03-03 Thread Alex Deucher
On Wed, Mar 3, 2021 at 8:44 AM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  In file included from 
> drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.c:59:
>  
> drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_11_2_sh_mask.h:10014:58:
>  warning: initialized field overwritten [-Woverride-init]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:214:16: note: in 
> expansion of macro ‘AUX_SW_DATA__AUX_SW_AUTOINCREMENT_DISABLE__SHIFT’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:127:2: note: in 
> expansion of macro ‘AUX_SF’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.c:177:2: 
> note: in expansion of macro ‘DCE_AUX_MASK_SH_LIST’
>  
> drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_11_2_sh_mask.h:10014:58:
>  note: (near initialization for ‘aux_shift.AUX_SW_AUTOINCREMENT_DISABLE’)
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:214:16: note: in 
> expansion of macro ‘AUX_SW_DATA__AUX_SW_AUTOINCREMENT_DISABLE__SHIFT’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:127:2: note: in 
> expansion of macro ‘AUX_SF’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.c:177:2: 
> note: in expansion of macro ‘DCE_AUX_MASK_SH_LIST’
>  
> drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_11_2_sh_mask.h:10013:56:
>  warning: initialized field overwritten [-Woverride-init]
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:214:16: note: in 
> expansion of macro ‘AUX_SW_DATA__AUX_SW_AUTOINCREMENT_DISABLE_MASK’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:127:2: note: in 
> expansion of macro ‘AUX_SF’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.c:181:2: 
> note: in expansion of macro ‘DCE_AUX_MASK_SH_LIST’
>  
> drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_11_2_sh_mask.h:10013:56:
>  note: (near initialization for ‘aux_mask.AUX_SW_AUTOINCREMENT_DISABLE’)
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:214:16: note: in 
> expansion of macro ‘AUX_SW_DATA__AUX_SW_AUTOINCREMENT_DISABLE_MASK’
>  drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.h:127:2: note: in 
> expansion of macro ‘AUX_SF’
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/dce/dce_aux.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h 
> b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
> index 775e24926380e..566b1bddd8cc6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
> @@ -100,7 +100,6 @@ struct dce110_aux_registers {
> AUX_SF(AUX_SW_CONTROL, AUX_SW_GO, mask_sh),\
> AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\
> AUX_SF(AUX_SW_DATA, AUX_SW_DATA_RW, mask_sh),\
> -   AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\
> AUX_SF(AUX_SW_DATA, AUX_SW_INDEX, mask_sh),\
> AUX_SF(AUX_SW_DATA, AUX_SW_DATA, mask_sh),\
> AUX_SF(AUX_SW_STATUS, AUX_SW_REPLY_BYTE_COUNT, mask_sh),\
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 07/53] drm/amd/display/dc/bios/command_table: Remove unused variable and associated comment

2021-03-03 Thread Alex Deucher
On Wed, Mar 3, 2021 at 8:43 AM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c: In function 
> ‘adjust_display_pll_v2’:
>  drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1462:11: 
> warning: unused variable ‘pixel_clock_10KHz_in’ [-Wunused-variable]
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Lee Jones 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Same comment as patch 4.


Alex

> ---
>  drivers/gpu/drm/amd/display/dc/bios/command_table.c | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table.c 
> b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> index 9d3bc3a073821..e879ceb0c49ed 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> @@ -1518,10 +1518,6 @@ static enum bp_result adjust_display_pll_v2(
>  {
> enum bp_result result = BP_RESULT_FAILURE;
>
> -   /* We need to convert from KHz units into 10KHz units and then convert
> -* output pixel clock back 10KHz-->KHz */
> -   uint32_t pixel_clock_10KHz_in = bp_params->pixel_clock / 10;
> -
> bp->cmd_helper->encoder_id_to_atom(
> 
> dal_graphics_object_id_get_encoder_id(bp_params->encoder_object_id));
> bp->cmd_helper->encoder_mode_bp_to_atom(bp_params->signal_type, 
> false);
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 04/53] drm/amd/display/dc/bios/command_table: Remove unused variable

2021-03-03 Thread Alex Deucher
On Wed, Mar 3, 2021 at 8:43 AM Lee Jones  wrote:
>
> None of the surrounding code was removed just in case even a small
> fraction of it was functional.
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c: In function 
> ‘adjust_display_pll_v2’:
>  drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1459:35: 
> warning: variable ‘params’ set but not used [-Wunused-but-set-variable]
>
> Cc: Harry Wentland 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Qinglang Miao 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

This function should be calling the atom cmd table with the
parameters.  Just sent a patch to fix this:
https://patchwork.freedesktop.org/patch/422833/

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/bios/command_table.c | 12 +++-
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table.c 
> b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> index afc10b954ffa7..9d3bc3a073821 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> @@ -1517,20 +1517,14 @@ static enum bp_result adjust_display_pll_v2(
> struct bp_adjust_pixel_clock_parameters *bp_params)
>  {
> enum bp_result result = BP_RESULT_FAILURE;
> -   ADJUST_DISPLAY_PLL_PS_ALLOCATION params = { 0 };
>
> /* We need to convert from KHz units into 10KHz units and then convert
>  * output pixel clock back 10KHz-->KHz */
> uint32_t pixel_clock_10KHz_in = bp_params->pixel_clock / 10;
>
> -   params.usPixelClock = cpu_to_le16((uint16_t)(pixel_clock_10KHz_in));
> -   params.ucTransmitterID =
> -   bp->cmd_helper->encoder_id_to_atom(
> -   dal_graphics_object_id_get_encoder_id(
> -   
> bp_params->encoder_object_id));
> -   params.ucEncodeMode =
> -   (uint8_t)bp->cmd_helper->encoder_mode_bp_to_atom(
> -   bp_params->signal_type, false);
> +   bp->cmd_helper->encoder_id_to_atom(
> +   
> dal_graphics_object_id_get_encoder_id(bp_params->encoder_object_id));
> +   bp->cmd_helper->encoder_mode_bp_to_atom(bp_params->signal_type, 
> false);
> return result;
>  }
>
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/radeon: fix copy of uninitialized variable back to userspace

2021-03-03 Thread Alex Deucher
Applied.  Thanks!

Alex

On Wed, Mar 3, 2021 at 2:42 AM Christian König  wrote:
>
> Am 03.03.21 um 01:27 schrieb Colin King:
> > From: Colin Ian King 
> >
> > Currently the ioctl command RADEON_INFO_SI_BACKEND_ENABLED_MASK can
> > copy back uninitialised data in value_tmp that pointer *value points
> > to. This can occur when rdev->family is less than CHIP_BONAIRE and
> > less than CHIP_TAHITI.  Fix this by adding in a missing -EINVAL
> > so that no invalid value is copied back to userspace.
> >
> > Addresses-Coverity: ("Uninitialized scalar variable)
> > Cc: sta...@vger.kernel.org # 3.13+
> > Fixes: 439a1cfffe2c ("drm/radeon: expose render backend mask to the 
> > userspace")
> > Signed-off-by: Colin Ian King 
>
> Reviewed-by: Christian König 
>
> Let's hope that this doesn't break UAPI.
>
> Christian.
>
> > ---
> >   drivers/gpu/drm/radeon/radeon_kms.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> > b/drivers/gpu/drm/radeon/radeon_kms.c
> > index 2479d6ab7a36..58876bb4ef2a 100644
> > --- a/drivers/gpu/drm/radeon/radeon_kms.c
> > +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> > @@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void 
> > *data, struct drm_file *filp)
> >   *value = rdev->config.si.backend_enable_mask;
> >   } else {
> >   DRM_DEBUG_KMS("BACKEND_ENABLED_MASK is si+ only!\n");
> > + return -EINVAL;
> >   }
> >   break;
> >   case RADEON_INFO_MAX_SCLK:
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: Remove unnecessary conversion to bool

2021-03-03 Thread Alex Deucher
On Wed, Mar 3, 2021 at 4:18 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2252:40-45: WARNING: conversion
> to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index c8c22c1..00d3773 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -2249,7 +2249,7 @@ static int sdma_v4_0_set_powergating_state(void *handle,
> case CHIP_RAVEN:
> case CHIP_RENOIR:
> sdma_v4_1_update_power_gating(adev,
> -   state == AMD_PG_STATE_GATE ? true : false);
> +   state == AMD_PG_STATE_GATE);
> break;
> default:
> break;
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Build regressions/improvements in v5.12-rc1

2021-03-02 Thread Alex Deucher
On Mon, Mar 1, 2021 at 9:21 AM Geert Uytterhoeven  wrote:
>
> On Mon, 1 Mar 2021, Geert Uytterhoeven wrote:
> > Below is the list of build error/warning regressions/improvements in
> > v5.12-rc1[1] compared to v5.11[2].
> >
> > Summarized:
> >  - build errors: +2/-0
>
> > [1] 
> > http://kisskb.ellerman.id.au/kisskb/branch/linus/head/fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8/
> >  (all 192 configs)
> > [2] 
> > http://kisskb.ellerman.id.au/kisskb/branch/linus/head/f40ddce88593482919761f74910f42f4b84c004b/
> >  (all 192 configs)
> >
> >
> > *** ERRORS ***
> >
> > 2 error regressions:
> >  + /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: 
> > error: implicit declaration of function 'disable_kernel_vsx' 
> > [-Werror=implicit-function-declaration]:  => 674:2
> >  + /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: 
> > error: implicit declaration of function 'enable_kernel_vsx' 
> > [-Werror=implicit-function-declaration]:  => 638:2
>
> powerpc-gcc4.9/ppc64_book3e_allmodconfig
>
> This was fixed in v5.11-rc1, but reappeared in v5.12-rc1?

Do you know what fixed in for 5.11?  I guess for PPC64 we depend on CONFIG_VSX?

Alex

>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-03-02 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Mar 1, 2021 at 1:50 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c:298:33-38:
> WARNING: conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> index 3398540..fbefbba 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> @@ -295,7 +295,7 @@ bool dpp3_program_gamcor_lut(
> cm_helper_program_gamcor_xfer_func(dpp_base->ctx, params, _regs);
>
> dpp3_program_gammcor_lut(dpp_base, params->rgb_resulted, 
> params->hw_points_num,
> -   next_mode == LUT_RAM_A ? true:false);
> +next_mode == LUT_RAM_A);
>
> //select Gamma LUT to use for next frame
> REG_UPDATE(CM_GAMCOR_CONTROL, CM_GAMCOR_SELECT, next_mode == 
> LUT_RAM_A ? 0:1);
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Fix an uninitialized index variable

2021-03-02 Thread Alex Deucher
On Thu, Feb 25, 2021 at 10:01 AM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> clang points out that the new logic uses an always-uninitialized
> array index:
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9810:38: warning: 
> variable 'i' is uninitialized when used here [-Wuninitialized]
> timing  = >detailed_timings[i];
>   ^
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9720:7: note: 
> initialize the variable 'i' to silence this warning
>
> My best guess is that the index should have been returned by the
> parse_hdmi_amd_vsdb() function that walks an array here, so do that.
>
> Fixes: f9b4f20c4777 ("drm/amd/display: Add Freesync HDMI support to DM")
> Signed-off-by: Arnd Bergmann 

Applied.  Thanks!

Alex


> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c| 16 
>  1 file changed, 8 insertions(+), 8 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 b19b93c74bae..667c0d52dbfa 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -9736,7 +9736,7 @@ static bool parse_edid_cea(struct amdgpu_dm_connector 
> *aconnector,
> return false;
>  }
>
> -static bool parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
> +static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
> struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
>  {
> uint8_t *edid_ext = NULL;
> @@ -9746,7 +9746,7 @@ static bool parse_hdmi_amd_vsdb(struct 
> amdgpu_dm_connector *aconnector,
> /*- drm_find_cea_extension() -*/
> /* No EDID or EDID extensions */
> if (edid == NULL || edid->extensions == 0)
> -   return false;
> +   return -ENODEV;
>
> /* Find CEA extension */
> for (i = 0; i < edid->extensions; i++) {
> @@ -9756,14 +9756,15 @@ static bool parse_hdmi_amd_vsdb(struct 
> amdgpu_dm_connector *aconnector,
> }
>
> if (i == edid->extensions)
> -   return false;
> +   return -ENODEV;
>
> /*- cea_db_offsets() -*/
> if (edid_ext[0] != CEA_EXT)
> -   return false;
> +   return -ENODEV;
>
> valid_vsdb_found = parse_edid_cea(aconnector, edid_ext, EDID_LENGTH, 
> vsdb_info);
> -   return valid_vsdb_found;
> +
> +   return valid_vsdb_found ? i : -ENODEV;
>  }
>
>  void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
> @@ -9781,7 +9782,6 @@ void amdgpu_dm_update_freesync_caps(struct 
> drm_connector *connector,
> struct amdgpu_device *adev = drm_to_adev(dev);
> bool freesync_capable = false;
> struct amdgpu_hdmi_vsdb_info vsdb_info = {0};
> -   bool hdmi_valid_vsdb_found = false;
>
> if (!connector->state) {
> DRM_ERROR("%s - Connector has no state", __func__);
> @@ -9857,8 +9857,8 @@ void amdgpu_dm_update_freesync_caps(struct 
> drm_connector *connector,
> }
> }
> } else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == 
> SIGNAL_TYPE_HDMI_TYPE_A) {
> -   hdmi_valid_vsdb_found = 
> parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, _info);
> -   if (hdmi_valid_vsdb_found && vsdb_info.freesync_supported) {
> +   i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, 
> _info);
> +   if (i >= 0 && vsdb_info.freesync_supported) {
> timing  = >detailed_timings[i];
> data= >data.other_data;
>
> --
> 2.29.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/amd/display: fix the return of the uninitialized value in ret

2021-03-02 Thread Alex Deucher
Applied.  Thanks!

Alex

On Tue, Mar 2, 2021 at 10:03 AM Harry Wentland  wrote:
>
> On 2021-03-02 9:05 a.m., Colin King wrote:
> > From: Colin Ian King 
> >
> > Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or
> > SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is
> > checked for > 0 at the end of the function.  Ret should be initialized,
> > I believe setting it to zero is a correct default.
> >
> > Addresses-Coverity: ("Uninitialized scalar variable")
> > Fixes: bd0c064c161c ("drm/amd/display: Add return code instead of boolean 
> > for future use")
> > Signed-off-by: Colin Ian King 
>
> Reviewed-by: Harry Wentland 
>
> Harry
>
> > ---
> >   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
> > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > index 5159399f8239..5750818db8f6 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > @@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
> >   {
> >   uint8_t enable_dsc = enable ? 1 : 0;
> >   struct amdgpu_dm_connector *aconnector;
> > - uint8_t ret;
> > + uint8_t ret = 0;
> >
> >   if (!stream)
> >   return false;
> >
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display/dc/dce/dmub_psr: Remove unnecessary conversion to bool

2021-02-26 Thread Alex Deucher
On Fri, Feb 26, 2021 at 4:42 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c:273:16-21: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c 
> b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> index 69e34be..c13f967 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> @@ -269,8 +269,7 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
> copy_settings_data->frame_cap_ind   = 
> psr_context->psrFrameCaptureIndicationReq;
> copy_settings_data->init_sdp_deadline   = 
> psr_context->sdpTransmitLineNumDeadline;
> copy_settings_data->debug.u32All = 0;
> -   copy_settings_data->debug.bitfields.visual_confirm  = 
> dc->dc->debug.visual_confirm == VISUAL_CONFIRM_PSR ?
> -   true 
> : false;
> +   copy_settings_data->debug.bitfields.visual_confirm  = 
> dc->dc->debug.visual_confirm == VISUAL_CONFIRM_PSR;
> copy_settings_data->debug.bitfields.use_hw_lock_mgr = 1;
>
> dc_dmub_srv_cmd_queue(dc->dmub_srv, );
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/pm/swsmu: Remove unnecessary conversion to bool

2021-02-26 Thread Alex Deucher
On Fri, Feb 26, 2021 at 4:17 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c:924:47-52:
> WARNING: conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 af73e14..2382438 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
> @@ -921,7 +921,7 @@ static bool 
> sienna_cichlid_is_support_fine_grained_dpm(struct smu_context *smu,
> dpm_desc = >DpmDescriptor[clk_index];
>
> /* 0 - Fine grained DPM, 1 - Discrete DPM */
> -   return dpm_desc->SnapToDiscrete == 0 ? true : false;
> +   return dpm_desc->SnapToDiscrete == 0;
>  }
>
>  static bool sienna_cichlid_is_od_feature_supported(struct 
> smu_11_0_7_overdrive_table *od_table,
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Fix an uninitialized index variable

2021-02-25 Thread Alex Deucher
On Thu, Feb 25, 2021 at 10:01 AM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> clang points out that the new logic uses an always-uninitialized
> array index:
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9810:38: warning: 
> variable 'i' is uninitialized when used here [-Wuninitialized]
> timing  = >detailed_timings[i];
>   ^
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9720:7: note: 
> initialize the variable 'i' to silence this warning
>
> My best guess is that the index should have been returned by the
> parse_hdmi_amd_vsdb() function that walks an array here, so do that.
>
> Fixes: f9b4f20c4777 ("drm/amd/display: Add Freesync HDMI support to DM")
> Signed-off-by: Arnd Bergmann 

This looks correct to me.  Stylon can you verify?

Thanks,

Alex


> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c| 16 
>  1 file changed, 8 insertions(+), 8 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 b19b93c74bae..667c0d52dbfa 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -9736,7 +9736,7 @@ static bool parse_edid_cea(struct amdgpu_dm_connector 
> *aconnector,
> return false;
>  }
>
> -static bool parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
> +static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
> struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
>  {
> uint8_t *edid_ext = NULL;
> @@ -9746,7 +9746,7 @@ static bool parse_hdmi_amd_vsdb(struct 
> amdgpu_dm_connector *aconnector,
> /*- drm_find_cea_extension() -*/
> /* No EDID or EDID extensions */
> if (edid == NULL || edid->extensions == 0)
> -   return false;
> +   return -ENODEV;
>
> /* Find CEA extension */
> for (i = 0; i < edid->extensions; i++) {
> @@ -9756,14 +9756,15 @@ static bool parse_hdmi_amd_vsdb(struct 
> amdgpu_dm_connector *aconnector,
> }
>
> if (i == edid->extensions)
> -   return false;
> +   return -ENODEV;
>
> /*- cea_db_offsets() -*/
> if (edid_ext[0] != CEA_EXT)
> -   return false;
> +   return -ENODEV;
>
> valid_vsdb_found = parse_edid_cea(aconnector, edid_ext, EDID_LENGTH, 
> vsdb_info);
> -   return valid_vsdb_found;
> +
> +   return valid_vsdb_found ? i : -ENODEV;
>  }
>
>  void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
> @@ -9781,7 +9782,6 @@ void amdgpu_dm_update_freesync_caps(struct 
> drm_connector *connector,
> struct amdgpu_device *adev = drm_to_adev(dev);
> bool freesync_capable = false;
> struct amdgpu_hdmi_vsdb_info vsdb_info = {0};
> -   bool hdmi_valid_vsdb_found = false;
>
> if (!connector->state) {
> DRM_ERROR("%s - Connector has no state", __func__);
> @@ -9857,8 +9857,8 @@ void amdgpu_dm_update_freesync_caps(struct 
> drm_connector *connector,
> }
> }
> } else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == 
> SIGNAL_TYPE_HDMI_TYPE_A) {
> -   hdmi_valid_vsdb_found = 
> parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, _info);
> -   if (hdmi_valid_vsdb_found && vsdb_info.freesync_supported) {
> +   i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, 
> _info);
> +   if (i >= 0 && vsdb_info.freesync_supported) {
> timing  = >detailed_timings[i];
> data= >data.other_data;
>
> --
> 2.29.2
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: remove unnecessary conversion to bool

2021-02-25 Thread Alex Deucher
On Thu, Feb 25, 2021 at 4:19 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c:243:67-72:
> WARNING: conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> index 3398540..102f6a0 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
> @@ -240,7 +240,7 @@ bool dpp3_program_gamcor_lut(
> next_mode = LUT_RAM_A;
>
> dpp3_power_on_gamcor_lut(dpp_base, true);
> -   dpp3_configure_gamcor_lut(dpp_base, next_mode == LUT_RAM_A ? 
> true:false);
> +   dpp3_configure_gamcor_lut(dpp_base, next_mode == LUT_RAM_A);
>
> if (next_mode == LUT_RAM_B) {
> gam_regs.start_cntl_b = REG(CM_GAMCOR_RAMB_START_CNTL_B);
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-25 Thread Alex Deucher
On Thu, Feb 25, 2021 at 4:02 AM Yang Li  wrote:
>
> Fix the following coccicheck warning:
> ./drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1589:0-23: WARNING:
> fops_ib_preempt should be defined with DEFINE_DEBUGFS_ATTRIBUTE
> ./drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1592:0-23: WARNING:
> fops_sclk_set should be defined with DEFINE_DEBUGFS_ATTRIBUTE
>
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 0a25fec..52ef488 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1586,10 +1586,10 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 
> val)
> return 0;
>  }
>
> -DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
> amdgpu_debugfs_ib_preempt, "%llu\n");
>
> -DEFINE_SIMPLE_ATTRIBUTE(fops_sclk_set, NULL,
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
> amdgpu_debugfs_sclk_set, "%llu\n");
>
>  int amdgpu_debugfs_init(struct amdgpu_device *adev)
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu: Remove unnecessary conversion to bool

2021-02-23 Thread Alex Deucher
On Mon, Feb 22, 2021 at 10:44 PM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/amdgpu/athub_v2_1.c:79:40-45: WARNING: conversion
> to bool not needed here.
>
> ./drivers/gpu/drm/amd/amdgpu/athub_v2_1.c:81:40-45: WARNING: conversion
> to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/athub_v2_1.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/athub_v2_1.c 
> b/drivers/gpu/drm/amd/amdgpu/athub_v2_1.c
> index 7b1b183..2ac4988 100644
> --- a/drivers/gpu/drm/amd/amdgpu/athub_v2_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/athub_v2_1.c
> @@ -74,10 +74,8 @@ int athub_v2_1_set_clockgating(struct amdgpu_device *adev,
> case CHIP_SIENNA_CICHLID:
> case CHIP_NAVY_FLOUNDER:
> case CHIP_DIMGREY_CAVEFISH:
> -   athub_v2_1_update_medium_grain_clock_gating(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> -   athub_v2_1_update_medium_grain_light_sleep(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> +   athub_v2_1_update_medium_grain_clock_gating(adev, state == 
> AMD_CG_STATE_GATE);
> +   athub_v2_1_update_medium_grain_light_sleep(adev, state == 
> AMD_CG_STATE_GATE);
> break;
> default:
> break;
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu/display: initialize the variable 'i'

2021-02-23 Thread Alex Deucher
On Mon, Feb 22, 2021 at 3:13 PM Souptick Joarder  wrote:
>
> >> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9804:38:
> >> warning: variable 'i' is uninitialized when used here
> >> [-Wuninitialized]
>timing  = >detailed_timings[i];
>  ^
>drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9714:7:
> note: initialize the variable 'i' to silence this warning
>int i;
> ^
>  = 0
>1 warning generated.
>
> Initialize the variable 'i'.
>
> Reported-by: kernel test robot 
> Signed-off-by: Souptick Joarder 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index a22a53d..e96d3d9 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -9717,7 +9717,7 @@ static bool parse_hdmi_amd_vsdb(struct 
> amdgpu_dm_connector *aconnector,
>  void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
> struct edid *edid)
>  {
> -   int i;
> +   int i = 0;
> struct detailed_timing *timing;
> struct detailed_non_pixel *data;
> struct detailed_data_monitor_range *range;
> --
> 1.9.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu/display: initialize the variable 'i'

2021-02-23 Thread Alex Deucher
yeah, fdo ran out of disk space so I moved to gitlab:
https://gitlab.freedesktop.org/agd5f/linux/-/commits/drm-next

Alex

On Mon, Feb 22, 2021 at 7:26 PM Bas Nieuwenhuizen
 wrote:
>
> I think Alex moved to gitlab for his branches
>
> On Tue, Feb 23, 2021, 12:50 AM Simon Ser  wrote:
>>
>> On Tuesday, February 23rd, 2021 at 12:44 AM, Nathan Chancellor 
>>  wrote:
>>
>> > On Mon, Feb 22, 2021 at 11:05:17PM +, Simon Ser wrote:
>> > > On Monday, February 22nd, 2021 at 8:25 PM, Souptick Joarder 
>> > >  wrote:
>> > >
>> > > > >> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9804:38:
>> > > > >> warning: variable 'i' is uninitialized when used here
>> > > > >> [-Wuninitialized]
>> > > >timing  = >detailed_timings[i];
>> > > >  ^
>> > > >drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9714:7:
>> > > > note: initialize the variable 'i' to silence this warning
>> > > >int i;
>> > > > ^
>> > > >  = 0
>> > > >1 warning generated.
>> > > >
>> > > > Initialize the variable 'i'.
>> > >
>> > > Hm, I see this variable already initialized in the loop:
>> > >
>> > > for (i = 0; i < 4; i++) {
>> > >
>> > > This is the branch agd5f/drm-next.
>> >
>> > That is in the
>> >
>> >   if (amdgpu_dm_connector->dc_sink->sink_signal == 
>> > SIGNAL_TYPE_DISPLAY_PORT
>> >   || amdgpu_dm_connector->dc_sink->sink_signal == 
>> > SIGNAL_TYPE_EDP) {
>> >
>> > branch not the
>> >
>> >   } else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == 
>> > SIGNAL_TYPE_HDMI_TYPE_A) {
>> >
>> > branch, where i is indeed used uninitialized like clang complains about.
>> >
>> > I am not at all familiar with the code so I cannot say if this fix is
>> > the proper one but it is definitely a legitimate issue.
>>
>> I think you have an outdated branch. In my checkout, i is not used in the 
>> first
>> branch, and is initialized in the second one.
>>
>> https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c?h=drm-next#n9700
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 0/3] drm/ttm: constify static vm_operations_structs

2021-02-23 Thread Alex Deucher
On Wed, Feb 10, 2021 at 8:14 AM Daniel Vetter  wrote:
>
> On Wed, Feb 10, 2021 at 08:45:56AM +0100, Christian König wrote:
> > Reviewed-by: Christian König  for the series.
>
> Smash it into -misc?

@Christian Koenig did these ever land?  I don't see them in drm-misc.

Alex

> -Daniel
>
> >
> > Am 10.02.21 um 00:48 schrieb Rikard Falkeborn:
> > > Constify a few static vm_operations_struct that are never modified. Their
> > > only usage is to assign their address to the vm_ops field in the
> > > vm_area_struct, which is a pointer to const vm_operations_struct. Make 
> > > them
> > > const to allow the compiler to put them in read-only memory.
> > >
> > > With this series applied, all static struct vm_operations_struct in the
> > > kernel tree are const.
> > >
> > > Rikard Falkeborn (3):
> > >drm/amdgpu/ttm: constify static vm_operations_struct
> > >drm/radeon/ttm: constify static vm_operations_struct
> > >drm/nouveau/ttm: constify static vm_operations_struct
> > >
> > >   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
> > >   drivers/gpu/drm/nouveau/nouveau_ttm.c   | 2 +-
> > >   drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
> > >   3 files changed, 3 insertions(+), 3 deletions(-)
> > >
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Remove unnecessary conversion to bool

2021-02-23 Thread Alex Deucher
This was already fixed by a patch from Yang Li .

Alex

On Tue, Feb 23, 2021 at 1:13 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:8260:16-21: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 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 94cd5dd..323473d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -8253,8 +8253,7 @@ static void amdgpu_dm_atomic_commit_tail(struct 
> drm_atomic_state *state)
> hdcp_update_display(
> adev->dm.hdcp_workqueue, 
> aconnector->dc_link->link_index, aconnector,
> new_con_state->hdcp_content_type,
> -   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED ? true
> - 
>: false);
> +   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED);
> }
>  #endif
>
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amdgpu/sdma5.2: Remove unnecessary conversion to bool

2021-02-22 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sat, Feb 20, 2021 at 3:35 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1621:40-45: WARNING: conversion
> to bool not needed here.
>
> ./drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1619:40-45: WARNING: conversion
> to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> index f1ba36a..9ed79a9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> @@ -1616,9 +1616,9 @@ static int sdma_v5_2_set_clockgating_state(void *handle,
> case CHIP_VANGOGH:
> case CHIP_DIMGREY_CAVEFISH:
> sdma_v5_2_update_medium_grain_clock_gating(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> +   state == AMD_CG_STATE_GATE);
> sdma_v5_2_update_medium_grain_light_sleep(adev,
> -   state == AMD_CG_STATE_GATE ? true : false);
> +   state == AMD_CG_STATE_GATE);
> break;
> default:
> break;
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display/dc/core/dc_link_ddc: Remove unnecessary conversion to bool

2021-02-22 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sat, Feb 20, 2021 at 2:16 AM Jiapeng Chong
 wrote:
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c:544:34-39: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> index c5936e0..45a59cf 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> @@ -541,7 +541,7 @@ bool dal_ddc_service_query_ddc_data(
> /* should not set mot (middle of transaction) to 0
>  * if there are pending read payloads
>  */
> -   payload.mot = read_size == 0 ? false : true;
> +   payload.mot = !(read_size == 0);
> payload.length = write_size;
> payload.data = write_buf;
>
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/amdgpu/swsmu/navi1x: Remove unnecessary conversion to bool

2021-02-22 Thread Alex Deucher
Applied.  Thanks!

Alex

On Sun, Feb 21, 2021 at 10:15 PM Quan, Evan  wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
> Reviewed-by: Evan Quan 
>
> -Original Message-
> From: amd-gfx  On Behalf Of Jiapeng 
> Chong
> Sent: Saturday, February 20, 2021 10:55 AM
> To: Deucher, Alexander 
> Cc: Jiapeng Chong ; airl...@linux.ie; 
> linux-kernel@vger.kernel.org; dri-de...@lists.freedesktop.org; 
> amd-...@lists.freedesktop.org; dan...@ffwll.ch; Koenig, Christian 
> 
> Subject: [PATCH v2] drm/amdgpu/swsmu/navi1x: Remove unnecessary conversion to 
> bool
>
> Fix the following coccicheck warnings:
>
> ./drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c:900:47-52: WARNING:
> conversion to bool not needed here.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c 
> b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> index cd7efa9..58028a7 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> @@ -897,7 +897,7 @@ static bool navi10_is_support_fine_grained_dpm(struct 
> smu_context *smu, enum smu
> dpm_desc = >DpmDescriptor[clk_index];
>
> /* 0 - Fine grained DPM, 1 - Discrete DPM */
> -   return dpm_desc->SnapToDiscrete == 0 ? true : false;
> +   return dpm_desc->SnapToDiscrete == 0;
>  }
>
>  static inline bool navi10_od_feature_is_supported(struct 
> smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_CAP cap)
> --
> 1.8.3.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=04%7C01%7Cevan.quan%40amd.com%7C443a5df938954827326108d8d6582201%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637495021310885387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=6ETadiVbRBgbXfEbkXbxTX%2F1Ozg1wp3Nr9lHGF3SKHk%3Dreserved=0
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics

2021-02-22 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Feb 18, 2021 at 6:12 PM Wang, Kevin(Yang)  wrote:
>
> thanks,
>
> Reviewed-by: Kevin Wang 
>
> Regards,
> Kevin
>
> > 在 2021年2月19日,06:49,Nathan Chancellor  写道:
> >
> > Clang warns:
> >
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> > variable 'structure_size' is used uninitialized whenever switch default
> > is taken [-Wsometimes-uninitialized]
> >default:
> >^~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> > uninitialized use occurs here
> >memset(header, 0xFF, structure_size);
> > ^~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> > initialize the variable 'structure_size' to silence this warning
> >uint16_t structure_size;
> >   ^
> >= 0
> > 1 warning generated.
> >
> > Return in the default case, as the size of the header will not be known.
> >
> > Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics 
> > function")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> > Signed-off-by: Nathan Chancellor 
> > ---
> > drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c 
> > b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > index bb620fdd4cd2..bcedd4d92e35 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t 
> > frev, uint8_t crev)
> >structure_size = sizeof(struct gpu_metrics_v2_0);
> >break;
> >default:
> > -break;
> > +return;
> >}
> >
> > #undef METRICS_VERSION
> > --
> > 2.30.1
> >
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [git pull] drm for 5.12-rc1

2021-02-22 Thread Alex Deucher
On Sun, Feb 21, 2021 at 6:45 PM Nathan Chancellor  wrote:
>
> On Sun, Feb 21, 2021 at 03:07:17PM -0800, Linus Torvalds wrote:
> > On Thu, Feb 18, 2021 at 10:06 PM Dave Airlie  wrote:
> > >
> > > Let me know if there are any issues,
> >
> > gcc was happy, and I obviously already pushed out my merge, but then
> > when I did my clang build afterwards, it reports:
> >
> >   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> > variable 'structure_size' is used uninitialized whenever switch
> > default is taken [-Wsometimes-uninitialized]
> >   default:
> >   ^~~
> >   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> > uninitialized use occurs here
> >   memset(header, 0xFF, structure_size);
> >^~
> >
> > and clang is very very right. That "default" case is completely
> > broken, and will generate a randomly sized memset. Not good.
> >
> > Presumably that default case never happens, but if so it shouldn't exist.
> >
> > Perhaps better yet, make the "default" case just do a "return" instead
> > of a break. Breaking out of the switch statement to code that cannot
> > possibly work is all kinds of mindless.
> >
> > Kevin/Alex? This was introduced by commit de4b7cd8cb87
> > ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> >
> >   Linus
>
> I sent https://lore.kernel.org/r/20210218224849.5591-1-nat...@kernel.org/
> a few days ago and Kevin reviewed it, just seems like Alex needs to pick
> it up.

Yeah, sorry, I meant to include it, but it slipped through the cracks
last week.  Will include it in my -fixes PR this week.

Alex


Re: [PATCH] drm/amd/display: Simplify bool conversion

2021-02-18 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, Feb 18, 2021 at 9:23 AM Yang Li  wrote:
>
> Fix the following coccicheck warning:
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:8142:16-21: WARNING:
> conversion to bool not needed here
>
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 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 961abf1..f163e54 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -8138,8 +8138,7 @@ static void amdgpu_dm_atomic_commit_tail(struct 
> drm_atomic_state *state)
> hdcp_update_display(
> adev->dm.hdcp_workqueue, 
> aconnector->dc_link->link_index, aconnector,
> new_con_state->hdcp_content_type,
> -   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED ? true
> - 
>: false);
> +   new_con_state->content_protection == 
> DRM_MODE_CONTENT_PROTECTION_DESIRED);
> }
>  #endif
>
> --
> 1.8.3.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/radeon: Remove unused function pointer typedef radeon_packet3_check_t

2021-02-15 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Feb 15, 2021 at 5:43 AM Christian König
 wrote:
>
>
>
> Am 15.02.21 um 11:21 schrieb Chen Lin:
> > From: Chen Lin 
> >
> > Remove the 'radeon_packet3_check_t' typedef as it is not used.
> >
> > Signed-off-by: Chen Lin 
>
> Reviewed-by: Christian König 
>
> > ---
> >   drivers/gpu/drm/radeon/radeon.h |3 ---
> >   1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon.h 
> > b/drivers/gpu/drm/radeon/radeon.h
> > index 5f3adba..a1c38b5 100644
> > --- a/drivers/gpu/drm/radeon/radeon.h
> > +++ b/drivers/gpu/drm/radeon/radeon.h
> > @@ -,9 +,6 @@ struct radeon_cs_packet {
> >   typedef int (*radeon_packet0_check_t)(struct radeon_cs_parser *p,
> > struct radeon_cs_packet *pkt,
> > unsigned idx, unsigned reg);
> > -typedef int (*radeon_packet3_check_t)(struct radeon_cs_parser *p,
> > -   struct radeon_cs_packet *pkt);
> > -
> >
> >   /*
> >* AGP
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH][next] drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in struct NISLANDS_SMC_SWSTATE

2021-02-15 Thread Alex Deucher
On Wed, Feb 10, 2021 at 6:49 PM Gustavo A. R. Silva
 wrote:
>
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
>
> Use flexible-array member in struct NISLANDS_SMC_SWSTATE, instead of
> one-element array.
>
> Also, this helps with the ongoing efforts to enable -Warray-bounds by
> fixing the following warnings:
>
> drivers/gpu/drm/radeon/ni_dpm.c: In function ‘ni_convert_power_state_to_smc’:
> drivers/gpu/drm/radeon/ni_dpm.c:2521:20: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2521 |   smc_state->levels[i].dpm2.MaxPS =
>   |   ~^~~
> drivers/gpu/drm/radeon/ni_dpm.c:2523:20: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2523 |   smc_state->levels[i].dpm2.NearTDPDec = NISLANDS_DPM2_NEAR_TDP_DEC;
>   |   ~^~~
> drivers/gpu/drm/radeon/ni_dpm.c:2524:20: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2524 |   smc_state->levels[i].dpm2.AboveSafeInc = 
> NISLANDS_DPM2_ABOVE_SAFE_INC;
>   |   ~^~~
> drivers/gpu/drm/radeon/ni_dpm.c:2525:20: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2525 |   smc_state->levels[i].dpm2.BelowSafeInc = 
> NISLANDS_DPM2_BELOW_SAFE_INC;
>   |   ~^~~
> drivers/gpu/drm/radeon/ni_dpm.c:2526:35: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2526 |   smc_state->levels[i].stateFlags |=
>   |   ^~
> drivers/gpu/drm/radeon/ni_dpm.c:2526:35: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2526 |   smc_state->levels[i].stateFlags |=
>   |   ^~
>  2527 |((i != (state->performance_level_count - 1)) && power_boost_limit) 
> ?
>   |
> 
>  2528 |PPSMC_STATEFLAG_POWERBOOST : 0;
>   |~~
> drivers/gpu/drm/radeon/ni_dpm.c:2442:20: warning: array subscript 1 is above 
> array bounds of ‘NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct 
> NISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>  2442 |   smc_state->levels[i + 1].aT = cpu_to_be32(a_t);
>
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
> [2] 
> https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/109
> Build-tested-by: kernel test robot 
> Link: https://lore.kernel.org/lkml/6023ed54.bfiy+9uz81i6nq19%25...@intel.com/
> Signed-off-by: Gustavo A. R. Silva 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/nislands_smc.h | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/nislands_smc.h 
> b/drivers/gpu/drm/radeon/nislands_smc.h
> index 3cf8fc0d83f4..7395cb6b3cac 100644
> --- a/drivers/gpu/drm/radeon/nislands_smc.h
> +++ b/drivers/gpu/drm/radeon/nislands_smc.h
> @@ -134,11 +134,11 @@ typedef struct NISLANDS_SMC_HW_PERFORMANCE_LEVEL 
> NISLANDS_SMC_HW_PERFORMANCE_LEV
>
>  struct NISLANDS_SMC_SWSTATE
>  {
> -uint8_t flags;
> -uint8_t levelCount;
> -uint8_t padding2;
> -uint8_t padding3;
> -NISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
> +   uint8_t flags;
> +   uint8_t levelCount;
> +   uint8_t padding2;
> +   uint8_t padding3;
> +   NISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[];
>  };
>
>  typedef struct NISLANDS_SMC_SWSTATE NISLANDS_SMC_SWSTATE;
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/amd/pm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE

2021-02-15 Thread Alex Deucher
On Wed, Feb 10, 2021 at 5:40 PM Gustavo A. R. Silva
 wrote:
>
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
>
> Refactor the code according to the use of a flexible-array member in
> struct SISLANDS_SMC_SWSTATE, instead of a one-element array, and use
> the struct_size() helper to calculate the size for the allocation.
>
> Also, this helps with the ongoing efforts to enable -Warray-bounds and
> fix the following warnings:
>
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:2448:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:2449:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:2450:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:2451:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:2452:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/si_dpm.c:5570:20: warning: array
> subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’
> {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
>
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
> [2] 
> https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/109
> Build-tested-by: kernel test robot 
> Link: 
> https://lore.kernel.org/lkml/6023be58.sk66l%2fv4vusji5mi%25...@intel.com/
> Signed-off-by: Gustavo A. R. Silva 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/amd/pm/powerplay/si_dpm.c   |  6 ++
>  drivers/gpu/drm/amd/pm/powerplay/sislands_smc.h | 10 +-
>  2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c 
> b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c
> index afa1711c9620..62291358fb1c 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c
> @@ -5715,11 +5715,9 @@ static int si_upload_sw_state(struct amdgpu_device 
> *adev,
> int ret;
> u32 address = si_pi->state_table_start +
> offsetof(SISLANDS_SMC_STATETABLE, driverState);
> -   u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) +
> -   ((new_state->performance_level_count - 1) *
> -sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> SISLANDS_SMC_SWSTATE *smc_state = _pi->smc_statetable.driverState;
> -
> +   size_t state_size = struct_size(smc_state, levels,
> +   new_state->performance_level_count);
> memset(smc_state, 0, state_size);
>
> ret = si_convert_power_state_to_smc(adev, amdgpu_new_state, 
> smc_state);
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/sislands_smc.h 
> b/drivers/gpu/drm/amd/pm/powerplay/sislands_smc.h
> index d2930eceaf3c..0f7554052c90 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/sislands_smc.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/sislands_smc.h
> @@ -182,11 +182,11 @@ typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL 
> SISLANDS_SMC_HW_PERFORMANCE_LEV
>
>  struct SISLANDS_SMC_SWSTATE
>  {
> -uint8_t flags;
> -uint8_t levelCount;
> -uint8_t padding2;
> -uint8_t padding3;
> -SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
> +   uint8_t flags;
> +   uint8_t levelCount;
> +   uint8_t padding2;
> +   uint8_t padding3;
> +   SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[];
>  };
>
>  typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE;
> --
> 2.27.0
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH][next] drm/amd/pm: Replace one-element array with flexible-array in struct _ATOM_Vega10_GFXCLK_Dependency_Table

2021-02-15 Thread Alex Deucher
On Wed, Feb 10, 2021 at 6:36 PM Gustavo A. R. Silva
 wrote:
>
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
>
> Use flexible-array member in struct _ATOM_Vega10_GFXCLK_Dependency_Table,
> instead of one-element array.
>
> Also, this helps with the ongoing efforts to enable -Warray-bounds and
> fix the following warning:
>
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c: In function 
> ‘vega10_get_pp_table_entry_callback_func’:
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c:3113:30: 
> warning: array subscript 4 is above array bounds of 
> ‘ATOM_Vega10_GFXCLK_Dependency_Record[1]’ {aka ‘struct 
> _ATOM_Vega10_GFXCLK_Dependency_Record[1]’} [-Warray-bounds]
>  3113 | gfxclk_dep_table->entries[4].ulClk;
>   | ~^~~
>
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
> [2] 
> https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/109
> Build-tested-by: kernel test robot 
> Link: https://lore.kernel.org/lkml/6023ff3d.wy3ssckgrqpdplvo%25...@intel.com/
> Signed-off-by: Gustavo A. R. Silva 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_pptable.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_pptable.h 
> b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_pptable.h
> index c934e9612c1b..9c479bd9a786 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_pptable.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_pptable.h
> @@ -161,9 +161,9 @@ typedef struct _ATOM_Vega10_MCLK_Dependency_Record {
>  } ATOM_Vega10_MCLK_Dependency_Record;
>
>  typedef struct _ATOM_Vega10_GFXCLK_Dependency_Table {
> -UCHAR ucRevId;
> -UCHAR ucNumEntries; /* Number of 
> entries. */
> -ATOM_Vega10_GFXCLK_Dependency_Record entries[1];/* 
> Dynamically allocate entries. */
> +   UCHAR ucRevId;
> +   UCHAR ucNumEntries; /* Number of 
> entries. */
> +   ATOM_Vega10_GFXCLK_Dependency_Record entries[]; /* 
> Dynamically allocate entries. */
>  } ATOM_Vega10_GFXCLK_Dependency_Table;
>
>  typedef struct _ATOM_Vega10_MCLK_Dependency_Table {
> --
> 2.27.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH][next] drm/amd/display: Fix potential integer overflow

2021-02-15 Thread Alex Deucher
On Wed, Feb 10, 2021 at 4:23 PM Gustavo A. R. Silva
 wrote:
>
> Fix potential integer overflow by casting actual_calculated_clock_100hz
> to u64, in order to give the compiler complete information about the
> proper arithmetic to use.
>
> Notice that such variable is used in a context that expects
> an expression of type u64 (64 bits, unsigned) and the following
> expression is currently being evaluated using 32-bit arithmetic:
>
> actual_calculated_clock_100hz * post_divider
>
> Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
> Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
> Signed-off-by: Gustavo A. R. Silva 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c 
> b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index bc942725b9d8..dec58b3c42e4 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
> pll_settings->calculated_pix_clk_100hz =
> actual_calculated_clock_100hz;
> pll_settings->vco_freq =
> -   div_u64(actual_calculated_clock_100hz * post_divider, 
> 10);
> +   div_u64((u64)actual_calculated_clock_100hz * 
> post_divider, 10);
> return true;
> }
> return false;
> --
> 2.27.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


  1   2   3   4   5   6   7   8   9   10   >