[PATCH 1/5] drm/amdgpu: add s0i3 capacity check for s0i3 routine

2020-11-11 Thread Prike Liang
add amdgpu_acpi_is_s0ix_supported() to check the platform
whether support s0i3.

Signed-off-by: Prike Liang 
Reviewed-by: Alex Deucher 
Acked-by: Huang Rui 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 20400ec..83ac06a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1314,9 +1314,11 @@ int amdgpu_acpi_pcie_notify_device_ready(struct 
amdgpu_device *adev);
 
 void amdgpu_acpi_get_backlight_caps(struct amdgpu_device *adev,
struct amdgpu_dm_backlight_caps *caps);
+bool amdgpu_acpi_is_s0ix_supported(void);
 #else
 static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
 static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
+static inline bool amdgpu_acpi_is_s0ix_supported(void) { return false; }
 #endif
 
 int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 165b02e..fd66ac0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "amdgpu.h"
@@ -894,3 +895,16 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev)
unregister_acpi_notifier(&adev->acpi_nb);
kfree(adev->atif);
 }
+
+/**
+ * amdgpu_acpi_is_s0ix_supported
+ *
+ * returns true if supported, false if not.
+ */
+bool amdgpu_acpi_is_s0ix_supported()
+{
+   if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
+   return true;
+
+   return false;
+}
-- 
2.7.4

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


[PATCH 4/5] drm/amdgpu: fix reset support for s0i3 enablement

2020-11-11 Thread Prike Liang
update amdgpu device suspend sequence for gpu reset during s0i3 enable.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index cf6a1b9..2f60b70 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2650,7 +2650,7 @@ static int amdgpu_device_ip_suspend_phase1(struct 
amdgpu_device *adev)
 {
int i, r;
 
-   if (!amdgpu_acpi_is_s0ix_supported()) {
+   if (!amdgpu_acpi_is_s0ix_supported() || amdgpu_in_reset(adev)) {
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
}
@@ -3708,7 +3708,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool 
fbcon)
 
amdgpu_fence_driver_suspend(adev);
 
-   if (!amdgpu_acpi_is_s0ix_supported())
+   if (!amdgpu_acpi_is_s0ix_supported() || amdgpu_in_reset(adev))
r = amdgpu_device_ip_suspend_phase2(adev);
else
amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);
-- 
2.7.4

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


[PATCH 3/5] drm/amdgpu: update amdgpu device suspend/resume sequence for s0i3 support

2020-11-11 Thread Prike Liang
- Need skip the RLC/CP/GFX disable for let GFXOFF enter during suspend period.
- For s0i3 suspend only need suspend DCE and each IP interrupt.
- Before VBIOS POSTed check and atom HW INT need set the GPU power status change
  to D0 in the resume period, otherwise the HW will be mess up and see the SDMA 
hang.

Signed-off-by: Prike Liang 
Reviewed-by: Alex Deucher 
Acked-by: Huang Rui 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f78aace..cf6a1b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2650,8 +2650,10 @@ static int amdgpu_device_ip_suspend_phase1(struct 
amdgpu_device *adev)
 {
int i, r;
 
-   amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
-   amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
+   if (!amdgpu_acpi_is_s0ix_supported()) {
+   amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
+   amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
+   }
 
for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
if (!adev->ip_blocks[i].status.valid)
@@ -3706,8 +3708,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool 
fbcon)
 
amdgpu_fence_driver_suspend(adev);
 
-   r = amdgpu_device_ip_suspend_phase2(adev);
-
+   if (!amdgpu_acpi_is_s0ix_supported())
+   r = amdgpu_device_ip_suspend_phase2(adev);
+   else
+   amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);
/* evict remaining vram memory
 * This second call to evict vram is to evict the gart page table
 * using the CPU.
@@ -3738,6 +3742,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool 
fbcon)
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
 
+   if (amdgpu_acpi_is_s0ix_supported())
+   amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry);
+
/* post card */
if (amdgpu_device_need_post(adev)) {
r = amdgpu_device_asic_init(adev);
-- 
2.7.4

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


[PATCH 5/5] drm/amd/pm: add gfx_state_change_set() for rn gfx power switch

2020-11-11 Thread Prike Liang
The gfx_state_change_set() funtion can support set GFX power
change status to D0/D3.

Signed-off-by: Prike Liang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |  3 +++
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h |  2 ++
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c   | 10 ++
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c |  7 +++
 4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 380dd3a..60c0a6d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -838,4 +838,7 @@ void amdgpu_gfx_state_change_set(struct amdgpu_device 
*adev, enum gfx_change_sta
 
mutex_unlock(&adev->pm.mutex);
 
+   if (is_support_sw_smu(adev))
+   smu_gfx_state_change_set(&adev->smu, state);
+
 }
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h 
b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
index 9724d6f..ae8ff7b 100644
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
@@ -576,6 +576,7 @@ struct pptable_funcs {
int (*post_init)(struct smu_context *smu);
void (*interrupt_work)(struct smu_context *smu);
int (*gpo_control)(struct smu_context *smu, bool enablement);
+   int (*gfx_state_change_set)(struct smu_context *smu, uint32_t state);
 };
 
 typedef enum {
@@ -764,6 +765,7 @@ int smu_get_status_gfxoff(struct amdgpu_device *adev, 
uint32_t *value);
 ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu, void **table);
 
 int smu_enable_mgpu_fan_boost(struct smu_context *smu);
+int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state);
 
 #endif
 #endif
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 3999079..35465a6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -2529,3 +2529,13 @@ int smu_enable_mgpu_fan_boost(struct smu_context *smu)
 
return ret;
 }
+
+int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state)
+{
+   int ret = 0;
+
+   if (smu->ppt_funcs->gfx_state_change_set)
+   ret = smu->ppt_funcs->gfx_state_change_set(smu, state);
+
+   return ret;
+}
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 66c1026..9423f36 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -1136,6 +1136,13 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context 
*smu,
return sizeof(struct gpu_metrics_v2_0);
 }
 
+static int renoir_gfx_state_change_set(struct smu_context *smu, uint32_t state)
+{
+   struct amdgpu_device *adev = smu->adev;
+
+   return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GpuChangeState, 
state, NULL);
+}
+
 static const struct pptable_funcs renoir_ppt_funcs = {
.set_power_state = NULL,
.print_clk_levels = renoir_print_clk_levels,
-- 
2.7.4

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


[PATCH 2/5] drm/amdgpu: add amdgpu_gfx_state_change_set() set gfx power change entry

2020-11-11 Thread Prike Liang
The new amdgpu_gfx_state_change_set() funtion can support set GFX power
change status to D0/D3.

Signed-off-by: Prike Liang 
Acked-by: Huang Rui 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c  | 20 
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  7 +++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h   |  1 +
 drivers/gpu/drm/amd/pm/inc/hwmgr.h   |  1 +
 drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h|  3 ++-
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 19 +++
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 10 ++
 7 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 97a8f78..380dd3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -819,3 +819,23 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)
}
return amdgpu_num_kcq;
 }
+
+/* amdgpu_gfx_state_change_set - Handle gfx power state change set
+ * @adev: amdgpu_device pointer
+ * @state: gfx power state(1 -sGpuChangeState_D0Entry and 2 
-sGpuChangeState_D3Entry)
+ *
+ */
+
+void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum 
gfx_change_state state)
+{
+
+   mutex_lock(&adev->pm.mutex);
+
+   if (adev->powerplay.pp_funcs &&
+   adev->powerplay.pp_funcs->gfx_state_change_set)
+   ((adev)->powerplay.pp_funcs->gfx_state_change_set(
+   (adev)->powerplay.pp_handle, state));
+
+   mutex_unlock(&adev->pm.mutex);
+
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index 671d4b3..6b5a8f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -47,6 +47,12 @@ enum gfx_pipe_priority {
AMDGPU_GFX_PIPE_PRIO_MAX
 };
 
+/* Argument for PPSMC_MSG_GpuChangeState */
+enum gfx_change_state {
+   sGpuChangeState_D0Entry = 1,
+   sGpuChangeState_D3Entry,
+};
+
 #define AMDGPU_GFX_QUEUE_PRIORITY_MINIMUM  0
 #define AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM  15
 
@@ -394,4 +400,5 @@ int amdgpu_gfx_cp_ecc_error_irq(struct amdgpu_device *adev,
 uint32_t amdgpu_kiq_rreg(struct amdgpu_device *adev, uint32_t reg);
 void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v);
 int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev);
+void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum 
gfx_change_state state);
 #endif
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h 
b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 94132c7..f775aac 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -285,6 +285,7 @@ struct amd_pm_funcs {
int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, 
uint32_t size);
int (*set_mp1_state)(void *handle, enum pp_mp1_state mp1_state);
int (*smu_i2c_bus_access)(void *handle, bool acquire);
+   int (*gfx_state_change_set)(void *handle, uint32_t state);
 /* export to DC */
u32 (*get_sclk)(void *handle, bool low);
u32 (*get_mclk)(void *handle, bool low);
diff --git a/drivers/gpu/drm/amd/pm/inc/hwmgr.h 
b/drivers/gpu/drm/amd/pm/inc/hwmgr.h
index 7e29ec2..1bb3794 100644
--- a/drivers/gpu/drm/amd/pm/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/inc/hwmgr.h
@@ -366,6 +366,7 @@ struct pp_hwmgr_func {
int (*disable_power_features_for_compute_performance)(struct pp_hwmgr 
*hwmgr,
bool disable);
ssize_t (*get_gpu_metrics)(struct pp_hwmgr *hwmgr, void **table);
+   int (*gfx_state_change)(struct pp_hwmgr *hwmgr, uint32_t state);
 };
 
 struct pp_table_func {
diff --git a/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h 
b/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
index df4677d..4c7e08b 100644
--- a/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
+++ b/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
@@ -83,7 +83,8 @@
 #define PPSMC_MSG_SetSoftMaxVcn 0x34
 #define PPSMC_MSG_PowerGateMmHub0x35
 #define PPSMC_MSG_SetRccPfcPmeRestoreRegister   0x36
-#define PPSMC_Message_Count 0x37
+#define PPSMC_MSG_GpuChangeState0x37
+#define PPSMC_Message_Count 0x42
 
 typedef uint16_t PPSMC_Result;
 typedef int  PPSMC_Msg;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c 
b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index eab9768..e0d2882 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -1629,6 +1629,24 @@ static ssize_t pp_get_gpu_metrics(void *handle, void 
**table)
return size;
 }
 
+static int pp_gfx_state_change_set(void *handle, uint32_t state)
+{
+   struct pp_hwmgr *hwmgr = handle;
+
+   if (!hwmgr || !hwmgr->pm_e

RE: [PATCH 3/8] drm/amdgpu: cleanup gmc_v10_0_process_interrupt a bit

2020-11-11 Thread Chauhan, Madhav
[AMD Public Use]

-Original Message-
From: amd-gfx  On Behalf Of Christian 
König
Sent: Tuesday, November 3, 2020 7:29 PM
To: amd-gfx@lists.freedesktop.org
Subject: [PATCH 3/8] drm/amdgpu: cleanup gmc_v10_0_process_interrupt a bit

Return early in case of a ratelimit and don't print leading zeros for the 
address.

Looks fine to me: Reviewed-by: Madhav Chauhan 

Regards,
Madhav

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 38 ++
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index d9399324be47..cffc3ca8fcde 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -95,6 +95,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device 
*adev,
   struct amdgpu_iv_entry *entry)  {
struct amdgpu_vmhub *hub = &adev->vmhub[entry->vmid_src];
+   struct amdgpu_task_info task_info;
uint32_t status = 0;
u64 addr;
 
@@ -115,24 +116,25 @@ static int gmc_v10_0_process_interrupt(struct 
amdgpu_device *adev,
WREG32_P(hub->vm_l2_pro_fault_cntl, 1, ~1);
}
 
-   if (printk_ratelimit()) {
-   struct amdgpu_task_info task_info;
-
-   memset(&task_info, 0, sizeof(struct amdgpu_task_info));
-   amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
-
-   dev_err(adev->dev,
-   "[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, "
-   "for process %s pid %d thread %s pid %d)\n",
-   entry->vmid_src ? "mmhub" : "gfxhub",
-   entry->src_id, entry->ring_id, entry->vmid,
-   entry->pasid, task_info.process_name, task_info.tgid,
-   task_info.task_name, task_info.pid);
-   dev_err(adev->dev, "  in page starting at address 0x%016llx 
from client %d\n",
-   addr, entry->client_id);
-   if (!amdgpu_sriov_vf(adev))
-   
hub->vmhub_funcs->print_l2_protection_fault_status(adev, status);
-   }
+   if (!printk_ratelimit())
+   return 0;
+
+   memset(&task_info, 0, sizeof(struct amdgpu_task_info));
+   amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
+
+   dev_err(adev->dev,
+   "[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, "
+   "for process %s pid %d thread %s pid %d)\n",
+   entry->vmid_src ? "mmhub" : "gfxhub",
+   entry->src_id, entry->ring_id, entry->vmid,
+   entry->pasid, task_info.process_name, task_info.tgid,
+   task_info.task_name, task_info.pid);
+   dev_err(adev->dev, "  in page starting at address 0x%012llx from client 
%d\n",
+   addr, entry->client_id);
+
+   if (!amdgpu_sriov_vf(adev))
+   hub->vmhub_funcs->print_l2_protection_fault_status(adev,
+  status);
 
return 0;
 }
--
2.25.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-gfx&data=04%7C01%7Cmadhav.chauhan%40amd.com%7Cf1eeafb1173c41100e6e08d880009473%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637400087287148200%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NWf8Sa9ygSAhuVWismqhKqSguIRBTTc3AGcEi7DFgTA%3D&reserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/8] drm/amdgpu: drop leading zeros from the gmc9 fault address

2020-11-11 Thread Chauhan, Madhav
[AMD Public Use]

-Original Message-
From: amd-gfx  On Behalf Of Christian 
König
Sent: Tuesday, November 3, 2020 7:29 PM
To: amd-gfx@lists.freedesktop.org
Subject: [PATCH 2/8] drm/amdgpu: drop leading zeros from the gmc9 fault address

The address space is only 48bit, not 64bit. And the VMHUBs work with sign 
extended addresses.

Looks fine to me, Reviewed-by: Madhav Chauhan 

Regards,
Madhav

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 0c3421d587e8..e86ef0c36596 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -557,7 +557,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device 
*adev,
entry->src_id, entry->ring_id, entry->vmid,
entry->pasid, task_info.process_name, task_info.tgid,
task_info.task_name, task_info.pid);
-   dev_err(adev->dev, "  in page starting at address 0x%016llx from client 
%d\n",
+   dev_err(adev->dev, "  in page starting at address 0x%012llx from 
+client %d\n",
addr, entry->client_id);
 
if (amdgpu_sriov_vf(adev))
--
2.25.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-gfx&data=04%7C01%7Cmadhav.chauhan%40amd.com%7C84c6c5a2c35f48bef42708d88000938a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637400087280302611%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=atlWsalQb3Ig0MrKVJezjjsxg5IZLynGiHfDFlWKwu0%3D&reserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH v2 4/8] drm/amdgpu: Split amdgpu_device_fini into early and late

2020-11-11 Thread Andrey Grodzovsky



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

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

Some of the stuff in amdgpu_device_fini such as HW interrupts
disable and pending fences finilization must be done right away on
pci_remove while most of the stuff which relates to finilizing and releasing
driver data structures can be kept until drm_driver.release hook is called, i.e.
when the last device reference is dropped.

Signed-off-by: Andrey Grodzovsky 

Long term I think best if as much of this code is converted over to devm
(for hw stuff) and drmm (for sw stuff and allocations). Doing this all
manually is very error prone.

I've started various such patches and others followed, but thus far only
very simple drivers tackled. But it should be doable step by step at
least, so you should have incremental benefits in code complexity right
away I hope.
-Daniel



Sure, I will definitely add this to my TODOs for after landing (hopefully) this 
patch set (after a few more iterations)

as indeed the required changes for using devm and drmm are non trivial and I 
prefer
to avoid diverging here into multiple directions at once.

Andrey





---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h|  6 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c|  6 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 24 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h|  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c| 23 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c|  3 +++
  7 files changed, 54 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 2a806cb..604a681 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1003,7 +1003,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
   struct drm_device *ddev,
   struct pci_dev *pdev,
   uint32_t flags);
-void amdgpu_device_fini(struct amdgpu_device *adev);
+void amdgpu_device_fini_early(struct amdgpu_device *adev);
+void amdgpu_device_fini_late(struct amdgpu_device *adev);
+
  int amdgpu_gpu_wait_for_idle(struct amdgpu_device *adev);
  
  void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,

@@ -1188,6 +1190,8 @@ void amdgpu_driver_lastclose_kms(struct drm_device *dev);
  int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file 
*file_priv);
  void amdgpu_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv);
+void amdgpu_driver_release_kms(struct drm_device *dev);
+
  int amdgpu_device_ip_suspend(struct amdgpu_device *adev);
  int amdgpu_device_suspend(struct drm_device *dev, bool fbcon);
  int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index cc41e8f..e7b9065 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2309,6 +2309,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device 
*adev)
  {
int i, r;
  
+	//DRM_ERROR("adev 0x%llx", (long long unsigned int)adev);

+
amdgpu_ras_pre_fini(adev);
  
  	if (adev->gmc.xgmi.num_physical_nodes > 1)

@@ -3304,10 +3306,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
   * Tear down the driver info (all asics).
   * Called at driver shutdown.
   */
-void amdgpu_device_fini(struct amdgpu_device *adev)
+void amdgpu_device_fini_early(struct amdgpu_device *adev)
  {
-   int r;
-
DRM_INFO("amdgpu: finishing device.\n");
flush_delayed_work(&adev->delayed_init_work);
adev->shutdown = true;
@@ -3330,7 +3330,13 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
if (adev->pm_sysfs_en)
amdgpu_pm_sysfs_fini(adev);
amdgpu_fbdev_fini(adev);
-   r = amdgpu_device_ip_fini(adev);
+
+   amdgpu_irq_fini_early(adev);
+}
+
+void amdgpu_device_fini_late(struct amdgpu_device *adev)
+{
+   amdgpu_device_ip_fini(adev);
if (adev->firmware.gpu_info_fw) {
release_firmware(adev->firmware.gpu_info_fw);
adev->firmware.gpu_info_fw = NULL;
@@ -3368,6 +3374,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
amdgpu_pmu_fini(adev);
if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
amdgpu_discovery_fini(adev);
+
  }
  
  
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 9e5afa5..43592dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1134,12 +1134,9 @@ amdgpu_pci_remove(struct pci_dev *pdev)
  {
struct drm_device *dev = pci_get_drvdata(pdev);
  
-#ifdef MODULE

-   if (THIS_MODULE->state != MODULE_STATE_GOING)
-#end

Re: [PATCH] drm/nouveau: Fix out-of-bounds access when deferencing MMU type

2020-11-11 Thread Ben Skeggs
On Thu, 12 Nov 2020 at 02:27, Ruhl, Michael J  wrote:
>
> >-Original Message-
> >From: Thomas Zimmermann 
> >Sent: Wednesday, November 11, 2020 7:08 AM
> >To: Ruhl, Michael J ; bske...@redhat.com;
> >airl...@linux.ie; dan...@ffwll.ch; christian.koe...@amd.com
> >Cc: nouv...@lists.freedesktop.org; dri-de...@lists.freedesktop.org;
> >Maarten Lankhorst ; Maxime Ripard
> >; Dave Airlie ; Gerd Hoffmann
> >; Alex Deucher ;
> >VMware Graphics ; Roland
> >Scheidegger ; Huang Rui ;
> >Felix Kuehling ; Hawking Zhang
> >; Jason Gunthorpe ; Likun Gao
> >; virtualizat...@lists.linux-foundation.org; spice-
> >de...@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
> >Subject: Re: [PATCH] drm/nouveau: Fix out-of-bounds access when
> >deferencing MMU type
> >
> >Hi
> >
> >Am 10.11.20 um 16:27 schrieb Ruhl, Michael J:
> >>
> >>
> >>> -Original Message-
> >>> From: Thomas Zimmermann 
> >>> Sent: Tuesday, November 10, 2020 8:37 AM
> >>> To: bske...@redhat.com; airl...@linux.ie; dan...@ffwll.ch; Ruhl, Michael J
> >>> ; christian.koe...@amd.com
> >>> Cc: nouv...@lists.freedesktop.org; dri-de...@lists.freedesktop.org;
> >Thomas
> >>> Zimmermann ; Maarten Lankhorst
> >>> ; Maxime Ripard
> >>> ; Dave Airlie ; Gerd Hoffmann
> >>> ; Alex Deucher ;
> >>> VMware Graphics ; Roland
> >>> Scheidegger ; Huang Rui ;
> >>> Felix Kuehling ; Hawking Zhang
> >>> ; Jason Gunthorpe ; Likun
> >Gao
> >>> ; virtualizat...@lists.linux-foundation.org; spice-
> >>> de...@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
> >>> Subject: [PATCH] drm/nouveau: Fix out-of-bounds access when
> >deferencing
> >>> MMU type
> >>>
> >>> The value of struct drm_device.ttm.type_vram can become -1 for
> >unknown
> >>> types of memory (see nouveau_ttm_init()). This leads to an out-of-bounds
> >>> error when accessing struct nvif_mmu.type[]:
> >>
> >> Would this make more sense to just set the type_vram = 0 instead of -1?
> >
> >From what I understand, these indices refer to an internal type of MMU,
> >rsp the MMU's capabilities. However, my hardware (pre-NV50) does not
> >have an MMU at all.
>
> Yeah, and upon further review I see that my comment was completely wrong
> (value vs. index).
>
> A better suggestion would have been, create an entry in the array that means,
> "unsupported type" with a value of 0, but...
>
> >I agree that it would be nice to have a cleaner design that incorporates
> >this case, but resolving that would apparently require more than a bugfix.
>
> I agree.  The -1 index is a special case for the platform path
> (platform != NV_DEVICE_INFO_V0_SOC).  This is a fix for the issue, but not
> a complete solution.
>
> If you need it:
> Reviewed-by: Michael J. Ruhl 
I've put an alternate fix for this here[1], and will get it into
drm-fixes later today.

Ben.

[1] 
https://github.com/skeggsb/nouveau/commit/4590f7120c2f1f4aea9d8b93a2dae43b312d35ad

>
> Thanks,
> Mike
>
> >Best regards
> >Thomas
> >
> >>
> >> Mike
> >>
> >>>
> >>>  [   18.304116]
> >>>
> >===
> >>> ===
> >>>  [   18.311649] BUG: KASAN: slab-out-of-bounds in
> >>> nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
> >>>  [   18.320415] Read of size 1 at addr 88810ffac1fe by task systemd-
> >>> udevd/342
> >>>  [   18.327681]
> >>>  [   18.329208] CPU: 1 PID: 342 Comm: systemd-udevd Tainted: G
> >>> E
> >>> 5.10.0-rc2-1-default+ #581
> >>>  [   18.338681] Hardware name: Dell Inc. OptiPlex 9020/0N4YC8, BIOS A24
> >>> 10/24/2018
> >>>  [   18.346032] Call Trace:
> >>>  [   18.348536]  dump_stack+0xae/0xe5
> >>>  [   18.351919]  print_address_description.constprop.0+0x17/0xf0
> >>>  [   18.357787]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
> >>>  [   18.363818]  __kasan_report.cold+0x20/0x38
> >>>  [   18.368099]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
> >>>  [   18.374133]  kasan_report+0x3a/0x50
> >>>  [   18.377789]  nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
> >>>  <...>
> >>>  [   18.767690] Allocated by task 342:
> >>>  [   18.773087]  kasan_save_stack+0x1b/0x40
> >>>  [   18.778890]  __kasan_kmalloc.constprop.0+0xbf/0xd0
> >>>  [   18.785646]  __kmalloc_track_caller+0x1be/0x390
> >>>  [   18.792165]  kstrdup_const+0x46/0x70
> >>>  [   18.797686]  kobject_set_name_vargs+0x2f/0xb0
> >>>  [   18.803992]  kobject_init_and_add+0x9d/0xf0
> >>>  [   18.810117]  ttm_mem_global_init+0x12c/0x210 [ttm]
> >>>  [   18.816853]  ttm_bo_global_init+0x4a/0x160 [ttm]
> >>>  [   18.823420]  ttm_bo_device_init+0x39/0x220 [ttm]
> >>>  [   18.830046]  nouveau_ttm_init+0x2c3/0x830 [nouveau]
> >>>  [   18.836929]  nouveau_drm_device_init+0x1b4/0x3f0 [nouveau]
> >>>  <...>
> >>>  [   19.105336]
> >>>
> >===
> >>> ===
> >>>
> >>> Fix this error, by not using type_vram as an index if it's negative.
> >>> Assume default values instead.
> >>>
> >>> The error was seen on Nvidia G72 hardware.
> >>>
> >>> Signed-off-by: Thomas Zimmerma

[PATCH v2 3/5] drm/amdgpu/vcn: add test for dec vcn software ring

2020-11-11 Thread James Zhu
Add vcn software ring decode ring test and decode ib test.

v2: clear compilation warning.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 135 ++--
 1 file changed, 129 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 7e19a66..cbd8b5f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -456,6 +456,37 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)
return r;
 }
 
+int amdgpu_vcn_dec_sw_ring_test_ring(struct amdgpu_ring *ring)
+{
+   struct amdgpu_device *adev = ring->adev;
+   uint32_t rptr;
+   unsigned int i;
+   int r;
+
+   if (amdgpu_sriov_vf(adev))
+   return 0;
+
+   r = amdgpu_ring_alloc(ring, 16);
+   if (r)
+   return r;
+
+   rptr = amdgpu_ring_get_rptr(ring);
+
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_END);
+   amdgpu_ring_commit(ring);
+
+   for (i = 0; i < adev->usec_timeout; i++) {
+   if (amdgpu_ring_get_rptr(ring) != rptr)
+   break;
+   udelay(1);
+   }
+
+   if (i >= adev->usec_timeout)
+   r = -ETIMEDOUT;
+
+   return r;
+}
+
 static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
   struct amdgpu_bo *bo,
   struct dma_fence **fence)
@@ -510,7 +541,10 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring 
*ring,
 }
 
 static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t 
handle,
- struct dma_fence **fence)
+   struct dma_fence **fence,
+   int (*send_msg)(struct amdgpu_ring *,
+   struct amdgpu_bo *,
+   struct dma_fence **))
 {
struct amdgpu_device *adev = ring->adev;
struct amdgpu_bo *bo = NULL;
@@ -540,11 +574,14 @@ static int amdgpu_vcn_dec_get_create_msg(struct 
amdgpu_ring *ring, uint32_t hand
for (i = 14; i < 1024; ++i)
msg[i] = cpu_to_le32(0x0);
 
-   return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+   return send_msg(ring, bo, fence);
 }
 
 static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t 
handle,
-  struct dma_fence **fence)
+   struct dma_fence **fence,
+   int (*send_msg)(struct amdgpu_ring *,
+   struct amdgpu_bo *,
+   struct dma_fence **))
 {
struct amdgpu_device *adev = ring->adev;
struct amdgpu_bo *bo = NULL;
@@ -566,7 +603,7 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct 
amdgpu_ring *ring, uint32_t han
for (i = 6; i < 1024; ++i)
msg[i] = cpu_to_le32(0x0);
 
-   return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+   return send_msg(ring, bo, fence);
 }
 
 int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)
@@ -574,11 +611,97 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, 
long timeout)
struct dma_fence *fence;
long r;
 
-   r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL);
+   r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL,
+   amdgpu_vcn_dec_send_msg);
+   if (r)
+   goto error;
+
+   r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence,
+   amdgpu_vcn_dec_send_msg);
+   if (r)
+   goto error;
+
+   r = dma_fence_wait_timeout(fence, false, timeout);
+   if (r == 0)
+   r = -ETIMEDOUT;
+   else if (r > 0)
+   r = 0;
+
+   dma_fence_put(fence);
+error:
+   return r;
+}
+
+static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,
+  struct amdgpu_bo *bo,
+  struct dma_fence **fence)
+{
+   struct amdgpu_vcn_decode_buffer *decode_buffer = NULL;
+   const unsigned int ib_size_dw = 64;
+   struct amdgpu_device *adev = ring->adev;
+   struct dma_fence *f = NULL;
+   struct amdgpu_job *job;
+   struct amdgpu_ib *ib;
+   uint64_t addr;
+   int i, r;
+
+   r = amdgpu_job_alloc_with_ib(adev, ib_size_dw * 4,
+   AMDGPU_IB_POOL_DIRECT, &job);
+   if (r)
+   goto err;
+
+   ib = &job->ibs[0];
+   addr = amdgpu_bo_gpu_offset(bo);
+   ib->length_dw = 0;
+
+   ib->ptr[ib->length_dw++] = sizeof(struct amdgpu_vcn_decode_buffer) + 8;
+   ib->ptr[ib->length_dw++] = 
cpu_to_le32(AMDGPU_VCN_IB_FLAG_DECODE_BUFFER);
+   decode_buffer = (struct amdgpu_vcn_decode_buffer 
*)&(ib->ptr[ib->length_dw]);
+   ib->length_dw += sizeof(struct amdgpu_vcn_decode_buffer) / 4;
+   m

[PATCH 1/2] drm/amdgpu: Use PSP_FW_NAME_LEN instead of magic number

2020-11-11 Thread Bhawanpreet Lakha
Signed-off-by: Bhawanpreet Lakha 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 2b0a2b93994b..74cbaf212698 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -2631,7 +2631,7 @@ int psp_init_ta_microcode(struct psp_context *psp,
  const char *chip_name)
 {
struct amdgpu_device *adev = psp->adev;
-   char fw_name[30];
+   char fw_name[PSP_FW_NAME_LEN];
const struct ta_firmware_header_v2_0 *ta_hdr;
int err = 0;
int ta_index = 0;
-- 
2.25.1

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


[PATCH 2/2] drm/amdgpu: Enable TA firmware loading for dimgrey_cavefish

2020-11-11 Thread Bhawanpreet Lakha
Signed-off-by: Bhawanpreet Lakha 
---
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index 03e88dbf92be..edd2d6bd1d86 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
@@ -62,7 +62,7 @@ MODULE_FIRMWARE("amdgpu/navy_flounder_ta.bin");
 MODULE_FIRMWARE("amdgpu/vangogh_asd.bin");
 MODULE_FIRMWARE("amdgpu/vangogh_toc.bin");
 MODULE_FIRMWARE("amdgpu/dimgrey_cavefish_sos.bin");
-MODULE_FIRMWARE("amdgpu/dimgrey_cavefish_asd.bin");
+MODULE_FIRMWARE("amdgpu/dimgrey_cavefish_ta.bin");
 
 /* address block */
 #define smnMP1_FIRMWARE_FLAGS  0x3010024
@@ -192,15 +192,11 @@ static int psp_v11_0_init_microcode(struct psp_context 
*psp)
break;
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
+   case CHIP_DIMGREY_CAVEFISH:
err = psp_init_sos_microcode(psp, chip_name);
if (err)
return err;
-   err = psp_init_ta_microcode(&adev->psp, chip_name);
-   if (err)
-   return err;
-   break;
-   case CHIP_DIMGREY_CAVEFISH:
-   err = psp_init_sos_microcode(psp, chip_name);
+   err = psp_init_ta_microcode(psp, chip_name);
if (err)
return err;
break;
-- 
2.25.1

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


[PATCH 4/5] drm/amdgpu/vcn3.0: add dec software ring vm functions to support

2020-11-11 Thread James Zhu
Add dec software ring vm functions to support.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 100 +-
 1 file changed, 98 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index c5e0a53..9d3c902 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -1673,6 +1673,98 @@ static void vcn_v3_0_dec_ring_set_wptr(struct 
amdgpu_ring *ring)
}
 }
 
+void vcn_v3_0_dec_sw_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
+   u64 seq, uint32_t flags)
+{
+   WARN_ON(flags & AMDGPU_FENCE_FLAG_64BIT);
+
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_FENCE);
+   amdgpu_ring_write(ring, addr);
+   amdgpu_ring_write(ring, upper_32_bits(addr));
+   amdgpu_ring_write(ring, seq);
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_TRAP);
+}
+
+void vcn_v3_0_dec_sw_ring_insert_end(struct amdgpu_ring *ring)
+{
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_END);
+}
+
+void vcn_v3_0_dec_sw_ring_emit_ib(struct amdgpu_ring *ring,
+  struct amdgpu_job *job,
+  struct amdgpu_ib *ib,
+  uint32_t flags)
+{
+   uint32_t vmid = AMDGPU_JOB_GET_VMID(job);
+
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_IB);
+   amdgpu_ring_write(ring, vmid);
+   amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
+   amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
+   amdgpu_ring_write(ring, ib->length_dw);
+}
+
+void vcn_v3_0_dec_sw_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
+   uint32_t val, uint32_t mask)
+{
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_REG_WAIT);
+   amdgpu_ring_write(ring, reg << 2);
+   amdgpu_ring_write(ring, mask);
+   amdgpu_ring_write(ring, val);
+}
+
+void vcn_v3_0_dec_sw_ring_emit_vm_flush(struct amdgpu_ring *ring,
+   uint32_t vmid, uint64_t pd_addr)
+{
+   struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
+   uint32_t data0, data1, mask;
+
+   pd_addr = amdgpu_gmc_emit_flush_gpu_tlb(ring, vmid, pd_addr);
+
+   /* wait for register write */
+   data0 = hub->ctx0_ptb_addr_lo32 + vmid * hub->ctx_addr_distance;
+   data1 = lower_32_bits(pd_addr);
+   mask = 0x;
+   vcn_v3_0_dec_sw_ring_emit_reg_wait(ring, data0, data1, mask);
+}
+
+void vcn_v3_0_dec_sw_ring_emit_wreg(struct amdgpu_ring *ring, uint32_t reg, 
uint32_t val)
+{
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_REG_WRITE);
+   amdgpu_ring_write(ring, reg << 2);
+   amdgpu_ring_write(ring, val);
+}
+
+static const struct amdgpu_ring_funcs vcn_v3_0_dec_sw_ring_vm_funcs = {
+   .type = AMDGPU_RING_TYPE_VCN_DEC,
+   .align_mask = 0x3f,
+   .nop = VCN_DEC_SW_CMD_NO_OP,
+   .vmhub = AMDGPU_MMHUB_0,
+   .get_rptr = vcn_v3_0_dec_ring_get_rptr,
+   .get_wptr = vcn_v3_0_dec_ring_get_wptr,
+   .set_wptr = vcn_v3_0_dec_ring_set_wptr,
+   .emit_frame_size =
+   SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
+   SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 4 +
+   4 + /* vcn_v3_0_dec_sw_ring_emit_vm_flush */
+   5 + 5 + /* vcn_v3_0_dec_sw_ring_emit_fdec_swe x2 vm fdec_swe */
+   1, /* vcn_v3_0_dec_sw_ring_insert_end */
+   .emit_ib_size = 5, /* vcn_v3_0_dec_sw_ring_emit_ib */
+   .emit_ib = vcn_v3_0_dec_sw_ring_emit_ib,
+   .emit_fence = vcn_v3_0_dec_sw_ring_emit_fence,
+   .emit_vm_flush = vcn_v3_0_dec_sw_ring_emit_vm_flush,
+   .test_ring = amdgpu_vcn_dec_sw_ring_test_ring,
+   .test_ib = NULL,//amdgpu_vcn_dec_sw_ring_test_ib,
+   .insert_nop = amdgpu_ring_insert_nop,
+   .insert_end = vcn_v3_0_dec_sw_ring_insert_end,
+   .pad_ib = amdgpu_ring_generic_pad_ib,
+   .begin_use = amdgpu_vcn_ring_begin_use,
+   .end_use = amdgpu_vcn_ring_end_use,
+   .emit_wreg = vcn_v3_0_dec_sw_ring_emit_wreg,
+   .emit_reg_wait = vcn_v3_0_dec_sw_ring_emit_reg_wait,
+   .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
+};
+
 static const struct amdgpu_ring_funcs vcn_v3_0_dec_ring_vm_funcs = {
.type = AMDGPU_RING_TYPE_VCN_DEC,
.align_mask = 0xf,
@@ -1810,9 +1902,13 @@ static void vcn_v3_0_set_dec_ring_funcs(struct 
amdgpu_device *adev)
if (adev->vcn.harvest_config & (1 << i))
continue;
 
-   adev->vcn.inst[i].ring_dec.funcs = &vcn_v3_0_dec_ring_vm_funcs;
+   if (!amdgpu_dec_sw_ring_enabled)
+   adev->vcn.inst[i].ring_dec.funcs = 
&vcn_v3_0_dec_ring_vm_funcs;
+   else
+   adev->vcn.inst[i].ring_dec.funcs = 
&vcn_v3_0_dec_sw_ring_vm_funcs;
adev->vcn.inst[i].ring_dec.me = i;
-   DRM_INFO("VCN(%d) decode is e

[PATCH 5/5] drm/amdgpu/vcn3.0: add software ring share memory support

2020-11-11 Thread James Zhu
Support software ring share memory with vcn firmware.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 35 +++
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index 9d3c902..18a56c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -169,6 +169,7 @@ static int vcn_v3_0_sw_init(void *handle)
}
 
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
+   volatile struct amdgpu_fw_shared *fw_shared;
if (adev->vcn.harvest_config & (1 << i))
continue;
 
@@ -233,6 +234,10 @@ static int vcn_v3_0_sw_init(void *handle)
if (r)
return r;
}
+
+   fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr;
+   fw_shared->present_flag_0 |= 
cpu_to_le32(AMDGPU_VCN_SW_RING_FLAG);
+   fw_shared->sw_ring.is_enabled = 
cpu_to_le32(!!amdgpu_dec_sw_ring_enabled);
}
 
if (amdgpu_sriov_vf(adev)) {
@@ -256,7 +261,17 @@ static int vcn_v3_0_sw_init(void *handle)
 static int vcn_v3_0_sw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-   int r;
+   int i, r;
+
+   for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
+   volatile struct amdgpu_fw_shared *fw_shared;
+
+   if (adev->vcn.harvest_config & (1 << i))
+   continue;
+   fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr;
+   fw_shared->present_flag_0 = 0;
+   fw_shared->sw_ring.is_enabled = false;
+   }
 
if (amdgpu_sriov_vf(adev))
amdgpu_virt_free_mm_table(adev);
@@ -466,6 +481,15 @@ static void vcn_v3_0_mc_resume(struct amdgpu_device *adev, 
int inst)
upper_32_bits(adev->vcn.inst[inst].gpu_addr + offset + 
AMDGPU_VCN_STACK_SIZE));
WREG32_SOC15(VCN, inst, mmUVD_VCPU_CACHE_OFFSET2, 0);
WREG32_SOC15(VCN, inst, mmUVD_VCPU_CACHE_SIZE2, 
AMDGPU_VCN_CONTEXT_SIZE);
+
+   /* non-cache window */
+   WREG32_SOC15(VCN, inst, mmUVD_LMI_VCPU_NC0_64BIT_BAR_LOW,
+   lower_32_bits(adev->vcn.inst[inst].fw_shared_gpu_addr));
+   WREG32_SOC15(VCN, inst, mmUVD_LMI_VCPU_NC0_64BIT_BAR_HIGH,
+   upper_32_bits(adev->vcn.inst[inst].fw_shared_gpu_addr));
+   WREG32_SOC15(VCN, inst, mmUVD_VCPU_NONCACHE_OFFSET0, 0);
+   WREG32_SOC15(VCN, inst, mmUVD_VCPU_NONCACHE_SIZE0,
+   AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)));
 }
 
 static void vcn_v3_0_mc_resume_dpg_mode(struct amdgpu_device *adev, int 
inst_idx, bool indirect)
@@ -548,13 +572,16 @@ static void vcn_v3_0_mc_resume_dpg_mode(struct 
amdgpu_device *adev, int inst_idx
 
/* non-cache window */
WREG32_SOC15_DPG_MODE(inst_idx, SOC15_DPG_MODE_OFFSET(
-   VCN, inst_idx, mmUVD_LMI_VCPU_NC0_64BIT_BAR_LOW), 0, 0, 
indirect);
+   VCN, inst_idx, mmUVD_LMI_VCPU_NC0_64BIT_BAR_LOW),
+   
lower_32_bits(adev->vcn.inst[inst_idx].fw_shared_gpu_addr), 0, indirect);
WREG32_SOC15_DPG_MODE(inst_idx, SOC15_DPG_MODE_OFFSET(
-   VCN, inst_idx, mmUVD_LMI_VCPU_NC0_64BIT_BAR_HIGH), 0, 
0, indirect);
+   VCN, inst_idx, mmUVD_LMI_VCPU_NC0_64BIT_BAR_HIGH),
+   
upper_32_bits(adev->vcn.inst[inst_idx].fw_shared_gpu_addr), 0, indirect);
WREG32_SOC15_DPG_MODE(inst_idx, SOC15_DPG_MODE_OFFSET(
VCN, inst_idx, mmUVD_VCPU_NONCACHE_OFFSET0), 0, 0, 
indirect);
WREG32_SOC15_DPG_MODE(inst_idx, SOC15_DPG_MODE_OFFSET(
-   VCN, inst_idx, mmUVD_VCPU_NONCACHE_SIZE0), 0, 0, 
indirect);
+   VCN, inst_idx, mmUVD_VCPU_NONCACHE_SIZE0),
+   AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)), 
0, indirect);
 }
 
 static void vcn_v3_0_disable_static_power_gating(struct amdgpu_device *adev, 
int inst)
-- 
2.7.4

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


[PATCH 3/5] drm/amdgpu/vcn: add test for dec vcn software ring

2020-11-11 Thread James Zhu
Add vcn software ring decode ring test and decode ib test.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 138 ++--
 1 file changed, 132 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 7e19a66..e3d54fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -456,6 +456,37 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)
return r;
 }
 
+int amdgpu_vcn_dec_sw_ring_test_ring(struct amdgpu_ring *ring)
+{
+   struct amdgpu_device *adev = ring->adev;
+   uint32_t rptr;
+   unsigned int i;
+   int r;
+
+   if (amdgpu_sriov_vf(adev))
+   return 0;
+
+   r = amdgpu_ring_alloc(ring, 16);
+   if (r)
+   return r;
+
+   rptr = amdgpu_ring_get_rptr(ring);
+
+   amdgpu_ring_write(ring, VCN_DEC_SW_CMD_END);
+   amdgpu_ring_commit(ring);
+
+   for (i = 0; i < adev->usec_timeout; i++) {
+   if (amdgpu_ring_get_rptr(ring) != rptr)
+   break;
+   udelay(1);
+   }
+
+   if (i >= adev->usec_timeout)
+   r = -ETIMEDOUT;
+
+   return r;
+}
+
 static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
   struct amdgpu_bo *bo,
   struct dma_fence **fence)
@@ -510,7 +541,10 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring 
*ring,
 }
 
 static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t 
handle,
- struct dma_fence **fence)
+ struct dma_fence **fence,
+ int (*send_msg)(struct amdgpu_ring *,
+ struct amdgpu_bo *,
+ struct dma_fence **))
 {
struct amdgpu_device *adev = ring->adev;
struct amdgpu_bo *bo = NULL;
@@ -540,13 +574,17 @@ static int amdgpu_vcn_dec_get_create_msg(struct 
amdgpu_ring *ring, uint32_t hand
for (i = 14; i < 1024; ++i)
msg[i] = cpu_to_le32(0x0);
 
-   return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+   return send_msg(ring, bo, fence);
 }
 
 static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t 
handle,
-  struct dma_fence **fence)
+ struct dma_fence **fence,
+ int (*send_msg)(struct amdgpu_ring *,
+ struct amdgpu_bo *,
+ struct dma_fence **))
 {
struct amdgpu_device *adev = ring->adev;
+   struct amdgpu_send_msg *dec;
struct amdgpu_bo *bo = NULL;
uint32_t *msg;
int r, i;
@@ -566,19 +604,107 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct 
amdgpu_ring *ring, uint32_t han
for (i = 6; i < 1024; ++i)
msg[i] = cpu_to_le32(0x0);
 
-   return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+   return send_msg(ring, bo, fence);
 }
 
 int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 {
+   struct amdgpu_device *adev = ring->adev;
struct dma_fence *fence;
long r;
 
-   r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL);
+   r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL,
+   amdgpu_vcn_dec_send_msg);
+   if (r)
+   goto error;
+
+   r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence,
+   amdgpu_vcn_dec_send_msg);
+   if (r)
+   goto error;
+
+   r = dma_fence_wait_timeout(fence, false, timeout);
+   if (r == 0)
+   r = -ETIMEDOUT;
+   else if (r > 0)
+   r = 0;
+
+   dma_fence_put(fence);
+error:
+   return r;
+}
+
+static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,
+  struct amdgpu_bo *bo,
+  struct dma_fence **fence)
+{
+   struct amdgpu_vcn_decode_buffer *decode_buffer = NULL;
+   const unsigned int ib_size_dw = 64;
+   struct amdgpu_device *adev = ring->adev;
+   struct dma_fence *f = NULL;
+   struct amdgpu_job *job;
+   struct amdgpu_ib *ib;
+   uint64_t addr;
+   int i, r;
+
+   r = amdgpu_job_alloc_with_ib(adev, ib_size_dw * 4,
+   AMDGPU_IB_POOL_DIRECT, &job);
+   if (r)
+   goto err;
+
+   ib = &job->ibs[0];
+   addr = amdgpu_bo_gpu_offset(bo);
+   ib->length_dw = 0;
+
+   ib->ptr[ib->length_dw++] = sizeof(struct amdgpu_vcn_decode_buffer) + 8;
+   ib->ptr[ib->length_dw++] = 
cpu_to_le32(AMDGPU_VCN_IB_FLAG_DECODE_BUFFER);
+   decode_buffer = (struct amdgpu_vcn_decode_buffer 
*)&(ib->ptr[ib->length_dw]);
+   ib->length_dw += sizeof(struct amdgpu_vcn_decode_

[PATCH 2/5] drm/amdgpu/vcn: update header to support dec vcn software ring

2020-11-11 Thread James Zhu
Add macro, structure and function prototype to
support dec vcn software ring.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 1769115..13aa417 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -44,6 +44,17 @@
 #define VCN_DEC_CMD_PACKET_START   0x000a
 #define VCN_DEC_CMD_PACKET_END 0x000b
 
+#define VCN_DEC_SW_CMD_NO_OP   0x
+#define VCN_DEC_SW_CMD_END 0x0001
+#define VCN_DEC_SW_CMD_IB  0x0002
+#define VCN_DEC_SW_CMD_FENCE   0x0003
+#define VCN_DEC_SW_CMD_TRAP0x0004
+#define VCN_DEC_SW_CMD_IB_AUTO 0x0005
+#define VCN_DEC_SW_CMD_SEMAPHORE   0x0006
+#define VCN_DEC_SW_CMD_PREEMPT_FENCE   0x0009
+#define VCN_DEC_SW_CMD_REG_WRITE   0x000b
+#define VCN_DEC_SW_CMD_REG_WAIT0x000c
+
 #define VCN_ENC_CMD_NO_OP  0x
 #define VCN_ENC_CMD_END0x0001
 #define VCN_ENC_CMD_IB 0x0002
@@ -145,6 +156,10 @@
} while (0)
 
 #define AMDGPU_VCN_MULTI_QUEUE_FLAG(1 << 8)
+#define AMDGPU_VCN_SW_RING_FLAG(1 << 9)
+
+#define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER   0x0001
+#define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER 0x0001
 
 enum fw_queue_mode {
FW_QUEUE_RING_RESET = 1,
@@ -236,12 +251,25 @@ struct amdgpu_fw_shared_multi_queue {
uint8_t padding[4];
 };
 
+struct amdgpu_fw_shared_sw_ring {
+   uint8_t is_enabled;
+   uint8_t padding[3];
+};
+
 struct amdgpu_fw_shared {
uint32_t present_flag_0;
uint8_t pad[53];
struct amdgpu_fw_shared_multi_queue multi_queue;
+   struct amdgpu_fw_shared_sw_ring sw_ring;
 } __attribute__((__packed__));
 
+struct amdgpu_vcn_decode_buffer {
+   uint32_t valid_buf_flag;
+   uint32_t msg_buffer_address_hi;
+   uint32_t msg_buffer_address_lo;
+   uint32_t pad[30];
+};
+
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
 int amdgpu_vcn_sw_fini(struct amdgpu_device *adev);
 int amdgpu_vcn_suspend(struct amdgpu_device *adev);
@@ -251,6 +279,8 @@ void amdgpu_vcn_ring_end_use(struct amdgpu_ring *ring);
 
 int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring);
 int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout);
+int amdgpu_vcn_dec_sw_ring_test_ring(struct amdgpu_ring *ring);
+int amdgpu_vcn_dec_sw_ring_test_ib(struct amdgpu_ring *ring, long timeout);
 
 int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring);
 int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout);
-- 
2.7.4

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


[PATCH 1/5] drm/amdgpu: add vcn dec software ring enabled parameter

2020-11-11 Thread James Zhu
This allows us to enable dec software ring feature on VCN.
The default is 0 for all asics, and it is only valid for
asics with vcn3.0 and above.

Signed-off-by: James Zhu 
Reviewed-by: Leo Liu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 20400ec..cc47da6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -209,6 +209,7 @@ extern int amdgpu_si_support;
 extern int amdgpu_cik_support;
 #endif
 extern int amdgpu_num_kcq;
+extern int amdgpu_dec_sw_ring_enabled;
 
 #define AMDGPU_VM_MAX_NUM_CTX  4096
 #define AMDGPU_SG_THRESHOLD(256*1024*1024)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 999f84d..570088f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -160,6 +160,7 @@ int amdgpu_force_asic_type = -1;
 int amdgpu_tmz;
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
+int amdgpu_dec_sw_ring_enabled;
 
 struct amdgpu_mgpu_info mgpu_info = {
.mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
@@ -806,6 +807,13 @@ module_param_named(bad_page_threshold, 
amdgpu_bad_page_threshold, int, 0444);
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup 
(8 if set to greater than 8 or less than 0, only affect gfx 8+)");
 module_param_named(num_kcq, amdgpu_num_kcq, int, 0444);
 
+/**
+ * DOC: dec_sw_ring_enabled (uint)
+ * Override vcn decode software ring features enabled.
+ */
+MODULE_PARM_DESC(dec_sw_ring_enabled, "vcn dec sw ring support (1 = enable, 0 
= disable (default))");
+module_param_named(dec_sw_ring_enabled, amdgpu_dec_sw_ring_enabled, int, 0444);
+
 static const struct pci_device_id pciidlist[] = {
 #ifdef  CONFIG_DRM_AMDGPU_SI
{0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
-- 
2.7.4

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


[PATCH 06/19] drm/radeon/ci_dpm: Move 'ci_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/cik.c:1868:5: warning: no previous prototype for 
‘ci_mc_load_microcode’ [-Wmissing-prototypes]
 1868 | int ci_mc_load_microcode(struct radeon_device *rdev)
 | ^~~~
 drivers/gpu/drm/radeon/cik.c:5847:6: warning: no previous prototype for 
‘cik_enter_rlc_safe_mode’ [-Wmissing-prototypes]
 5847 | void cik_enter_rlc_safe_mode(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/cik.c:5868:6: warning: no previous prototype for 
‘cik_exit_rlc_safe_mode’ [-Wmissing-prototypes]
 5868 | void cik_exit_rlc_safe_mode(struct radeon_device *rdev)
 | ^~
 drivers/gpu/drm/radeon/cik.c:6286:6: warning: no previous prototype for 
‘cik_update_cg’ [-Wmissing-prototypes]
 6286 | void cik_update_cg(struct radeon_device *rdev,
 | ^

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/ci_dpm.c |  7 +--
 drivers/gpu/drm/radeon/cik.c|  1 +
 drivers/gpu/drm/radeon/cik.h| 33 +
 3 files changed, 35 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/radeon/cik.h

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 8324aca5fd006..a9fc0a552736c 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -27,6 +27,7 @@
 
 #include "atom.h"
 #include "ci_dpm.h"
+#include "cik.h"
 #include "cikd.h"
 #include "r600_dpm.h"
 #include "radeon.h"
@@ -157,12 +158,6 @@ extern u8 si_get_mclk_frequency_ratio(u32 memory_clock, 
bool strobe_mode);
 extern void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
*rdev,
 u32 max_voltage_steps,
 struct atom_voltage_table 
*voltage_table);
-extern void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
-extern void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
-extern int ci_mc_load_microcode(struct radeon_device *rdev);
-extern void cik_update_cg(struct radeon_device *rdev,
- u32 block, bool enable);
-
 static int ci_get_std_voltage_value_sidd(struct radeon_device *rdev,
 struct atom_voltage_table_entry 
*voltage_table,
 u16 *std_voltage_hi_sidd, u16 
*std_voltage_lo_sidd);
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 377c3f0c9d316..af08d6f1be53e 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -32,6 +32,7 @@
 #include "atom.h"
 #include "evergreen.h"
 #include "cik_blit_shaders.h"
+#include "cik.h"
 #include "cikd.h"
 #include "clearstate_ci.h"
 #include "r600.h"
diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
new file mode 100644
index 0..297b3c1ff804f
--- /dev/null
+++ b/drivers/gpu/drm/radeon/cik.h
@@ -0,0 +1,33 @@
+/* cik.h -- Private header for radeon driver -*- linux-c -*-
+ * Copyright 2012 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __CIK_H__
+#define __CIK_H__
+
+struct radeon_device;
+
+void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
+void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
+int ci_mc_load_microcode(struct radeon_device *rdev);
+void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
+
+#endif /* __CIK_H__ */
-- 
2.25.1

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


[PATCH 11/19] drm/radeon/radeon_audio: Move 'dce6_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/dce6_afmt.c:32:5: warning: no previous prototype for 
‘dce6_endpoint_rreg’ [-Wmissing-prototypes]
 32 | u32 dce6_endpoint_rreg(struct radeon_device *rdev,
 | ^~
 drivers/gpu/drm/radeon/dce6_afmt.c:46:6: warning: no previous prototype for 
‘dce6_endpoint_wreg’ [-Wmissing-prototypes]
 46 | void dce6_endpoint_wreg(struct radeon_device *rdev,
 | ^~
 drivers/gpu/drm/radeon/dce6_afmt.c:110:6: warning: no previous prototype for 
‘dce6_afmt_select_pin’ [-Wmissing-prototypes]
 110 | void dce6_afmt_select_pin(struct drm_encoder *encoder)
 | ^~~~
 drivers/gpu/drm/radeon/dce6_afmt.c:123:6: warning: no previous prototype for 
‘dce6_afmt_write_latency_fields’ [-Wmissing-prototypes]
 123 | void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
 | ^~
 drivers/gpu/drm/radeon/dce6_afmt.c:152:6: warning: no previous prototype for 
‘dce6_afmt_hdmi_write_speaker_allocation’ [-Wmissing-prototypes]
 152 | void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
 | ^~~
 drivers/gpu/drm/radeon/dce6_afmt.c:177:6: warning: no previous prototype for 
‘dce6_afmt_dp_write_speaker_allocation’ [-Wmissing-prototypes]
 177 | void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
 | ^
 drivers/gpu/drm/radeon/dce6_afmt.c:202:6: warning: no previous prototype for 
‘dce6_afmt_write_sad_regs’ [-Wmissing-prototypes]
 202 | void dce6_afmt_write_sad_regs(struct drm_encoder *encoder,
 | ^~~~
 drivers/gpu/drm/radeon/dce6_afmt.c:268:6: warning: no previous prototype for 
‘dce6_hdmi_audio_set_dto’ [-Wmissing-prototypes]
 268 | void dce6_hdmi_audio_set_dto(struct radeon_device *rdev,
 | ^~~
 drivers/gpu/drm/radeon/dce6_afmt.c:287:6: warning: no previous prototype for 
‘dce6_dp_audio_set_dto’ [-Wmissing-prototypes]
 287 | void dce6_dp_audio_set_dto(struct radeo_device *rdev,
 | ^

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Slava Grigorev 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/dce6_afmt.c|  1 +
 drivers/gpu/drm/radeon/dce6_afmt.h| 52 +++
 drivers/gpu/drm/radeon/radeon_audio.c | 17 +
 3 files changed, 54 insertions(+), 16 deletions(-)
 create mode 100644 drivers/gpu/drm/radeon/dce6_afmt.h

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
b/drivers/gpu/drm/radeon/dce6_afmt.c
index eec5d7a627388..4a1d5447eac17 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -22,6 +22,7 @@
  */
 #include 
 
+#include "dce6_afmt.h"
 #include "radeon.h"
 #include "radeon_audio.h"
 #include "sid.h"
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.h 
b/drivers/gpu/drm/radeon/dce6_afmt.h
new file mode 100644
index 0..176a538664a27
--- /dev/null
+++ b/drivers/gpu/drm/radeon/dce6_afmt.h
@@ -0,0 +1,52 @@
+/* dce6_afmt.h -- Private header for radeon driver -*- linux-c -*-
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __DCE6_AFMT_H__
+#define __DCE6_AFMT_H__
+
+struct cea_sad;
+struct drm_connector;
+struct drm_display_mode;
+struct drm_encoder;
+struct radeon_crtc;
+struct radeon_device;
+
+u32 dce6_endpoint_rreg(struct radeon_device *rdev, u32 offset, u32 reg);
+void dce6_endpoint_wreg(struct radeon_device *rdev, u32 offset, u32 reg, u32 
v);
+void dce6_afmt_write_sad_regs(struct drm_encoder *encoder,
+ struct cea_sad *sads, int sad_count);
+void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
+u8 *sadb, int sad_count);
+void dce6_afmt_dp_write_speaker_all

[PATCH 19/19] drm/radeon/evergreen_cs: Move 'r600_dma_cs_next_reloc()'s prototype to shared header

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

 drivers/gpu/drm/radeon/r600_cs.c:2343:5: warning: no previous prototype for 
‘r600_dma_cs_next_reloc’ [-Wmissing-prototypes]
 2343 | int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
 | ^~

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

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c 
b/drivers/gpu/drm/radeon/evergreen_cs.c
index 53b75cf201958..0de79f3a7e3ff 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -28,6 +28,7 @@
 
 #include "radeon.h"
 #include "radeon_asic.h"
+#include "r600.h"
 #include "evergreend.h"
 #include "evergreen_reg_safe.h"
 #include "cayman_reg_safe.h"
@@ -37,8 +38,6 @@
 
 #define REG_SAFE_BM_SIZE ARRAY_SIZE(evergreen_reg_safe_bm)
 
-int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
-  struct radeon_bo_list **cs_reloc);
 struct evergreen_cs_track {
u32 group_size;
u32 nbanks;
diff --git a/drivers/gpu/drm/radeon/r600.h b/drivers/gpu/drm/radeon/r600.h
index a259976a95913..21fe44198a966 100644
--- a/drivers/gpu/drm/radeon/r600.h
+++ b/drivers/gpu/drm/radeon/r600.h
@@ -29,7 +29,9 @@
 #define __R600_H__
 
 struct r600_audio_pin;
+struct radeon_bo_list;
 struct radeon_crtc;
+struct radeon_cs_parser;
 struct radeon_device;
 struct radeon_hdmi_acr;
 
@@ -50,4 +52,6 @@ void r600_hdmi_update_acr(struct drm_encoder *encoder, long 
offset,
 void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
 void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
 
+int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
+  struct radeon_bo_list **cs_reloc);
 #endif /* __R600_H__ */
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index f20b619466816..dc68e538d5a97 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -29,6 +29,7 @@
 
 #include "radeon.h"
 #include "radeon_asic.h"
+#include "r600.h"
 #include "r600d.h"
 #include "r600_reg_safe.h"
 
-- 
2.25.1

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


[PATCH 02/19] drm/radeon/r600: Move 'evergreen_rlc_resume()'s prototype to shared header

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

 drivers/gpu/drm/radeon/evergreen.c:4380:5: warning: no previous prototype for 
‘evergreen_rlc_resume’ [-Wmissing-prototypes]
 4380 | int evergreen_rlc_resume(struct radeon_device *rdev)
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/evergreen.h 
b/drivers/gpu/drm/radeon/evergreen.h
index eb46ac7776951..f8d772e612a48 100644
--- a/drivers/gpu/drm/radeon/evergreen.h
+++ b/drivers/gpu/drm/radeon/evergreen.h
@@ -48,5 +48,6 @@ void evergreen_gpu_pci_config_reset(struct radeon_device 
*rdev);
 u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev);
 void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
 u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
+int evergreen_rlc_resume(struct radeon_device *rdev);
 
 #endif /* __RADEON_EVERGREEN_H__ */
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 94e8815e5067d..b44e0c607b1b1 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -39,6 +39,7 @@
 
 #include "atom.h"
 #include "avivod.h"
+#include "evergreen.h"
 #include "r600.h"
 #include "r600d.h"
 #include "rv770.h"
@@ -113,7 +114,6 @@ static void r600_gpu_init(struct radeon_device *rdev);
 void r600_fini(struct radeon_device *rdev);
 void r600_irq_disable(struct radeon_device *rdev);
 static void r600_pcie_gen2_enable(struct radeon_device *rdev);
-extern int evergreen_rlc_resume(struct radeon_device *rdev);
 
 /*
  * Indirect registers accessor
-- 
2.25.1

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


[PATCH 01/19] drm/radeon/evergreen_dma: Move 'evergreen_gpu_check_soft_reset()'s prototype to shared header

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

 drivers/gpu/drm/radeon/evergreen.c:3825:5: warning: no previous prototype for 
‘evergreen_gpu_check_soft_reset’ [-Wmissing-prototypes]
 3825 | u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev)
 | ^~

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

diff --git a/drivers/gpu/drm/radeon/evergreen.h 
b/drivers/gpu/drm/radeon/evergreen.h
index 30c9ca99ced90..eb46ac7776951 100644
--- a/drivers/gpu/drm/radeon/evergreen.h
+++ b/drivers/gpu/drm/radeon/evergreen.h
@@ -47,5 +47,6 @@ int sumo_rlc_init(struct radeon_device *rdev);
 void evergreen_gpu_pci_config_reset(struct radeon_device *rdev);
 u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev);
 void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
+u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
 
 #endif /* __RADEON_EVERGREEN_H__ */
diff --git a/drivers/gpu/drm/radeon/evergreen_dma.c 
b/drivers/gpu/drm/radeon/evergreen_dma.c
index 767857d4a8c5c..52c79da1ecf57 100644
--- a/drivers/gpu/drm/radeon/evergreen_dma.c
+++ b/drivers/gpu/drm/radeon/evergreen_dma.c
@@ -24,10 +24,9 @@
 
 #include "radeon.h"
 #include "radeon_asic.h"
+#include "evergreen.h"
 #include "evergreend.h"
 
-u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
-
 /**
  * evergreen_dma_fence_ring_emit - emit a fence on the DMA ring
  *
-- 
2.25.1

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


[PATCH 18/19] drm/radeon/cik: Move 'vce_v2_0_enable_mgcg()'s prototype to shared header

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

 drivers/gpu/drm/radeon/vce_v2_0.c:111:6: warning: no previous prototype for 
‘vce_v2_0_enable_mgcg’ [-Wmissing-prototypes]
 111 | void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable)
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 4520ec4c7b2e2..ae2a507d13bb7 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -41,6 +41,7 @@
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
 #include "si.h"
+#include "vce.h"
 
 #define SH_MEM_CONFIG_GFX_DEFAULT \
ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED)
@@ -129,7 +130,6 @@ MODULE_FIRMWARE("radeon/mullins_rlc.bin");
 MODULE_FIRMWARE("radeon/mullins_sdma.bin");
 
 static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
sh);
-extern void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 static void cik_rlc_stop(struct radeon_device *rdev);
 static void cik_pcie_gen3_enable(struct radeon_device *rdev);
 static void cik_program_aspm(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/vce.h b/drivers/gpu/drm/radeon/vce.h
index 1eb4f5715202e..ccc9c00f0d02c 100644
--- a/drivers/gpu/drm/radeon/vce.h
+++ b/drivers/gpu/drm/radeon/vce.h
@@ -30,5 +30,6 @@
 struct radeon_device;
 
 void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
+void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 
 #endif /* __VCE_H__ */
diff --git a/drivers/gpu/drm/radeon/vce_v2_0.c 
b/drivers/gpu/drm/radeon/vce_v2_0.c
index d6fde3659e65f..163c9bfc03da8 100644
--- a/drivers/gpu/drm/radeon/vce_v2_0.c
+++ b/drivers/gpu/drm/radeon/vce_v2_0.c
@@ -30,6 +30,7 @@
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "cikd.h"
+#include "vce.h"
 
 #define VCE_V2_0_FW_SIZE   (256 * 1024)
 #define VCE_V2_0_STACK_SIZE(64 * 1024)
-- 
2.25.1

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


[PATCH 12/19] drm/radeon/evergreen: Move 'si_get_csb_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/si.c:5678:5: warning: no previous prototype for 
‘si_get_csb_size’ [-Wmissing-prototypes]
 5678 | u32 si_get_csb_size(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/si.c:5710:6: warning: no previous prototype for 
‘si_get_csb_buffer’ [-Wmissing-prototypes]
 5710 | void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer)
 | ^

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

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 28830f4ef95e3..d8ee80ad4ea44 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -41,6 +41,7 @@
 #include "radeon_asic.h"
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
+#include "si.h"
 
 #define DC_HPDx_CONTROL(x)(DC_HPD1_CONTROL + (x * 0xc))
 #define DC_HPDx_INT_CONTROL(x)(DC_HPD1_INT_CONTROL + (x * 0xc))
@@ -218,8 +219,6 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
 void evergreen_program_aspm(struct radeon_device *rdev);
 void cik_init_cp_pg_table(struct radeon_device *rdev);
 
-extern u32 si_get_csb_size(struct radeon_device *rdev);
-extern void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer);
 extern u32 cik_get_csb_size(struct radeon_device *rdev);
 extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer);
 
diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
index f483a64d17050..310c58376f927 100644
--- a/drivers/gpu/drm/radeon/si.h
+++ b/drivers/gpu/drm/radeon/si.h
@@ -32,5 +32,7 @@ u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
 void si_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
 void si_rlc_reset(struct radeon_device *rdev);
 void si_init_uvd_internal_cg(struct radeon_device *rdev);
+u32 si_get_csb_size(struct radeon_device *rdev);
+void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
 
 #endif /* __SI_H__ */
-- 
2.25.1

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


[PATCH 13/19] drm/radeon/cik_sdma: Move 'amdgpu_cik_gpu_check_soft_reset()'s prototype to shared header

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

 drivers/gpu/drm/radeon/cik.c:4845:5: warning: no previous prototype for 
‘cik_gpu_check_soft_reset’ [-Wmissing-prototypes]
 4845 | u32 cik_gpu_check_soft_reset(struct radeon_device *rdev)
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
index 297b3c1ff804f..6630b9da9e7aa 100644
--- a/drivers/gpu/drm/radeon/cik.h
+++ b/drivers/gpu/drm/radeon/cik.h
@@ -29,5 +29,6 @@ void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
 void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
 int ci_mc_load_microcode(struct radeon_device *rdev);
 void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
+u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
 
 #endif /* __CIK_H__ */
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c 
b/drivers/gpu/drm/radeon/cik_sdma.c
index 3c709ebe8d1ab..919b14845c3c7 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -27,14 +27,13 @@
 #include "radeon_ucode.h"
 #include "radeon_asic.h"
 #include "radeon_trace.h"
+#include "cik.h"
 #include "cikd.h"
 
 /* sdma */
 #define CIK_SDMA_UCODE_SIZE 1050
 #define CIK_SDMA_UCODE_VERSION 64
 
-u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
-
 /*
  * sDMA - System DMA
  * Starting with CIK, the GPU has new asynchronous
-- 
2.25.1

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


[PATCH 05/19] drm/radeon/radeon_encoders: Move 'radeon_atom_backlight_init's prototype to shared header

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

 drivers/gpu/drm/radeon/atombios_encoders.c:186:6: warning: no previous 
prototype for ‘radeon_atom_backlight_init’ [-Wmissing-prototypes]
 186 | void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
 | ^~

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

diff --git a/drivers/gpu/drm/radeon/radeon_atombios.h 
b/drivers/gpu/drm/radeon/radeon_atombios.h
index a895a7002c3d3..fd03755e6fa2c 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.h
+++ b/drivers/gpu/drm/radeon/radeon_atombios.h
@@ -28,14 +28,18 @@
 #ifndef __RADEON_ATOMBIOS_H__
 #define __RADEON_ATOMBIOS_H__
 
+struct drm_connector;
 struct drm_device;
 struct drm_display_mode;
 struct radeon_device;
+struct radeon_encoder;
 
 bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
struct drm_display_mode *mode);
 void radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
 uint32_t supported_device, u16 caps);
+void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
+   struct drm_connector *drm_connector);
 
 
 #endif /* __RADEON_ATOMBIOS_H__ */
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c 
b/drivers/gpu/drm/radeon/radeon_encoders.c
index b60a373d3ead3..46549d5179ee9 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -31,14 +31,10 @@
 #include 
 
 #include "radeon.h"
+#include "radeon_atombios.h"
 #include "radeon_legacy_encoders.h"
 #include "atom.h"
 
-extern void
-radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
-  struct drm_connector *drm_connector);
-
-
 static uint32_t radeon_encoder_clones(struct drm_encoder *encoder)
 {
struct drm_device *dev = encoder->dev;
-- 
2.25.1

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


[PATCH 14/19] drm/radeon/evergreen: Move 'cik_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/cik.c:6413:6: warning: no previous prototype for 
‘cik_init_cp_pg_table’ [-Wmissing-prototypes]
 6413 | void cik_init_cp_pg_table(struct radeon_device *rdev)
 | ^~~~
 drivers/gpu/drm/radeon/cik.c:6670:5: warning: no previous prototype for 
‘cik_get_csb_size’ [-Wmissing-prototypes]
 6670 | u32 cik_get_csb_size(struct radeon_device *rdev)
 | ^~~~
 drivers/gpu/drm/radeon/cik.c:6702:6: warning: no previous prototype for 
‘cik_get_csb_buffer’ [-Wmissing-prototypes]
 6702 | void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer)
 | ^~

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

diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
index 6630b9da9e7aa..420207d19de52 100644
--- a/drivers/gpu/drm/radeon/cik.h
+++ b/drivers/gpu/drm/radeon/cik.h
@@ -30,5 +30,8 @@ void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
 int ci_mc_load_microcode(struct radeon_device *rdev);
 void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
 u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
+void cik_init_cp_pg_table(struct radeon_device *rdev);
+u32 cik_get_csb_size(struct radeon_device *rdev);
+void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
 
 #endif /* __CIK_H__ */
diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index d8ee80ad4ea44..f95b588354274 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -31,6 +31,7 @@
 
 #include "atom.h"
 #include "avivod.h"
+#include "cik.h"
 #include "ni.h"
 #include "rv770.h"
 #include "evergreen.h"
@@ -217,10 +218,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev);
 void evergreen_fini(struct radeon_device *rdev);
 void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
 void evergreen_program_aspm(struct radeon_device *rdev);
-void cik_init_cp_pg_table(struct radeon_device *rdev);
-
-extern u32 cik_get_csb_size(struct radeon_device *rdev);
-extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
*buffer);
 
 static const u32 evergreen_golden_registers[] =
 {
-- 
2.25.1

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


[PATCH 10/19] drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared header

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

 drivers/gpu/drm/radeon/rv770_dpm.c:62:30: warning: no previous prototype for 
‘evergreen_get_pi’ [-Wmissing-prototypes]
 62 | struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev)
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 018949668536e..4e64ed38c439f 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -29,6 +29,7 @@
 #include "btc_dpm.h"
 #include "btcd.h"
 #include "cypress_dpm.h"
+#include "evergreen.h"
 #include "r600_dpm.h"
 #include "rv770.h"
 #include "radeon.h"
@@ -49,8 +50,6 @@
 #ifndef BTC_MGCG_SEQUENCE
 #define BTC_MGCG_SEQUENCE  300
 
-struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
-
 extern int ni_mc_load_microcode(struct radeon_device *rdev);
 
 //* BARTS **//
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
b/drivers/gpu/drm/radeon/cypress_dpm.c
index 6d3690bcca2d2..fdddbbaecbb74 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -26,6 +26,7 @@
 
 #include "atom.h"
 #include "cypress_dpm.h"
+#include "evergreen.h"
 #include "evergreend.h"
 #include "r600_dpm.h"
 #include "rv770.h"
@@ -44,8 +45,6 @@
 #define MC_CG_SEQ_YCLK_SUSPEND  0x04
 #define MC_CG_SEQ_YCLK_RESUME   0x0a
 
-struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
-
 static void cypress_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev,
 bool enable)
 {
diff --git a/drivers/gpu/drm/radeon/evergreen.h 
b/drivers/gpu/drm/radeon/evergreen.h
index f8d772e612a48..a829deb8b078a 100644
--- a/drivers/gpu/drm/radeon/evergreen.h
+++ b/drivers/gpu/drm/radeon/evergreen.h
@@ -29,6 +29,7 @@
 #define __RADEON_EVERGREEN_H__
 
 struct evergreen_mc_save;
+struct evergreen_power_info;
 struct radeon_device;
 
 bool evergreen_is_display_hung(struct radeon_device *rdev);
@@ -49,5 +50,6 @@ u32 evergreen_get_number_of_dram_channels(struct 
radeon_device *rdev);
 void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
 u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
 int evergreen_rlc_resume(struct radeon_device *rdev);
+struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
 
 #endif /* __RADEON_EVERGREEN_H__ */
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index d39bbd9793cc2..dd5ef64937230 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -26,6 +26,7 @@
 #include 
 
 #include "atom.h"
+#include "evergreen.h"
 #include "ni_dpm.h"
 #include "nid.h"
 #include "r600_dpm.h"
@@ -720,8 +721,6 @@ static const u32 cayman_sysls_enable[] =
 };
 #define CAYMAN_SYSLS_ENABLE_LENGTH sizeof(cayman_sysls_enable) / (3 * 
sizeof(u32))
 
-struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
-
 extern int ni_mc_load_microcode(struct radeon_device *rdev);
 
 struct ni_power_info *ni_get_pi(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c 
b/drivers/gpu/drm/radeon/rv770_dpm.c
index badd8ac6e038f..ef2f1a048cfed 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -30,6 +30,7 @@
 #include "rv770_dpm.h"
 #include "cypress_dpm.h"
 #include "atom.h"
+#include "evergreen.h"
 #include 
 
 #define MC_CG_ARB_FREQ_F0   0x0a
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 32b697965c064..b4581392fbce9 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -26,6 +26,7 @@
 #include 
 
 #include "atom.h"
+#include "evergreen.h"
 #include "r600_dpm.h"
 #include "rv770.h"
 #include "radeon.h"
@@ -1720,8 +1721,6 @@ static const struct si_powertune_data 
powertune_data_hainan =
true
 };
 
-struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
-
 extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 
 static int si_populate_voltage_value(struct radeon_device *rdev,
-- 
2.25.1

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


[PATCH 16/19] drm/radeon/cik: Move 'Move 'cik_sdma_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/cik_sdma.c:331:6: warning: no previous prototype for 
‘cik_sdma_enable’ [-Wmissing-prototypes]
 331 | void cik_sdma_enable(struct radeon_device *rdev, bool enable)
 | ^~~
 drivers/gpu/drm/radeon/cik_sdma.c:528:5: warning: no previous prototype for 
‘cik_sdma_resume’ [-Wmissing-prototypes]
 528 | int cik_sdma_resume(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/cik_sdma.c:557:6: warning: no previous prototype for 
‘cik_sdma_fini’ [-Wmissing-prototypes]
 557 | void cik_sdma_fini(struct radeon_device *rdev)
 | ^

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

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 0330ee86a372b..4520ec4c7b2e2 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -129,9 +129,6 @@ MODULE_FIRMWARE("radeon/mullins_rlc.bin");
 MODULE_FIRMWARE("radeon/mullins_sdma.bin");
 
 static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
sh);
-extern int cik_sdma_resume(struct radeon_device *rdev);
-extern void cik_sdma_enable(struct radeon_device *rdev, bool enable);
-extern void cik_sdma_fini(struct radeon_device *rdev);
 extern void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 static void cik_rlc_stop(struct radeon_device *rdev);
 static void cik_pcie_gen3_enable(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
index 420207d19de52..d1bf541da5923 100644
--- a/drivers/gpu/drm/radeon/cik.h
+++ b/drivers/gpu/drm/radeon/cik.h
@@ -34,4 +34,7 @@ void cik_init_cp_pg_table(struct radeon_device *rdev);
 u32 cik_get_csb_size(struct radeon_device *rdev);
 void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
 
+int cik_sdma_resume(struct radeon_device *rdev);
+void cik_sdma_enable(struct radeon_device *rdev, bool enable);
+void cik_sdma_fini(struct radeon_device *rdev);
 #endif /* __CIK_H__ */
-- 
2.25.1

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


[PATCH 00/19] [Set 5] Rid W=1 warnings from GPU

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

This finishes cleaning up Radeon.  AMD next!

Lee Jones (19):
  drm/radeon/evergreen_dma: Move 'evergreen_gpu_check_soft_reset()'s
prototype to shared header
  drm/radeon/r600: Move 'evergreen_rlc_resume()'s prototype to shared
header
  drm/radeon/ni_dma: Move 'cayman_gpu_check_soft_reset()'s prototype to
shared header
  drm/radeon/radeon_atombios: Move 'radeon_add_atom_encoder()'s
prototype to shared header
  drm/radeon/radeon_encoders: Move 'radeon_atom_backlight_init's
prototype to shared header
  drm/radeon/ci_dpm: Move 'ci_*()'s prototypes to shared header
  drm/radeon/si_dpm: Move 'si_mc_load_microcode()'s prototype to shared
header
  drm/radeon/si_dma: Move 'si_gpu_check_soft_reset()'s prototype to
shared header
  drm/radeon/cik: Move 'si_*()'s prototypes to shared header
  drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared
header
  drm/radeon/radeon_audio: Move 'dce6_*()'s prototypes to shared header
  drm/radeon/evergreen: Move 'si_get_csb_*()'s prototypes to shared
header
  drm/radeon/cik_sdma: Move 'amdgpu_cik_gpu_check_soft_reset()'s
prototype to shared header
  drm/radeon/evergreen: Move 'cik_*()'s prototypes to shared header
  drm/radeon/ci_dpm: Move 'si_*()'s prototypes to shared header
  drm/radeon/cik: Move 'Move 'cik_sdma_*()'s prototypes to shared header
  drm/radeon/si_dpm: Move 'vce_v1_0_enable_mgcg()'s prototype to shared
header
  drm/radeon/cik: Move 'vce_v2_0_enable_mgcg()'s prototype to shared
header
  drm/radeon/evergreen_cs: Move 'r600_dma_cs_next_reloc()'s prototype to
shared header

 drivers/gpu/drm/radeon/btc_dpm.c |  3 +-
 drivers/gpu/drm/radeon/ci_dpm.c  | 13 +-
 drivers/gpu/drm/radeon/cik.c | 10 ++---
 drivers/gpu/drm/radeon/cik.h | 40 ++
 drivers/gpu/drm/radeon/cik_sdma.c|  3 +-
 drivers/gpu/drm/radeon/cypress_dpm.c |  3 +-
 drivers/gpu/drm/radeon/dce6_afmt.c   |  1 +
 drivers/gpu/drm/radeon/dce6_afmt.h   | 52 
 drivers/gpu/drm/radeon/evergreen.c   |  8 +---
 drivers/gpu/drm/radeon/evergreen.h   |  4 ++
 drivers/gpu/drm/radeon/evergreen_cs.c|  3 +-
 drivers/gpu/drm/radeon/evergreen_dma.c   |  3 +-
 drivers/gpu/drm/radeon/ni.h  |  1 +
 drivers/gpu/drm/radeon/ni_dma.c  |  3 +-
 drivers/gpu/drm/radeon/ni_dpm.c  |  3 +-
 drivers/gpu/drm/radeon/r600.c|  2 +-
 drivers/gpu/drm/radeon/r600.h|  4 ++
 drivers/gpu/drm/radeon/r600_cs.c |  1 +
 drivers/gpu/drm/radeon/radeon_atombios.c |  4 --
 drivers/gpu/drm/radeon/radeon_atombios.h |  8 
 drivers/gpu/drm/radeon/radeon_audio.c| 17 +---
 drivers/gpu/drm/radeon/radeon_encoders.c |  6 +--
 drivers/gpu/drm/radeon/rv770_dpm.c   |  1 +
 drivers/gpu/drm/radeon/si.c  |  1 +
 drivers/gpu/drm/radeon/si.h  | 38 +
 drivers/gpu/drm/radeon/si_dma.c  |  3 +-
 drivers/gpu/drm/radeon/si_dpm.c  |  8 ++--
 drivers/gpu/drm/radeon/si_dpm.h  |  5 +++
 drivers/gpu/drm/radeon/trinity_dpm.c |  2 +-
 drivers/gpu/drm/radeon/vce.h | 35 
 drivers/gpu/drm/radeon/vce_v1_0.c|  1 +
 drivers/gpu/drm/radeon/vce_v2_0.c|  1 +
 32 files changed, 215 insertions(+), 72 deletions(-)
 create mode 100644 drivers/gpu/drm/radeon/cik.h
 create mode 100644 drivers/gpu/drm/radeon/dce6_afmt.h
 create mode 100644 drivers/gpu/drm/radeon/si.h
 create mode 100644 drivers/gpu/drm/radeon/vce.h

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

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


[PATCH 17/19] drm/radeon/si_dpm: Move 'vce_v1_0_enable_mgcg()'s prototype to shared header

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

 drivers/gpu/drm/radeon/vce_v1_0.c:102:6: warning: no previous prototype for 
‘vce_v1_0_enable_mgcg’ [-Wmissing-prototypes]
 102 | void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable)
 | ^~~~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/radeon/si_dpm.c  |  3 +--
 drivers/gpu/drm/radeon/trinity_dpm.c |  2 +-
 drivers/gpu/drm/radeon/vce.h | 34 
 drivers/gpu/drm/radeon/vce_v1_0.c|  1 +
 4 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/radeon/vce.h

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index b4581392fbce9..cd07b06301b44 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -35,6 +35,7 @@
 #include "si_dpm.h"
 #include "si.h"
 #include "sid.h"
+#include "vce.h"
 
 #define MC_CG_ARB_FREQ_F0   0x0a
 #define MC_CG_ARB_FREQ_F1   0x0b
@@ -1721,8 +1722,6 @@ static const struct si_powertune_data 
powertune_data_hainan =
true
 };
 
-extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
-
 static int si_populate_voltage_value(struct radeon_device *rdev,
 const struct atom_voltage_table *table,
 u16 value, SISLANDS_SMC_VOLTAGE_VALUE 
*voltage);
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c 
b/drivers/gpu/drm/radeon/trinity_dpm.c
index e005c18aac00e..08ea1c864cb23 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -29,6 +29,7 @@
 #include "radeon_asic.h"
 #include "trinity_dpm.h"
 #include "trinityd.h"
+#include "vce.h"
 
 #define TRINITY_MAX_DEEPSLEEP_DIVIDER_ID 5
 #define TRINITY_MINIMUM_ENGINE_CLOCK 800
@@ -293,7 +294,6 @@ static const u32 trinity_override_mgpg_sequences[] =
0x0204, 0x,
 };
 
-extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 static void trinity_program_clk_gating_hw_sequence(struct radeon_device *rdev,
   const u32 *seq, u32 count);
 static void trinity_override_dynamic_mg_powergating(struct radeon_device 
*rdev);
diff --git a/drivers/gpu/drm/radeon/vce.h b/drivers/gpu/drm/radeon/vce.h
new file mode 100644
index 0..1eb4f5715202e
--- /dev/null
+++ b/drivers/gpu/drm/radeon/vce.h
@@ -0,0 +1,34 @@
+/* vce.h -- Private header for radeon driver -*- linux-c -*-
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+
+#ifndef __VCE_H__
+#define __VCE_H__
+
+struct radeon_device;
+
+void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
+
+#endif /* __VCE_H__ */
diff --git a/drivers/gpu/drm/radeon/vce_v1_0.c 
b/drivers/gpu/drm/radeon/vce_v1_0.c
index bd75bbcf5bf63..70c5da2141d75 100644
--- a/drivers/gpu/drm/radeon/vce_v1_0.c
+++ b/drivers/gpu/drm/radeon/vce_v1_0.c
@@ -30,6 +30,7 @@
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "sid.h"
+#include "vce.h"
 
 #define VCE_V1_0_FW_SIZE   (256 * 1024)
 #define VCE_V1_0_STACK_SIZE(64 * 1024)
-- 
2.25.1

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


[PATCH 04/19] drm/radeon/radeon_atombios: Move 'radeon_add_atom_encoder()'s prototype to shared header

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

 drivers/gpu/drm/radeon/atombios_encoders.c:2721:1: warning: no previous 
prototype for ‘radeon_add_atom_encoder’ [-Wmissing-prototypes]
 2721 | radeon_add_atom_encoder(struct drm_device *dev,
 | ^~~

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

diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
b/drivers/gpu/drm/radeon/radeon_atombios.c
index cc80651b25773..be96d9b64e43b 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -37,10 +37,6 @@
 #include "radeon_atombios.h"
 #include "radeon_legacy_encoders.h"
 
-extern void
-radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
-   uint32_t supported_device, u16 caps);
-
 union atom_supported_devices {
struct _ATOM_SUPPORTED_DEVICES_INFO info;
struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.h 
b/drivers/gpu/drm/radeon/radeon_atombios.h
index b7c76920feb7d..a895a7002c3d3 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.h
+++ b/drivers/gpu/drm/radeon/radeon_atombios.h
@@ -28,10 +28,14 @@
 #ifndef __RADEON_ATOMBIOS_H__
 #define __RADEON_ATOMBIOS_H__
 
+struct drm_device;
 struct drm_display_mode;
 struct radeon_device;
 
 bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
struct drm_display_mode *mode);
+void radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
+uint32_t supported_device, u16 caps);
+
 
 #endif /* __RADEON_ATOMBIOS_H__ */
-- 
2.25.1

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


[PATCH 15/19] drm/radeon/ci_dpm: Move 'si_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/si_dpm.c:3802:4: warning: no previous prototype for 
‘si_get_ddr3_mclk_frequency_ratio’ [-Wmissing-prototypes]
 3802 | u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock)
 | ^~~~
 drivers/gpu/drm/radeon/si_dpm.c:3815:4: warning: no previous prototype for 
‘si_get_mclk_frequency_ratio’ [-Wmissing-prototypes]
 3815 | u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode)
 | ^~~
 drivers/gpu/drm/radeon/si_dpm.c:3897:6: warning: no previous prototype for 
‘si_trim_voltage_table_to_fit_state_table’ [-Wmissing-prototypes]
 3897 | void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
*rdev,
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index a9fc0a552736c..0dfb0ed9af89d 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -33,6 +33,7 @@
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_ucode.h"
+#include "si_dpm.h"
 
 #define MC_CG_ARB_FREQ_F0   0x0a
 #define MC_CG_ARB_FREQ_F1   0x0b
@@ -153,11 +154,6 @@ static const struct ci_pt_config_reg didt_config_ci[] =
 extern u8 rv770_get_memory_module_index(struct radeon_device *rdev);
 extern int ni_copy_and_switch_arb_sets(struct radeon_device *rdev,
   u32 arb_freq_src, u32 arb_freq_dest);
-extern u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock);
-extern u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode);
-extern void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
*rdev,
-u32 max_voltage_steps,
-struct atom_voltage_table 
*voltage_table);
 static int ci_get_std_voltage_value_sidd(struct radeon_device *rdev,
 struct atom_voltage_table_entry 
*voltage_table,
 u16 *std_voltage_hi_sidd, u16 
*std_voltage_lo_sidd);
diff --git a/drivers/gpu/drm/radeon/si_dpm.h b/drivers/gpu/drm/radeon/si_dpm.h
index 1032a68be792b..aa857906ef93d 100644
--- a/drivers/gpu/drm/radeon/si_dpm.h
+++ b/drivers/gpu/drm/radeon/si_dpm.h
@@ -234,5 +234,10 @@ struct si_power_info {
 #define SISLANDS_CGULVPARAMETER_DFLT0x00040035
 #define SISLANDS_CGULVCONTROL_DFLT  0x1f007550
 
+u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock);
+u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode);
+void si_trim_voltage_table_to_fit_state_table(struct radeon_device *rdev,
+ u32 max_voltage_steps,
+ struct atom_voltage_table 
*voltage_table);
 
 #endif
-- 
2.25.1

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


[PATCH 07/19] drm/radeon/si_dpm: Move 'si_mc_load_microcode()'s prototype to shared header

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

 drivers/gpu/drm/radeon/si.c:1570:5: warning: no previous prototype for 
‘si_mc_load_microcode’ [-Wmissing-prototypes]

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

diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index d0407145c07b5..88731b79c8f57 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -39,6 +39,7 @@
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
 #include "si_blit_shaders.h"
+#include "si.h"
 #include "sid.h"
 
 
diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
new file mode 100644
index 0..0a5018ef166e2
--- /dev/null
+++ b/drivers/gpu/drm/radeon/si.h
@@ -0,0 +1,31 @@
+/* si.h -- Private header for radeon driver -*- linux-c -*-
+ *
+ * Copyright 2011 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __SI_H__
+#define __SI_H__
+
+struct radeon_device;
+
+int si_mc_load_microcode(struct radeon_device *rdev);
+
+#endif /* __SI_H__ */
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index c68ab2fb1ac23..32b697965c064 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -32,6 +32,7 @@
 #include "radeon_asic.h"
 #include "ni_dpm.h"
 #include "si_dpm.h"
+#include "si.h"
 #include "sid.h"
 
 #define MC_CG_ARB_FREQ_F0   0x0a
@@ -1721,7 +1722,6 @@ static const struct si_powertune_data 
powertune_data_hainan =
 
 struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
 
-extern int si_mc_load_microcode(struct radeon_device *rdev);
 extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
 
 static int si_populate_voltage_value(struct radeon_device *rdev,
-- 
2.25.1

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


[PATCH 09/19] drm/radeon/cik: Move 'si_*()'s prototypes to shared header

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

 drivers/gpu/drm/radeon/si.c:4186:6: warning: no previous prototype for 
‘si_vram_gtt_location’ [-Wmissing-prototypes]
 4186 | void si_vram_gtt_location(struct radeon_device *rdev,
 | ^~~~
 drivers/gpu/drm/radeon/si.c:5186:6: warning: no previous prototype for 
‘si_init_uvd_internal_cg’ [-Wmissing-prototypes]
 5186 | void si_init_uvd_internal_cg(struct radeon_device *rdev)
 | ^~~
 drivers/gpu/drm/radeon/si.c:5801:6: warning: no previous prototype for 
‘si_rlc_reset’ [-Wmissing-prototypes]
 5801 | void si_rlc_reset(struct radeon_device *rdev)
 | ^~~~

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

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index af08d6f1be53e..0330ee86a372b 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -40,6 +40,7 @@
 #include "radeon_asic.h"
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
+#include "si.h"
 
 #define SH_MEM_CONFIG_GFX_DEFAULT \
ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED)
@@ -127,9 +128,6 @@ MODULE_FIRMWARE("radeon/mullins_mec.bin");
 MODULE_FIRMWARE("radeon/mullins_rlc.bin");
 MODULE_FIRMWARE("radeon/mullins_sdma.bin");
 
-extern void si_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc 
*mc);
-extern void si_rlc_reset(struct radeon_device *rdev);
-extern void si_init_uvd_internal_cg(struct radeon_device *rdev);
 static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
sh);
 extern int cik_sdma_resume(struct radeon_device *rdev);
 extern void cik_sdma_enable(struct radeon_device *rdev, bool enable);
diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
index a1751ae560f02..f483a64d17050 100644
--- a/drivers/gpu/drm/radeon/si.h
+++ b/drivers/gpu/drm/radeon/si.h
@@ -25,8 +25,12 @@
 #define __SI_H__
 
 struct radeon_device;
+struct radeon_mc;
 
 int si_mc_load_microcode(struct radeon_device *rdev);
 u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
+void si_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
+void si_rlc_reset(struct radeon_device *rdev);
+void si_init_uvd_internal_cg(struct radeon_device *rdev);
 
 #endif /* __SI_H__ */
-- 
2.25.1

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


[PATCH 03/19] drm/radeon/ni_dma: Move 'cayman_gpu_check_soft_reset()'s prototype to shared header

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

 drivers/gpu/drm/radeon/ni.c:1733:5: warning: no previous prototype for 
‘cayman_gpu_check_soft_reset’ [-Wmissing-prototypes]
 1733 | u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev)
 | ^~~

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

diff --git a/drivers/gpu/drm/radeon/ni.h b/drivers/gpu/drm/radeon/ni.h
index d63be1c88c0f1..9a5f31a05e68f 100644
--- a/drivers/gpu/drm/radeon/ni.h
+++ b/drivers/gpu/drm/radeon/ni.h
@@ -34,5 +34,6 @@ void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
  int ring, u32 cp_int_cntl);
 void cayman_vm_decode_fault(struct radeon_device *rdev,
u32 status, u32 addr);
+u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev);
 
 #endif /* __NI_H__ */
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c
index c56136848360e..bd515ad4fe4cc 100644
--- a/drivers/gpu/drm/radeon/ni_dma.c
+++ b/drivers/gpu/drm/radeon/ni_dma.c
@@ -25,10 +25,9 @@
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_trace.h"
+#include "ni.h"
 #include "nid.h"
 
-u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev);
-
 /*
  * DMA
  * Starting with R600, the GPU has an asynchronous
-- 
2.25.1

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


[PATCH 08/19] drm/radeon/si_dma: Move 'si_gpu_check_soft_reset()'s prototype to shared header

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

 drivers/gpu/drm/radeon/si.c:3768:5: warning: no previous prototype for 
‘si_gpu_check_soft_reset’ [-Wmissing-prototypes]
 3768 | u32 si_gpu_check_soft_reset(struct radeon_device *rdev)
 | ^~~

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

diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
index 0a5018ef166e2..a1751ae560f02 100644
--- a/drivers/gpu/drm/radeon/si.h
+++ b/drivers/gpu/drm/radeon/si.h
@@ -27,5 +27,6 @@
 struct radeon_device;
 
 int si_mc_load_microcode(struct radeon_device *rdev);
+u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
 
 #endif /* __SI_H__ */
diff --git a/drivers/gpu/drm/radeon/si_dma.c b/drivers/gpu/drm/radeon/si_dma.c
index d2fa302a5be9f..645897d1bfc31 100644
--- a/drivers/gpu/drm/radeon/si_dma.c
+++ b/drivers/gpu/drm/radeon/si_dma.c
@@ -25,10 +25,9 @@
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_trace.h"
+#include "si.h"
 #include "sid.h"
 
-u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
-
 /**
  * si_dma_is_lockup - Check if the DMA engine is locked up
  *
-- 
2.25.1

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


Re: [PATCH] drm/amdgpu: add UMC to ip discovery map

2020-11-11 Thread Deucher, Alexander
[AMD Official Use Only - Internal Distribution Only]

Are there any other IP mappings that are missing?  Maybe just add them all to 
avoid problems if there are other IPs we need to access in the future.

Alex


From: amd-gfx  on behalf of Clements, 
John 
Sent: Wednesday, November 11, 2020 3:53 AM
To: amd-gfx@lists.freedesktop.org ; Zhang, 
Hawking 
Subject: [PATCH] drm/amdgpu: add UMC to ip discovery map


[AMD Official Use Only - Internal Distribution Only]


Submitting patch to add UMC into IP discovery mapping.



Thank you,

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


Re: [PATCH v2 5/8] drm/amdgpu: Refactor sysfs removal

2020-11-11 Thread Andrey Grodzovsky


On 11/11/20 11:06 AM, Greg KH wrote:

On Wed, Nov 11, 2020 at 10:45:53AM -0500, Andrey Grodzovsky wrote:

On 11/11/20 10:34 AM, Greg KH wrote:

On Wed, Nov 11, 2020 at 10:13:13AM -0500, Andrey Grodzovsky wrote:

On 11/10/20 12:59 PM, Greg KH wrote:

On Tue, Nov 10, 2020 at 12:54:21PM -0500, Andrey Grodzovsky wrote:

Hi, back to this after a long context switch for some higher priority stuff.

So here I was able eventually to drop all this code and this change here 
https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~agrodzov%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm-next-device-unplug%26id%3D61852c8a59b4dd89d637693552c73175b9f2ccd6&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C3e019e2780114b696b4f08d8865bac36%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637407075579242822%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=E%2FIZmVeJDvHiY2xSaaPaay4mXN49EbhSJaJ4zlt6WKk%3D&reserved=0
was enough for me. Seems like while device_remove_file can handle the use
case where the file and the parent directory already gone,
sysfs_remove_group goes down in flames in that case
due to kobj->sd being unset on device removal.

A driver shouldn't ever have to remove individual sysfs groups, the
driver core/bus logic should do it for them automatically.

And whenever a driver calls a sysfs_* call, that's a hint that something
is not working properly.


Do you mean that while the driver creates the groups and files explicitly
from it's different subsystems it should not explicitly remove each
one of them because all of them should be removed at once (and
recursively) when the device is being removed ?

Individual drivers should never add groups/files in sysfs, the driver
core should do it properly for you if you have everything set up
properly.  And yes, the driver core will automatically remove them as
well.

Please use the default groups attribute for your bus/subsystem and this
will happen automagically.

Googling for default groups attributes i found this - 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linuxfoundation.org%2Fblog%2F2013%2F06%2Fhow-to-create-a-sysfs-file-correctly%2F&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C3e019e2780114b696b4f08d8865bac36%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637407075579252818%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AVhdi%2BcKeFXM8CBv%2BhRNTCYX2XSS8oo0so6mB%2BPuEfk%3D&reserved=0

Odd, mirror of the original article:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fkroah.com%2Flog%2Fblog%2F2013%2F06%2F26%2Fhow-to-create-a-sysfs-file-correctly%2F&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C3e019e2780114b696b4f08d8865bac36%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637407075579252818%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lGMd3PJOWIlKUpvbV3Zz%2FvbBIRwz6%2BlJ%2BS%2BiVcXxuzM%3D&reserved=0


Would this be what you suggest for us ? Specifically for our case the struct
device's  groups  seems the right solution as different devices
might have slightly diffreent sysfs attributes.

That's what the is_visable() callback in your attribute group is for, to
tell the kernel if an individual sysfs attribute should be created or
not.


I see, this looks like a good improvement to our current way of managing sysfs. 
Since this
change is somewhat fundamental and requires good testing I prefer to deal with 
it separately from my current

work on device unplug and so I will put it on TODO right after finishing this 
work.

Andrey




thanks,

greg k-h

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


RE: [PATCH] drm/nouveau: Fix out-of-bounds access when deferencing MMU type

2020-11-11 Thread Ruhl, Michael J
>-Original Message-
>From: Thomas Zimmermann 
>Sent: Wednesday, November 11, 2020 7:08 AM
>To: Ruhl, Michael J ; bske...@redhat.com;
>airl...@linux.ie; dan...@ffwll.ch; christian.koe...@amd.com
>Cc: nouv...@lists.freedesktop.org; dri-de...@lists.freedesktop.org;
>Maarten Lankhorst ; Maxime Ripard
>; Dave Airlie ; Gerd Hoffmann
>; Alex Deucher ;
>VMware Graphics ; Roland
>Scheidegger ; Huang Rui ;
>Felix Kuehling ; Hawking Zhang
>; Jason Gunthorpe ; Likun Gao
>; virtualizat...@lists.linux-foundation.org; spice-
>de...@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
>Subject: Re: [PATCH] drm/nouveau: Fix out-of-bounds access when
>deferencing MMU type
>
>Hi
>
>Am 10.11.20 um 16:27 schrieb Ruhl, Michael J:
>>
>>
>>> -Original Message-
>>> From: Thomas Zimmermann 
>>> Sent: Tuesday, November 10, 2020 8:37 AM
>>> To: bske...@redhat.com; airl...@linux.ie; dan...@ffwll.ch; Ruhl, Michael J
>>> ; christian.koe...@amd.com
>>> Cc: nouv...@lists.freedesktop.org; dri-de...@lists.freedesktop.org;
>Thomas
>>> Zimmermann ; Maarten Lankhorst
>>> ; Maxime Ripard
>>> ; Dave Airlie ; Gerd Hoffmann
>>> ; Alex Deucher ;
>>> VMware Graphics ; Roland
>>> Scheidegger ; Huang Rui ;
>>> Felix Kuehling ; Hawking Zhang
>>> ; Jason Gunthorpe ; Likun
>Gao
>>> ; virtualizat...@lists.linux-foundation.org; spice-
>>> de...@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
>>> Subject: [PATCH] drm/nouveau: Fix out-of-bounds access when
>deferencing
>>> MMU type
>>>
>>> The value of struct drm_device.ttm.type_vram can become -1 for
>unknown
>>> types of memory (see nouveau_ttm_init()). This leads to an out-of-bounds
>>> error when accessing struct nvif_mmu.type[]:
>>
>> Would this make more sense to just set the type_vram = 0 instead of -1?
>
>From what I understand, these indices refer to an internal type of MMU,
>rsp the MMU's capabilities. However, my hardware (pre-NV50) does not
>have an MMU at all.

Yeah, and upon further review I see that my comment was completely wrong
(value vs. index).

A better suggestion would have been, create an entry in the array that means,
"unsupported type" with a value of 0, but...

>I agree that it would be nice to have a cleaner design that incorporates
>this case, but resolving that would apparently require more than a bugfix.

I agree.  The -1 index is a special case for the platform path
(platform != NV_DEVICE_INFO_V0_SOC).  This is a fix for the issue, but not
a complete solution.

If you need it:
Reviewed-by: Michael J. Ruhl 

Thanks,
Mike

>Best regards
>Thomas
>
>>
>> Mike
>>
>>>
>>>  [   18.304116]
>>>
>===
>>> ===
>>>  [   18.311649] BUG: KASAN: slab-out-of-bounds in
>>> nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>>  [   18.320415] Read of size 1 at addr 88810ffac1fe by task systemd-
>>> udevd/342
>>>  [   18.327681]
>>>  [   18.329208] CPU: 1 PID: 342 Comm: systemd-udevd Tainted: GE
>>> 5.10.0-rc2-1-default+ #581
>>>  [   18.338681] Hardware name: Dell Inc. OptiPlex 9020/0N4YC8, BIOS A24
>>> 10/24/2018
>>>  [   18.346032] Call Trace:
>>>  [   18.348536]  dump_stack+0xae/0xe5
>>>  [   18.351919]  print_address_description.constprop.0+0x17/0xf0
>>>  [   18.357787]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>>  [   18.363818]  __kasan_report.cold+0x20/0x38
>>>  [   18.368099]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>>  [   18.374133]  kasan_report+0x3a/0x50
>>>  [   18.377789]  nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>>  <...>
>>>  [   18.767690] Allocated by task 342:
>>>  [   18.773087]  kasan_save_stack+0x1b/0x40
>>>  [   18.778890]  __kasan_kmalloc.constprop.0+0xbf/0xd0
>>>  [   18.785646]  __kmalloc_track_caller+0x1be/0x390
>>>  [   18.792165]  kstrdup_const+0x46/0x70
>>>  [   18.797686]  kobject_set_name_vargs+0x2f/0xb0
>>>  [   18.803992]  kobject_init_and_add+0x9d/0xf0
>>>  [   18.810117]  ttm_mem_global_init+0x12c/0x210 [ttm]
>>>  [   18.816853]  ttm_bo_global_init+0x4a/0x160 [ttm]
>>>  [   18.823420]  ttm_bo_device_init+0x39/0x220 [ttm]
>>>  [   18.830046]  nouveau_ttm_init+0x2c3/0x830 [nouveau]
>>>  [   18.836929]  nouveau_drm_device_init+0x1b4/0x3f0 [nouveau]
>>>  <...>
>>>  [   19.105336]
>>>
>===
>>> ===
>>>
>>> Fix this error, by not using type_vram as an index if it's negative.
>>> Assume default values instead.
>>>
>>> The error was seen on Nvidia G72 hardware.
>>>
>>> Signed-off-by: Thomas Zimmermann 
>>> Fixes: 1cf65c45183a ("drm/ttm: add caching state to ttm_bus_placement")
>>> Cc: Christian König 
>>> Cc: Michael J. Ruhl 
>>> Cc: Maarten Lankhorst 
>>> Cc: Maxime Ripard 
>>> Cc: Thomas Zimmermann 
>>> Cc: David Airlie 
>>> Cc: Daniel Vetter 
>>> Cc: Ben Skeggs 
>>> Cc: Dave Airlie 
>>> Cc: Gerd Hoffmann 
>>> Cc: Alex Deucher 
>>> Cc: "Christian König" 
>>> Cc: VMware Graphics 
>>> Cc: Roland Scheidegger 
>>> Cc: Huang Rui 
>>> Cc: Felix Kuehling 
>>> Cc: Hawking Zhang 
>>> Cc: Jaso

Re: [PATCH 2/2] drm/amd/pm: update the swSMU headers for vangogh

2020-11-11 Thread Deucher, Alexander
[AMD Official Use Only - Internal Distribution Only]

Series is:
Reviewed-by: Alex Deucher 

From: Du, Xiaojian 
Sent: Tuesday, November 10, 2020 10:04 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Huang, Ray ; Huang, Shimmer ; 
Quan, Evan ; Deucher, Alexander ; 
Du, Xiaojian 
Subject: [PATCH 2/2] drm/amd/pm: update the swSMU headers for vangogh

This patch is to update the swSMU headers for vangogh.

Signed-off-by: Xiaojian Du 
Reviewed-by: Huang Rui 
Reviewed-by: Evan Quan 
---
 drivers/gpu/drm/amd/pm/inc/smu11_driver_if_vangogh.h |  6 ++
 drivers/gpu/drm/amd/pm/inc/smu_v11_5_pmfw.h  | 11 +++
 drivers/gpu/drm/amd/pm/inc/smu_v11_5_ppsmc.h | 11 +--
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_vangogh.h 
b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_vangogh.h
index 8f438c80132e..1c19eae93ff1 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_vangogh.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_vangogh.h
@@ -142,6 +142,12 @@ typedef struct {

   uint8_t NumDfPstatesEnabled;
   uint8_t NumDpmLevelsEnabled;
+  uint8_t NumDcfclkLevelsEnabled;
+  uint8_t NumDispClkLevelsEnabled;  //applies to both dispclk and dppclk
+  uint8_t NumSocClkLevelsEnabled;
+
+  uint8_t IspClkLevelsEnabled;  //applies to both ispiclk and ispxclk
+  uint8_t VcnClkLevelsEnabled;  //applies to both vclk/dclk
   uint8_t spare[2];
 } DpmClocks_t;

diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_5_pmfw.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_5_pmfw.h
index 99a406984135..22edd88b8117 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_5_pmfw.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_5_pmfw.h
@@ -90,14 +90,16 @@
 #define FEATURE_ATHUB_PG_BIT  56
 #define FEATURE_ECO_DEEPCSTATE_BIT57
 #define FEATURE_CC6_BIT   58
-#define NUM_FEATURES  59
+#define FEATURE_GFX_EDC_BIT   59
+#define NUM_FEATURES  60

 typedef struct {
   // MP1_EXT_SCRATCH0
   uint32_t DpmHandlerID : 8;
   uint32_t ActivityMonitorID: 8;
   uint32_t DpmTimerID   : 8;
-  uint32_t spare0   : 8;
+  uint32_t DpmHubID : 4;
+  uint32_t DpmHubTask   : 4;
   // MP1_EXT_SCRATCH1
   uint32_t GfxStatus: 2;
   uint32_t GfxoffStatus : 8;
@@ -109,9 +111,10 @@ typedef struct {
   uint32_t spare1   : 16;
   // MP1_EXT_SCRATCH2
   uint32_t P2JobHandler: 32;
-  // MP1_EXT_SCRATCH3
-//  uint32_t spare2   : 32;
+  // MP1_EXT_SCRATCH3: used for postcodes
+
   // MP1_EXT_SCRATCH4:6 are used by Kernel
+  // MP1_EXT_SCRATCH7: used by HW
 } FwStatus_t;


diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_5_ppsmc.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_5_ppsmc.h
index 1ada0eb64663..7e69b3bd311b 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_5_ppsmc.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_5_ppsmc.h
@@ -97,9 +97,16 @@
 #define PPSMC_MSG_StopDramLogging  0x3F
 #define PPSMC_MSG_SetSoftMinCclk   0x40
 #define PPSMC_MSG_SetSoftMaxCclk   0x41
-#define PPSMC_Message_Count0x42
+#define PPSMC_MSG_SetDfPstateActiveLevel   0x42
+#define PPSMC_MSG_SetDfPstateSoftMinLevel  0x43
+#define PPSMC_MSG_SetCclkPolicy0x44
+#define PPSMC_MSG_DramLogSetDramAddrHigh   0x45
+#define PPSMC_MSG_DramLogSetDramBufferSize 0x46
+#define PPSMC_MSG_RequestActiveWgp 0x47
+#define PPSMC_MSG_QueryActiveWgp   0x48
+#define PPSMC_Message_Count0x49

-//Argument for  PPSMC_MSG_GpuChangeState
+//Argument for PPSMC_MSG_GfxDeviceDriverReset
 enum {
   MODE1_RESET = 1,
   MODE2_RESET = 2
--
2.17.1

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


Re: [PATCH v2 5/8] drm/amdgpu: Refactor sysfs removal

2020-11-11 Thread Greg KH
On Wed, Nov 11, 2020 at 10:45:53AM -0500, Andrey Grodzovsky wrote:
> 
> On 11/11/20 10:34 AM, Greg KH wrote:
> > On Wed, Nov 11, 2020 at 10:13:13AM -0500, Andrey Grodzovsky wrote:
> > > On 11/10/20 12:59 PM, Greg KH wrote:
> > > > On Tue, Nov 10, 2020 at 12:54:21PM -0500, Andrey Grodzovsky wrote:
> > > > > Hi, back to this after a long context switch for some higher priority 
> > > > > stuff.
> > > > > 
> > > > > So here I was able eventually to drop all this code and this change 
> > > > > here 
> > > > > https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~agrodzov%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm-next-device-unplug%26id%3D61852c8a59b4dd89d637693552c73175b9f2ccd6&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C9fbfecac94a340dfb68408d886571609%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637407055896651058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ye8HJR1vidppcOBnlOgVu5GwKD2%2Bb5ztHbiI%2BubKKT0%3D&reserved=0
> > > > > was enough for me. Seems like while device_remove_file can handle the 
> > > > > use
> > > > > case where the file and the parent directory already gone,
> > > > > sysfs_remove_group goes down in flames in that case
> > > > > due to kobj->sd being unset on device removal.
> > > > A driver shouldn't ever have to remove individual sysfs groups, the
> > > > driver core/bus logic should do it for them automatically.
> > > > 
> > > > And whenever a driver calls a sysfs_* call, that's a hint that something
> > > > is not working properly.
> > > 
> > > 
> > > Do you mean that while the driver creates the groups and files explicitly
> > > from it's different subsystems it should not explicitly remove each
> > > one of them because all of them should be removed at once (and
> > > recursively) when the device is being removed ?
> > Individual drivers should never add groups/files in sysfs, the driver
> > core should do it properly for you if you have everything set up
> > properly.  And yes, the driver core will automatically remove them as
> > well.
> > 
> > Please use the default groups attribute for your bus/subsystem and this
> > will happen automagically.
> 
> Googling for default groups attributes i found this - 
> https://www.linuxfoundation.org/blog/2013/06/how-to-create-a-sysfs-file-correctly/

Odd, mirror of the original article:

http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/

> Would this be what you suggest for us ? Specifically for our case the struct
> device's  groups  seems the right solution as different devices
> might have slightly diffreent sysfs attributes.

That's what the is_visable() callback in your attribute group is for, to
tell the kernel if an individual sysfs attribute should be created or
not.

thanks,

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


Re: [PATCH v2 5/8] drm/amdgpu: Refactor sysfs removal

2020-11-11 Thread Andrey Grodzovsky


On 11/11/20 10:34 AM, Greg KH wrote:

On Wed, Nov 11, 2020 at 10:13:13AM -0500, Andrey Grodzovsky wrote:

On 11/10/20 12:59 PM, Greg KH wrote:

On Tue, Nov 10, 2020 at 12:54:21PM -0500, Andrey Grodzovsky wrote:

Hi, back to this after a long context switch for some higher priority stuff.

So here I was able eventually to drop all this code and this change here 
https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~agrodzov%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm-next-device-unplug%26id%3D61852c8a59b4dd89d637693552c73175b9f2ccd6&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C9fbfecac94a340dfb68408d886571609%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637407055896651058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ye8HJR1vidppcOBnlOgVu5GwKD2%2Bb5ztHbiI%2BubKKT0%3D&reserved=0
was enough for me. Seems like while device_remove_file can handle the use
case where the file and the parent directory already gone,
sysfs_remove_group goes down in flames in that case
due to kobj->sd being unset on device removal.

A driver shouldn't ever have to remove individual sysfs groups, the
driver core/bus logic should do it for them automatically.

And whenever a driver calls a sysfs_* call, that's a hint that something
is not working properly.



Do you mean that while the driver creates the groups and files explicitly
from it's different subsystems it should not explicitly remove each
one of them because all of them should be removed at once (and
recursively) when the device is being removed ?

Individual drivers should never add groups/files in sysfs, the driver
core should do it properly for you if you have everything set up
properly.  And yes, the driver core will automatically remove them as
well.

Please use the default groups attribute for your bus/subsystem and this
will happen automagically.


Googling for default groups attributes i found this - 
https://www.linuxfoundation.org/blog/2013/06/how-to-create-a-sysfs-file-correctly/
Would this be what you suggest for us ? Specifically for our case the struct 
device's  groups  seems the right solution as different devices

might have slightly diffreent sysfs attributes.

Andrey




thanks,

greg k-h

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


Re: [PATCH v2 5/8] drm/amdgpu: Refactor sysfs removal

2020-11-11 Thread Greg KH
On Wed, Nov 11, 2020 at 10:13:13AM -0500, Andrey Grodzovsky wrote:
> 
> On 11/10/20 12:59 PM, Greg KH wrote:
> > On Tue, Nov 10, 2020 at 12:54:21PM -0500, Andrey Grodzovsky wrote:
> > > Hi, back to this after a long context switch for some higher priority 
> > > stuff.
> > > 
> > > So here I was able eventually to drop all this code and this change here 
> > > https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~agrodzov%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm-next-device-unplug%26id%3D61852c8a59b4dd89d637693552c73175b9f2ccd6&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C7ae9e5798c7648d6dbb908d885a22c58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637406278875513811%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=aoFIsBxpLC9tBZw3E%2B8IJlNqFSq6uRgEvvciaZ6B1iw%3D&reserved=0
> > > was enough for me. Seems like while device_remove_file can handle the use
> > > case where the file and the parent directory already gone,
> > > sysfs_remove_group goes down in flames in that case
> > > due to kobj->sd being unset on device removal.
> > A driver shouldn't ever have to remove individual sysfs groups, the
> > driver core/bus logic should do it for them automatically.
> > 
> > And whenever a driver calls a sysfs_* call, that's a hint that something
> > is not working properly.
> 
> 
> 
> Do you mean that while the driver creates the groups and files explicitly
> from it's different subsystems it should not explicitly remove each
> one of them because all of them should be removed at once (and
> recursively) when the device is being removed ?

Individual drivers should never add groups/files in sysfs, the driver
core should do it properly for you if you have everything set up
properly.  And yes, the driver core will automatically remove them as
well.

Please use the default groups attribute for your bus/subsystem and this
will happen automagically.

thanks,

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


Re: [PATCH v2 5/8] drm/amdgpu: Refactor sysfs removal

2020-11-11 Thread Andrey Grodzovsky



On 11/10/20 12:59 PM, Greg KH wrote:

On Tue, Nov 10, 2020 at 12:54:21PM -0500, Andrey Grodzovsky wrote:

Hi, back to this after a long context switch for some higher priority stuff.

So here I was able eventually to drop all this code and this change here 
https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~agrodzov%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm-next-device-unplug%26id%3D61852c8a59b4dd89d637693552c73175b9f2ccd6&data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C7ae9e5798c7648d6dbb908d885a22c58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637406278875513811%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=aoFIsBxpLC9tBZw3E%2B8IJlNqFSq6uRgEvvciaZ6B1iw%3D&reserved=0
was enough for me. Seems like while device_remove_file can handle the use
case where the file and the parent directory already gone,
sysfs_remove_group goes down in flames in that case
due to kobj->sd being unset on device removal.

A driver shouldn't ever have to remove individual sysfs groups, the
driver core/bus logic should do it for them automatically.

And whenever a driver calls a sysfs_* call, that's a hint that something
is not working properly.




Do you mean that while the driver creates the groups and files explicitly from 
it's different
subsystems it should not explicitly remove each one of them because all of them 
should

be removed at once (and recursively) when the device is being removed ?

Andrey




Also, run your patch above through checkpatch.pl before submitting it :)

thanks,

greg k-h

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


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

2020-11-11 Thread Chun-Kuang Hu
Hi, Thomas:

Thomas Zimmermann  於 2020年11月9日 週一 下午6:32寫道:
>
> Fixes a build failure with mediatek.
>
> This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
> Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
> mediatek was forgotten.

Acked-by: Chun-Kuang Hu 

>
> Signed-off-by: Thomas Zimmermann 
> Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and 
> convert GEM backends")
> Cc: Thomas Zimmermann 
> Cc: Christian König 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: Dave Airlie 
> Cc: Lucas Stach 
> Cc: Russell King 
> Cc: Christian Gmeiner 
> Cc: Qiang Yu 
> Cc: Ben Skeggs 
> Cc: Rob Herring 
> Cc: Tomeu Vizoso 
> Cc: Steven Price 
> Cc: Alyssa Rosenzweig 
> Cc: Gerd Hoffmann 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: Sandy Huang 
> Cc: "Heiko Stübner" 
> Cc: Hans de Goede 
> Cc: Sean Paul 
> Cc: Eric Anholt 
> Cc: Rodrigo Siqueira 
> Cc: Melissa Wen 
> Cc: Haneen Mohammed 
> Cc: Oleksandr Andrushchenko 
> Cc: Sumit Semwal 
> Cc: Emil Velikov 
> Cc: Marek Szyprowski 
> Cc: Arunpravin 
> Cc: Huang Rui 
> Cc: Luben Tuikov 
> Cc: Madhav Chauhan 
> Cc: Nirmoy Das 
> Cc: Jason Gunthorpe 
> Cc: Sam Ravnborg 
> Cc: Chris Wilson 
> Cc: dri-de...@lists.freedesktop.org
> Cc: etna...@lists.freedesktop.org
> Cc: l...@lists.freedesktop.org
> Cc: nouv...@lists.freedesktop.org
> Cc: virtualizat...@lists.linux-foundation.org
> Cc: spice-de...@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-rockc...@lists.infradead.org
> Cc: xen-de...@lists.xenproject.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 
>  drivers/gpu/drm/mediatek/mtk_drm_gem.h |  4 ++--
>  2 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index cdd1a6e61564..28a2ee1336ef 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -240,23 +240,25 @@ struct drm_gem_object 
> *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> return &mtk_gem->base;
>  }
>
> -void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
> +int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map 
> *map)
>  {
> struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
> -   struct sg_table *sgt;
> +   struct sg_table *sgt = NULL;
> unsigned int npages;
>
> if (mtk_gem->kvaddr)
> -   return mtk_gem->kvaddr;
> +   goto out;
>
> sgt = mtk_gem_prime_get_sg_table(obj);
> if (IS_ERR(sgt))
> -   return NULL;
> +   return PTR_ERR(sgt);
>
> npages = obj->size >> PAGE_SHIFT;
> mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
> -   if (!mtk_gem->pages)
> -   goto out;
> +   if (!mtk_gem->pages) {
> +   kfree(sgt);
> +   return -ENOMEM;
> +   }
>
> drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages);
>
> @@ -265,13 +267,15 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
>
>  out:
> kfree(sgt);
> +   dma_buf_map_set_vaddr(map, mtk_gem->kvaddr);
>
> -   return mtk_gem->kvaddr;
> +   return 0;
>  }
>
> -void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
> +void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
> *map)
>  {
> struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
> +   void *vaddr = map->vaddr;
>
> if (!mtk_gem->pages)
> return;
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h 
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> index ff9f976d9807..6da5ccb4b933 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> @@ -45,7 +45,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
>  struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
>  struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> struct dma_buf_attachment *attach, struct sg_table 
> *sg);
> -void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
> -void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
> +int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map 
> *map);
> +void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
> *map);
>
>  #endif
> --
> 2.29.2
>
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/nouveau: Fix out-of-bounds access when deferencing MMU type

2020-11-11 Thread Thomas Zimmermann
Hi

Am 10.11.20 um 16:27 schrieb Ruhl, Michael J:
> 
> 
>> -Original Message-
>> From: Thomas Zimmermann 
>> Sent: Tuesday, November 10, 2020 8:37 AM
>> To: bske...@redhat.com; airl...@linux.ie; dan...@ffwll.ch; Ruhl, Michael J
>> ; christian.koe...@amd.com
>> Cc: nouv...@lists.freedesktop.org; dri-de...@lists.freedesktop.org; Thomas
>> Zimmermann ; Maarten Lankhorst
>> ; Maxime Ripard
>> ; Dave Airlie ; Gerd Hoffmann
>> ; Alex Deucher ;
>> VMware Graphics ; Roland
>> Scheidegger ; Huang Rui ;
>> Felix Kuehling ; Hawking Zhang
>> ; Jason Gunthorpe ; Likun Gao
>> ; virtualizat...@lists.linux-foundation.org; spice-
>> de...@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
>> Subject: [PATCH] drm/nouveau: Fix out-of-bounds access when deferencing
>> MMU type
>>
>> The value of struct drm_device.ttm.type_vram can become -1 for unknown
>> types of memory (see nouveau_ttm_init()). This leads to an out-of-bounds
>> error when accessing struct nvif_mmu.type[]:
> 
> Would this make more sense to just set the type_vram = 0 instead of -1?

From what I understand, these indices refer to an internal type of MMU,
rsp the MMU's capabilities. However, my hardware (pre-NV50) does not
have an MMU at all.

I agree that it would be nice to have a cleaner design that incorporates
this case, but resolving that would apparently require more than a bugfix.

Best regards
Thomas

> 
> Mike
> 
>>
>>  [   18.304116]
>> ===
>> ===
>>  [   18.311649] BUG: KASAN: slab-out-of-bounds in
>> nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>  [   18.320415] Read of size 1 at addr 88810ffac1fe by task systemd-
>> udevd/342
>>  [   18.327681]
>>  [   18.329208] CPU: 1 PID: 342 Comm: systemd-udevd Tainted: GE
>> 5.10.0-rc2-1-default+ #581
>>  [   18.338681] Hardware name: Dell Inc. OptiPlex 9020/0N4YC8, BIOS A24
>> 10/24/2018
>>  [   18.346032] Call Trace:
>>  [   18.348536]  dump_stack+0xae/0xe5
>>  [   18.351919]  print_address_description.constprop.0+0x17/0xf0
>>  [   18.357787]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>  [   18.363818]  __kasan_report.cold+0x20/0x38
>>  [   18.368099]  ? nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>  [   18.374133]  kasan_report+0x3a/0x50
>>  [   18.377789]  nouveau_ttm_io_mem_reserve+0x17a/0x7e0 [nouveau]
>>  <...>
>>  [   18.767690] Allocated by task 342:
>>  [   18.773087]  kasan_save_stack+0x1b/0x40
>>  [   18.778890]  __kasan_kmalloc.constprop.0+0xbf/0xd0
>>  [   18.785646]  __kmalloc_track_caller+0x1be/0x390
>>  [   18.792165]  kstrdup_const+0x46/0x70
>>  [   18.797686]  kobject_set_name_vargs+0x2f/0xb0
>>  [   18.803992]  kobject_init_and_add+0x9d/0xf0
>>  [   18.810117]  ttm_mem_global_init+0x12c/0x210 [ttm]
>>  [   18.816853]  ttm_bo_global_init+0x4a/0x160 [ttm]
>>  [   18.823420]  ttm_bo_device_init+0x39/0x220 [ttm]
>>  [   18.830046]  nouveau_ttm_init+0x2c3/0x830 [nouveau]
>>  [   18.836929]  nouveau_drm_device_init+0x1b4/0x3f0 [nouveau]
>>  <...>
>>  [   19.105336]
>> ===
>> ===
>>
>> Fix this error, by not using type_vram as an index if it's negative.
>> Assume default values instead.
>>
>> The error was seen on Nvidia G72 hardware.
>>
>> Signed-off-by: Thomas Zimmermann 
>> Fixes: 1cf65c45183a ("drm/ttm: add caching state to ttm_bus_placement")
>> Cc: Christian König 
>> Cc: Michael J. Ruhl 
>> Cc: Maarten Lankhorst 
>> Cc: Maxime Ripard 
>> Cc: Thomas Zimmermann 
>> Cc: David Airlie 
>> Cc: Daniel Vetter 
>> Cc: Ben Skeggs 
>> Cc: Dave Airlie 
>> Cc: Gerd Hoffmann 
>> Cc: Alex Deucher 
>> Cc: "Christian König" 
>> Cc: VMware Graphics 
>> Cc: Roland Scheidegger 
>> Cc: Huang Rui 
>> Cc: Felix Kuehling 
>> Cc: Hawking Zhang 
>> Cc: Jason Gunthorpe 
>> Cc: Likun Gao 
>> Cc: dri-de...@lists.freedesktop.org
>> Cc: nouv...@lists.freedesktop.org
>> Cc: virtualizat...@lists.linux-foundation.org
>> Cc: spice-de...@lists.freedesktop.org
>> Cc: amd-gfx@lists.freedesktop.org
>> ---
>> drivers/gpu/drm/nouveau/nouveau_bo.c | 5 -
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
>> b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> index 8133377d865d..fe15299d417e 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> @@ -1142,9 +1142,12 @@ nouveau_ttm_io_mem_reserve(struct
>> ttm_bo_device *bdev, struct ttm_resource *reg)
>>  struct nvkm_device *device = nvxx_device(&drm->client.device);
>>  struct nouveau_mem *mem = nouveau_mem(reg);
>>  struct nvif_mmu *mmu = &drm->client.mmu;
>> -const u8 type = mmu->type[drm->ttm.type_vram].type;
>> +u8 type = 0;
>>  int ret;
>>
>> +if (drm->ttm.type_vram >= 0)
>> +type = mmu->type[drm->ttm.type_vram].type;
>> +
>>  mutex_lock(&drm->ttm.io_reserve_mutex);
>> retry:
>>  switch (reg->mem_type) {
>> --
>> 2.29.2
> 

-- 
Thomas Zimmermann
Graphics Driver Developer

RE: [PATCH] drm/amdgpu: add UMC to ip discovery map

2020-11-11 Thread Zhang, Hawking
[AMD Public Use]

Reviewed-by: Hawking Zhang 

Regards,
Hawking
From: Clements, John 
Sent: Wednesday, November 11, 2020 16:54
To: amd-gfx@lists.freedesktop.org; Zhang, Hawking 
Subject: [PATCH] drm/amdgpu: add UMC to ip discovery map


[AMD Official Use Only - Internal Distribution Only]

Submitting patch to add UMC into IP discovery mapping.

Thank you,
John Clements
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: add UMC to ip discovery map

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

Submitting patch to add UMC into IP discovery mapping.

Thank you,
John Clements


0001-drm-amdgpu-add-UMC-to-ip-discovery-map.patch
Description: 0001-drm-amdgpu-add-UMC-to-ip-discovery-map.patch
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2020-11-11 Thread Wang, Chao-kai (Stylon)
[AMD Official Use Only - Internal Distribution Only]

Hi Harry,

Checked Lee Starnes's patch. It does not fix the issue but does preserve the 
tradition of assigning the number of probed modes to aconnector->num_modes, 
which appears elsewhere in AMD code. I observed in some cases the memory leak 
is not reproducing (or not detected) even without mine or Lee's fix. Maybe 
that's why Lee thinks it may fix the leak.

Another way to fix the issue is to not wipe out the probed list by calling 
INIT_LIST_HEAD() in amdgpu_dm_connector_ddc_get_modes(). But I am not entirely 
sure what other impact will that do.

I am checking out how everyone is handling resume from S3 so would like some 
second opinions.


Regards
Regards

Stylon Wang

MTS Software Development Eng.  |  AMD
Display Solution Team

O +(886) 2-3789-3667 ext. 23667  C +(886) 921-897-142

--

6F, 3, YuanCyu St (NanKang Software Park) Taipei, Taiwan

Facebook |  Twitter |  
amd.com




From: Deucher, Alexander 
Sent: November 11, 2020 12:55 AM
To: Wentland, Harry ; Wang, Chao-kai (Stylon) 
; amd-gfx@lists.freedesktop.org 

Cc: Kazlauskas, Nicholas 
Subject: Re: [PATCH] drm/amd/display: Fix memory leaks in S3 resume


[AMD Official Use Only - Internal Distribution Only]

Ah, sorry, I missed that part of the patch.

Alex


From: Wentland, Harry 
Sent: Tuesday, November 10, 2020 11:42 AM
To: Deucher, Alexander ; Wang, Chao-kai (Stylon) 
; amd-gfx@lists.freedesktop.org 

Cc: Kazlauskas, Nicholas 
Subject: Re: [PATCH] drm/amd/display: Fix memory leaks in S3 resume

It's missing the "drm_connector_list_update" call which I assume is important.

Stylon, can you review Lee Starnes's patch? Is the drm_connector_list_update 
call maybe not needed?

Thanks,
Harry

On 2020-11-10 11:26 a.m., Deucher, Alexander wrote:

[AMD Official Use Only - Internal Distribution Only]

Lee Starnes just sent the exact same patch yesterday.  Please review that one:
https://patchwork.freedesktop.org/patch/399497/

Alex


From: Wentland, Harry 
Sent: Tuesday, November 10, 2020 9:27 AM
To: Wang, Chao-kai (Stylon) ; 
amd-gfx@lists.freedesktop.org 

Cc: Kazlauskas, Nicholas 
; Deucher, 
Alexander 
Subject: Re: [PATCH] drm/amd/display: Fix memory leaks in S3 resume

On 2020-11-10 2:49 a.m., Stylon Wang wrote:
> EDID parsing in S3 resume pushes new display modes
> to probed_modes list but doesn't consolidate to actual
> mode list. This creates a race condition when
> amdgpu_dm_connector_ddc_get_modes() re-initializes the
> list head without walking the list and results in  memory leak.
>
> Signed-off-by: Stylon Wang 

Looks reasonable to me but haven't had a chance to understand whether
this is the best solution.

Acked-by: Harry Wentland 

Harry

> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 0b6adf23d316..715e0bd489f8 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2337,7 +2337,8 @@ void amdgpu_dm_update_connector_after_detect(
>
>drm_connector_update_edid_property(connector,
>   aconnector->edid);
> - drm_add_edid_modes(connector, aconnector->edid);
> + aconnector->num_modes = drm_add_edid_modes(connector, 
> aconnector->edid);
> + drm_connector_list_update(connector);
>
>if (aconnector->dc_link->aux_mode)
>drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
>

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