RE: [PATCH 4/4] drm/amdgpu: only set DPM_FLAG_NEVER_SKIP for legacy ATPX BOCO

2020-05-07 Thread Quan, Evan
[AMD Official Use Only - Internal Distribution Only]

Patch2 is reviewed-by: Evan Quan 
Others from the series are acked-by: Evan Quan 

-Original Message-
From: amd-gfx  On Behalf Of Alex Deucher
Sent: Friday, May 8, 2020 12:08 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
Subject: [PATCH 4/4] drm/amdgpu: only set DPM_FLAG_NEVER_SKIP for legacy ATPX 
BOCO

We only need to set DPM_FLAG_NEVER_SKIP for the legacy ATPX
BOCO case.  D3cold and BACO work as expected.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 233d6c8c4ca3..4e4c9550dcf8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -188,7 +188,10 @@ int amdgpu_driver_load_kms(struct drm_device *dev, 
unsigned long flags)
 dev_dbg(>pdev->dev, "Error during ACPI methods call\n");

 if (adev->runpm) {
-dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
+/* only need to skip on ATPX */
+if (amdgpu_device_supports_boco(dev) &&
+!amdgpu_is_atpx_hybrid())
+dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
 pm_runtime_use_autosuspend(dev->dev);
 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
 pm_runtime_allow(dev->dev);
--
2.25.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cevan.quan%40amd.com%7C62fe0eef98e74285482908d7f2a0dd85%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244645084791405sdata=n4w17BAf2MR8AClxM6RQ8MZHoTnMiC3aeGj3RYUPdtk%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH] drm/amdgpu: implement soft_recovery for gfx10

2020-05-07 Thread Quan, Evan
[AMD Official Use Only - Internal Distribution Only]

Acked-by: Evan Quan 

-Original Message-
From: amd-gfx  On Behalf Of Alex Deucher
Sent: Wednesday, May 6, 2020 12:42 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
Subject: [PATCH] drm/amdgpu: implement soft_recovery for gfx10

Same as gfx9.  This allows us to kill the waves for hung shaders.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index ddb485e1e963..27c63a8f698c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -7690,6 +7690,19 @@ static void 
gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
ref, mask);
 }

+static void gfx_v10_0_ring_soft_recovery(struct amdgpu_ring *ring,
+ unsigned vmid)
+{
+struct amdgpu_device *adev = ring->adev;
+uint32_t value = 0;
+
+value = REG_SET_FIELD(value, SQ_CMD, CMD, 0x03);
+value = REG_SET_FIELD(value, SQ_CMD, MODE, 0x01);
+value = REG_SET_FIELD(value, SQ_CMD, CHECK_VMID, 1);
+value = REG_SET_FIELD(value, SQ_CMD, VM_ID, vmid);
+WREG32_SOC15(GC, 0, mmSQ_CMD, value);
+}
+
 static void
 gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
   uint32_t me, uint32_t pipe,
@@ -8105,6 +8118,7 @@ static const struct amdgpu_ring_funcs 
gfx_v10_0_ring_funcs_gfx = {
 .emit_wreg = gfx_v10_0_ring_emit_wreg,
 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
 .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
+.soft_recovery = gfx_v10_0_ring_soft_recovery,
 .emit_mem_sync = gfx_v10_0_emit_mem_sync,  };

--
2.25.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cevan.quan%40amd.com%7Ca05c11564652426256c808d7f1134cfa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637242937523172802sdata=N5Ia6bTtJ%2F4MoryLJqjSuAfefg%2FWNZYfa%2Fi%2BcLvUTxI%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 1/1] drm/amdgpu: cleanup sysfs file handling

2020-05-07 Thread Das, Nirmoy



On 5/7/2020 9:21 PM, Alex Deucher wrote:

On Thu, May 7, 2020 at 4:15 PM Nirmoy Das  wrote:

Create sysfs file using attributes when possible.

Signed-off-by: Nirmoy Das 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  36 +++

Reviewed-by: Alex Deucher 
for the amdgpu_device.c changes.  For amdgpu_pm.c, I think Kevin has a
patch set out to clean this up as well that also fixes up the VF
handling.  May want to check with him on the pm changes.



Thanks Alex, I didn't know. I will check with Kevin.


Regards,

Nirmoy



Alex


  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 114 +++--
  2 files changed, 48 insertions(+), 102 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bf302c799832..cc41e8f5ad14 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2918,6 +2918,14 @@ static int amdgpu_device_get_job_timeout_settings(struct 
amdgpu_device *adev)
 return ret;
  }

+static const struct attribute *amdgpu_dev_attributes[] = {
+   _attr_product_name.attr,
+   _attr_product_number.attr,
+   _attr_serial_number.attr,
+   _attr_pcie_replay_count.attr,
+   NULL
+};
+
  /**
   * amdgpu_device_init - initialize the driver
   *
@@ -3267,27 +3275,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 queue_delayed_work(system_wq, >delayed_init_work,
msecs_to_jiffies(AMDGPU_RESUME_MS));

-   r = device_create_file(adev->dev, _attr_pcie_replay_count);
-   if (r) {
-   dev_err(adev->dev, "Could not create pcie_replay_count");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_product_name);
+   r = sysfs_create_files(>dev->kobj, amdgpu_dev_attributes);
 if (r) {
-   dev_err(adev->dev, "Could not create product_name");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_product_number);
-   if (r) {
-   dev_err(adev->dev, "Could not create product_number");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_serial_number);
-   if (r) {
-   dev_err(adev->dev, "Could not create serial_number");
+   dev_err(adev->dev, "Could not create amdgpu device attr\n");
 return r;
 }

@@ -3370,12 +3360,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 adev->rmmio = NULL;
 amdgpu_device_doorbell_fini(adev);

-   device_remove_file(adev->dev, _attr_pcie_replay_count);
 if (adev->ucode_sysfs_en)
 amdgpu_ucode_sysfs_fini(adev);
-   device_remove_file(adev->dev, _attr_product_name);
-   device_remove_file(adev->dev, _attr_product_number);
-   device_remove_file(adev->dev, _attr_serial_number);
+
+   sysfs_remove_files(>dev->kobj, amdgpu_dev_attributes);
 if (IS_ENABLED(CONFIG_PERF_EVENTS))
 amdgpu_pmu_fini(adev);
 if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index c762deb5abc7..f375bc341acc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -3239,6 +3239,27 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device 
*adev, uint32_t *smu_versio
 return 0;
  }

+static const struct attribute *amdgpu_pm_attributes[] = {
+   _attr_power_dpm_state.attr,
+   _attr_power_dpm_force_performance_level.attr,
+   _attr_pp_dpm_sclk.attr,
+   _attr_pp_dpm_mclk.attr,
+
+   _attr_pp_sclk_od.attr,
+   _attr_pp_mclk_od.attr,
+   _attr_pp_power_profile_mode.attr,
+   _attr_gpu_busy_percent.attr,
+   NULL
+};
+
+static const struct attribute *amdgpu_pm_non_vf_attributes[] = {
+   _attr_pp_num_states.attr,
+   _attr_pp_cur_state.attr,
+   _attr_pp_force_state.attr,
+   _attr_pp_table.attr,
+   NULL
+};
+
  int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
  {
 struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
@@ -3260,45 +3281,6 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 return ret;
 }

-   ret = device_create_file(adev->dev, _attr_power_dpm_state);
-   if (ret) {
-   DRM_ERROR("failed to create device file for dpm state\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, 
_attr_power_dpm_force_performance_level);
-   if (ret) {
-   DRM_ERROR("failed to create device file for dpm state\n");
-   return ret;
-   }
-
-   if (!amdgpu_sriov_vf(adev)) {
-   ret = device_create_file(adev->dev, _attr_pp_num_states);
-   if (ret) {
-   DRM_ERROR("failed to create device file 
pp_num_states\n");
-   return ret;
-   }
- 

Re: [PATCH 1/1] drm/amdgpu: cleanup sysfs file handling

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 4:15 PM Nirmoy Das  wrote:
>
> Create sysfs file using attributes when possible.
>
> Signed-off-by: Nirmoy Das 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  36 +++

Reviewed-by: Alex Deucher 
for the amdgpu_device.c changes.  For amdgpu_pm.c, I think Kevin has a
patch set out to clean this up as well that also fixes up the VF
handling.  May want to check with him on the pm changes.

Alex

>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 114 +++--
>  2 files changed, 48 insertions(+), 102 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index bf302c799832..cc41e8f5ad14 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2918,6 +2918,14 @@ static int 
> amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
> return ret;
>  }
>
> +static const struct attribute *amdgpu_dev_attributes[] = {
> +   _attr_product_name.attr,
> +   _attr_product_number.attr,
> +   _attr_serial_number.attr,
> +   _attr_pcie_replay_count.attr,
> +   NULL
> +};
> +
>  /**
>   * amdgpu_device_init - initialize the driver
>   *
> @@ -3267,27 +3275,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
> queue_delayed_work(system_wq, >delayed_init_work,
>msecs_to_jiffies(AMDGPU_RESUME_MS));
>
> -   r = device_create_file(adev->dev, _attr_pcie_replay_count);
> -   if (r) {
> -   dev_err(adev->dev, "Could not create pcie_replay_count");
> -   return r;
> -   }
> -
> -   r = device_create_file(adev->dev, _attr_product_name);
> +   r = sysfs_create_files(>dev->kobj, amdgpu_dev_attributes);
> if (r) {
> -   dev_err(adev->dev, "Could not create product_name");
> -   return r;
> -   }
> -
> -   r = device_create_file(adev->dev, _attr_product_number);
> -   if (r) {
> -   dev_err(adev->dev, "Could not create product_number");
> -   return r;
> -   }
> -
> -   r = device_create_file(adev->dev, _attr_serial_number);
> -   if (r) {
> -   dev_err(adev->dev, "Could not create serial_number");
> +   dev_err(adev->dev, "Could not create amdgpu device attr\n");
> return r;
> }
>
> @@ -3370,12 +3360,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
> adev->rmmio = NULL;
> amdgpu_device_doorbell_fini(adev);
>
> -   device_remove_file(adev->dev, _attr_pcie_replay_count);
> if (adev->ucode_sysfs_en)
> amdgpu_ucode_sysfs_fini(adev);
> -   device_remove_file(adev->dev, _attr_product_name);
> -   device_remove_file(adev->dev, _attr_product_number);
> -   device_remove_file(adev->dev, _attr_serial_number);
> +
> +   sysfs_remove_files(>dev->kobj, amdgpu_dev_attributes);
> if (IS_ENABLED(CONFIG_PERF_EVENTS))
> amdgpu_pmu_fini(adev);
> if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index c762deb5abc7..f375bc341acc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -3239,6 +3239,27 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device 
> *adev, uint32_t *smu_versio
> return 0;
>  }
>
> +static const struct attribute *amdgpu_pm_attributes[] = {
> +   _attr_power_dpm_state.attr,
> +   _attr_power_dpm_force_performance_level.attr,
> +   _attr_pp_dpm_sclk.attr,
> +   _attr_pp_dpm_mclk.attr,
> +
> +   _attr_pp_sclk_od.attr,
> +   _attr_pp_mclk_od.attr,
> +   _attr_pp_power_profile_mode.attr,
> +   _attr_gpu_busy_percent.attr,
> +   NULL
> +};
> +
> +static const struct attribute *amdgpu_pm_non_vf_attributes[] = {
> +   _attr_pp_num_states.attr,
> +   _attr_pp_cur_state.attr,
> +   _attr_pp_force_state.attr,
> +   _attr_pp_table.attr,
> +   NULL
> +};
> +
>  int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
>  {
> struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
> @@ -3260,45 +3281,6 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
> return ret;
> }
>
> -   ret = device_create_file(adev->dev, _attr_power_dpm_state);
> -   if (ret) {
> -   DRM_ERROR("failed to create device file for dpm state\n");
> -   return ret;
> -   }
> -   ret = device_create_file(adev->dev, 
> _attr_power_dpm_force_performance_level);
> -   if (ret) {
> -   DRM_ERROR("failed to create device file for dpm state\n");
> -   return ret;
> -   }
> -
> -   if (!amdgpu_sriov_vf(adev)) {
> -   ret = device_create_file(adev->dev, _attr_pp_num_states);
> -   if (ret) {
> -   

[PATCH 1/1] drm/amdgpu: cleanup sysfs file handling

2020-05-07 Thread Nirmoy Das
Create sysfs file using attributes when possible.

Signed-off-by: Nirmoy Das 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  36 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 114 +++--
 2 files changed, 48 insertions(+), 102 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bf302c799832..cc41e8f5ad14 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2918,6 +2918,14 @@ static int amdgpu_device_get_job_timeout_settings(struct 
amdgpu_device *adev)
return ret;
 }
 
+static const struct attribute *amdgpu_dev_attributes[] = {
+   _attr_product_name.attr,
+   _attr_product_number.attr,
+   _attr_serial_number.attr,
+   _attr_pcie_replay_count.attr,
+   NULL
+};
+
 /**
  * amdgpu_device_init - initialize the driver
  *
@@ -3267,27 +3275,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
queue_delayed_work(system_wq, >delayed_init_work,
   msecs_to_jiffies(AMDGPU_RESUME_MS));
 
-   r = device_create_file(adev->dev, _attr_pcie_replay_count);
-   if (r) {
-   dev_err(adev->dev, "Could not create pcie_replay_count");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_product_name);
+   r = sysfs_create_files(>dev->kobj, amdgpu_dev_attributes);
if (r) {
-   dev_err(adev->dev, "Could not create product_name");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_product_number);
-   if (r) {
-   dev_err(adev->dev, "Could not create product_number");
-   return r;
-   }
-
-   r = device_create_file(adev->dev, _attr_serial_number);
-   if (r) {
-   dev_err(adev->dev, "Could not create serial_number");
+   dev_err(adev->dev, "Could not create amdgpu device attr\n");
return r;
}
 
@@ -3370,12 +3360,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
adev->rmmio = NULL;
amdgpu_device_doorbell_fini(adev);
 
-   device_remove_file(adev->dev, _attr_pcie_replay_count);
if (adev->ucode_sysfs_en)
amdgpu_ucode_sysfs_fini(adev);
-   device_remove_file(adev->dev, _attr_product_name);
-   device_remove_file(adev->dev, _attr_product_number);
-   device_remove_file(adev->dev, _attr_serial_number);
+
+   sysfs_remove_files(>dev->kobj, amdgpu_dev_attributes);
if (IS_ENABLED(CONFIG_PERF_EVENTS))
amdgpu_pmu_fini(adev);
if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index c762deb5abc7..f375bc341acc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -3239,6 +3239,27 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device 
*adev, uint32_t *smu_versio
return 0;
 }
 
+static const struct attribute *amdgpu_pm_attributes[] = {
+   _attr_power_dpm_state.attr,
+   _attr_power_dpm_force_performance_level.attr,
+   _attr_pp_dpm_sclk.attr,
+   _attr_pp_dpm_mclk.attr,
+
+   _attr_pp_sclk_od.attr,
+   _attr_pp_mclk_od.attr,
+   _attr_pp_power_profile_mode.attr,
+   _attr_gpu_busy_percent.attr,
+   NULL
+};
+
+static const struct attribute *amdgpu_pm_non_vf_attributes[] = {
+   _attr_pp_num_states.attr,
+   _attr_pp_cur_state.attr,
+   _attr_pp_force_state.attr,
+   _attr_pp_table.attr,
+   NULL
+};
+
 int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 {
struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
@@ -3260,45 +3281,6 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
return ret;
}
 
-   ret = device_create_file(adev->dev, _attr_power_dpm_state);
-   if (ret) {
-   DRM_ERROR("failed to create device file for dpm state\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, 
_attr_power_dpm_force_performance_level);
-   if (ret) {
-   DRM_ERROR("failed to create device file for dpm state\n");
-   return ret;
-   }
-
-   if (!amdgpu_sriov_vf(adev)) {
-   ret = device_create_file(adev->dev, _attr_pp_num_states);
-   if (ret) {
-   DRM_ERROR("failed to create device file 
pp_num_states\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_pp_cur_state);
-   if (ret) {
-   DRM_ERROR("failed to create device file 
pp_cur_state\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_pp_force_state);
-   if (ret) {
-   DRM_ERROR("failed to create device file 
pp_force_state\n");

Re: [PATCH] MAINTAINERS: Remove me from amdgpu maintainers

2020-05-07 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, May 7, 2020 at 2:45 AM Christian König
 wrote:
>
> Am 07.05.20 um 04:02 schrieb Chunming Zhou:
> > Glad to spend time on kernel driver in past years.
> > I've moved to new focus in umd and couldn't commit
> > enough time to discussions.
> >
> > Signed-off-by: Chunming Zhou 
>
> So Long, and Thanks for All the Fish :)
>
> Reviewed-by: Christian König 
>
> > ---
> >   MAINTAINERS | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 938316092634..4ca508bd4c9e 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -14066,7 +14066,6 @@ F:drivers/net/wireless/quantenna
> >   RADEON and AMDGPU DRM DRIVERS
> >   M:  Alex Deucher 
> >   M:  Christian König 
> > -M:   David (ChunMing) Zhou 
> >   L:  amd-gfx@lists.freedesktop.org
> >   S:  Supported
> >   T:  git git://people.freedesktop.org/~agd5f/linux
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: builtin display using amdgpu gives a black screen on macbook pro 13, 3

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 3:36 PM D Marinus  wrote:
>
> Hi!
>
> Since I've updated the linux kernel to 5.6 my builtin display of my
> Apple Macbook Pro 13,3 is blank. The following bug reports have been
> opened:
>
> https://github.com/Dunedan/mbp-2016-linux/issues/142
> https://bugzilla.kernel.org/show_bug.cgi?id=207589
> https://bugzilla.redhat.com/show_bug.cgi?id=1829174
>
>
> xrandr gives the following message
> xrandr: Output eDP is not disconnected but has no modes
>
> the /sys/kernel/debug/vgaswitcheroo/switch entry is missing
>
> lspci gives:
> 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
> [AMD/ATI] Baffin [Radeon RX 460/560D / Pro
> 450/455/460/555/555X/560/560X] (rev ef)
>
> Any thoughts on the cause or fix? What would be helpful information?

Macs handle hybrid graphics differently than other systems.  Maybe
some change related to the mac mux driver?  A bisection would be
helpful.

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


Re: [PATCH -next] drm/amd/display: remove duplicate headers

2020-05-07 Thread Alex Deucher
Applied.  Thanks!

Alex

On Thu, May 7, 2020 at 11:27 AM Chen Zhou  wrote:
>
> Remove duplicate headers which are included twice.
>
> Signed-off-by: Chen Zhou 
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 1 -
>  1 file changed, 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 9ef9e50a34fa..1db592372435 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
> @@ -13,7 +13,6 @@
>  #include "core_status.h"
>  #include "dpcd_defs.h"
>
> -#include "resource.h"
>  #define DC_LOGGER \
> link->ctx->logger
>
> --
> 2.20.1
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH -next] drm/amd/dc: Remove a useless comparison

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 9:35 AM ChenTao  wrote:
>
> Fix the following warning:
>
> 'en' is uint32_t and can never be negative.
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_hpd.c:132:10: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
> drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_generic.c:109:10: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
>

While it's not required, I think it improves readability and protects
if the enum has negative values.  I think it would be better to change
the en var to signed.

Alex

> Reported-by: Hulk Robot 
> Signed-off-by: ChenTao 
> ---
>  drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c | 2 +-
>  drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c 
> b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
> index f9e847e6555d..6cd50232c432 100644
> --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
> +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
> @@ -106,7 +106,7 @@ void dal_hw_generic_init(
> enum gpio_id id,
> uint32_t en)
>  {
> -   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
> +   if (en > GPIO_DDC_LINE_MAX) {
> ASSERT_CRITICAL(false);
> *hw_generic = NULL;
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c 
> b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
> index 692f29de7797..f91f426699c0 100644
> --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
> +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
> @@ -129,7 +129,7 @@ void dal_hw_hpd_init(
> enum gpio_id id,
> uint32_t en)
>  {
> -   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
> +   if (en > GPIO_DDC_LINE_MAX) {
> ASSERT_CRITICAL(false);
> *hw_hpd = NULL;
> }
> --
> 2.22.0
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


builtin display using amdgpu gives a black screen on macbook pro 13, 3

2020-05-07 Thread D Marinus
Hi!

Since I've updated the linux kernel to 5.6 my builtin display of my
Apple Macbook Pro 13,3 is blank. The following bug reports have been
opened:

https://github.com/Dunedan/mbp-2016-linux/issues/142
https://bugzilla.kernel.org/show_bug.cgi?id=207589
https://bugzilla.redhat.com/show_bug.cgi?id=1829174


xrandr gives the following message
xrandr: Output eDP is not disconnected but has no modes

the /sys/kernel/debug/vgaswitcheroo/switch entry is missing

lspci gives:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Baffin [Radeon RX 460/560D / Pro
450/455/460/555/555X/560/560X] (rev ef)

Any thoughts on the cause or fix? What would be helpful information?

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


Re: [PATCH] drm/amd/display: remove variable "result" in dcn20_patch_unknown_plane_state()

2020-05-07 Thread Alex Deucher
Applied thanks!

Alex

On Thu, May 7, 2020 at 9:35 AM Jason Yan  wrote:
>
> Fix the following coccicheck warning:
>
> drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c:3216:16-22:
> Unneeded variable: "result". Return "DC_OK" on line 3229
>
> Signed-off-by: Jason Yan 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c 
> b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
> index 4dea550c3f83..3c0090797866 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
> @@ -3228,8 +3228,6 @@ static struct dc_cap_funcs cap_funcs = {
>
>  enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state 
> *plane_state)
>  {
> -   enum dc_status result = DC_OK;
> -
> enum surface_pixel_format surf_pix_format = plane_state->format;
> unsigned int bpp = resource_pixel_format_to_bpp(surf_pix_format);
>
> @@ -3241,7 +3239,7 @@ enum dc_status dcn20_patch_unknown_plane_state(struct 
> dc_plane_state *plane_stat
> swizzle = DC_SW_64KB_S;
>
> plane_state->tiling_info.gfx9.swizzle = swizzle;
> -   return result;
> +   return DC_OK;
>  }
>
>  static struct resource_funcs dcn20_res_pool_funcs = {
> --
> 2.21.1
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 5:22 AM Christian König  wrote:
>
> Am 07.05.20 um 11:13 schrieb Bernard Zhao:
> > There is DEVICE_ATTR mechanism in separate attribute define.
> > So this change is to use attr array, also use
> > sysfs_create_files in init function & sysfs_remove_files in
> > fini function.
> > This maybe make the code a bit readable.
> >
> > Signed-off-by: Bernard Zhao 
>
> Reviewed-by: Christian König 
>

Applied with a minor change to make the array const to fix the build.

Alex

> >
> > Changes since V1:
> > *Use DEVICE_ATTR mechanism
> >
> > Link for V1:
> > *https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fpatchwork%2Fpatch%2F1228076%2Fdata=02%7C01%7Cchristian.koenig%40amd.com%7C073b9043be5346b3c90c08d7f266e6fb%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244396096735223sdata=PjFsYvmw2pvVisZ6TzMqOyoSr0m3DsFN%2F0q%2B%2FfBxACg%3Dreserved=0
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 43 ++--
> >   1 file changed, 13 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> > index 82a3299e53c0..57bbc70662ff 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> > @@ -148,6 +148,15 @@ static DEVICE_ATTR(mem_info_vis_vram_used, S_IRUGO,
> >   static DEVICE_ATTR(mem_info_vram_vendor, S_IRUGO,
> >  amdgpu_mem_info_vram_vendor, NULL);
> >
> > +static struct attribute *amdgpu_vram_mgr_attributes[] = {
> > + _attr_mem_info_vram_total.attr,
> > + _attr_mem_info_vis_vram_total.attr,
> > + _attr_mem_info_vram_used.attr,
> > + _attr_mem_info_vis_vram_used.attr,
> > + _attr_mem_info_vram_vendor.attr,
> > + NULL
> > +};
> > +
> >   /**
> >* amdgpu_vram_mgr_init - init VRAM manager and DRM MM
> >*
> > @@ -172,31 +181,9 @@ static int amdgpu_vram_mgr_init(struct 
> > ttm_mem_type_manager *man,
> >   man->priv = mgr;
> >
> >   /* Add the two VRAM-related sysfs files */
> > - ret = device_create_file(adev->dev, _attr_mem_info_vram_total);
> > - if (ret) {
> > - DRM_ERROR("Failed to create device file 
> > mem_info_vram_total\n");
> > - return ret;
> > - }
> > - ret = device_create_file(adev->dev, 
> > _attr_mem_info_vis_vram_total);
> > - if (ret) {
> > - DRM_ERROR("Failed to create device file 
> > mem_info_vis_vram_total\n");
> > - return ret;
> > - }
> > - ret = device_create_file(adev->dev, _attr_mem_info_vram_used);
> > - if (ret) {
> > - DRM_ERROR("Failed to create device file 
> > mem_info_vram_used\n");
> > - return ret;
> > - }
> > - ret = device_create_file(adev->dev, _attr_mem_info_vis_vram_used);
> > - if (ret) {
> > - DRM_ERROR("Failed to create device file 
> > mem_info_vis_vram_used\n");
> > - return ret;
> > - }
> > - ret = device_create_file(adev->dev, _attr_mem_info_vram_vendor);
> > - if (ret) {
> > - DRM_ERROR("Failed to create device file 
> > mem_info_vram_vendor\n");
> > - return ret;
> > - }
> > + ret = sysfs_create_files(>dev->kobj, 
> > amdgpu_vram_mgr_attributes);
> > + if (ret)
> > + DRM_ERROR("Failed to register sysfs\n");
> >
> >   return 0;
> >   }
> > @@ -219,11 +206,7 @@ static int amdgpu_vram_mgr_fini(struct 
> > ttm_mem_type_manager *man)
> >   spin_unlock(>lock);
> >   kfree(mgr);
> >   man->priv = NULL;
> > - device_remove_file(adev->dev, _attr_mem_info_vram_total);
> > - device_remove_file(adev->dev, _attr_mem_info_vis_vram_total);
> > - device_remove_file(adev->dev, _attr_mem_info_vram_used);
> > - device_remove_file(adev->dev, _attr_mem_info_vis_vram_used);
> > - device_remove_file(adev->dev, _attr_mem_info_vram_vendor);
> > + sysfs_remove_files(>dev->kobj, amdgpu_vram_mgr_attributes);
> >   return 0;
> >   }
> >
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] Revert "drm/amdgpu: Add ReadSerial defines for Arcturus"

2020-05-07 Thread Deucher, Alexander
[AMD Public Use]

Series is:
Reviewed-by: Alex Deucher 

From: amd-gfx  on behalf of Kent Russell 

Sent: Thursday, May 7, 2020 2:54 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Russell, Kent 
Subject: [PATCH 2/2] Revert "drm/amdgpu: Add ReadSerial defines for Arcturus"

This reverts commit a0d4939d8616fab676699dab8ba3cbe519d4a8e9.

SMU does not support this on Arcturus right now

Signed-off-by: Kent Russell 
Change-Id: I50efa3695570302231986d56c2351aac331726ca
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c   | 2 --
 drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index e98d92ec1eac..1c66b7d7139c 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -128,8 +128,6 @@ static struct smu_11_0_cmn2aisc_mapping 
arcturus_message_map[SMU_MSG_MAX_COUNT]
 MSG_MAP(SetXgmiMode, PPSMC_MSG_SetXgmiMode),
 MSG_MAP(SetMemoryChannelEnable,  
PPSMC_MSG_SetMemoryChannelEnable),
 MSG_MAP(DFCstateControl, 
PPSMC_MSG_DFCstateControl),
-   MSG_MAP(ReadSerialNumTop32,  
PPSMC_MSG_ReadSerialNumTop32),
-   MSG_MAP(ReadSerialNumBottom32,   
PPSMC_MSG_ReadSerialNumBottom32),
 };

 static struct smu_11_0_cmn2aisc_mapping arcturus_clk_map[SMU_CLK_COUNT] = {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h 
b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
index b426be7c76c6..f736d773f9d6 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
@@ -116,9 +116,6 @@
 #define PPSMC_MSG_DFCstateControl0x3B
 #define PPSMC_Message_Count  0x3C

-#define PPSMC_MSG_ReadSerialNumTop320x49
-#define PPSMC_MSG_ReadSerialNumBottom32 0x4A
-
 typedef uint32_t PPSMC_Result;
 typedef uint32_t PPSMC_Msg;
 #pragma pack(pop)
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Calexander.deucher%40amd.com%7C67572abb9c0c4048437508d7f2b80cdc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244744643483015sdata=C%2B1WKdorha3NIZHKxeNQTcD8krgBeP2I2crG0dCrRPk%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 1/2] Revert "drm/amdgpu: Add unique_id for Arcturus"

2020-05-07 Thread Kent Russell
This reverts commit b3abbca4eca6091e0e657baf9a5402e204e97d4c.

SMU does not support this on Arcturus right now

Signed-off-by: Kent Russell 
Change-Id: Ia5f29f91a64005f68dbb9499b43789fe473cd00c
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index f55f9b371bf2..e98d92ec1eac 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -293,7 +293,6 @@ static int arcturus_get_workload_type(struct smu_context 
*smu, enum PP_SMC_POWER
 static int arcturus_tables_init(struct smu_context *smu, struct smu_table 
*tables)
 {
struct smu_table_context *smu_table = >smu_table;
-   uint32_t top32, bottom32;
 
SMU_TABLE_INIT(tables, SMU_TABLE_PPTABLE, sizeof(PPTable_t),
   PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
@@ -316,15 +315,6 @@ static int arcturus_tables_init(struct smu_context *smu, 
struct smu_table *table
return -ENOMEM;
smu_table->metrics_time = 0;
 
-   if (smu->adev->asic_type == CHIP_ARCTURUS) {
-   /* Get the SN to turn into a Unique ID */
-   smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32,
-);
-   smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumBottom32,
-);
-
-   smu->adev->unique_id = ((uint64_t)bottom32 << 32) | top32;
-   }
return 0;
 }
 
-- 
2.17.1

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


[PATCH 2/2] Revert "drm/amdgpu: Add ReadSerial defines for Arcturus"

2020-05-07 Thread Kent Russell
This reverts commit a0d4939d8616fab676699dab8ba3cbe519d4a8e9.

SMU does not support this on Arcturus right now

Signed-off-by: Kent Russell 
Change-Id: I50efa3695570302231986d56c2351aac331726ca
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c   | 2 --
 drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index e98d92ec1eac..1c66b7d7139c 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -128,8 +128,6 @@ static struct smu_11_0_cmn2aisc_mapping 
arcturus_message_map[SMU_MSG_MAX_COUNT]
MSG_MAP(SetXgmiMode, PPSMC_MSG_SetXgmiMode),
MSG_MAP(SetMemoryChannelEnable,  
PPSMC_MSG_SetMemoryChannelEnable),
MSG_MAP(DFCstateControl, PPSMC_MSG_DFCstateControl),
-   MSG_MAP(ReadSerialNumTop32,  
PPSMC_MSG_ReadSerialNumTop32),
-   MSG_MAP(ReadSerialNumBottom32,   
PPSMC_MSG_ReadSerialNumBottom32),
 };
 
 static struct smu_11_0_cmn2aisc_mapping arcturus_clk_map[SMU_CLK_COUNT] = {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h 
b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
index b426be7c76c6..f736d773f9d6 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
@@ -116,9 +116,6 @@
 #define PPSMC_MSG_DFCstateControl   0x3B
 #define PPSMC_Message_Count 0x3C
 
-#define PPSMC_MSG_ReadSerialNumTop320x49
-#define PPSMC_MSG_ReadSerialNumBottom32 0x4A
-
 typedef uint32_t PPSMC_Result;
 typedef uint32_t PPSMC_Msg;
 #pragma pack(pop)
-- 
2.17.1

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


Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

2020-05-07 Thread Sam Ravnborg
Hi Emil.

On Thu, May 07, 2020 at 04:07:52PM +0100, Emil Velikov wrote:
> From: Emil Velikov 
> 
> The driver does not hold struct_mutex, thus using the locked version of
> the helper is incorrect.
> 
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: amd-gfx@lists.freedesktop.org
> Fixes: a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
> Signed-off-by: Emil Velikov 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index 43d8ed7dbd00..652c57a3b847 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct 
> drm_device *dev,
>   attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
>   _dma_buf_attach_ops, obj);
>   if (IS_ERR(attach)) {
> - drm_gem_object_put(obj);
> + drm_gem_object_put_unlocked(obj);
>   return ERR_CAST(attach);
>   }
Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.

Sam

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


Re: [PATCH] drm/amd/display: Fix vblank and pageflip event handling for FreeSync

2020-05-07 Thread Kazlauskas, Nicholas

It applies on top of Alex's amd-staging-drm-next-branch.

It is essentially just a revert to the old behavior with 
acrtc_state->active_planes == 0 special case you added on top and some 
small refactoring.


The only remaining bits that are kind of questionable is the 
VUPDATE_NO_LOCK vs VUPDATE bit again along with some of the locking 
around where we check if FreeSync is active or not.


I also don't think that VSTARTUP is the correct place to be performing 
the update for the registers since the offset between VSTARTUP and 
VUPDATE can be small enough such that the programming won't finish in 
time for some timings. We should be doing it on line 0 instead.


All these issues existed before this patch series at least though.

Regards,
Nicholas Kazlauskas

On 2020-05-07 12:58 p.m., Mario Kleiner wrote:
Looking over it now, will do some testing. Alex amdgpu-drm-next branch 
would be the best to test this?


It looks like a revert of the whole vstartup series, except for that 
one  if(acrtc_state->active_planes == 0)  special case, so i expect it 
should be fine?


thanks,
-mario


On Thu, May 7, 2020 at 5:56 PM Leo Li > wrote:




On 2020-05-06 3:47 p.m., Nicholas Kazlauskas wrote:
> [Why]
> We're the drm vblank event a frame too early in the case where the
        ^sending

Thanks for catching this!

Reviewed-by: Leo Li mailto:sunpeng...@amd.com>>

> pageflip happens close to VUPDATE and ends up blocking the signal.
>
> The implementation in DM was previously correct *before* we started
> sending vblank events from VSTARTUP unconditionally to handle cases
> where HUBP was off, OTG was ON and userspace was still
requesting some
> DRM planes enabled. As part of that patch series we dropped VUPDATE
> since it was deemed close enough to VSTARTUP, but there's a key
> difference betweeen VSTARTUP and VUPDATE - the VUPDATE signal can be
> blocked if we're holding the pipe lock >
> There was a fix recently to revert the unconditional behavior
for the
> DCN VSTARTUP vblank event since it was sending the pageflip event on
> the wrong frame - once again, due to blocking VUPDATE and having the
> address start scanning out two frames later.
>
> The problem with this fix is it didn't update the logic that calls
> drm_crtc_handle_vblank(), so the timestamps are totally bogus now.
>
> [How]
> Essentially reverts most of the original VSTARTUP series but retains
> the behavior to send back events when active planes == 0.
>
> Some refactoring/cleanup was done to not have duplicated code in
both
> the handlers.
>
> Fixes: 16f17eda8bad ("drm/amd/display: Send vblank and user
events at vsartup for DCN")
> Fixes: 3a2ce8d66a4b ("drm/amd/display: Disable VUpdate interrupt
for DCN hardware")
> Fixes: 2b5aed9ac3f7 ("drm/amd/display: Fix pageflip event race
condition for DCN.")
>
> Cc: Leo Li mailto:sunpeng...@amd.com>>
> Cc: Mario Kleiner mailto:mario.kleiner...@gmail.com>>
> Signed-off-by: Nicholas Kazlauskas mailto:nicholas.kazlaus...@amd.com>>
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 137
+++---
>   1 file changed, 55 insertions(+), 82 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 59f1d4a94f12..30ce28f7c444 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void
*interrupt_params)
>
>   /**
>    * dm_crtc_high_irq() - Handles CRTC interrupt
> - * @interrupt_params: ignored
> + * @interrupt_params: used for determining the CRTC instance
>    *
>    * Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
>    * event handler.
> @@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void
*interrupt_params)
>       unsigned long flags;
>
>       acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src -
IRQ_TYPE_VBLANK);
> -
> -     if (acrtc) {
> -             acrtc_state = to_dm_crtc_state(acrtc->base.state);
> -
> -             DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
> -                           acrtc->crtc_id,
> -  amdgpu_dm_vrr_active(acrtc_state));
> -
> -             /* Core vblank handling at start of front-porch is
only possible
> -              * in non-vrr mode, as only there vblank
timestamping will give
> -              * valid results while done in front-porch.
Otherwise defer it
> -              * to dm_vupdate_high_irq after end of front-porch.
> -              */
> -             if (!amdgpu_dm_vrr_active(acrtc_state))
> -  drm_crtc_handle_vblank(>base);
> -
> -             /* Following stuff 

Re: [PATCH] drm/amd/display: Fix vblank and pageflip event handling for FreeSync

2020-05-07 Thread Mario Kleiner
Looking over it now, will do some testing. Alex amdgpu-drm-next branch
would be the best to test this?

It looks like a revert of the whole vstartup series, except for that one
if(acrtc_state->active_planes == 0)  special case, so i expect it should be
fine?

thanks,
-mario


On Thu, May 7, 2020 at 5:56 PM Leo Li  wrote:

>
>
> On 2020-05-06 3:47 p.m., Nicholas Kazlauskas wrote:
> > [Why]
> > We're the drm vblank event a frame too early in the case where the
> ^sending
>
> Thanks for catching this!
>
> Reviewed-by: Leo Li 
>
> > pageflip happens close to VUPDATE and ends up blocking the signal.
> >
> > The implementation in DM was previously correct *before* we started
> > sending vblank events from VSTARTUP unconditionally to handle cases
> > where HUBP was off, OTG was ON and userspace was still requesting some
> > DRM planes enabled. As part of that patch series we dropped VUPDATE
> > since it was deemed close enough to VSTARTUP, but there's a key
> > difference betweeen VSTARTUP and VUPDATE - the VUPDATE signal can be
> > blocked if we're holding the pipe lock >
> > There was a fix recently to revert the unconditional behavior for the
> > DCN VSTARTUP vblank event since it was sending the pageflip event on
> > the wrong frame - once again, due to blocking VUPDATE and having the
> > address start scanning out two frames later.
> >
> > The problem with this fix is it didn't update the logic that calls
> > drm_crtc_handle_vblank(), so the timestamps are totally bogus now.
> >
> > [How]
> > Essentially reverts most of the original VSTARTUP series but retains
> > the behavior to send back events when active planes == 0.
> >
> > Some refactoring/cleanup was done to not have duplicated code in both
> > the handlers.
> >
> > Fixes: 16f17eda8bad ("drm/amd/display: Send vblank and user events at
> vsartup for DCN")
> > Fixes: 3a2ce8d66a4b ("drm/amd/display: Disable VUpdate interrupt for DCN
> hardware")
> > Fixes: 2b5aed9ac3f7 ("drm/amd/display: Fix pageflip event race condition
> for DCN.")
> >
> > Cc: Leo Li 
> > Cc: Mario Kleiner 
> > Signed-off-by: Nicholas Kazlauskas 
> > ---
> >   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 137 +++---
> >   1 file changed, 55 insertions(+), 82 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 59f1d4a94f12..30ce28f7c444 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > @@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void
> *interrupt_params)
> >
> >   /**
> >* dm_crtc_high_irq() - Handles CRTC interrupt
> > - * @interrupt_params: ignored
> > + * @interrupt_params: used for determining the CRTC instance
> >*
> >* Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
> >* event handler.
> > @@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void *interrupt_params)
> >   unsigned long flags;
> >
> >   acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src -
> IRQ_TYPE_VBLANK);
> > -
> > - if (acrtc) {
> > - acrtc_state = to_dm_crtc_state(acrtc->base.state);
> > -
> > - DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
> > -   acrtc->crtc_id,
> > -   amdgpu_dm_vrr_active(acrtc_state));
> > -
> > - /* Core vblank handling at start of front-porch is only
> possible
> > -  * in non-vrr mode, as only there vblank timestamping will
> give
> > -  * valid results while done in front-porch. Otherwise
> defer it
> > -  * to dm_vupdate_high_irq after end of front-porch.
> > -  */
> > - if (!amdgpu_dm_vrr_active(acrtc_state))
> > - drm_crtc_handle_vblank(>base);
> > -
> > - /* Following stuff must happen at start of vblank, for crc
> > -  * computation and below-the-range btr support in vrr mode.
> > -  */
> > - amdgpu_dm_crtc_handle_crc_irq(>base);
> > -
> > - if (acrtc_state->stream && adev->family >=
> AMDGPU_FAMILY_AI &&
> > - acrtc_state->vrr_params.supported &&
> > - acrtc_state->freesync_config.state ==
> VRR_STATE_ACTIVE_VARIABLE) {
> > - spin_lock_irqsave(>ddev->event_lock, flags);
> > - mod_freesync_handle_v_update(
> > - adev->dm.freesync_module,
> > - acrtc_state->stream,
> > - _state->vrr_params);
> > -
> > - dc_stream_adjust_vmin_vmax(
> > - adev->dm.dc,
> > - acrtc_state->stream,
> > - _state->vrr_params.adjust);
> > - spin_unlock_irqrestore(>ddev->event_lock,
> flags);
> > - }
> > - }
> > -}
> > -
> > -#if 

Re: [PATCH AUTOSEL 5.6 33/50] drm/amdgpu: bump version for invalidate L2 before SDMA IBs

2020-05-07 Thread Michel Dänzer
On 2020-05-07 4:27 p.m., Sasha Levin wrote:
> From: Marek Olšák 
> 
> [ Upstream commit 9017a4897a20658f010bebea825262963c10afa6 ]
> 
> This fixes GPU hangs due to cache coherency issues.
> Bump the driver version. Split out from the original patch.
> 
> Signed-off-by: Marek Olšák 
> Reviewed-by: Christian König 
> Tested-by: Pierre-Eric Pelloux-Prayer 
> Signed-off-by: Alex Deucher 
> Signed-off-by: Sasha Levin 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 42f4febe24c6d..8d45a2b662aeb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -85,9 +85,10 @@
>   * - 3.34.0 - Non-DC can flip correctly between buffers with different 
> pitches
>   * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
>   * - 3.36.0 - Allow reading more status registers on si/cik
> + * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
>   */
>  #define KMS_DRIVER_MAJOR 3
> -#define KMS_DRIVER_MINOR 36
> +#define KMS_DRIVER_MINOR 37
>  #define KMS_DRIVER_PATCHLEVEL0
>  
>  int amdgpu_vram_limit = 0;
> 

This requires the parent commit fdf83646c0542ecfb9adc4db8f741a1f43dca058
"drm/amdgpu: invalidate L2 before SDMA IBs (v2)". KMS_DRIVER_MINOR is
bumped to signal to userspace the fix in that commit is present.


-- 
Earthling Michel Dänzer   |   https://redhat.com
Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: implement soft_recovery for gfx10

2020-05-07 Thread Alex Deucher
Ping?

On Tue, May 5, 2020 at 12:42 PM Alex Deucher  wrote:
>
> Same as gfx9.  This allows us to kill the waves for hung
> shaders.
>
> Signed-off-by: Alex Deucher 
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> index ddb485e1e963..27c63a8f698c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> @@ -7690,6 +7690,19 @@ static void 
> gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
>ref, mask);
>  }
>
> +static void gfx_v10_0_ring_soft_recovery(struct amdgpu_ring *ring,
> +unsigned vmid)
> +{
> +   struct amdgpu_device *adev = ring->adev;
> +   uint32_t value = 0;
> +
> +   value = REG_SET_FIELD(value, SQ_CMD, CMD, 0x03);
> +   value = REG_SET_FIELD(value, SQ_CMD, MODE, 0x01);
> +   value = REG_SET_FIELD(value, SQ_CMD, CHECK_VMID, 1);
> +   value = REG_SET_FIELD(value, SQ_CMD, VM_ID, vmid);
> +   WREG32_SOC15(GC, 0, mmSQ_CMD, value);
> +}
> +
>  static void
>  gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
>   uint32_t me, uint32_t pipe,
> @@ -8105,6 +8118,7 @@ static const struct amdgpu_ring_funcs 
> gfx_v10_0_ring_funcs_gfx = {
> .emit_wreg = gfx_v10_0_ring_emit_wreg,
> .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
> .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
> +   .soft_recovery = gfx_v10_0_ring_soft_recovery,
> .emit_mem_sync = gfx_v10_0_emit_mem_sync,
>  };
>
> --
> 2.25.4
>
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: simplify ATIF backlight handling

2020-05-07 Thread Alex Deucher
Ping?

On Tue, May 5, 2020 at 3:48 PM Alex Deucher  wrote:
>
> Just register the a pointer to the backlight device and use
> that. Unifies the DC and non-DC handling.
>
> Signed-off-by: Alex Deucher 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 73 ++--
>  1 file changed, 30 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 956cbbda4793..913c8f0513bd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -64,7 +64,9 @@ struct amdgpu_atif {
> struct amdgpu_atif_notifications notifications;
> struct amdgpu_atif_functions functions;
> struct amdgpu_atif_notification_cfg notification_cfg;
> -   struct amdgpu_encoder *encoder_for_bl;
> +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || 
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
> +   struct backlight_device *bd;
> +#endif
> struct amdgpu_dm_backlight_caps backlight_caps;
>  };
>
> @@ -444,45 +446,21 @@ static int amdgpu_atif_handler(struct amdgpu_device 
> *adev,
>
> DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count);
>
> -   if ((req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) &&
> -   !amdgpu_device_has_dc_support(adev)) {
> -   struct amdgpu_encoder *enc = atif->encoder_for_bl;
> -
> -   if (enc) {
> -   struct amdgpu_encoder_atom_dig *dig = 
> enc->enc_priv;
> -
> -   DRM_DEBUG_DRIVER("Changing brightness to 
> %d\n",
> -req.backlight_level);
> -
> -   amdgpu_display_backlight_set_level(adev, enc, 
> req.backlight_level);
> -
> -#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || 
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
> -   backlight_force_update(dig->bl_dev,
> -  
> BACKLIGHT_UPDATE_HOTKEY);
> -#endif
> -   }
> -   }
> -#if defined(CONFIG_DRM_AMD_DC)
> +   if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) {
>  #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || 
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
> -   if ((req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) &&
> -   amdgpu_device_has_dc_support(adev)) {
> -   struct amdgpu_display_manager *dm = >dm;
> -   struct backlight_device *bd = dm->backlight_dev;
> -
> -   if (bd) {
> +   if (atif->bd) {
> DRM_DEBUG_DRIVER("Changing brightness to 
> %d\n",
>  req.backlight_level);
> -
> /*
>  * XXX backlight_device_set_brightness() is
>  * hardwired to post BACKLIGHT_UPDATE_SYSFS.
>  * It probably should accept 'reason' 
> parameter.
>  */
> -   backlight_device_set_brightness(bd, 
> req.backlight_level);
> +   backlight_device_set_brightness(atif->bd, 
> req.backlight_level);
> }
> -   }
> -#endif
>  #endif
> +   }
> +
> if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
> if (adev->flags & AMD_IS_PX) {
> pm_runtime_get_sync(adev->ddev->dev);
> @@ -829,23 +807,32 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
> adev->atif = atif;
>
> if (atif->notifications.brightness_change) {
> -   struct drm_encoder *tmp;
> -
> -   /* Find the encoder controlling the brightness */
> -   list_for_each_entry(tmp, 
> >ddev->mode_config.encoder_list,
> -   head) {
> -   struct amdgpu_encoder *enc = to_amdgpu_encoder(tmp);
> -
> -   if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
> -   enc->enc_priv) {
> -   struct amdgpu_encoder_atom_dig *dig = 
> enc->enc_priv;
> -   if (dig->bl_dev) {
> -   atif->encoder_for_bl = enc;
> -   break;
> +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || 
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
> +   if (amdgpu_device_has_dc_support(adev)) {
> +#if defined(CONFIG_DRM_AMD_DC)
> +   struct amdgpu_display_manager *dm = >dm;
> +   atif->bd = dm->backlight_dev;
> +#endif
> +   } else {
> +   struct drm_encoder *tmp;
> +
> +   /* Find the 

[PATCH 1/4] drm/amdgpu: drop pm_runtime_set_active

2020-05-07 Thread Alex Deucher
The pci core handles this for us in pci_pm_init.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index c7f42ff6ab5e..233d6c8c4ca3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -191,7 +191,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned 
long flags)
dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
pm_runtime_use_autosuspend(dev->dev);
pm_runtime_set_autosuspend_delay(dev->dev, 5000);
-   pm_runtime_set_active(dev->dev);
pm_runtime_allow(dev->dev);
pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev);
-- 
2.25.4

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


[PATCH 2/4] drm/amdgpu: fix runpm logic in amdgpu_pmops_resume

2020-05-07 Thread Alex Deucher
We should be checking whether the driver enabled runtime pm
rather than whether the asic supports BOCO or BACO.  That said
in general they are equivalent unless the user has disabled
runpm or it has been disabled for a specific asic.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0ca396d4ebcb..ea2b4254d30c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1174,10 +1174,10 @@ static int amdgpu_pmops_suspend(struct device *dev)
 static int amdgpu_pmops_resume(struct device *dev)
 {
struct drm_device *drm_dev = dev_get_drvdata(dev);
+   struct amdgpu_device *adev = drm_dev->dev_private;
 
/* GPU comes up enabled by the bios on resume */
-   if (amdgpu_device_supports_boco(drm_dev) ||
-   amdgpu_device_supports_baco(drm_dev)) {
+   if (adev->runpm) {
pm_runtime_disable(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
-- 
2.25.4

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


[PATCH 4/4] drm/amdgpu: only set DPM_FLAG_NEVER_SKIP for legacy ATPX BOCO

2020-05-07 Thread Alex Deucher
We only need to set DPM_FLAG_NEVER_SKIP for the legacy ATPX
BOCO case.  D3cold and BACO work as expected.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 233d6c8c4ca3..4e4c9550dcf8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -188,7 +188,10 @@ int amdgpu_driver_load_kms(struct drm_device *dev, 
unsigned long flags)
dev_dbg(>pdev->dev, "Error during ACPI methods call\n");
 
if (adev->runpm) {
-   dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
+   /* only need to skip on ATPX */
+   if (amdgpu_device_supports_boco(dev) &&
+   !amdgpu_is_atpx_hybrid())
+   dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
pm_runtime_use_autosuspend(dev->dev);
pm_runtime_set_autosuspend_delay(dev->dev, 5000);
pm_runtime_allow(dev->dev);
-- 
2.25.4

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


[PATCH 3/4] drm/amdgpu: drop extra runtime pm handling in resume pmop

2020-05-07 Thread Alex Deucher
The core handles this for us.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index ea2b4254d30c..5407edeeccc2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1174,14 +1174,6 @@ static int amdgpu_pmops_suspend(struct device *dev)
 static int amdgpu_pmops_resume(struct device *dev)
 {
struct drm_device *drm_dev = dev_get_drvdata(dev);
-   struct amdgpu_device *adev = drm_dev->dev_private;
-
-   /* GPU comes up enabled by the bios on resume */
-   if (adev->runpm) {
-   pm_runtime_disable(dev);
-   pm_runtime_set_active(dev);
-   pm_runtime_enable(dev);
-   }
 
return amdgpu_device_resume(drm_dev, true);
 }
-- 
2.25.4

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


Re: [PATCH] drm/amd/display: Fix vblank and pageflip event handling for FreeSync

2020-05-07 Thread Leo Li




On 2020-05-06 3:47 p.m., Nicholas Kazlauskas wrote:

[Why]
We're the drm vblank event a frame too early in the case where the

   ^sending

Thanks for catching this!

Reviewed-by: Leo Li 


pageflip happens close to VUPDATE and ends up blocking the signal.

The implementation in DM was previously correct *before* we started
sending vblank events from VSTARTUP unconditionally to handle cases
where HUBP was off, OTG was ON and userspace was still requesting some
DRM planes enabled. As part of that patch series we dropped VUPDATE
since it was deemed close enough to VSTARTUP, but there's a key
difference betweeen VSTARTUP and VUPDATE - the VUPDATE signal can be
blocked if we're holding the pipe lock >
There was a fix recently to revert the unconditional behavior for the
DCN VSTARTUP vblank event since it was sending the pageflip event on
the wrong frame - once again, due to blocking VUPDATE and having the
address start scanning out two frames later.

The problem with this fix is it didn't update the logic that calls
drm_crtc_handle_vblank(), so the timestamps are totally bogus now.

[How]
Essentially reverts most of the original VSTARTUP series but retains
the behavior to send back events when active planes == 0.

Some refactoring/cleanup was done to not have duplicated code in both
the handlers.

Fixes: 16f17eda8bad ("drm/amd/display: Send vblank and user events at vsartup for 
DCN")
Fixes: 3a2ce8d66a4b ("drm/amd/display: Disable VUpdate interrupt for DCN 
hardware")
Fixes: 2b5aed9ac3f7 ("drm/amd/display: Fix pageflip event race condition for 
DCN.")

Cc: Leo Li 
Cc: Mario Kleiner 
Signed-off-by: Nicholas Kazlauskas 
---
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 137 +++---
  1 file changed, 55 insertions(+), 82 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 59f1d4a94f12..30ce28f7c444 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
  
  /**

   * dm_crtc_high_irq() - Handles CRTC interrupt
- * @interrupt_params: ignored
+ * @interrupt_params: used for determining the CRTC instance
   *
   * Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
   * event handler.
@@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void *interrupt_params)
unsigned long flags;
  
  	acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);

-
-   if (acrtc) {
-   acrtc_state = to_dm_crtc_state(acrtc->base.state);
-
-   DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
- acrtc->crtc_id,
- amdgpu_dm_vrr_active(acrtc_state));
-
-   /* Core vblank handling at start of front-porch is only possible
-* in non-vrr mode, as only there vblank timestamping will give
-* valid results while done in front-porch. Otherwise defer it
-* to dm_vupdate_high_irq after end of front-porch.
-*/
-   if (!amdgpu_dm_vrr_active(acrtc_state))
-   drm_crtc_handle_vblank(>base);
-
-   /* Following stuff must happen at start of vblank, for crc
-* computation and below-the-range btr support in vrr mode.
-*/
-   amdgpu_dm_crtc_handle_crc_irq(>base);
-
-   if (acrtc_state->stream && adev->family >= AMDGPU_FAMILY_AI &&
-   acrtc_state->vrr_params.supported &&
-   acrtc_state->freesync_config.state == 
VRR_STATE_ACTIVE_VARIABLE) {
-   spin_lock_irqsave(>ddev->event_lock, flags);
-   mod_freesync_handle_v_update(
-   adev->dm.freesync_module,
-   acrtc_state->stream,
-   _state->vrr_params);
-
-   dc_stream_adjust_vmin_vmax(
-   adev->dm.dc,
-   acrtc_state->stream,
-   _state->vrr_params.adjust);
-   spin_unlock_irqrestore(>ddev->event_lock, flags);
-   }
-   }
-}
-
-#if defined(CONFIG_DRM_AMD_DC_DCN)
-/**
- * dm_dcn_crtc_high_irq() - Handles VStartup interrupt for DCN generation ASICs
- * @interrupt params - interrupt parameters
- *
- * Notify DRM's vblank event handler at VSTARTUP
- *
- * Unlike DCE hardware, we trigger the handler at VSTARTUP. at which:
- * * We are close enough to VUPDATE - the point of no return for hw
- * * We are in the fixed portion of variable front porch when vrr is enabled
- * * We are before VUPDATE, where double-buffered vrr registers are swapped
- *
- * It is therefore the correct place to signal vblank, send user flip events,
- * and update VRR.
- */
-static void dm_dcn_crtc_high_irq(void *interrupt_params)

[PATCH -next] drm/amd/display: remove duplicate headers

2020-05-07 Thread Chen Zhou
Remove duplicate headers which are included twice.

Signed-off-by: Chen Zhou 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 1 -
 1 file changed, 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 9ef9e50a34fa..1db592372435 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
@@ -13,7 +13,6 @@
 #include "core_status.h"
 #include "dpcd_defs.h"
 
-#include "resource.h"
 #define DC_LOGGER \
link->ctx->logger
 
-- 
2.20.1

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


RE: [PATCH] drm/amdgpu: Don't report unique_id for Arcturus

2020-05-07 Thread Russell, Kent
[AMD Public Use]


[AMD Public Use]

Indeed. I was trying to keep it all in there anyways to make less churn, but I 
can remove it altogether, including the definitions that aren't supported. I 
was informed that it wasn't supported nor working correctly, so I'll revert 
both patches (definitions and adding support) for clarity. Thanks!

Kent

From: Deucher, Alexander 
Sent: Thursday, May 7, 2020 11:10 AM
To: Russell, Kent ; amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Don't report unique_id for Arcturus


[AMD Public Use]

Shouldn't all of this code be moved later anyway to make sure the SMU is up and 
running already?

Alex

From: amd-gfx 
mailto:amd-gfx-boun...@lists.freedesktop.org>>
 on behalf of Kent Russell mailto:kent.russ...@amd.com>>
Sent: Thursday, May 7, 2020 9:53 AM
To: amd-gfx@lists.freedesktop.org 
mailto:amd-gfx@lists.freedesktop.org>>
Cc: Russell, Kent mailto:kent.russ...@amd.com>>
Subject: [PATCH] drm/amdgpu: Don't report unique_id for Arcturus

This isn't supported in the SMU yet, so just break early. This can be
reverted once the SMU supports the feature

Signed-off-by: Kent Russell mailto:kent.russ...@amd.com>>
Change-Id: I09945613aa7400afdf3f9d5dc0ffb636ee2896f7
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index f55f9b371bf2..cb90825aacf1 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -317,6 +317,11 @@ static int arcturus_tables_init(struct smu_context *smu, 
struct smu_table *table
 smu_table->metrics_time = 0;

 if (smu->adev->asic_type == CHIP_ARCTURUS) {
+   /* TODO: SMU doesn't currently support this. Return
+* early and remove this once SMU supports it
+*/
+   return 0;
+
 /* Get the SN to turn into a Unique ID */
 smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32,
  );
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Calexander.deucher%40amd.com%7C2081bb617dd14d81e7a108d7f28e1f8f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244564588764106sdata=GevSmW%2Fgzq862kdiJwcbGbCMHfboIGx77zfA%2FOuwhW8%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

2020-05-07 Thread Emil Velikov
From: Emil Velikov 

The driver does not hold struct_mutex, thus using the locked version of
the helper is incorrect.

Cc: Alex Deucher 
Cc: Christian König 
Cc: amd-gfx@lists.freedesktop.org
Fixes: a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 43d8ed7dbd00..652c57a3b847 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct 
drm_device *dev,
attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
_dma_buf_attach_ops, obj);
if (IS_ERR(attach)) {
-   drm_gem_object_put(obj);
+   drm_gem_object_put_unlocked(obj);
return ERR_CAST(attach);
}
 
-- 
2.25.1

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


Re: [PATCH] drm/amdgpu: Don't report unique_id for Arcturus

2020-05-07 Thread Deucher, Alexander
[AMD Public Use]

Shouldn't all of this code be moved later anyway to make sure the SMU is up and 
running already?

Alex

From: amd-gfx  on behalf of Kent Russell 

Sent: Thursday, May 7, 2020 9:53 AM
To: amd-gfx@lists.freedesktop.org 
Cc: Russell, Kent 
Subject: [PATCH] drm/amdgpu: Don't report unique_id for Arcturus

This isn't supported in the SMU yet, so just break early. This can be
reverted once the SMU supports the feature

Signed-off-by: Kent Russell 
Change-Id: I09945613aa7400afdf3f9d5dc0ffb636ee2896f7
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index f55f9b371bf2..cb90825aacf1 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -317,6 +317,11 @@ static int arcturus_tables_init(struct smu_context *smu, 
struct smu_table *table
 smu_table->metrics_time = 0;

 if (smu->adev->asic_type == CHIP_ARCTURUS) {
+   /* TODO: SMU doesn't currently support this. Return
+* early and remove this once SMU supports it
+*/
+   return 0;
+
 /* Get the SN to turn into a Unique ID */
 smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32,
  );
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Calexander.deucher%40amd.com%7C2081bb617dd14d81e7a108d7f28e1f8f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244564588764106sdata=GevSmW%2Fgzq862kdiJwcbGbCMHfboIGx77zfA%2FOuwhW8%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH AUTOSEL 5.4 27/35] drm/amd/display: check if REFCLK_CNTL register is present

2020-05-07 Thread Sasha Levin
From: Dmytro Laktyushkin 

[ Upstream commit 3159d41db3a04330c31ece32f8b29752fc114848 ]

Check before programming the register since it isn't present on
all IPs using this code.

Signed-off-by: Dmytro Laktyushkin 
Reviewed-by: Eric Bernstein 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index e933f6a369f92..083c42e521f5c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -2015,7 +2015,8 @@ static void dcn20_fpga_init_hw(struct dc *dc)
 
REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, 2);
REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, 1);
-   REG_WRITE(REFCLK_CNTL, 0);
+   if (REG(REFCLK_CNTL))
+   REG_WRITE(REFCLK_CNTL, 0);
//
 
 
-- 
2.20.1

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


[PATCH AUTOSEL 5.4 25/35] drm/amd/powerplay: avoid using pm_en before it is initialized revised

2020-05-07 Thread Sasha Levin
From: Tiecheng Zhou 

[ Upstream commit 690ae30be163d5262feae01335b2a6f30569e5aa ]

hwmgr->pm_en is initialized at hwmgr_hw_init.

during amdgpu_device_init, there is amdgpu_asic_reset that calls to
soc15_asic_reset (for V320 usecase, Vega10 asic), in which:
1) soc15_asic_reset_method calls to pp_get_asic_baco_capability (pm_en)
2) soc15_asic_baco_reset calls to pp_set_asic_baco_state (pm_en)

pm_en is used in the above two cases while it has not yet been initialized

So avoid using pm_en in the above two functions for V320 passthrough.

Reviewed-by: Evan Quan 
Signed-off-by: Tiecheng Zhou 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c 
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index d306cc7119976..8bb5fbef7de0f 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1425,7 +1425,8 @@ static int pp_get_asic_baco_capability(void *handle, bool 
*cap)
if (!hwmgr)
return -EINVAL;
 
-   if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_capability)
+   if (!(hwmgr->not_vf && amdgpu_dpm) ||
+   !hwmgr->hwmgr_func->get_asic_baco_capability)
return 0;
 
mutex_lock(>smu_lock);
@@ -1459,7 +1460,8 @@ static int pp_set_asic_baco_state(void *handle, int state)
if (!hwmgr)
return -EINVAL;
 
-   if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_state)
+   if (!(hwmgr->not_vf && amdgpu_dpm) ||
+   !hwmgr->hwmgr_func->set_asic_baco_state)
return 0;
 
mutex_lock(>smu_lock);
-- 
2.20.1

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


[PATCH AUTOSEL 5.4 28/35] drm/amd/display: Update downspread percent to match spreadsheet for DCN2.1

2020-05-07 Thread Sasha Levin
From: Sung Lee 

[ Upstream commit 668a6741f809f2d15d125cfe2b39661e8f1655ea ]

[WHY]
The downspread percentage was copied over from a previous version
of the display_mode_lib spreadsheet. This value has been updated,
and the previous value is too high to allow for such modes as
4K120hz. The new value is sufficient for such modes.

[HOW]
Update the value in dcn21_resource to match the spreadsheet.

Signed-off-by: Sung Lee 
Reviewed-by: Yongqiang Sun 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +-
 1 file changed, 1 insertion(+), 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 161bf7caf3ae0..bb7add5ea2273 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -247,7 +247,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = {
.dram_channel_width_bytes = 4,
.fabric_datapath_to_dcn_data_return_bytes = 32,
.dcn_downspread_percent = 0.5,
-   .downspread_percent = 0.5,
+   .downspread_percent = 0.38,
.dram_page_open_time_ns = 50.0,
.dram_rw_turnaround_time_ns = 17.5,
.dram_return_buffer_per_channel_bytes = 8192,
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 36/50] drm/amd/display: Defer cursor update around VUPDATE for all ASIC

2020-05-07 Thread Sasha Levin
From: Nicholas Kazlauskas 

[ Upstream commit fdfd2a858590d318cfee483bd1c73e00f77533af ]

[Why]
Fixes the following scenario:

- Flip has been prepared sometime during the frame, update pending
- Cursor update happens right when VUPDATE would happen
- OPTC lock acquired, VUPDATE is blocked until next frame
- Flip is delayed potentially infinitely

With the igt@kms_cursor_legacy cursor-vs-flip-legacy test we can
observe nearly *13* frames of delay for some flips on Navi.

[How]
Apply the Raven workaround generically. When close enough to VUPDATE
block cursor updates from occurring from the dc_stream_set_cursor_*
helpers.

This could perhaps be a little smarter by checking if there were
pending updates or flips earlier in the frame on the HUBP side before
applying the delay, but this should be fine for now.

This fixes the kms_cursor_legacy test.

Signed-off-by: Nicholas Kazlauskas 
Reviewed-by: Aric Cyr 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_stream.c   | 28 +--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 6ddbb00ed37a5..8c20e9e907b2f 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -239,24 +239,24 @@ static void delay_cursor_until_vupdate(struct pipe_ctx 
*pipe_ctx, struct dc *dc)
struct dc_stream_state *stream = pipe_ctx->stream;
unsigned int us_per_line;
 
-   if (stream->ctx->asic_id.chip_family == FAMILY_RV &&
-   ASICREV_IS_RAVEN(stream->ctx->asic_id.hw_internal_rev)) 
{
+   if (!dc->hwss.get_vupdate_offset_from_vsync)
+   return;
 
-   vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
-   if (!dc_stream_get_crtc_position(dc, , 1, , ))
-   return;
+   vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
+   if (!dc_stream_get_crtc_position(dc, , 1, , ))
+   return;
 
-   if (vpos >= vupdate_line)
-   return;
+   if (vpos >= vupdate_line)
+   return;
 
-   us_per_line = stream->timing.h_total * 1 / 
stream->timing.pix_clk_100hz;
-   lines_to_vupdate = vupdate_line - vpos;
-   us_to_vupdate = lines_to_vupdate * us_per_line;
+   us_per_line =
+   stream->timing.h_total * 1 / stream->timing.pix_clk_100hz;
+   lines_to_vupdate = vupdate_line - vpos;
+   us_to_vupdate = lines_to_vupdate * us_per_line;
 
-   /* 70 us is a conservative estimate of cursor update time*/
-   if (us_to_vupdate < 70)
-   udelay(us_to_vupdate);
-   }
+   /* 70 us is a conservative estimate of cursor update time*/
+   if (us_to_vupdate < 70)
+   udelay(us_to_vupdate);
 #endif
 }
 
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 37/50] drm/amd/display: Update downspread percent to match spreadsheet for DCN2.1

2020-05-07 Thread Sasha Levin
From: Sung Lee 

[ Upstream commit 668a6741f809f2d15d125cfe2b39661e8f1655ea ]

[WHY]
The downspread percentage was copied over from a previous version
of the display_mode_lib spreadsheet. This value has been updated,
and the previous value is too high to allow for such modes as
4K120hz. The new value is sufficient for such modes.

[HOW]
Update the value in dcn21_resource to match the spreadsheet.

Signed-off-by: Sung Lee 
Reviewed-by: Yongqiang Sun 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +-
 1 file changed, 1 insertion(+), 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 33d0a176841a5..122d3e734c59a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -250,7 +250,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = {
.dram_channel_width_bytes = 4,
.fabric_datapath_to_dcn_data_return_bytes = 32,
.dcn_downspread_percent = 0.5,
-   .downspread_percent = 0.5,
+   .downspread_percent = 0.38,
.dram_page_open_time_ns = 50.0,
.dram_rw_turnaround_time_ns = 17.5,
.dram_return_buffer_per_channel_bytes = 8192,
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 35/50] drm/amd/display: check if REFCLK_CNTL register is present

2020-05-07 Thread Sasha Levin
From: Dmytro Laktyushkin 

[ Upstream commit 3159d41db3a04330c31ece32f8b29752fc114848 ]

Check before programming the register since it isn't present on
all IPs using this code.

Signed-off-by: Dmytro Laktyushkin 
Reviewed-by: Eric Bernstein 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index a444fed941849..ad422e00f9fec 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -2306,7 +2306,8 @@ void dcn20_fpga_init_hw(struct dc *dc)
 
REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, 2);
REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, 1);
-   REG_WRITE(REFCLK_CNTL, 0);
+   if (REG(REFCLK_CNTL))
+   REG_WRITE(REFCLK_CNTL, 0);
//
 
 
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 32/50] drm/amd/powerplay: avoid using pm_en before it is initialized revised

2020-05-07 Thread Sasha Levin
From: Tiecheng Zhou 

[ Upstream commit 690ae30be163d5262feae01335b2a6f30569e5aa ]

hwmgr->pm_en is initialized at hwmgr_hw_init.

during amdgpu_device_init, there is amdgpu_asic_reset that calls to
soc15_asic_reset (for V320 usecase, Vega10 asic), in which:
1) soc15_asic_reset_method calls to pp_get_asic_baco_capability (pm_en)
2) soc15_asic_baco_reset calls to pp_set_asic_baco_state (pm_en)

pm_en is used in the above two cases while it has not yet been initialized

So avoid using pm_en in the above two functions for V320 passthrough.

Reviewed-by: Evan Quan 
Signed-off-by: Tiecheng Zhou 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c 
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index c195575366a3b..e4e5a53b2b4ea 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1435,7 +1435,8 @@ static int pp_get_asic_baco_capability(void *handle, bool 
*cap)
if (!hwmgr)
return -EINVAL;
 
-   if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_capability)
+   if (!(hwmgr->not_vf && amdgpu_dpm) ||
+   !hwmgr->hwmgr_func->get_asic_baco_capability)
return 0;
 
mutex_lock(>smu_lock);
@@ -1469,7 +1470,8 @@ static int pp_set_asic_baco_state(void *handle, int state)
if (!hwmgr)
return -EINVAL;
 
-   if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_state)
+   if (!(hwmgr->not_vf && amdgpu_dpm) ||
+   !hwmgr->hwmgr_func->set_asic_baco_state)
return 0;
 
mutex_lock(>smu_lock);
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 33/50] drm/amdgpu: bump version for invalidate L2 before SDMA IBs

2020-05-07 Thread Sasha Levin
From: Marek Olšák 

[ Upstream commit 9017a4897a20658f010bebea825262963c10afa6 ]

This fixes GPU hangs due to cache coherency issues.
Bump the driver version. Split out from the original patch.

Signed-off-by: Marek Olšák 
Reviewed-by: Christian König 
Tested-by: Pierre-Eric Pelloux-Prayer 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 42f4febe24c6d..8d45a2b662aeb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -85,9 +85,10 @@
  * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
  * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
  * - 3.36.0 - Allow reading more status registers on si/cik
+ * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
  */
 #define KMS_DRIVER_MAJOR   3
-#define KMS_DRIVER_MINOR   36
+#define KMS_DRIVER_MINOR   37
 #define KMS_DRIVER_PATCHLEVEL  0
 
 int amdgpu_vram_limit = 0;
-- 
2.20.1

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


[PATCH AUTOSEL 5.6 21/50] drm/amd/display: blank dp stream before re-train the link

2020-05-07 Thread Sasha Levin
From: Xiaodong Yan 

[ Upstream commit 718a5569b6fa6e1f49f1ae76a3c18acb4ddb74f1 ]

[Why]
When link loss happened, monitor can not light up if only re-train the
link.

[How]
Blank all the DP streams on this link before re-train the link, and then
unblank the stream

Signed-off-by: Xiaodong Yan 
Reviewed-by: Tony Cheng 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 12 
 1 file changed, 12 insertions(+)

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 fd9e69634c50a..1b6c75a4dd60a 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
@@ -2885,6 +2885,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, 
union hpd_irq_data *out_hpd
sizeof(hpd_irq_dpcd_data),
"Status: ");
 
+   for (i = 0; i < MAX_PIPES; i++) {
+   pipe_ctx = 
>dc->current_state->res_ctx.pipe_ctx[i];
+   if (pipe_ctx && pipe_ctx->stream && 
pipe_ctx->stream->link == link)
+   link->dc->hwss.blank_stream(pipe_ctx);
+   }
+
for (i = 0; i < MAX_PIPES; i++) {
pipe_ctx = 
>dc->current_state->res_ctx.pipe_ctx[i];
if (pipe_ctx && pipe_ctx->stream && 
pipe_ctx->stream->link == link)
@@ -2904,6 +2910,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, 
union hpd_irq_data *out_hpd
if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
dc_link_reallocate_mst_payload(link);
 
+   for (i = 0; i < MAX_PIPES; i++) {
+   pipe_ctx = 
>dc->current_state->res_ctx.pipe_ctx[i];
+   if (pipe_ctx && pipe_ctx->stream && 
pipe_ctx->stream->link == link)
+   link->dc->hwss.unblank_stream(pipe_ctx, 
_link_settings);
+   }
+
status = false;
if (out_link_loss)
*out_link_loss = true;
-- 
2.20.1

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


[PATCH] drm/amdgpu: Don't report unique_id for Arcturus

2020-05-07 Thread Kent Russell
This isn't supported in the SMU yet, so just break early. This can be
reverted once the SMU supports the feature

Signed-off-by: Kent Russell 
Change-Id: I09945613aa7400afdf3f9d5dc0ffb636ee2896f7
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index f55f9b371bf2..cb90825aacf1 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -317,6 +317,11 @@ static int arcturus_tables_init(struct smu_context *smu, 
struct smu_table *table
smu_table->metrics_time = 0;
 
if (smu->adev->asic_type == CHIP_ARCTURUS) {
+   /* TODO: SMU doesn't currently support this. Return
+* early and remove this once SMU supports it
+*/
+   return 0;
+
/* Get the SN to turn into a Unique ID */
smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32,
 );
-- 
2.17.1

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


Re: [PATCH] drm/amd/display: Fix vblank and pageflip event handling for FreeSync

2020-05-07 Thread Alex Deucher
On Wed, May 6, 2020 at 3:48 PM Nicholas Kazlauskas
 wrote:
>
> [Why]
> We're the drm vblank event a frame too early in the case where the
> pageflip happens close to VUPDATE and ends up blocking the signal.
>
> The implementation in DM was previously correct *before* we started
> sending vblank events from VSTARTUP unconditionally to handle cases
> where HUBP was off, OTG was ON and userspace was still requesting some
> DRM planes enabled. As part of that patch series we dropped VUPDATE
> since it was deemed close enough to VSTARTUP, but there's a key
> difference betweeen VSTARTUP and VUPDATE - the VUPDATE signal can be
> blocked if we're holding the pipe lock.
>
> There was a fix recently to revert the unconditional behavior for the
> DCN VSTARTUP vblank event since it was sending the pageflip event on
> the wrong frame - once again, due to blocking VUPDATE and having the
> address start scanning out two frames later.
>
> The problem with this fix is it didn't update the logic that calls
> drm_crtc_handle_vblank(), so the timestamps are totally bogus now.
>
> [How]
> Essentially reverts most of the original VSTARTUP series but retains
> the behavior to send back events when active planes == 0.
>
> Some refactoring/cleanup was done to not have duplicated code in both
> the handlers.
>
> Fixes: 16f17eda8bad ("drm/amd/display: Send vblank and user events at vsartup 
> for DCN")
> Fixes: 3a2ce8d66a4b ("drm/amd/display: Disable VUpdate interrupt for DCN 
> hardware")
> Fixes: 2b5aed9ac3f7 ("drm/amd/display: Fix pageflip event race condition for 
> DCN.")
>
> Cc: Leo Li 
> Cc: Mario Kleiner 
> Signed-off-by: Nicholas Kazlauskas 

Acked-by: Alex Deucher 

> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 137 +++---
>  1 file changed, 55 insertions(+), 82 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 59f1d4a94f12..30ce28f7c444 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
>
>  /**
>   * dm_crtc_high_irq() - Handles CRTC interrupt
> - * @interrupt_params: ignored
> + * @interrupt_params: used for determining the CRTC instance
>   *
>   * Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
>   * event handler.
> @@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void *interrupt_params)
> unsigned long flags;
>
> acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - 
> IRQ_TYPE_VBLANK);
> -
> -   if (acrtc) {
> -   acrtc_state = to_dm_crtc_state(acrtc->base.state);
> -
> -   DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
> - acrtc->crtc_id,
> - amdgpu_dm_vrr_active(acrtc_state));
> -
> -   /* Core vblank handling at start of front-porch is only 
> possible
> -* in non-vrr mode, as only there vblank timestamping will 
> give
> -* valid results while done in front-porch. Otherwise defer it
> -* to dm_vupdate_high_irq after end of front-porch.
> -*/
> -   if (!amdgpu_dm_vrr_active(acrtc_state))
> -   drm_crtc_handle_vblank(>base);
> -
> -   /* Following stuff must happen at start of vblank, for crc
> -* computation and below-the-range btr support in vrr mode.
> -*/
> -   amdgpu_dm_crtc_handle_crc_irq(>base);
> -
> -   if (acrtc_state->stream && adev->family >= AMDGPU_FAMILY_AI &&
> -   acrtc_state->vrr_params.supported &&
> -   acrtc_state->freesync_config.state == 
> VRR_STATE_ACTIVE_VARIABLE) {
> -   spin_lock_irqsave(>ddev->event_lock, flags);
> -   mod_freesync_handle_v_update(
> -   adev->dm.freesync_module,
> -   acrtc_state->stream,
> -   _state->vrr_params);
> -
> -   dc_stream_adjust_vmin_vmax(
> -   adev->dm.dc,
> -   acrtc_state->stream,
> -   _state->vrr_params.adjust);
> -   spin_unlock_irqrestore(>ddev->event_lock, 
> flags);
> -   }
> -   }
> -}
> -
> -#if defined(CONFIG_DRM_AMD_DC_DCN)
> -/**
> - * dm_dcn_crtc_high_irq() - Handles VStartup interrupt for DCN generation 
> ASICs
> - * @interrupt params - interrupt parameters
> - *
> - * Notify DRM's vblank event handler at VSTARTUP
> - *
> - * Unlike DCE hardware, we trigger the handler at VSTARTUP. at which:
> - * * We are close enough to VUPDATE - the point of no return for hw
> - * * We are in the fixed portion of variable front porch when vrr is enabled
> - * * We are before VUPDATE, where double-buffered vrr registers 

[PATCH -next] drm/amd/dc: Remove a useless comparison

2020-05-07 Thread ChenTao
Fix the following warning:

'en' is uint32_t and can never be negative.

drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_hpd.c:132:10: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_generic.c:109:10: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c | 2 +-
 drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c 
b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
index f9e847e6555d..6cd50232c432 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
@@ -106,7 +106,7 @@ void dal_hw_generic_init(
enum gpio_id id,
uint32_t en)
 {
-   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
+   if (en > GPIO_DDC_LINE_MAX) {
ASSERT_CRITICAL(false);
*hw_generic = NULL;
}
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c 
b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
index 692f29de7797..f91f426699c0 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
@@ -129,7 +129,7 @@ void dal_hw_hpd_init(
enum gpio_id id,
uint32_t en)
 {
-   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
+   if (en > GPIO_DDC_LINE_MAX) {
ASSERT_CRITICAL(false);
*hw_hpd = NULL;
}
-- 
2.22.0

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


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

2020-05-07 Thread Bernard Zhao
There is DEVICE_ATTR mechanism in separate attribute define.
So this change is to use attr array, also use
sysfs_create_files in init function & sysfs_remove_files in
fini function.
This maybe make the code a bit readable.

Signed-off-by: Bernard Zhao 

Changes since V1:
*Use DEVICE_ATTR mechanism

Link for V1:
*https://lore.kernel.org/patchwork/patch/1228076/
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 43 ++--
 1 file changed, 13 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 82a3299e53c0..57bbc70662ff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -148,6 +148,15 @@ static DEVICE_ATTR(mem_info_vis_vram_used, S_IRUGO,
 static DEVICE_ATTR(mem_info_vram_vendor, S_IRUGO,
   amdgpu_mem_info_vram_vendor, NULL);
 
+static struct attribute *amdgpu_vram_mgr_attributes[] = {
+   _attr_mem_info_vram_total.attr,
+   _attr_mem_info_vis_vram_total.attr,
+   _attr_mem_info_vram_used.attr,
+   _attr_mem_info_vis_vram_used.attr,
+   _attr_mem_info_vram_vendor.attr,
+   NULL
+};
+
 /**
  * amdgpu_vram_mgr_init - init VRAM manager and DRM MM
  *
@@ -172,31 +181,9 @@ static int amdgpu_vram_mgr_init(struct 
ttm_mem_type_manager *man,
man->priv = mgr;
 
/* Add the two VRAM-related sysfs files */
-   ret = device_create_file(adev->dev, _attr_mem_info_vram_total);
-   if (ret) {
-   DRM_ERROR("Failed to create device file mem_info_vram_total\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vis_vram_total);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vis_vram_total\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vram_used);
-   if (ret) {
-   DRM_ERROR("Failed to create device file mem_info_vram_used\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vis_vram_used);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vis_vram_used\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vram_vendor);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vram_vendor\n");
-   return ret;
-   }
+   ret = sysfs_create_files(>dev->kobj, amdgpu_vram_mgr_attributes);
+   if (ret)
+   DRM_ERROR("Failed to register sysfs\n");
 
return 0;
 }
@@ -219,11 +206,7 @@ static int amdgpu_vram_mgr_fini(struct 
ttm_mem_type_manager *man)
spin_unlock(>lock);
kfree(mgr);
man->priv = NULL;
-   device_remove_file(adev->dev, _attr_mem_info_vram_total);
-   device_remove_file(adev->dev, _attr_mem_info_vis_vram_total);
-   device_remove_file(adev->dev, _attr_mem_info_vram_used);
-   device_remove_file(adev->dev, _attr_mem_info_vis_vram_used);
-   device_remove_file(adev->dev, _attr_mem_info_vram_vendor);
+   sysfs_remove_files(>dev->kobj, amdgpu_vram_mgr_attributes);
return 0;
 }
 
-- 
2.26.2

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


[PATCH] drm/amd/display: remove variable "result" in dcn20_patch_unknown_plane_state()

2020-05-07 Thread Jason Yan
Fix the following coccicheck warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c:3216:16-22:
Unneeded variable: "result". Return "DC_OK" on line 3229

Signed-off-by: Jason Yan 
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
index 4dea550c3f83..3c0090797866 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
@@ -3228,8 +3228,6 @@ static struct dc_cap_funcs cap_funcs = {
 
 enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state 
*plane_state)
 {
-   enum dc_status result = DC_OK;
-
enum surface_pixel_format surf_pix_format = plane_state->format;
unsigned int bpp = resource_pixel_format_to_bpp(surf_pix_format);
 
@@ -3241,7 +3239,7 @@ enum dc_status dcn20_patch_unknown_plane_state(struct 
dc_plane_state *plane_stat
swizzle = DC_SW_64KB_S;
 
plane_state->tiling_info.gfx9.swizzle = swizzle;
-   return result;
+   return DC_OK;
 }
 
 static struct resource_funcs dcn20_res_pool_funcs = {
-- 
2.21.1

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


Re: [PATCH] drm/amdgpu: enable hibernate support on Navi1X

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 6:26 AM Evan Quan  wrote:
>
> BACO is needed to support hibernate on Navi1X.
>
> Change-Id: Ia283612919e9a5b4e1e198ab2cc0bc15f7f94760
> Signed-off-by: Evan Quan 

Acked-by: Alex Deucher 

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 2 ++
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +-
>  3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 5bd213f88ae5..e649a3d3fd7c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1010,6 +1010,7 @@ struct amdgpu_device {
>
> /* s3/s4 mask */
> boolin_suspend;
> +   boolin_hibernate;
>
> boolin_gpu_reset;
> enum pp_mp1_state   mp1_state;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index eb351844e46c..5eaa5ea83d0c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1260,7 +1260,9 @@ static int amdgpu_pmops_freeze(struct device *dev)
> struct amdgpu_device *adev = drm_dev->dev_private;
> int r;
>
> +   adev->in_hibernate = true;
> r = amdgpu_device_suspend(drm_dev, true);
> +   adev->in_hibernate = false;
> if (r)
> return r;
> return amdgpu_asic_reset(adev);
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 8a0c37dc5182..f1621147db61 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1500,7 +1500,7 @@ static int smu_disable_dpm(struct smu_context *smu)
> bool use_baco = !smu->is_apu &&
> ((adev->in_gpu_reset &&
>   (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) 
> ||
> -(adev->in_runpm && amdgpu_asic_supports_baco(adev)));
> +((adev->in_runpm || adev->in_hibernate) && 
> amdgpu_asic_supports_baco(adev)));
>
> ret = smu_get_smc_version(smu, NULL, _version);
> if (ret) {
> --
> 2.26.2
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/amdgpu: add raven1 part to the gfxoff quirk list

2020-05-07 Thread Alex Deucher
On Thu, May 7, 2020 at 8:38 AM Tom St Denis  wrote:
>
> On my raven1 system (rev c6) with VBIOS 113-RAVEN-114 GFXOFF is
> not stable (resulting in large block tiling noise in some applications).
>
> Disabling GFXOFF via the quirk list fixes the problems for me.
>
> Signed-off-by: Tom St Denis 

Acked-by: Alex Deucher 

> ---
>  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 fbd54d347d91..1573ac1f03b2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -1233,6 +1233,8 @@ static const struct amdgpu_gfxoff_quirk 
> amdgpu_gfxoff_quirk_list[] = {
> { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
> /* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */
> { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
> +   /* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */
> +   { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
> { 0, 0, 0, 0, 0 },
>  };
>
> --
> 2.26.2
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/amdgpu: add raven1 part to the gfxoff quirk list

2020-05-07 Thread Tom St Denis
On my raven1 system (rev c6) with VBIOS 113-RAVEN-114 GFXOFF is
not stable (resulting in large block tiling noise in some applications).

Disabling GFXOFF via the quirk list fixes the problems for me.

Signed-off-by: Tom St Denis 
---
 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 fbd54d347d91..1573ac1f03b2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1233,6 +1233,8 @@ static const struct amdgpu_gfxoff_quirk 
amdgpu_gfxoff_quirk_list[] = {
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
/* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */
{ 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
+   /* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */
+   { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
{ 0, 0, 0, 0, 0 },
 };
 
-- 
2.26.2

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


[PATCH] drm/amdgpu: enable hibernate support on Navi1X

2020-05-07 Thread Evan Quan
BACO is needed to support hibernate on Navi1X.

Change-Id: Ia283612919e9a5b4e1e198ab2cc0bc15f7f94760
Signed-off-by: Evan Quan 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 2 ++
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 5bd213f88ae5..e649a3d3fd7c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1010,6 +1010,7 @@ struct amdgpu_device {
 
/* s3/s4 mask */
boolin_suspend;
+   boolin_hibernate;
 
boolin_gpu_reset;
enum pp_mp1_state   mp1_state;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index eb351844e46c..5eaa5ea83d0c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1260,7 +1260,9 @@ static int amdgpu_pmops_freeze(struct device *dev)
struct amdgpu_device *adev = drm_dev->dev_private;
int r;
 
+   adev->in_hibernate = true;
r = amdgpu_device_suspend(drm_dev, true);
+   adev->in_hibernate = false;
if (r)
return r;
return amdgpu_asic_reset(adev);
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 8a0c37dc5182..f1621147db61 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1500,7 +1500,7 @@ static int smu_disable_dpm(struct smu_context *smu)
bool use_baco = !smu->is_apu &&
((adev->in_gpu_reset &&
  (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
-(adev->in_runpm && amdgpu_asic_supports_baco(adev)));
+((adev->in_runpm || adev->in_hibernate) && 
amdgpu_asic_supports_baco(adev)));
 
ret = smu_get_smc_version(smu, NULL, _version);
if (ret) {
-- 
2.26.2

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


[PATCH 3/4] drm/amdgpu: cleanup unnecessary virt sriov check in amdgpu attribute

2020-05-07 Thread Kevin Wang
the amdgpu device attribute node will be created accordding to sriov vf
mode at runtime.
cleanup unnecessary sriov check in attribute operation function.

Signed-off-by: Kevin Wang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 105 -
 1 file changed, 105 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index b75362bf0742..bc7de2f62d12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -163,9 +163,6 @@ static ssize_t amdgpu_get_power_dpm_state(struct device 
*dev,
enum amd_pm_state_type pm;
int ret;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -199,9 +196,6 @@ static ssize_t amdgpu_set_power_dpm_state(struct device 
*dev,
enum amd_pm_state_type  state;
int ret;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return -EINVAL;
-
if (strncmp("battery", buf, strlen("battery")) == 0)
state = POWER_STATE_TYPE_BATTERY;
else if (strncmp("balanced", buf, strlen("balanced")) == 0)
@@ -303,9 +297,6 @@ static ssize_t 
amdgpu_get_power_dpm_force_performance_level(struct device *dev,
enum amd_dpm_forced_level level = 0xff;
int ret;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -343,9 +334,6 @@ static ssize_t 
amdgpu_set_power_dpm_force_performance_level(struct device *dev,
enum amd_dpm_forced_level current_level = 0xff;
int ret = 0;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return -EINVAL;
-
if (strncmp("low", buf, strlen("low")) == 0) {
level = AMD_DPM_FORCED_LEVEL_LOW;
} else if (strncmp("high", buf, strlen("high")) == 0) {
@@ -475,9 +463,6 @@ static ssize_t amdgpu_get_pp_cur_state(struct device *dev,
enum amd_pm_state_type pm = 0;
int i = 0, ret = 0;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -514,9 +499,6 @@ static ssize_t amdgpu_get_pp_force_state(struct device *dev,
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return 0;
-
if (adev->pp_force_state_enabled)
return amdgpu_get_pp_cur_state(dev, attr, buf);
else
@@ -534,9 +516,6 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev,
unsigned long idx;
int ret;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return -EINVAL;
-
if (strlen(buf) == 1)
adev->pp_force_state_enabled = false;
else if (is_support_sw_smu(adev))
@@ -592,9 +571,6 @@ static ssize_t amdgpu_get_pp_table(struct device *dev,
char *table = NULL;
int size, ret;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -634,9 +610,6 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
struct amdgpu_device *adev = ddev->dev_private;
int ret = 0;
 
-   if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
-   return -EINVAL;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -739,9 +712,6 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device 
*dev,
const char delimiter[3] = {' ', '\n', '\0'};
uint32_t type;
 
-   if (amdgpu_sriov_vf(adev))
-   return -EINVAL;
-
if (count > 127)
return -EINVAL;
 
@@ -831,9 +801,6 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device 
*dev,
ssize_t size;
int ret;
 
-   if (amdgpu_sriov_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)
return ret;
@@ -883,9 +850,6 @@ static ssize_t amdgpu_set_pp_features(struct device *dev,
uint64_t featuremask;
int ret;
 
-   if (amdgpu_sriov_vf(adev))
-   return -EINVAL;
-
ret = kstrtou64(buf, 0, );
if (ret)
return -EINVAL;
@@ -926,9 +890,6 @@ static ssize_t amdgpu_get_pp_features(struct device *dev,
ssize_t size;
int ret;
 
-   if (amdgpu_sriov_vf(adev))
-   return 0;
-
ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0)

[PATCH 2/4] drm/amdgpu: optimize amdgpu device attribute code

2020-05-07 Thread Kevin Wang
unified amdgpu device attribute node functions:
1. add some helper functions to create amdgpu device attribute node.
2. create device node according to device attr flags on different VF mode.
3. rename some functions name to adapt a new interface.

v2:
1. remove ATTR_STATE_DEAD, ATTR_STATE_ALIVE enum.
2. rename callback function perform to attr_update.
3. modify some variable names

Signed-off-by: Kevin Wang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 494 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h |  46 +++
 2 files changed, 262 insertions(+), 278 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index c762deb5abc7..b75362bf0742 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -154,9 +154,9 @@ int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum 
amd_pp_sensors senso
  *
  */
 
-static ssize_t amdgpu_get_dpm_state(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+static ssize_t amdgpu_get_power_dpm_state(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -189,10 +189,10 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
(pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : 
"performance");
 }
 
-static ssize_t amdgpu_set_dpm_state(struct device *dev,
-   struct device_attribute *attr,
-   const char *buf,
-   size_t count)
+static ssize_t amdgpu_set_power_dpm_state(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -294,9 +294,9 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
  *
  */
 
-static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+static ssize_t amdgpu_get_power_dpm_force_performance_level(struct device *dev,
+   struct 
device_attribute *attr,
+   char *buf)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -332,10 +332,10 @@ static ssize_t 
amdgpu_get_dpm_forced_performance_level(struct device *dev,
"unknown");
 }
 
-static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
-  struct device_attribute 
*attr,
-  const char *buf,
-  size_t count)
+static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,
+   struct 
device_attribute *attr,
+   const char *buf,
+   size_t count)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -873,10 +873,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device 
*dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
-   struct device_attribute *attr,
-   const char *buf,
-   size_t count)
+static ssize_t amdgpu_set_pp_features(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -917,9 +917,9 @@ static ssize_t amdgpu_set_pp_feature_status(struct device 
*dev,
return count;
 }
 
-static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+static ssize_t amdgpu_get_pp_features(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
 {
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = ddev->dev_private;
@@ -1663,9 

RE: [PATCH] drm/amdgpu: Fix bug in RAS invoke

2020-05-07 Thread Zhang, Hawking
[AMD Official Use Only - Internal Distribution Only]

Good catch.

Reviewed-by: Hawking Zhang 

Regards,
Hawking
From: Clements, John 
Sent: Thursday, May 7, 2020 17:12
To: amd-gfx@lists.freedesktop.org; Zhang, Hawking 
Subject: [PATCH] drm/amdgpu: Fix bug in RAS invoke


[AMD Official Use Only - Internal Distribution Only]

Invoke sequence should abort when RAS interrupt is detected before reading TA 
host shared memory
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 4/4] drm/amdgpu: cleanup sriov mode check in internal swsmu driver

2020-05-07 Thread Kevin Wang
cleanup unnecessary check in internal swsmu driver:
1. cleanup amdgpu_sriov_is_pp_one_vf() check logic.
2. cleanup amdgpu_sriov_vf() check logic.
3. add sw smu ip block according to different vf mode.

Signed-off-by: Kevin Wang 
---
 drivers/gpu/drm/amd/amdgpu/nv.c  |  29 +++-
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c   | 170 ---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |   7 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c   |   6 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c|  24 ---
 5 files changed, 102 insertions(+), 134 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index 9c42316c47c0..cef516b89a34 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -452,6 +452,7 @@ static int nv_reg_base_init(struct amdgpu_device *adev)
 int nv_set_ip_blocks(struct amdgpu_device *adev)
 {
int r;
+   enum amdgpu_sriov_vf_mode vf_mode;
 
adev->nbio.funcs = _v2_3_funcs;
adev->nbio.hdp_flush_reg = _v2_3_hdp_flush_reg;
@@ -494,12 +495,22 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
amdgpu_device_ip_block_add(adev, _v10_1_ip_block);
break;
case CHIP_NAVI12:
+   vf_mode = amdgpu_virt_get_sriov_vf_mode(adev);
amdgpu_device_ip_block_add(adev, _common_ip_block);
amdgpu_device_ip_block_add(adev, _v10_0_ip_block);
amdgpu_device_ip_block_add(adev, _ih_ip_block);
amdgpu_device_ip_block_add(adev, _v11_0_ip_block);
-   if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)
-   amdgpu_device_ip_block_add(adev, _v11_0_ip_block);
+   if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
+   switch (vf_mode) {
+   case SRIOV_VF_MODE_BARE_METAL:
+   case SRIOV_VF_MODE_ONE_VF:
+   amdgpu_device_ip_block_add(adev, 
_v11_0_ip_block);
+   break;
+   case SRIOV_VF_MODE_MULTI_VF:
+   default:
+   break;
+   }
+   }
if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, _virtual_ip_block);
 #if defined(CONFIG_DRM_AMD_DC)
@@ -508,9 +519,17 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
 #endif
amdgpu_device_ip_block_add(adev, _v10_0_ip_block);
amdgpu_device_ip_block_add(adev, _v5_0_ip_block);
-   if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
-   !amdgpu_sriov_vf(adev))
-   amdgpu_device_ip_block_add(adev, _v11_0_ip_block);
+   if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
+   switch (vf_mode) {
+   case SRIOV_VF_MODE_BARE_METAL:
+   case SRIOV_VF_MODE_ONE_VF:
+   amdgpu_device_ip_block_add(adev, 
_v11_0_ip_block);
+   break;
+   case SRIOV_VF_MODE_MULTI_VF:
+   default:
+   break;
+   }
+   }
amdgpu_device_ip_block_add(adev, _v2_0_ip_block);
if (!amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, _v2_0_ip_block);
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 607ff0270aee..8b305498a084 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -569,10 +569,9 @@ bool is_support_sw_smu(struct amdgpu_device *adev)
 {
if (adev->asic_type == CHIP_VEGA20)
return (amdgpu_dpm == 2) ? true : false;
-   else if (adev->asic_type >= CHIP_ARCTURUS) {
- if (amdgpu_sriov_is_pp_one_vf(adev) || !amdgpu_sriov_vf(adev))
-   return true;
-   }
+   else if (adev->asic_type >= CHIP_ARCTURUS)
+   return true;
+
return false;
 }
 
@@ -1131,59 +1130,58 @@ static int smu_smc_table_hw_init(struct smu_context 
*smu,
return ret;
 
/* smu_dump_pptable(smu); */
-   if (!amdgpu_sriov_vf(adev)) {
-   /*
-* Copy pptable bo in the vram to smc with SMU MSGs such as
-* SetDriverDramAddr and TransferTableDram2Smu.
-*/
-   ret = smu_write_pptable(smu);
-   if (ret)
-   return ret;
-
-   /* issue Run*Btc msg */
-   ret = smu_run_btc(smu);
-   if (ret)
-   return ret;
-   ret = smu_feature_set_allowed_mask(smu);
-   if (ret)
-   return ret;
+   /*
+* Copy pptable 

[PATCH 1/4] drm/amdgpu: add amdgpu_virt_get_vf_mode helper function

2020-05-07 Thread Kevin Wang
the swsmu or powerplay(hwmgr) need to handle task according to different VF 
mode,
this function to help query vf mode.

vf mode:
1. SRIOV_VF_MODE_BARE_METAL: the driver work on host  OS (PF)
2. SRIOV_VF_MODE_ONE_VF: the driver work on guest OS with one VF
3. SRIOV_VF_MODE_MULTI_VF  : the driver work on guest OS with multi VF

Signed-off-by: Kevin Wang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 16 
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h |  8 
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index cbbb8d02535a..f3b38c9e04ca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -370,3 +370,19 @@ void amdgpu_virt_disable_access_debugfs(struct 
amdgpu_device *adev)
if (amdgpu_sriov_vf(adev))
adev->virt.caps |= AMDGPU_SRIOV_CAPS_RUNTIME;
 }
+
+enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device 
*adev)
+{
+   enum amdgpu_sriov_vf_mode mode;
+
+   if (amdgpu_sriov_vf(adev)) {
+   if (amdgpu_sriov_is_pp_one_vf(adev))
+   mode = SRIOV_VF_MODE_ONE_VF;
+   else
+   mode = SRIOV_VF_MODE_MULTI_VF;
+   } else {
+   mode = SRIOV_VF_MODE_BARE_METAL;
+   }
+
+   return mode;
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index de27308802c9..b90e822cebd7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -35,6 +35,12 @@
 /* tonga/fiji use this offset */
 #define mmBIF_IOV_FUNC_IDENTIFIER 0x1503
 
+enum amdgpu_sriov_vf_mode {
+   SRIOV_VF_MODE_BARE_METAL = 0,
+   SRIOV_VF_MODE_ONE_VF,
+   SRIOV_VF_MODE_MULTI_VF,
+};
+
 struct amdgpu_mm_table {
struct amdgpu_bo*bo;
uint32_t*cpu_addr;
@@ -323,4 +329,6 @@ void amdgpu_detect_virtualization(struct amdgpu_device 
*adev);
 bool amdgpu_virt_can_access_debugfs(struct amdgpu_device *adev);
 int amdgpu_virt_enable_access_debugfs(struct amdgpu_device *adev);
 void amdgpu_virt_disable_access_debugfs(struct amdgpu_device *adev);
+
+enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device 
*adev);
 #endif
-- 
2.17.1

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


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

2020-05-07 Thread Christian König

Am 07.05.20 um 11:13 schrieb Bernard Zhao:

There is DEVICE_ATTR mechanism in separate attribute define.
So this change is to use attr array, also use
sysfs_create_files in init function & sysfs_remove_files in
fini function.
This maybe make the code a bit readable.

Signed-off-by: Bernard Zhao 


Reviewed-by: Christian König 



Changes since V1:
*Use DEVICE_ATTR mechanism

Link for V1:
*https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fpatchwork%2Fpatch%2F1228076%2Fdata=02%7C01%7Cchristian.koenig%40amd.com%7C073b9043be5346b3c90c08d7f266e6fb%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244396096735223sdata=PjFsYvmw2pvVisZ6TzMqOyoSr0m3DsFN%2F0q%2B%2FfBxACg%3Dreserved=0
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 43 ++--
  1 file changed, 13 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 82a3299e53c0..57bbc70662ff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -148,6 +148,15 @@ static DEVICE_ATTR(mem_info_vis_vram_used, S_IRUGO,
  static DEVICE_ATTR(mem_info_vram_vendor, S_IRUGO,
   amdgpu_mem_info_vram_vendor, NULL);
  
+static struct attribute *amdgpu_vram_mgr_attributes[] = {

+   _attr_mem_info_vram_total.attr,
+   _attr_mem_info_vis_vram_total.attr,
+   _attr_mem_info_vram_used.attr,
+   _attr_mem_info_vis_vram_used.attr,
+   _attr_mem_info_vram_vendor.attr,
+   NULL
+};
+
  /**
   * amdgpu_vram_mgr_init - init VRAM manager and DRM MM
   *
@@ -172,31 +181,9 @@ static int amdgpu_vram_mgr_init(struct 
ttm_mem_type_manager *man,
man->priv = mgr;
  
  	/* Add the two VRAM-related sysfs files */

-   ret = device_create_file(adev->dev, _attr_mem_info_vram_total);
-   if (ret) {
-   DRM_ERROR("Failed to create device file mem_info_vram_total\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vis_vram_total);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vis_vram_total\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vram_used);
-   if (ret) {
-   DRM_ERROR("Failed to create device file mem_info_vram_used\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vis_vram_used);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vis_vram_used\n");
-   return ret;
-   }
-   ret = device_create_file(adev->dev, _attr_mem_info_vram_vendor);
-   if (ret) {
-   DRM_ERROR("Failed to create device file 
mem_info_vram_vendor\n");
-   return ret;
-   }
+   ret = sysfs_create_files(>dev->kobj, amdgpu_vram_mgr_attributes);
+   if (ret)
+   DRM_ERROR("Failed to register sysfs\n");
  
  	return 0;

  }
@@ -219,11 +206,7 @@ static int amdgpu_vram_mgr_fini(struct 
ttm_mem_type_manager *man)
spin_unlock(>lock);
kfree(mgr);
man->priv = NULL;
-   device_remove_file(adev->dev, _attr_mem_info_vram_total);
-   device_remove_file(adev->dev, _attr_mem_info_vis_vram_total);
-   device_remove_file(adev->dev, _attr_mem_info_vram_used);
-   device_remove_file(adev->dev, _attr_mem_info_vis_vram_used);
-   device_remove_file(adev->dev, _attr_mem_info_vram_vendor);
+   sysfs_remove_files(>dev->kobj, amdgpu_vram_mgr_attributes);
return 0;
  }
  


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


[PATCH] drm/amdgpu: Fix bug in RAS invoke

2020-05-07 Thread Clements, John
[AMD Official Use Only - Internal Distribution Only]

Invoke sequence should abort when RAS interrupt is detected before reading TA 
host shared memory


0001-drm-amdgpu-Fix-bug-in-RAS-invoke.patch
Description: 0001-drm-amdgpu-Fix-bug-in-RAS-invoke.patch
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: allocate large structures dynamically

2020-05-07 Thread Joe Perches
On Thu, 2020-05-07 at 08:42 +0200, Christian König wrote:
> Am 06.05.20 um 21:01 schrieb Joe Perches:
[]
> > And trivia:
> > 
> > The !! uses with bool seem unnecessary and it's probably better
> > to make amdgpu_ras_is_feature_enabled to return bool.
[]
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
[]
> > @@ -560,7 +560,7 @@ static int __amdgpu_ras_feature_enable(struct 
> > amdgpu_device *adev,
> >  */
> > if (!amdgpu_ras_is_feature_allowed(adev, head))
> > return 0;
> > -   if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head)))
> > +   if (!(enable ^ amdgpu_ras_is_feature_enabled(adev, head)))
> 
> And while we are at improving coding style I think that writing this as 
> "if (enabled == amdgpu_ras_is_feature_enabled(adev, head))" would be 
> much more readable.

 that's decidedly true...


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


Re: [PATCH] MAINTAINERS: Remove me from amdgpu maintainers

2020-05-07 Thread Christian König

Am 07.05.20 um 04:02 schrieb Chunming Zhou:

Glad to spend time on kernel driver in past years.
I've moved to new focus in umd and couldn't commit
enough time to discussions.

Signed-off-by: Chunming Zhou 


So Long, and Thanks for All the Fish :)

Reviewed-by: Christian König 


---
  MAINTAINERS | 1 -
  1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 938316092634..4ca508bd4c9e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14066,7 +14066,6 @@ F:  drivers/net/wireless/quantenna
  RADEON and AMDGPU DRM DRIVERS
  M:Alex Deucher 
  M:Christian König 
-M: David (ChunMing) Zhou 
  L:amd-gfx@lists.freedesktop.org
  S:Supported
  T:git git://people.freedesktop.org/~agd5f/linux


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


Re: [PATCH] drm/amdgpu: allocate large structures dynamically

2020-05-07 Thread Christian König

Am 06.05.20 um 21:01 schrieb Joe Perches:

On Tue, 2020-05-05 at 16:01 +0200, Arnd Bergmann wrote:

After the structure was padded to 1024 bytes, it is no longer
suitable for being a local variable, as the function surpasses
the warning limit for 32-bit architectures:

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:587:5: error: stack frame size of 1072 
bytes in function 'amdgpu_ras_feature_enable' [-Werror,-Wframe-larger-than=]
int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 ^

Use kzalloc() instead to get it from the heap.

[]

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

[]

@@ -588,19 +588,23 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
struct ras_common_if *head, bool enable)
  {
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
-   union ta_ras_cmd_input info;
+   union ta_ras_cmd_input *info;
int ret;
  
  	if (!con)

return -EINVAL;
  
+info = kzalloc(sizeof(union ta_ras_cmd_input), GFP_KERNEL);

Spaces were used for indentation here not a tab.
It might be useful to run your proposed patches through checkpatch

Is this an actual bug fix as the previous use didn't
zero unused info members?


+   if (!info)
+   return -ENOMEM;
+
if (!enable) {
-   info.disable_features = (struct ta_ras_disable_features_input) {
+   info->disable_features = (struct ta_ras_disable_features_input) 
{
.block_id =  amdgpu_ras_block_to_ta(head->block),
.error_type = amdgpu_ras_error_to_ta(head->type),
};
} else {
-   info.enable_features = (struct ta_ras_enable_features_input) {
+   info->enable_features = (struct ta_ras_enable_features_input) {
.block_id =  amdgpu_ras_block_to_ta(head->block),
.error_type = amdgpu_ras_error_to_ta(head->type),
};
@@ -609,26 +613,33 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
/* Do not enable if it is not allowed. */
WARN_ON(enable && !amdgpu_ras_is_feature_allowed(adev, head));
/* Are we alerady in that state we are going to set? */
-   if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head)))
-   return 0;
+   if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head))) {

And trivia:

The !! uses with bool seem unnecessary and it's probably better
to make amdgpu_ras_is_feature_enabled to return bool.

Maybe something like:
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 538895cfd862..05c4eaf0ddfa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -526,16 +526,16 @@ void amdgpu_ras_parse_status_code(struct amdgpu_device* 
adev,
  }
  
  /* feature ctl begin */

-static int amdgpu_ras_is_feature_allowed(struct amdgpu_device *adev,
-   struct ras_common_if *head)
+static bool amdgpu_ras_is_feature_allowed(struct amdgpu_device *adev,
+ struct ras_common_if *head)
  {
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
  
  	return con->hw_supported & BIT(head->block);

  }
  
-static int amdgpu_ras_is_feature_enabled(struct amdgpu_device *adev,

-   struct ras_common_if *head)
+static bool amdgpu_ras_is_feature_enabled(struct amdgpu_device *adev,
+ struct ras_common_if *head)
  {
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
  
@@ -560,7 +560,7 @@ static int __amdgpu_ras_feature_enable(struct amdgpu_device *adev,

 */
if (!amdgpu_ras_is_feature_allowed(adev, head))
return 0;
-   if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head)))
+   if (!(enable ^ amdgpu_ras_is_feature_enabled(adev, head)))


And while we are at improving coding style I think that writing this as 
"if (enabled == amdgpu_ras_is_feature_enabled(adev, head))" would be 
much more readable.


Christian.


return 0;
  
  	if (enable) {

@@ -609,7 +609,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
/* Do not enable if it is not allowed. */
WARN_ON(enable && !amdgpu_ras_is_feature_allowed(adev, head));
/* Are we alerady in that state we are going to set? */
-   if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head)))
+   if (!(enable ^ amdgpu_ras_is_feature_enabled(adev, head)))
return 0;
  
  	if (!amdgpu_ras_intr_triggered()) {




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


___