[PATCH] drm/amdgpu: Use correct enum to set powergating state

2018-06-19 Thread Stefan Agner
Use enum amd_powergating_state instead of enum amd_clockgating_state.
The underlying value stays the same, so there is no functional change
in practise. This fixes a warning seen with clang:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1930:14: warning: implicit
  conversion from enumeration type 'enum amd_clockgating_state' to
  different enumeration type 'enum amd_powergating_state'
  [-Wenum-conversion]
   AMD_CG_STATE_UNGATE);
   ^~~~~~~

Signed-off-by: Stefan Agner 
---
 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 fe76ec1f9737..2a1d19c31922 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1927,7 +1927,7 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
if (adev->powerplay.pp_feature & PP_GFXOFF_MASK)
amdgpu_device_ip_set_powergating_state(adev,
   AMD_IP_BLOCK_TYPE_SMC,
-  AMD_CG_STATE_UNGATE);
+  AMD_PG_STATE_UNGATE);
 
/* ungate SMC block first */
r = amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_SMC,
-- 
2.17.1

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


Re: [PATCH] drm/amdgpu:All UVD instances share one idle_work handle

2018-06-19 Thread Stefan Agner
On 18.06.2018 20:00, James Zhu wrote:
> All UVD instanses have only one dpm control, so it is better
> to share one idle_work handle.

Compiles fine with clang here.

Tested-by: Stefan Agner 

> 
> Signed-off-by: James Zhu 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 14 +++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index 04d77f1..cc15d32 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -130,7 +130,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
>   unsigned family_id;
>   int i, j, r;
>  
> - INIT_DELAYED_WORK(&adev->uvd.inst->idle_work, 
> amdgpu_uvd_idle_work_handler);
> + INIT_DELAYED_WORK(&adev->uvd.idle_work, amdgpu_uvd_idle_work_handler);
>  
>   switch (adev->asic_type) {
>  #ifdef CONFIG_DRM_AMDGPU_CIK
> @@ -331,12 +331,12 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
>   void *ptr;
>   int i, j;
>  
> + cancel_delayed_work_sync(&adev->uvd.idle_work);
> +
>   for (j = 0; j < adev->uvd.num_uvd_inst; ++j) {
>   if (adev->uvd.inst[j].vcpu_bo == NULL)
>   continue;
>  
> - cancel_delayed_work_sync(&adev->uvd.inst[j].idle_work);
> -
>   /* only valid for physical mode */
>   if (adev->asic_type < CHIP_POLARIS10) {
>   for (i = 0; i < adev->uvd.max_handles; ++i)
> @@ -1162,7 +1162,7 @@ int amdgpu_uvd_get_destroy_msg(struct
> amdgpu_ring *ring, uint32_t handle,
>  static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
>  {
>   struct amdgpu_device *adev =
> - container_of(work, struct amdgpu_device, 
> uvd.inst->idle_work.work);
> + container_of(work, struct amdgpu_device, uvd.idle_work.work);
>   unsigned fences = 0, i, j;
>  
>   for (i = 0; i < adev->uvd.num_uvd_inst; ++i) {
> @@ -1184,7 +1184,7 @@ static void amdgpu_uvd_idle_work_handler(struct
> work_struct *work)
>  
> AMD_CG_STATE_GATE);
>   }
>   } else {
> - schedule_delayed_work(&adev->uvd.inst->idle_work, 
> UVD_IDLE_TIMEOUT);
> + schedule_delayed_work(&adev->uvd.idle_work, UVD_IDLE_TIMEOUT);
>   }
>  }
>  
> @@ -1196,7 +1196,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
>   if (amdgpu_sriov_vf(adev))
>   return;
>  
> - set_clocks = !cancel_delayed_work_sync(&adev->uvd.inst->idle_work);
> + set_clocks = !cancel_delayed_work_sync(&adev->uvd.idle_work);
>   if (set_clocks) {
>   if (adev->pm.dpm_enabled) {
>   amdgpu_dpm_enable_uvd(adev, true);
> @@ -1213,7 +1213,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
>  void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring)
>  {
>   if (!amdgpu_sriov_vf(ring->adev))
> - schedule_delayed_work(&ring->adev->uvd.inst->idle_work, 
> UVD_IDLE_TIMEOUT);
> + schedule_delayed_work(&ring->adev->uvd.idle_work, 
> UVD_IDLE_TIMEOUT);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> index b1579fb..8b23a1b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> @@ -44,7 +44,6 @@ struct amdgpu_uvd_inst {
>   void*saved_bo;
>   atomic_thandles[AMDGPU_MAX_UVD_HANDLES];
>   struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES];
> - struct delayed_work idle_work;
>   struct amdgpu_ring  ring;
>   struct amdgpu_ring  ring_enc[AMDGPU_MAX_UVD_ENC_RINGS];
>   struct amdgpu_irq_src   irq;
> @@ -62,6 +61,7 @@ struct amdgpu_uvd {
>   booladdress_64_bit;
>   booluse_ctx_buf;
>   struct amdgpu_uvd_inst  inst[AMDGPU_MAX_UVD_INSTANCES];
> + struct delayed_work idle_work;
>  };
>  
>  int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: use first uvd instance to avoid clang build error

2018-06-17 Thread Stefan Agner
Explicitly use the first uvd instance to avoid a build error when
using clang 6:
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:1148:52: error: expected ')'
container_of(work, struct amdgpu_device, 
uvd.inst->idle_work.work);
 ^
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:1148:3: note: to match this '('
container_of(work, struct amdgpu_device, 
uvd.inst->idle_work.work);
^
./include/linux/kernel.h:967:21: note: expanded from macro 'container_of'
((type *)(__mptr - offsetof(type, member))); })
   ^
./include/linux/stddef.h:17:32: note: expanded from macro 'offsetof'
^
./include/linux/compiler-gcc.h:170:20: note: expanded from macro
  '__compiler_offsetof'
__builtin_offsetof(a, b)
  ^
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:1147:24: error: initializing
  'struct amdgpu_device *' with an expression of incompatible type 'void'
struct amdgpu_device *adev =
  ^
2 errors generated.

Fixes: 10dd74eac4db ("drm/amdgpu/vg20:Restruct uvd.inst to support multiple 
instances")
Cc: James Zhu 
Signed-off-by: Stefan Agner 
---
 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 bcf68f80bbf0..a5888c44 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -1145,7 +1145,7 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, 
uint32_t handle,
 static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
 {
struct amdgpu_device *adev =
-   container_of(work, struct amdgpu_device, 
uvd.inst->idle_work.work);
+   container_of(work, struct amdgpu_device, 
uvd.inst[0].idle_work.work);
unsigned fences = 0, i, j;
 
for (i = 0; i < adev->uvd.num_uvd_inst; ++i) {
-- 
2.17.1

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


[PATCH] drm/amd/display: don't initialize result

2018-06-17 Thread Stefan Agner
The wrong enum type is used to initialize the result, leading to a
warning when using clang:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:1998:26: warning:
  implicit conversion from enumeration type 'enum ddc_result' to different
  enumeration type 'enum dc_status' [-Wenum-conversion]
enum dc_status result = DDC_RESULT_UNKNOWN;
   ~~   ^~
1 warning generated.

Initialization of result is unnecessary anyway, just drop the
initialization.

Signed-off-by: Stefan Agner 
---
 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 7857cb42b3e6..1dbfbfc0fd45 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
@@ -1995,7 +1995,7 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, 
union hpd_irq_data *out_hpd
 {
union hpd_irq_data hpd_irq_dpcd_data = 0;
union device_service_irq device_service_clear = { { 0 } };
-   enum dc_status result = DDC_RESULT_UNKNOWN;
+   enum dc_status result;
bool status = false;
/* For use cases related to down stream connection status change,
 * PSR and device auto test, refer to function handle_sst_hpd_irq
-- 
2.17.1

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