History

Merge tag 'drm-next-2019-01-05' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie: "Happy New Year, just decloaking from leave to get some stuff from the last week in before rc1: core: - two regression fixes for damage blob and atomic i915 gvt: - Some missed GVT fixes from the original pull amdgpu: - new PCI IDs - SR-IOV fixes - DC fixes - Vega20 fixes" * tag 'drm-next-2019-01-05' of git://anongit.freedesktop.org/drm/drm: (53 commits) drm: Put damage blob when destroy plane state drm: fix null pointer dereference on null state pointer drm/amdgpu: Add new VegaM pci id drm/ttm: Use drm_debug_printer for all ttm_bo_mem_space_debug output drm/amdgpu: add Vega20 PSP ASD firmware loading drm/amd/display: Fix MST dp_blank REG_WAIT timeout drm/amd/display: validate extended dongle caps drm/amd/display: Use div_u64 for flip timestamp ns to ms drm/amdgpu/uvd:Change uvd ring name convention drm/amd/powerplay: add Vega20 LCLK DPM level setting support drm/amdgpu: print process info when job timeout drm/amdgpu/nbio7.4: add hw bug workaround for vega20 drm/amdgpu/nbio6.1: add hw bug workaround for vega10/12 drm/amd/display: Optimize passive update planes. drm/amd/display: verify lane status before exiting verify link cap drm/amd/display: Fix bug with not updating VSP infoframe drm/amd/display: Add retry to read ddc_clock pin drm/amd/display: Don't skip link training for empty dongle drm/amd/display: Wait edp HPD to high in detect_sink drm/amd/display: fix surface update sequence ...

Linus Torvalds committed 7 years ago

Commit 0fe4e2d2 parents 3954e1d 9ddf32a51 files · +628 −290Browse files

Unified · Split

51 files
  1. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 −0
  2. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 −4
  3. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  4. drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +6 −0
  5. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 −1
  6. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 −8
  7. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +9 −8
  8. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 −1
  9. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +16 −6
  10. drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +13 −2
  11. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +31 −22
  12. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.h +10 −0
  13. drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c +7 −0
  14. drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +7 −0
  15. drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +56 −22
  16. drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +4 −1
  17. drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 −4
  18. drivers/gpu/drm/amd/amdgpu/soc15_common.h +7 −2
  19. drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +2 −2
  20. drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +20 −10
  21. drivers/gpu/drm/amd/amdgpu/vi.c +9 −9
  22. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 −2
  23. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +75 −18
  24. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 −1
  25. drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +15 −0
  26. drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 −0
  27. drivers/gpu/drm/amd/display/dc/core/dc.c +2 −8
  28. drivers/gpu/drm/amd/display/dc/core/dc_link.c +38 −10
  29. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +127 −119
  30. drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +2 −1
  31. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 −1
  32. drivers/gpu/drm/amd/display/dc/dc_helper.c +2 −2
  33. drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 −1
  34. drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +7 −0
  35. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10 −1
  36. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +13 −2
  37. drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +1 −0
  38. drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +1 −0
  39. drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c +1 −0
  40. drivers/gpu/drm/amd/display/include/bios_parser_types.h +1 −0
  41. drivers/gpu/drm/amd/display/include/dal_types.h +1 −0
  42. drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +43 −0
  43. drivers/gpu/drm/drm_atomic_state_helper.c +3 −0
  44. drivers/gpu/drm/drm_damage_helper.c +2 −1
  45. drivers/gpu/drm/i915/gvt/cmd_parser.c +3 −3
  46. drivers/gpu/drm/i915/gvt/gvt.c +1 −1
  47. drivers/gpu/drm/i915/gvt/gvt.h +4 −0
  48. drivers/gpu/drm/i915/gvt/handlers.c +1 −0
  49. drivers/gpu/drm/i915/gvt/interrupt.c +1 −1
  50. drivers/gpu/drm/i915/gvt/scheduler.c +33 −0
  51. drivers/gpu/drm/ttm/ttm_bo.c +17 −16
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+3−0
@@ -1428,6 +1428,9 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, · 1427 unmodified lines
14281428 if (IS_ERR(fence))
14291429 return PTR_ERR(fence);
14301430
1431+ if (!fence)
1432+ fence = dma_fence_get_stub();
1433+
14311434 switch (info->in.what) {
14321435 case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ:
14331436 r = drm_syncobj_create(&syncobj, 0, fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+6−4
@@ -3476,14 +3476,16 @@ static void amdgpu_device_lock_adev(struct amdgpu_device *adev) · 3475 unmodified lines
34763476 mutex_lock(&adev->lock_reset);
34773477 atomic_inc(&adev->gpu_reset_counter);
34783478 adev->in_gpu_reset = 1;
3479− /* Block kfd */
3480− amdgpu_amdkfd_pre_reset(adev);
3479+ /* Block kfd: SRIOV would do it separately */
3480+ if (!amdgpu_sriov_vf(adev))
3481+ amdgpu_amdkfd_pre_reset(adev);
34813482 }
34823483
34833484 static void amdgpu_device_unlock_adev(struct amdgpu_device *adev)
34843485 {
3485− /*unlock kfd */
3486− amdgpu_amdkfd_post_reset(adev);
3486+ /*unlock kfd: SRIOV would do it separately */
3487+ if (!amdgpu_sriov_vf(adev))
3488+ amdgpu_amdkfd_post_reset(adev);
34873489 amdgpu_vf_error_trans_all(adev);
34883490 adev->in_gpu_reset = 0;
34893491 mutex_unlock(&adev->lock_reset);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -865,6 +865,7 @@ static const struct pci_device_id pciidlist[] = { · 864 unmodified lines
865865 /* VEGAM */
866866 {0x1002, 0x694C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
867867 {0x1002, 0x694E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
868+ {0x1002, 0x694F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
868869 /* Vega 10 */
869870 {0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
870871 {0x1002, 0x6861, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c+6−0
@@ -32,6 +32,9 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job) · 31 unmodified lines
3232 {
3333 struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched);
3434 struct amdgpu_job *job = to_amdgpu_job(s_job);
35+ struct amdgpu_task_info ti;
36+
37+ memset(&ti, 0, sizeof(struct amdgpu_task_info));
3538
3639 if (amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
3740 DRM_ERROR("ring %s timeout, but soft recovered\n",
@@ -39,9 +42,12 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job) · 1 unmodified line
3942 return;
4043 }
4144
45+ amdgpu_vm_get_task_info(ring->adev, job->pasid, &ti);
4246 DRM_ERROR("ring %s timeout, signaled seq=%u, emitted seq=%u\n",
4347 job->base.sched->name, atomic_read(&ring->fence_drv.last_seq),
4448 ring->fence_drv.sync_seq);
49+ DRM_ERROR("Process information: process %s pid %d thread %s pid %d\n",
50+ ti.process_name, ti.tgid, ti.task_name, ti.pid);
4551
4652 if (amdgpu_device_should_recover_gpu(ring->adev))
4753 amdgpu_device_gpu_recover(ring->adev, job);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+1−1
@@ -912,7 +912,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo) · 911 unmodified lines
912912 struct ttm_operation_ctx ctx = { false, false };
913913 int r, i;
914914
915− if (!bo->pin_count) {
915+ if (WARN_ON_ONCE(!bo->pin_count)) {
916916 dev_warn(adev->dev, "%p unpin not necessary\n", bo);
917917 return 0;
918918 }
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c+0−8
@@ -155,14 +155,6 @@ psp_cmd_submit_buf(struct psp_context *psp, · 154 unmodified lines
155155 return ret;
156156 }
157157
158−bool psp_support_vmr_ring(struct psp_context *psp)
159−{
160− if (amdgpu_sriov_vf(psp->adev) && psp->sos_fw_version > 0x80045)
161− return true;
162− else
163− return false;
164−}
165−
166158 static void psp_prep_tmr_cmd_buf(struct psp_context *psp,
167159 struct psp_gfx_cmd_resp *cmd,
168160 uint64_t tmr_mc, uint32_t size)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h+9−8
@@ -83,12 +83,13 @@ struct psp_funcs · 82 unmodified lines
8383 enum AMDGPU_UCODE_ID ucode_type);
8484 bool (*smu_reload_quirk)(struct psp_context *psp);
8585 int (*mode1_reset)(struct psp_context *psp);
86− uint64_t (*xgmi_get_node_id)(struct psp_context *psp);
87− uint64_t (*xgmi_get_hive_id)(struct psp_context *psp);
86+ int (*xgmi_get_node_id)(struct psp_context *psp, uint64_t *node_id);
87+ int (*xgmi_get_hive_id)(struct psp_context *psp, uint64_t *hive_id);
8888 int (*xgmi_get_topology_info)(struct psp_context *psp, int number_devices,
8989 struct psp_xgmi_topology_info *topology);
9090 int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices,
9191 struct psp_xgmi_topology_info *topology);
92+ bool (*support_vmr_ring)(struct psp_context *psp);
9293 };
9394
9495 struct psp_xgmi_context {
@@ -192,12 +193,14 @@ struct psp_xgmi_topology_info { · 97 unmodified lines
192193 ((psp)->funcs->bootloader_load_sos ? (psp)->funcs->bootloader_load_sos((psp)) : 0)
193194 #define psp_smu_reload_quirk(psp) \
194195 ((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false)
196+#define psp_support_vmr_ring(psp) \
197+ ((psp)->funcs->support_vmr_ring ? (psp)->funcs->support_vmr_ring((psp)) : false)
195198 #define psp_mode1_reset(psp) \
196199 ((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false)
197−#define psp_xgmi_get_node_id(psp) \
198− ((psp)->funcs->xgmi_get_node_id ? (psp)->funcs->xgmi_get_node_id((psp)) : 0)
199−#define psp_xgmi_get_hive_id(psp) \
200− ((psp)->funcs->xgmi_get_hive_id ? (psp)->funcs->xgmi_get_hive_id((psp)) : 0)
200+#define psp_xgmi_get_node_id(psp, node_id) \
201+ ((psp)->funcs->xgmi_get_node_id ? (psp)->funcs->xgmi_get_node_id((psp), (node_id)) : -EINVAL)
202+#define psp_xgmi_get_hive_id(psp, hive_id) \
203+ ((psp)->funcs->xgmi_get_hive_id ? (psp)->funcs->xgmi_get_hive_id((psp), (hive_id)) : -EINVAL)
201204 #define psp_xgmi_get_topology_info(psp, num_device, topology) \
202205 ((psp)->funcs->xgmi_get_topology_info ? \
203206 (psp)->funcs->xgmi_get_topology_info((psp), (num_device), (topology)) : -EINVAL)
@@ -217,8 +220,6 @@ extern const struct amdgpu_ip_block_version psp_v10_0_ip_block; · 13 unmodified lines
217220
218221 int psp_gpu_reset(struct amdgpu_device *adev);
219222 int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
220−bool psp_support_vmr_ring(struct psp_context *psp);
221−
222223 extern const struct amdgpu_ip_block_version psp_v11_0_ip_block;
223224
224225 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include <drm/drm_print.h>
3030
3131 /* max number of rings */
32−#define AMDGPU_MAX_RINGS 21
32+#define AMDGPU_MAX_RINGS 23
3333 #define AMDGPU_MAX_GFX_RINGS 1
3434 #define AMDGPU_MAX_COMPUTE_RINGS 8
3535 #define AMDGPU_MAX_VCE_RINGS 3
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+16−6
@@ -262,7 +262,7 @@ static int amdgpu_vcn_pause_dpg_mode(struct amdgpu_device *adev, · 261 unmodified lines
262262
263263 ring = &adev->vcn.ring_dec;
264264 WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
265− RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2));
265+ RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2) & 0x7FFFFFFF);
266266 SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
267267 UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON,
268268 UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
@@ -322,7 +322,7 @@ static int amdgpu_vcn_pause_dpg_mode(struct amdgpu_device *adev, · 53 unmodified lines
322322
323323 ring = &adev->vcn.ring_dec;
324324 WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
325− RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2));
325+ RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2) & 0x7FFFFFFF);
326326 SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
327327 UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON,
328328 UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
@@ -396,16 +396,26 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring) · 67 unmodified lines
396396
397397 if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
398398 struct dpg_pause_state new_state;
399+ unsigned int fences = 0;
400+ unsigned int i;
399401
400− if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
402+ for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
403+ fences += amdgpu_fence_count_emitted(&adev->vcn.ring_enc[i]);
404+ }
405+ if (fences)
401406 new_state.fw_based = VCN_DPG_STATE__PAUSE;
402407 else
403− new_state.fw_based = adev->vcn.pause_state.fw_based;
408+ new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
404409
405− if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
410+ if (amdgpu_fence_count_emitted(&adev->vcn.ring_jpeg))
406411 new_state.jpeg = VCN_DPG_STATE__PAUSE;
407412 else
408− new_state.jpeg = adev->vcn.pause_state.jpeg;
413+ new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
414+
415+ if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
416+ new_state.fw_based = VCN_DPG_STATE__PAUSE;
417+ else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
418+ new_state.jpeg = VCN_DPG_STATE__PAUSE;
409419
410420 amdgpu_vcn_pause_dpg_mode(adev, &new_state);
411421 }
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c+13−2
@@ -97,8 +97,19 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 96 unmodified lines
9797 if (!adev->gmc.xgmi.supported)
9898 return 0;
9999
100− adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
101− adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
100+ ret = psp_xgmi_get_node_id(&adev->psp, &adev->gmc.xgmi.node_id);
101+ if (ret) {
102+ dev_err(adev->dev,
103+ "XGMI: Failed to get node id\n");
104+ return ret;
105+ }
106+
107+ ret = psp_xgmi_get_hive_id(&adev->psp, &adev->gmc.xgmi.hive_id);
108+ if (ret) {
109+ dev_err(adev->dev,
110+ "XGMI: Failed to get hive id\n");
111+ return ret;
112+ }
102113
103114 mutex_lock(&xgmi_mutex);
104115 hive = amdgpu_get_xgmi_hive(adev);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+31−22
@@ -718,37 +718,46 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev) · 717 unmodified lines
718718 }
719719 }
720720
721−static int gmc_v9_0_late_init(void *handle)
721+static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
722722 {
723− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
724− /*
725− * The latest engine allocation on gfx9 is:
726− * Engine 0, 1: idle
727− * Engine 2, 3: firmware
728− * Engine 4~13: amdgpu ring, subject to change when ring number changes
729− * Engine 14~15: idle
730− * Engine 16: kfd tlb invalidation
731− * Engine 17: Gart flushes
732− */
733− unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 4, 4 };
723+ struct amdgpu_ring *ring;
724+ unsigned vm_inv_engs[AMDGPU_MAX_VMHUBS] =
725+ {GFXHUB_FREE_VM_INV_ENGS_BITMAP, MMHUB_FREE_VM_INV_ENGS_BITMAP};
734726 unsigned i;
735− int r;
727+ unsigned vmhub, inv_eng;
736728
737− if (!gmc_v9_0_keep_stolen_memory(adev))
738− amdgpu_bo_late_init(adev);
729+ for (i = 0; i < adev->num_rings; ++i) {
730+ ring = adev->rings[i];
731+ vmhub = ring->funcs->vmhub;
732+
733+ inv_eng = ffs(vm_inv_engs[vmhub]);
734+ if (!inv_eng) {
735+ dev_err(adev->dev, "no VM inv eng for ring %s\n",
736+ ring->name);
737+ return -EINVAL;
738+ }
739739
740− for(i = 0; i < adev->num_rings; ++i) {
741− struct amdgpu_ring *ring = adev->rings[i];
742− unsigned vmhub = ring->funcs->vmhub;
740+ ring->vm_inv_eng = inv_eng - 1;
741+ change_bit(inv_eng - 1, (unsigned long *)(&vm_inv_engs[vmhub]));
743742
744− ring->vm_inv_eng = vm_inv_eng[vmhub]++;
745743 dev_info(adev->dev, "ring %s uses VM inv eng %u on hub %u\n",
746744 ring->name, ring->vm_inv_eng, ring->funcs->vmhub);
747745 }
748746
749− /* Engine 16 is used for KFD and 17 for GART flushes */
750− for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
751− BUG_ON(vm_inv_eng[i] > 16);
747+ return 0;
748+}
749+
750+static int gmc_v9_0_late_init(void *handle)
751+{
752+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
753+ int r;
754+
755+ if (!gmc_v9_0_keep_stolen_memory(adev))
756+ amdgpu_bo_late_init(adev);
757+
758+ r = gmc_v9_0_allocate_vm_inv_eng(adev);
759+ if (r)
760+ return r;
752761
753762 if (adev->asic_type == CHIP_VEGA10 && !amdgpu_sriov_vf(adev)) {
754763 r = gmc_v9_0_ecc_available(adev);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.h+10−0
@@ -24,6 +24,16 @@ · 23 unmodified lines
2424 #ifndef __GMC_V9_0_H__
2525 #define __GMC_V9_0_H__
2626
27+ /*
28+ * The latest engine allocation on gfx9 is:
29+ * Engine 2, 3: firmware
30+ * Engine 0, 1, 4~16: amdgpu ring,
31+ * subject to change when ring number changes
32+ * Engine 17: Gart flushes
33+ */
34+#define GFXHUB_FREE_VM_INV_ENGS_BITMAP 0x1FFF3
35+#define MMHUB_FREE_VM_INV_ENGS_BITMAP 0x1FFF3
36+
2737 extern const struct amd_ip_funcs gmc_v9_0_ip_funcs;
2838 extern const struct amdgpu_ip_block_version gmc_v9_0_ip_block;
2939
drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c+7−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #define smnCPM_CONTROL 0x11180460
3333 #define smnPCIE_CNTL2 0x11180070
3434 #define smnPCIE_CONFIG_CNTL 0x11180044
35+#define smnPCIE_CI_CNTL 0x11180080
3536
3637 static u32 nbio_v6_1_get_rev_id(struct amdgpu_device *adev)
3738 {
@@ -270,6 +271,12 @@ static void nbio_v6_1_init_registers(struct amdgpu_device *adev) · 232 unmodified lines
270271
271272 if (def != data)
272273 WREG32_PCIE(smnPCIE_CONFIG_CNTL, data);
274+
275+ def = data = RREG32_PCIE(smnPCIE_CI_CNTL);
276+ data = REG_SET_FIELD(data, PCIE_CI_CNTL, CI_SLV_ORDERING_DIS, 1);
277+
278+ if (def != data)
279+ WREG32_PCIE(smnPCIE_CI_CNTL, data);
273280 }
274281
275282 const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c+7−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131
3232 #define smnCPM_CONTROL 0x11180460
3333 #define smnPCIE_CNTL2 0x11180070
34+#define smnPCIE_CI_CNTL 0x11180080
3435
3536 static u32 nbio_v7_4_get_rev_id(struct amdgpu_device *adev)
3637 {
@@ -222,7 +223,13 @@ static void nbio_v7_4_detect_hw_virt(struct amdgpu_device *adev) · 185 unmodified lines
222223
223224 static void nbio_v7_4_init_registers(struct amdgpu_device *adev)
224225 {
226+ uint32_t def, data;
227+
228+ def = data = RREG32_PCIE(smnPCIE_CI_CNTL);
229+ data = REG_SET_FIELD(data, PCIE_CI_CNTL, CI_SLV_ORDERING_DIS, 1);
225230
231+ if (def != data)
232+ WREG32_PCIE(smnPCIE_CI_CNTL, data);
226233 }
227234
228235 const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c+56−22
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include "nbio/nbio_7_4_offset.h"
3535
3636 MODULE_FIRMWARE("amdgpu/vega20_sos.bin");
37+MODULE_FIRMWARE("amdgpu/vega20_asd.bin");
3738 MODULE_FIRMWARE("amdgpu/vega20_ta.bin");
3839
3940 /* address block */
@@ -100,6 +101,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 60 unmodified lines
100101 char fw_name[30];
101102 int err = 0;
102103 const struct psp_firmware_header_v1_0 *sos_hdr;
104+ const struct psp_firmware_header_v1_0 *asd_hdr;
103105 const struct ta_firmware_header_v1_0 *ta_hdr;
104106
105107 DRM_DEBUG("\n");
@@ -132,14 +134,30 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 26 unmodified lines
132134 adev->psp.sos_start_addr = (uint8_t *)adev->psp.sys_start_addr +
133135 le32_to_cpu(sos_hdr->sos_offset_bytes);
134136
137+ snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name);
138+ err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev);
139+ if (err)
140+ goto out1;
141+
142+ err = amdgpu_ucode_validate(adev->psp.asd_fw);
143+ if (err)
144+ goto out1;
145+
146+ asd_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.asd_fw->data;
147+ adev->psp.asd_fw_version = le32_to_cpu(asd_hdr->header.ucode_version);
148+ adev->psp.asd_feature_version = le32_to_cpu(asd_hdr->ucode_feature_version);
149+ adev->psp.asd_ucode_size = le32_to_cpu(asd_hdr->header.ucode_size_bytes);
150+ adev->psp.asd_start_addr = (uint8_t *)asd_hdr +
151+ le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes);
152+
135153 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
136154 err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
137155 if (err)
138− goto out;
156+ goto out2;
139157
140158 err = amdgpu_ucode_validate(adev->psp.ta_fw);
141159 if (err)
142− goto out;
160+ goto out2;
143161
144162 ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
145163 adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
@@ -148,14 +166,18 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 2 unmodified lines
148166 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
149167
150168 return 0;
169+
170+out2:
171+ release_firmware(adev->psp.ta_fw);
172+ adev->psp.ta_fw = NULL;
173+out1:
174+ release_firmware(adev->psp.asd_fw);
175+ adev->psp.asd_fw = NULL;
151176 out:
152− if (err) {
153− dev_err(adev->dev,
154− "psp v11.0: Failed to load firmware \"%s\"\n",
155− fw_name);
156− release_firmware(adev->psp.sos_fw);
157− adev->psp.sos_fw = NULL;
158− }
177+ dev_err(adev->dev,
178+ "psp v11.0: Failed to load firmware \"%s\"\n", fw_name);
179+ release_firmware(adev->psp.sos_fw);
180+ adev->psp.sos_fw = NULL;
159181
160182 return err;
161183 }
@@ -291,6 +313,13 @@ static int psp_v11_0_ring_init(struct psp_context *psp, · 129 unmodified lines
291313 return 0;
292314 }
293315
316+static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)
317+{
318+ if (amdgpu_sriov_vf(psp->adev) && psp->sos_fw_version > 0x80045)
319+ return true;
320+ return false;
321+}
322+
294323 static int psp_v11_0_ring_create(struct psp_context *psp,
295324 enum psp_ring_type ring_type)
296325 {
@@ -299,7 +328,7 @@ static int psp_v11_0_ring_create(struct psp_context *psp, · 2 unmodified lines
299328 struct psp_ring *ring = &psp->km_ring;
300329 struct amdgpu_device *adev = psp->adev;
301330
302− if (psp_support_vmr_ring(psp)) {
331+ if (psp_v11_0_support_vmr_ring(psp)) {
303332 /* Write low address of the ring to C2PMSG_102 */
304333 psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
305334 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg);
@@ -351,7 +380,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp, · 45 unmodified lines
351380 struct amdgpu_device *adev = psp->adev;
352381
353382 /* Write the ring destroy command*/
354− if (psp_support_vmr_ring(psp))
383+ if (psp_v11_0_support_vmr_ring(psp))
355384 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
356385 GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
357386 else
@@ -362,7 +391,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp, · 4 unmodified lines
362391 mdelay(20);
363392
364393 /* Wait for response flag (bit 31) */
365− if (psp_support_vmr_ring(psp))
394+ if (psp_v11_0_support_vmr_ring(psp))
366395 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
367396 0x80000000, 0x80000000, false);
368397 else
@@ -406,7 +435,7 @@ static int psp_v11_0_cmd_submit(struct psp_context *psp, · 37 unmodified lines
406435 uint32_t rb_frame_size_dw = sizeof(struct psp_gfx_rb_frame) / 4;
407436
408437 /* KM (GPCOM) prepare write pointer */
409− if (psp_support_vmr_ring(psp))
438+ if (psp_v11_0_support_vmr_ring(psp))
410439 psp_write_ptr_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
411440 else
412441 psp_write_ptr_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
@@ -438,7 +467,7 @@ static int psp_v11_0_cmd_submit(struct psp_context *psp, · 25 unmodified lines
438467
439468 /* Update the write Pointer in DWORDs */
440469 psp_write_ptr_reg = (psp_write_ptr_reg + rb_frame_size_dw) % ring_size_dw;
441− if (psp_support_vmr_ring(psp)) {
470+ if (psp_v11_0_support_vmr_ring(psp)) {
442471 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_write_ptr_reg);
443472 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD);
444473 } else
@@ -680,7 +709,7 @@ static int psp_v11_0_xgmi_set_topology_info(struct psp_context *psp, · 235 unmodified lines
680709 return psp_xgmi_invoke(psp, TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);
681710 }
682711
683−static u64 psp_v11_0_xgmi_get_hive_id(struct psp_context *psp)
712+static int psp_v11_0_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id)
684713 {
685714 struct ta_xgmi_shared_memory *xgmi_cmd;
686715 int ret;
@@ -693,12 +722,14 @@ static u64 psp_v11_0_xgmi_get_hive_id(struct psp_context *psp) · 6 unmodified lines
693722 /* Invoke xgmi ta to get hive id */
694723 ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
695724 if (ret)
696− return 0;
697− else
698− return xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
725+ return ret;
726+
727+ *hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
728+
729+ return 0;
699730 }
700731
701−static u64 psp_v11_0_xgmi_get_node_id(struct psp_context *psp)
732+static int psp_v11_0_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id)
702733 {
703734 struct ta_xgmi_shared_memory *xgmi_cmd;
704735 int ret;
@@ -711,9 +742,11 @@ static u64 psp_v11_0_xgmi_get_node_id(struct psp_context *psp) · 6 unmodified lines
711742 /* Invoke xgmi ta to get the node id */
712743 ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
713744 if (ret)
714− return 0;
715− else
716− return xgmi_cmd->xgmi_out_message.get_node_id.node_id;
745+ return ret;
746+
747+ *node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
748+
749+ return 0;
717750 }
718751
719752 static const struct psp_funcs psp_v11_0_funcs = {
@@ -732,6 +765,7 @@ static const struct psp_funcs psp_v11_0_funcs = { · 12 unmodified lines
732765 .xgmi_set_topology_info = psp_v11_0_xgmi_set_topology_info,
733766 .xgmi_get_hive_id = psp_v11_0_xgmi_get_hive_id,
734767 .xgmi_get_node_id = psp_v11_0_xgmi_get_node_id,
768+ .support_vmr_ring = psp_v11_0_support_vmr_ring,
735769 };
736770
737771 void psp_v11_0_set_psp_funcs(struct psp_context *psp)
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c+4−1
@@ -240,8 +240,11 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) · 239 unmodified lines
240240 * are already been loaded.
241241 */
242242 sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
243− if (sol_reg)
243+ if (sol_reg) {
244+ psp->sos_fw_version = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58);
245+ printk("sos fw version = 0x%x.\n", psp->sos_fw_version);
244246 return 0;
247+ }
245248
246249 /* Wait for bootloader to signify that is ready having bit 31 of C2PMSG_35 set to 1 */
247250 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c+5−4
@@ -1458,8 +1458,7 @@ static bool sdma_v4_0_fw_support_paging_queue(struct amdgpu_device *adev) · 1457 unmodified lines
14581458 /*return fw_version >= 31;*/
14591459 return false;
14601460 case CHIP_VEGA20:
1461− /*return fw_version >= 115;*/
1462− return false;
1461+ return fw_version >= 123;
14631462 default:
14641463 return false;
14651464 }
@@ -1706,13 +1705,15 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev, · 240 unmodified lines
17061705 amdgpu_fence_process(&adev->sdma.instance[instance].ring);
17071706 break;
17081707 case 1:
1709− /* XXX compute */
1708+ if (adev->asic_type == CHIP_VEGA20)
1709+ amdgpu_fence_process(&adev->sdma.instance[instance].page);
17101710 break;
17111711 case 2:
17121712 /* XXX compute */
17131713 break;
17141714 case 3:
1715− amdgpu_fence_process(&adev->sdma.instance[instance].page);
1715+ if (adev->asic_type != CHIP_VEGA20)
1716+ amdgpu_fence_process(&adev->sdma.instance[instance].page);
17161717 break;
17171718 }
17181719 return 0;
drivers/gpu/drm/amd/amdgpu/soc15_common.h+7−2
@@ -49,14 +49,19 @@ · 48 unmodified lines
4949
5050 #define SOC15_WAIT_ON_RREG(ip, inst, reg, expected_value, mask, ret) \
5151 do { \
52+ uint32_t old_ = 0; \
5253 uint32_t tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \
5354 uint32_t loop = adev->usec_timeout; \
5455 while ((tmp_ & (mask)) != (expected_value)) { \
55− udelay(2); \
56+ if (old_ != tmp_) { \
57+ loop = adev->usec_timeout; \
58+ old_ = tmp_; \
59+ } else \
60+ udelay(1); \
5661 tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \
5762 loop--; \
5863 if (!loop) { \
59− DRM_ERROR("Register(%d) [%s] failed to reach value 0x%08x != 0x%08x\n", \
64+ DRM_WARN("Register(%d) [%s] failed to reach value 0x%08x != 0x%08x\n", \
6065 inst, #reg, (unsigned)expected_value, (unsigned)(tmp_ & (mask))); \
6166 ret = -ETIMEDOUT; \
6267 break; \
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c+2−2
@@ -435,7 +435,7 @@ static int uvd_v7_0_sw_init(void *handle) · 434 unmodified lines
435435 continue;
436436 if (!amdgpu_sriov_vf(adev)) {
437437 ring = &adev->uvd.inst[j].ring;
438− sprintf(ring->name, "uvd<%d>", j);
438+ sprintf(ring->name, "uvd_%d", ring->me);
439439 r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst[j].irq, 0);
440440 if (r)
441441 return r;
@@ -443,7 +443,7 @@ static int uvd_v7_0_sw_init(void *handle) · 1 unmodified line
443443
444444 for (i = 0; i < adev->uvd.num_enc_rings; ++i) {
445445 ring = &adev->uvd.inst[j].ring_enc[i];
446− sprintf(ring->name, "uvd_enc%d<%d>", i, j);
446+ sprintf(ring->name, "uvd_enc_%d.%d", ring->me, i);
447447 if (amdgpu_sriov_vf(adev)) {
448448 ring->use_doorbell = true;
449449
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c+20−10
@@ -214,7 +214,8 @@ static int vcn_v1_0_hw_fini(void *handle) · 213 unmodified lines
214214 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
215215 struct amdgpu_ring *ring = &adev->vcn.ring_dec;
216216
217− if (RREG32_SOC15(VCN, 0, mmUVD_STATUS))
217+ if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
218+ RREG32_SOC15(VCN, 0, mmUVD_STATUS))
218219 vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
219220
220221 ring->sched.ready = false;
@@ -1087,7 +1088,8 @@ static int vcn_v1_0_start_dpg_mode(struct amdgpu_device *adev) · 866 unmodified lines
10871088 WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_RBC_RB_CNTL), 0,
10881089 ~UVD_RBC_RB_CNTL__RB_NO_FETCH_MASK);
10891090
1090− /* initialize wptr */
1091+ /* initialize JPEG wptr */
1092+ ring = &adev->vcn.ring_jpeg;
10911093 ring->wptr = RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR);
10921094
10931095 /* copy patch commands to the jpeg ring */
@@ -1159,21 +1161,29 @@ static int vcn_v1_0_stop_spg_mode(struct amdgpu_device *adev) · 65 unmodified lines
11591161 static int vcn_v1_0_stop_dpg_mode(struct amdgpu_device *adev)
11601162 {
11611163 int ret_code = 0;
1164+ uint32_t tmp;
11621165
11631166 /* Wait for power status to be UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF */
11641167 SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
11651168 UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF,
11661169 UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
11671170
1168− if (!ret_code) {
1169− int tmp = RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR) & 0x7FFFFFFF;
1170− /* wait for read ptr to be equal to write ptr */
1171− SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_RBC_RB_RPTR, tmp, 0xFFFFFFFF, ret_code);
1171+ /* wait for read ptr to be equal to write ptr */
1172+ tmp = RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR);
1173+ SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_RB_RPTR, tmp, 0xFFFFFFFF, ret_code);
11721174
1173− SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
1174− UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF,
1175− UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
1176− }
1175+ tmp = RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2);
1176+ SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_RB_RPTR2, tmp, 0xFFFFFFFF, ret_code);
1177+
1178+ tmp = RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR);
1179+ SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_JRBC_RB_RPTR, tmp, 0xFFFFFFFF, ret_code);
1180+
1181+ tmp = RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR) & 0x7FFFFFFF;
1182+ SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_RBC_RB_RPTR, tmp, 0xFFFFFFFF, ret_code);
1183+
1184+ SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
1185+ UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF,
1186+ UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
11771187
11781188 /* disable dynamic power gating mode */
11791189 WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS), 0,
drivers/gpu/drm/amd/amdgpu/vi.c+9−9
@@ -87,9 +87,9 @@ static u32 vi_pcie_rreg(struct amdgpu_device *adev, u32 reg) · 86 unmodified lines
8787 u32 r;
8888
8989 spin_lock_irqsave(&adev->pcie_idx_lock, flags);
90− WREG32(mmPCIE_INDEX, reg);
91− (void)RREG32(mmPCIE_INDEX);
92− r = RREG32(mmPCIE_DATA);
90+ WREG32_NO_KIQ(mmPCIE_INDEX, reg);
91+ (void)RREG32_NO_KIQ(mmPCIE_INDEX);
92+ r = RREG32_NO_KIQ(mmPCIE_DATA);
9393 spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
9494 return r;
9595 }
@@ -99,10 +99,10 @@ static void vi_pcie_wreg(struct amdgpu_device *adev, u32 reg, u32 v) · 3 unmodified lines
9999 unsigned long flags;
100100
101101 spin_lock_irqsave(&adev->pcie_idx_lock, flags);
102− WREG32(mmPCIE_INDEX, reg);
103− (void)RREG32(mmPCIE_INDEX);
104− WREG32(mmPCIE_DATA, v);
105− (void)RREG32(mmPCIE_DATA);
102+ WREG32_NO_KIQ(mmPCIE_INDEX, reg);
103+ (void)RREG32_NO_KIQ(mmPCIE_INDEX);
104+ WREG32_NO_KIQ(mmPCIE_DATA, v);
105+ (void)RREG32_NO_KIQ(mmPCIE_DATA);
106106 spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
107107 }
108108
@@ -123,8 +123,8 @@ static void vi_smc_wreg(struct amdgpu_device *adev, u32 reg, u32 v) · 14 unmodified lines
123123 unsigned long flags;
124124
125125 spin_lock_irqsave(&adev->smc_idx_lock, flags);
126− WREG32(mmSMC_IND_INDEX_11, (reg));
127− WREG32(mmSMC_IND_DATA_11, (v));
126+ WREG32_NO_KIQ(mmSMC_IND_INDEX_11, (reg));
127+ WREG32_NO_KIQ(mmSMC_IND_DATA_11, (v));
128128 spin_unlock_irqrestore(&adev->smc_idx_lock, flags);
129129 }
130130
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+2−2
@@ -1623,8 +1623,8 @@ static int kfd_ioctl_import_dmabuf(struct file *filep, · 1622 unmodified lines
16231623 return -EINVAL;
16241624
16251625 dmabuf = dma_buf_get(args->dmabuf_fd);
1626− if (!dmabuf)
1627− return -EINVAL;
1626+ if (IS_ERR(dmabuf))
1627+ return PTR_ERR(dmabuf);
16281628
16291629 mutex_lock(&p->mutex);
16301630
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+75−18
@@ -331,12 +331,29 @@ static void dm_crtc_high_irq(void *interrupt_params) · 330 unmodified lines
331331 struct common_irq_params *irq_params = interrupt_params;
332332 struct amdgpu_device *adev = irq_params->adev;
333333 struct amdgpu_crtc *acrtc;
334+ struct dm_crtc_state *acrtc_state;
334335
335336 acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);
336337
337338 if (acrtc) {
338339 drm_crtc_handle_vblank(&acrtc->base);
339340 amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
341+
342+ acrtc_state = to_dm_crtc_state(acrtc->base.state);
343+
344+ if (acrtc_state->stream &&
345+ acrtc_state->vrr_params.supported &&
346+ acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE) {
347+ mod_freesync_handle_v_update(
348+ adev->dm.freesync_module,
349+ acrtc_state->stream,
350+ &acrtc_state->vrr_params);
351+
352+ dc_stream_adjust_vmin_vmax(
353+ adev->dm.dc,
354+ acrtc_state->stream,
355+ &acrtc_state->vrr_params.adjust);
356+ }
340357 }
341358 }
342359
@@ -3009,7 +3026,7 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc) · 2666 unmodified lines
30093026 dc_stream_retain(state->stream);
30103027 }
30113028
3012− state->adjust = cur->adjust;
3029+ state->vrr_params = cur->vrr_params;
30133030 state->vrr_infopacket = cur->vrr_infopacket;
30143031 state->abm_level = cur->abm_level;
30153032 state->vrr_supported = cur->vrr_supported;
@@ -3628,10 +3645,20 @@ static int dm_plane_atomic_check(struct drm_plane *plane, · 612 unmodified lines
36283645 static int dm_plane_atomic_async_check(struct drm_plane *plane,
36293646 struct drm_plane_state *new_plane_state)
36303647 {
3648+ struct drm_plane_state *old_plane_state =
3649+ drm_atomic_get_old_plane_state(new_plane_state->state, plane);
3650+
36313651 /* Only support async updates on cursor planes. */
36323652 if (plane->type != DRM_PLANE_TYPE_CURSOR)
36333653 return -EINVAL;
36343654
3655+ /*
3656+ * DRM calls prepare_fb and cleanup_fb on new_plane_state for
3657+ * async commits so don't allow fb changes.
3658+ */
3659+ if (old_plane_state->fb != new_plane_state->fb)
3660+ return -EINVAL;
3661+
36353662 return 0;
36363663 }
36373664
@@ -4445,9 +4472,11 @@ struct dc_stream_status *dc_state_get_stream_status( · 807 unmodified lines
44454472 static void update_freesync_state_on_stream(
44464473 struct amdgpu_display_manager *dm,
44474474 struct dm_crtc_state *new_crtc_state,
4448− struct dc_stream_state *new_stream)
4475+ struct dc_stream_state *new_stream,
4476+ struct dc_plane_state *surface,
4477+ u32 flip_timestamp_in_us)
44494478 {
4450− struct mod_vrr_params vrr = {0};
4479+ struct mod_vrr_params vrr_params = new_crtc_state->vrr_params;
44514480 struct dc_info_packet vrr_infopacket = {0};
44524481 struct mod_freesync_config config = new_crtc_state->freesync_config;
44534482
@@ -4474,43 +4503,52 @@ static void update_freesync_state_on_stream( · 20 unmodified lines
44744503
44754504 mod_freesync_build_vrr_params(dm->freesync_module,
44764505 new_stream,
4477− &config, &vrr);
4506+ &config, &vrr_params);
4507+
4508+ if (surface) {
4509+ mod_freesync_handle_preflip(
4510+ dm->freesync_module,
4511+ surface,
4512+ new_stream,
4513+ flip_timestamp_in_us,
4514+ &vrr_params);
4515+ }
44784516
44794517 mod_freesync_build_vrr_infopacket(
44804518 dm->freesync_module,
44814519 new_stream,
4482− &vrr,
4520+ &vrr_params,
44834521 PACKET_TYPE_VRR,
44844522 TRANSFER_FUNC_UNKNOWN,
44854523 &vrr_infopacket);
44864524
44874525 new_crtc_state->freesync_timing_changed =
4488− (memcmp(&new_crtc_state->adjust,
4489− &vrr.adjust,
4490− sizeof(vrr.adjust)) != 0);
4526+ (memcmp(&new_crtc_state->vrr_params.adjust,
4527+ &vrr_params.adjust,
4528+ sizeof(vrr_params.adjust)) != 0);
44914529
44924530 new_crtc_state->freesync_vrr_info_changed =
44934531 (memcmp(&new_crtc_state->vrr_infopacket,
44944532 &vrr_infopacket,
44954533 sizeof(vrr_infopacket)) != 0);
44964534
4497− new_crtc_state->adjust = vrr.adjust;
4535+ new_crtc_state->vrr_params = vrr_params;
44984536 new_crtc_state->vrr_infopacket = vrr_infopacket;
44994537
4500− new_stream->adjust = new_crtc_state->adjust;
4538+ new_stream->adjust = new_crtc_state->vrr_params.adjust;
45014539 new_stream->vrr_infopacket = vrr_infopacket;
45024540
45034541 if (new_crtc_state->freesync_vrr_info_changed)
45044542 DRM_DEBUG_KMS("VRR packet update: crtc=%u enabled=%d state=%d",
45054543 new_crtc_state->base.crtc->base.id,
45064544 (int)new_crtc_state->base.vrr_enabled,
4507− (int)vrr.state);
4545+ (int)vrr_params.state);
45084546
45094547 if (new_crtc_state->freesync_timing_changed)
45104548 DRM_DEBUG_KMS("VRR timing update: crtc=%u min=%u max=%u\n",
45114549 new_crtc_state->base.crtc->base.id,
4512− vrr.adjust.v_total_min,
4513− vrr.adjust.v_total_max);
4550+ vrr_params.adjust.v_total_min,
4551+ vrr_params.adjust.v_total_max);
45144552 }
45154553
45164554 /*
@@ -4524,6 +4562,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 7 unmodified lines
45244562 struct dc_state *state)
45254563 {
45264564 unsigned long flags;
4565+ uint64_t timestamp_ns;
45274566 uint32_t target_vblank;
45284567 int r, vpos, hpos;
45294568 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
@@ -4537,6 +4576,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 7 unmodified lines
45374576 struct dc_stream_update stream_update = {0};
45384577 struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
45394578 struct dc_stream_status *stream_status;
4579+ struct dc_plane_state *surface;
45404580
45414581
45424582 /* Prepare wait for target vblank early - before the fence-waits */
@@ -4586,6 +4626,9 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 43 unmodified lines
45864626 addr.address.grph.addr.high_part = upper_32_bits(afb->address);
45874627 addr.flip_immediate = async_flip;
45884628
4629+ timestamp_ns = ktime_get_ns();
4630+ addr.flip_timestamp_in_us = div_u64(timestamp_ns, 1000);
4631+
45894632
45904633 if (acrtc->base.state->event)
45914634 prepare_flip_isr(acrtc);
@@ -4599,8 +4642,10 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 7 unmodified lines
45994642 return;
46004643 }
46014644
4602− surface_updates->surface = stream_status->plane_states[0];
4603− if (!surface_updates->surface) {
4645+ surface = stream_status->plane_states[0];
4646+ surface_updates->surface = surface;
4647+
4648+ if (!surface) {
46044649 DRM_ERROR("No surface for CRTC: id=%d\n",
46054650 acrtc->crtc_id);
46064651 return;
@@ -4611,7 +4656,9 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 4 unmodified lines
46114656 update_freesync_state_on_stream(
46124657 &adev->dm,
46134658 acrtc_state,
4614− acrtc_state->stream);
4659+ acrtc_state->stream,
4660+ surface,
4661+ addr.flip_timestamp_in_us);
46154662
46164663 if (acrtc_state->freesync_timing_changed)
46174664 stream_update.adjust =
@@ -4622,7 +4669,16 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, · 4 unmodified lines
46224669 &acrtc_state->stream->vrr_infopacket;
46234670 }
46244671
4672+ /* Update surface timing information. */
4673+ surface->time.time_elapsed_in_us[surface->time.index] =
4674+ addr.flip_timestamp_in_us - surface->time.prev_update_time_in_us;
4675+ surface->time.prev_update_time_in_us = addr.flip_timestamp_in_us;
4676+ surface->time.index++;
4677+ if (surface->time.index >= DC_PLANE_UPDATE_TIMES_MAX)
4678+ surface->time.index = 0;
4679+
46254680 mutex_lock(&adev->dm.dc_lock);
4681+
46264682 dc_commit_updates_for_stream(adev->dm.dc,
46274683 surface_updates,
46284684 1,
@@ -5314,6 +5370,7 @@ static void get_freesync_config_for_crtc( · 685 unmodified lines
53145370 config.max_refresh_in_uhz =
53155371 aconnector->max_vfreq * 1000000;
53165372 config.vsif_supported = true;
5373+ config.btr = true;
53175374 }
53185375
53195376 new_crtc_state->freesync_config = config;
@@ -5324,8 +5381,8 @@ static void reset_freesync_config_for_crtc( · 4 unmodified lines
53245381 {
53255382 new_crtc_state->vrr_supported = false;
53265383
5327− memset(&new_crtc_state->adjust, 0,
5328− sizeof(new_crtc_state->adjust));
5384+ memset(&new_crtc_state->vrr_params, 0,
5385+ sizeof(new_crtc_state->vrr_params));
53295386 memset(&new_crtc_state->vrr_infopacket, 0,
53305387 sizeof(new_crtc_state->vrr_infopacket));
53315388 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+1−1
@@ -268,7 +268,7 @@ struct dm_crtc_state { · 267 unmodified lines
268268
269269 bool vrr_supported;
270270 struct mod_freesync_config freesync_config;
271− struct dc_crtc_timing_adjust adjust;
271+ struct mod_vrr_params vrr_params;
272272 struct dc_info_packet vrr_infopacket;
273273
274274 int abm_level;
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c+15−0
@@ -638,6 +638,7 @@ static enum bp_result get_ss_info_v4_1( · 637 unmodified lines
638638 {
639639 enum bp_result result = BP_RESULT_OK;
640640 struct atom_display_controller_info_v4_1 *disp_cntl_tbl = NULL;
641+ struct atom_smu_info_v3_3 *smu_info = NULL;
641642
642643 if (!ss_info)
643644 return BP_RESULT_BADINPUT;
@@ -650,6 +651,7 @@ static enum bp_result get_ss_info_v4_1( · 6 unmodified lines
650651 if (!disp_cntl_tbl)
651652 return BP_RESULT_BADBIOSTABLE;
652653
654+
653655 ss_info->type.STEP_AND_DELAY_INFO = false;
654656 ss_info->spread_percentage_divider = 1000;
655657 /* BIOS no longer uses target clock. Always enable for now */
@@ -688,6 +690,19 @@ static enum bp_result get_ss_info_v4_1( · 32 unmodified lines
688690 */
689691 result = BP_RESULT_UNSUPPORTED;
690692 break;
693+ case AS_SIGNAL_TYPE_XGMI:
694+ smu_info = GET_IMAGE(struct atom_smu_info_v3_3,
695+ DATA_TABLES(smu_info));
696+ if (!smu_info)
697+ return BP_RESULT_BADBIOSTABLE;
698+
699+ ss_info->spread_spectrum_percentage =
700+ smu_info->waflclk_ss_percentage;
701+ ss_info->spread_spectrum_range =
702+ smu_info->gpuclk_ss_rate_10hz * 10;
703+ if (smu_info->waflclk_ss_mode & ATOM_SS_CENTRE_SPREAD_MODE)
704+ ss_info->type.CENTER_MODE = true;
705+ break;
691706 default:
692707 result = BP_RESULT_UNSUPPORTED;
693708 }
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c+1−0
@@ -67,6 +67,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2( · 66 unmodified lines
6767 return true;
6868 #endif
6969 case DCE_VERSION_12_0:
70+ case DCE_VERSION_12_1:
7071 *h = dal_cmd_tbl_helper_dce112_get_table2();
7172 return true;
7273
drivers/gpu/drm/amd/display/dc/core/dc.c+2−8
@@ -151,10 +151,6 @@ static bool create_links( · 150 unmodified lines
151151 return false;
152152 }
153153
154− if (connectors_num == 0 && num_virtual_links == 0) {
155− dm_error("DC: Number of connectors is zero!\n");
156− }
157−
158154 dm_output_to_console(
159155 "DC: %s: connectors_num: physical:%d, virtual:%d\n",
160156 __func__,
@@ -1471,7 +1467,8 @@ static void commit_planes_do_stream_update(struct dc *dc, · 1310 unmodified lines
14711467
14721468 if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) ||
14731469 stream_update->vrr_infopacket ||
1474− stream_update->vsc_infopacket) {
1470+ stream_update->vsc_infopacket ||
1471+ stream_update->vsp_infopacket) {
14751472 resource_build_info_frame(pipe_ctx);
14761473 dc->hwss.update_info_frame(pipe_ctx);
14771474 }
@@ -1573,9 +1570,6 @@ static void commit_planes_for_stream(struct dc *dc, · 95 unmodified lines
15731570 }
15741571 }
15751572
1576− if (update_type == UPDATE_TYPE_FULL)
1577− context_timing_trace(dc, &context->res_ctx);
1578−
15791573 // Update Type FAST, Surface updates
15801574 if (update_type == UPDATE_TYPE_FAST) {
15811575 /* Lock the top pipe while updating plane addrs, since freesync requires
drivers/gpu/drm/amd/display/dc/core/dc_link.c+38−10
@@ -215,6 +215,9 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type) · 214 unmodified lines
215215 return true;
216216 }
217217
218+ if (link->connector_signal == SIGNAL_TYPE_EDP)
219+ link->dc->hwss.edp_wait_for_hpd_ready(link, true);
220+
218221 /* todo: may need to lock gpio access */
219222 hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);
220223 if (hpd_pin == NULL)
@@ -339,7 +342,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) · 118 unmodified lines
339342 {
340343 enum gpio_result gpio_result;
341344 uint32_t clock_pin = 0;
342−
345+ uint8_t retry = 0;
343346 struct ddc *ddc;
344347
345348 enum connector_id connector_id =
@@ -368,11 +371,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) · 22 unmodified lines
368371 return present;
369372 }
370373
371− /* Read GPIO: DP sink is present if both clock and data pins are zero */
372− /* [anaumov] in DAL2, there was no check for GPIO failure */
373−
374− gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin);
375− ASSERT(gpio_result == GPIO_RESULT_OK);
374+ /*
375+ * Read GPIO: DP sink is present if both clock and data pins are zero
376+ *
377+ * [W/A] plug-unplug DP cable, sometimes customer board has
378+ * one short pulse on clk_pin(1V, < 1ms). DP will be config to HDMI/DVI
379+ * then monitor can't br light up. Add retry 3 times
380+ * But in real passive dongle, it need additional 3ms to detect
381+ */
382+ do {
383+ gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin);
384+ ASSERT(gpio_result == GPIO_RESULT_OK);
385+ if (clock_pin)
386+ udelay(1000);
387+ else
388+ break;
389+ } while (retry++ < 3);
376390
377391 present = (gpio_result == GPIO_RESULT_OK) && !clock_pin;
378392
@@ -703,12 +717,26 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) · 324 unmodified lines
703717 if (memcmp(&link->dpcd_caps, &prev_dpcd_caps, sizeof(struct dpcd_caps)))
704718 same_dpcd = false;
705719 }
706− /* Active dongle downstream unplug */
720+ /* Active dongle plug in without display or downstream unplug*/
707721 if (link->type == dc_connection_active_dongle
708722 && link->dpcd_caps.sink_count.
709723 bits.SINK_COUNT == 0) {
710− if (prev_sink != NULL)
724+ if (prev_sink != NULL) {
725+ /* Downstream unplug */
711726 dc_sink_release(prev_sink);
727+ } else {
728+ /* Empty dongle plug in */
729+ for (i = 0; i < LINK_TRAINING_MAX_VERIFY_RETRY; i++) {
730+ int fail_count = 0;
731+
732+ dp_verify_link_cap(link,
733+ &link->reported_link_cap,
734+ &fail_count);
735+
736+ if (fail_count == 0)
737+ break;
738+ }
739+ }
712740 return true;
713741 }
714742
@@ -2622,11 +2650,11 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option) · 1907 unmodified lines
26222650 {
26232651 struct dc *core_dc = pipe_ctx->stream->ctx->dc;
26242652
2653+ core_dc->hwss.blank_stream(pipe_ctx);
2654+
26252655 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
26262656 deallocate_mst_payload(pipe_ctx);
26272657
2628− core_dc->hwss.blank_stream(pipe_ctx);
2629−
26302658 core_dc->hwss.disable_stream(pipe_ctx, option);
26312659
26322660 disable_link(pipe_ctx->stream->sink->link, pipe_ctx->stream->signal);
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+127−119
@@ -1089,6 +1089,121 @@ static struct dc_link_settings get_max_link_cap(struct dc_link *link) · 1088 unmodified lines
10891089 return max_link_cap;
10901090 }
10911091
1092+static enum dc_status read_hpd_rx_irq_data(
1093+ struct dc_link *link,
1094+ union hpd_irq_data *irq_data)
1095+{
1096+ static enum dc_status retval;
1097+
1098+ /* The HW reads 16 bytes from 200h on HPD,
1099+ * but if we get an AUX_DEFER, the HW cannot retry
1100+ * and this causes the CTS tests 4.3.2.1 - 3.2.4 to
1101+ * fail, so we now explicitly read 6 bytes which is
1102+ * the req from the above mentioned test cases.
1103+ *
1104+ * For DP 1.4 we need to read those from 2002h range.
1105+ */
1106+ if (link->dpcd_caps.dpcd_rev.raw < DPCD_REV_14)
1107+ retval = core_link_read_dpcd(
1108+ link,
1109+ DP_SINK_COUNT,
1110+ irq_data->raw,
1111+ sizeof(union hpd_irq_data));
1112+ else {
1113+ /* Read 14 bytes in a single read and then copy only the required fields.
1114+ * This is more efficient than doing it in two separate AUX reads. */
1115+
1116+ uint8_t tmp[DP_SINK_STATUS_ESI - DP_SINK_COUNT_ESI + 1];
1117+
1118+ retval = core_link_read_dpcd(
1119+ link,
1120+ DP_SINK_COUNT_ESI,
1121+ tmp,
1122+ sizeof(tmp));
1123+
1124+ if (retval != DC_OK)
1125+ return retval;
1126+
1127+ irq_data->bytes.sink_cnt.raw = tmp[DP_SINK_COUNT_ESI - DP_SINK_COUNT_ESI];
1128+ irq_data->bytes.device_service_irq.raw = tmp[DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 - DP_SINK_COUNT_ESI];
1129+ irq_data->bytes.lane01_status.raw = tmp[DP_LANE0_1_STATUS_ESI - DP_SINK_COUNT_ESI];
1130+ irq_data->bytes.lane23_status.raw = tmp[DP_LANE2_3_STATUS_ESI - DP_SINK_COUNT_ESI];
1131+ irq_data->bytes.lane_status_updated.raw = tmp[DP_LANE_ALIGN_STATUS_UPDATED_ESI - DP_SINK_COUNT_ESI];
1132+ irq_data->bytes.sink_status.raw = tmp[DP_SINK_STATUS_ESI - DP_SINK_COUNT_ESI];
1133+ }
1134+
1135+ return retval;
1136+}
1137+
1138+static bool hpd_rx_irq_check_link_loss_status(
1139+ struct dc_link *link,
1140+ union hpd_irq_data *hpd_irq_dpcd_data)
1141+{
1142+ uint8_t irq_reg_rx_power_state = 0;
1143+ enum dc_status dpcd_result = DC_ERROR_UNEXPECTED;
1144+ union lane_status lane_status;
1145+ uint32_t lane;
1146+ bool sink_status_changed;
1147+ bool return_code;
1148+
1149+ sink_status_changed = false;
1150+ return_code = false;
1151+
1152+ if (link->cur_link_settings.lane_count == 0)
1153+ return return_code;
1154+
1155+ /*1. Check that Link Status changed, before re-training.*/
1156+
1157+ /*parse lane status*/
1158+ for (lane = 0; lane < link->cur_link_settings.lane_count; lane++) {
1159+ /* check status of lanes 0,1
1160+ * changed DpcdAddress_Lane01Status (0x202)
1161+ */
1162+ lane_status.raw = get_nibble_at_index(
1163+ &hpd_irq_dpcd_data->bytes.lane01_status.raw,
1164+ lane);
1165+
1166+ if (!lane_status.bits.CHANNEL_EQ_DONE_0 ||
1167+ !lane_status.bits.CR_DONE_0 ||
1168+ !lane_status.bits.SYMBOL_LOCKED_0) {
1169+ /* if one of the channel equalization, clock
1170+ * recovery or symbol lock is dropped
1171+ * consider it as (link has been
1172+ * dropped) dp sink status has changed
1173+ */
1174+ sink_status_changed = true;
1175+ break;
1176+ }
1177+ }
1178+
1179+ /* Check interlane align.*/
1180+ if (sink_status_changed ||
1181+ !hpd_irq_dpcd_data->bytes.lane_status_updated.bits.INTERLANE_ALIGN_DONE) {
1182+
1183+ DC_LOG_HW_HPD_IRQ("%s: Link Status changed.\n", __func__);
1184+
1185+ return_code = true;
1186+
1187+ /*2. Check that we can handle interrupt: Not in FS DOS,
1188+ * Not in "Display Timeout" state, Link is trained.
1189+ */
1190+ dpcd_result = core_link_read_dpcd(link,
1191+ DP_SET_POWER,
1192+ &irq_reg_rx_power_state,
1193+ sizeof(irq_reg_rx_power_state));
1194+
1195+ if (dpcd_result != DC_OK) {
1196+ DC_LOG_HW_HPD_IRQ("%s: DPCD read failed to obtain power state.\n",
1197+ __func__);
1198+ } else {
1199+ if (irq_reg_rx_power_state != DP_SET_POWER_D0)
1200+ return_code = false;
1201+ }
1202+ }
1203+
1204+ return return_code;
1205+}
1206+
10921207 bool dp_verify_link_cap(
10931208 struct dc_link *link,
10941209 struct dc_link_settings *known_limit_link_setting,
@@ -1104,12 +1219,14 @@ bool dp_verify_link_cap( · 9 unmodified lines
11041219 struct clock_source *dp_cs;
11051220 enum clock_source_id dp_cs_id = CLOCK_SOURCE_ID_EXTERNAL;
11061221 enum link_training_result status;
1222+ union hpd_irq_data irq_data;
11071223
11081224 if (link->dc->debug.skip_detection_link_training) {
11091225 link->verified_link_cap = *known_limit_link_setting;
11101226 return true;
11111227 }
11121228
1229+ memset(&irq_data, 0, sizeof(irq_data));
11131230 success = false;
11141231 skip_link_training = false;
11151232
@@ -1168,9 +1285,15 @@ bool dp_verify_link_cap( · 52 unmodified lines
11681285 (*fail_count)++;
11691286 }
11701287
1171− if (success)
1288+ if (success) {
11721289 link->verified_link_cap = *cur;
1173−
1290+ udelay(1000);
1291+ if (read_hpd_rx_irq_data(link, &irq_data) == DC_OK)
1292+ if (hpd_rx_irq_check_link_loss_status(
1293+ link,
1294+ &irq_data))
1295+ (*fail_count)++;
1296+ }
11741297 /* always disable the link before trying another
11751298 * setting or before returning we'll enable it later
11761299 * based on the actual mode we're driving
@@ -1572,122 +1695,6 @@ void decide_link_settings(struct dc_stream_state *stream, · 395 unmodified lines
15721695 }
15731696
15741697 /*************************Short Pulse IRQ***************************/
1575−
1576−static bool hpd_rx_irq_check_link_loss_status(
1577− struct dc_link *link,
1578− union hpd_irq_data *hpd_irq_dpcd_data)
1579−{
1580− uint8_t irq_reg_rx_power_state = 0;
1581− enum dc_status dpcd_result = DC_ERROR_UNEXPECTED;
1582− union lane_status lane_status;
1583− uint32_t lane;
1584− bool sink_status_changed;
1585− bool return_code;
1586−
1587− sink_status_changed = false;
1588− return_code = false;
1589−
1590− if (link->cur_link_settings.lane_count == 0)
1591− return return_code;
1592−
1593− /*1. Check that Link Status changed, before re-training.*/
1594−
1595− /*parse lane status*/
1596− for (lane = 0; lane < link->cur_link_settings.lane_count; lane++) {
1597− /* check status of lanes 0,1
1598− * changed DpcdAddress_Lane01Status (0x202)
1599− */
1600− lane_status.raw = get_nibble_at_index(
1601− &hpd_irq_dpcd_data->bytes.lane01_status.raw,
1602− lane);
1603−
1604− if (!lane_status.bits.CHANNEL_EQ_DONE_0 ||
1605− !lane_status.bits.CR_DONE_0 ||
1606− !lane_status.bits.SYMBOL_LOCKED_0) {
1607− /* if one of the channel equalization, clock
1608− * recovery or symbol lock is dropped
1609− * consider it as (link has been
1610− * dropped) dp sink status has changed
1611− */
1612− sink_status_changed = true;
1613− break;
1614− }
1615− }
1616−
1617− /* Check interlane align.*/
1618− if (sink_status_changed ||
1619− !hpd_irq_dpcd_data->bytes.lane_status_updated.bits.INTERLANE_ALIGN_DONE) {
1620−
1621− DC_LOG_HW_HPD_IRQ("%s: Link Status changed.\n", __func__);
1622−
1623− return_code = true;
1624−
1625− /*2. Check that we can handle interrupt: Not in FS DOS,
1626− * Not in "Display Timeout" state, Link is trained.
1627− */
1628− dpcd_result = core_link_read_dpcd(link,
1629− DP_SET_POWER,
1630− &irq_reg_rx_power_state,
1631− sizeof(irq_reg_rx_power_state));
1632−
1633− if (dpcd_result != DC_OK) {
1634− DC_LOG_HW_HPD_IRQ("%s: DPCD read failed to obtain power state.\n",
1635− __func__);
1636− } else {
1637− if (irq_reg_rx_power_state != DP_SET_POWER_D0)
1638− return_code = false;
1639− }
1640− }
1641−
1642− return return_code;
1643−}
1644−
1645−static enum dc_status read_hpd_rx_irq_data(
1646− struct dc_link *link,
1647− union hpd_irq_data *irq_data)
1648−{
1649− static enum dc_status retval;
1650−
1651− /* The HW reads 16 bytes from 200h on HPD,
1652− * but if we get an AUX_DEFER, the HW cannot retry
1653− * and this causes the CTS tests 4.3.2.1 - 3.2.4 to
1654− * fail, so we now explicitly read 6 bytes which is
1655− * the req from the above mentioned test cases.
1656− *
1657− * For DP 1.4 we need to read those from 2002h range.
1658− */
1659− if (link->dpcd_caps.dpcd_rev.raw < DPCD_REV_14)
1660− retval = core_link_read_dpcd(
1661− link,
1662− DP_SINK_COUNT,
1663− irq_data->raw,
1664− sizeof(union hpd_irq_data));
1665− else {
1666− /* Read 14 bytes in a single read and then copy only the required fields.
1667− * This is more efficient than doing it in two separate AUX reads. */
1668−
1669− uint8_t tmp[DP_SINK_STATUS_ESI - DP_SINK_COUNT_ESI + 1];
1670−
1671− retval = core_link_read_dpcd(
1672− link,
1673− DP_SINK_COUNT_ESI,
1674− tmp,
1675− sizeof(tmp));
1676−
1677− if (retval != DC_OK)
1678− return retval;
1679−
1680− irq_data->bytes.sink_cnt.raw = tmp[DP_SINK_COUNT_ESI - DP_SINK_COUNT_ESI];
1681− irq_data->bytes.device_service_irq.raw = tmp[DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 - DP_SINK_COUNT_ESI];
1682− irq_data->bytes.lane01_status.raw = tmp[DP_LANE0_1_STATUS_ESI - DP_SINK_COUNT_ESI];
1683− irq_data->bytes.lane23_status.raw = tmp[DP_LANE2_3_STATUS_ESI - DP_SINK_COUNT_ESI];
1684− irq_data->bytes.lane_status_updated.raw = tmp[DP_LANE_ALIGN_STATUS_UPDATED_ESI - DP_SINK_COUNT_ESI];
1685− irq_data->bytes.sink_status.raw = tmp[DP_SINK_STATUS_ESI - DP_SINK_COUNT_ESI];
1686− }
1687−
1688− return retval;
1689−}
1690−
16911698 static bool allow_hpd_rx_irq(const struct dc_link *link)
16921699 {
16931700 /*
@@ -2240,7 +2247,8 @@ static void get_active_converter_info( · 546 unmodified lines
22402247 translate_dpcd_max_bpc(
22412248 hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT);
22422249
2243− link->dpcd_caps.dongle_caps.extendedCapValid = true;
2250+ if (link->dpcd_caps.dongle_caps.dp_hdmi_max_pixel_clk != 0)
2251+ link->dpcd_caps.dongle_caps.extendedCapValid = true;
22442252 }
22452253
22462254 break;
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c+2−1
@@ -96,6 +96,7 @@ void dp_enable_link_phy( · 95 unmodified lines
9696 link_settings,
9797 clock_source);
9898 }
99+ link->cur_link_settings = *link_settings;
99100
100101 dp_receiver_power_ctrl(link, true);
101102 }
@@ -307,6 +308,7 @@ void dp_retrain_link_dp_test(struct dc_link *link, · 205 unmodified lines
307308 link->link_enc,
308309 link_setting,
309310 pipes[i].clock_source->id);
311+ link->cur_link_settings = *link_setting;
310312
311313 dp_receiver_power_ctrl(link, true);
312314
@@ -316,7 +318,6 @@ void dp_retrain_link_dp_test(struct dc_link *link, · 3 unmodified lines
316318 skip_video_pattern,
317319 LINK_TRAINING_ATTEMPTS);
318320
319− link->cur_link_settings = *link_setting;
320321
321322 link->dc->hwss.enable_stream(&pipes[i]);
322323
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+5−1
@@ -83,7 +83,10 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id) · 82 unmodified lines
8383 dc_version = DCE_VERSION_11_22;
8484 break;
8585 case FAMILY_AI:
86− dc_version = DCE_VERSION_12_0;
86+ if (ASICREV_IS_VEGA20_P(asic_id.hw_internal_rev))
87+ dc_version = DCE_VERSION_12_1;
88+ else
89+ dc_version = DCE_VERSION_12_0;
8790 break;
8891 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
8992 case FAMILY_RV:
@@ -136,6 +139,7 @@ struct resource_pool *dc_create_resource_pool( · 46 unmodified lines
136139 num_virtual_links, dc);
137140 break;
138141 case DCE_VERSION_12_0:
142+ case DCE_VERSION_12_1:
139143 res_pool = dce120_create_resource_pool(
140144 num_virtual_links, dc);
141145 break;
drivers/gpu/drm/amd/display/dc/dc_helper.c+2−2
@@ -234,14 +234,14 @@ uint32_t generic_reg_wait(const struct dc_context *ctx, · 233 unmodified lines
234234 if (field_value == condition_value) {
235235 if (i * delay_between_poll_us > 1000 &&
236236 !IS_FPGA_MAXIMUS_DC(ctx->dce_environment))
237− dm_output_to_console("REG_WAIT taking a while: %dms in %s line:%d\n",
237+ DC_LOG_DC("REG_WAIT taking a while: %dms in %s line:%d\n",
238238 delay_between_poll_us * i / 1000,
239239 func_name, line);
240240 return reg_val;
241241 }
242242 }
243243
244− dm_error("REG_WAIT timeout %dus * %d tries - %s line:%d\n",
244+ DC_LOG_WARNING("REG_WAIT timeout %dus * %d tries - %s line:%d\n",
245245 delay_between_poll_us, time_out_num_tries,
246246 func_name, line);
247247
drivers/gpu/drm/amd/display/dc/dc_hw_types.h+1−1
@@ -192,7 +192,6 @@ enum surface_pixel_format { · 191 unmodified lines
192192 /*swaped & float*/
193193 SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F,
194194 /*grow graphics here if necessary */
195− SURFACE_PIXEL_FORMAT_VIDEO_AYCrCb8888,
196195 SURFACE_PIXEL_FORMAT_VIDEO_BEGIN,
197196 SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr =
198197 SURFACE_PIXEL_FORMAT_VIDEO_BEGIN,
@@ -200,6 +199,7 @@ enum surface_pixel_format { · 1 unmodified line
200199 SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr,
201200 SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb,
202201 SURFACE_PIXEL_FORMAT_SUBSAMPLE_END,
202+ SURFACE_PIXEL_FORMAT_VIDEO_AYCrCb8888,
203203 SURFACE_PIXEL_FORMAT_INVALID
204204
205205 /*grow 444 video here if necessary */
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c+7−0
@@ -676,6 +676,11 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, · 675 unmodified lines
676676 {
677677 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr);
678678 struct dm_pp_power_level_change_request level_change_req;
679+ int unpatched_disp_clk = context->bw.dce.dispclk_khz;
680+
681+ /*TODO: W/A for dal3 linux, investigate why this works */
682+ if (!clk_mgr_dce->dfs_bypass_active)
683+ context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz * 115 / 100;
679684
680685 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr, context);
681686 /* get max clock state from PPLIB */
@@ -690,6 +695,8 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, · 8 unmodified lines
690695 clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz;
691696 }
692697 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context);
698+
699+ context->bw.dce.dispclk_khz = unpatched_disp_clk;
693700 }
694701
695702 static void dce12_update_clocks(struct clk_mgr *clk_mgr,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+10−1
@@ -1267,10 +1267,19 @@ static void program_scaler(const struct dc *dc, · 1266 unmodified lines
12671267 pipe_ctx->plane_res.scl_data.lb_params.depth,
12681268 &pipe_ctx->stream->bit_depth_params);
12691269
1270− if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color)
1270+ if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) {
1271+ /*
1272+ * The way 420 is packed, 2 channels carry Y component, 1 channel
1273+ * alternate between Cb and Cr, so both channels need the pixel
1274+ * value for Y
1275+ */
1276+ if (pipe_ctx->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
1277+ color.color_r_cr = color.color_g_y;
1278+
12711279 pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color(
12721280 pipe_ctx->stream_res.tg,
12731281 &color);
1282+ }
12741283
12751284 pipe_ctx->plane_res.xfm->funcs->transform_set_scaler(pipe_ctx->plane_res.xfm,
12761285 &pipe_ctx->plane_res.scl_data);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+13−2
@@ -2159,6 +2159,15 @@ static void dcn10_blank_pixel_data( · 2158 unmodified lines
21592159 color_space = stream->output_color_space;
21602160 color_space_to_black_color(dc, color_space, &black_color);
21612161
2162+ /*
2163+ * The way 420 is packed, 2 channels carry Y component, 1 channel
2164+ * alternate between Cb and Cr, so both channels need the pixel
2165+ * value for Y
2166+ */
2167+ if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
2168+ black_color.color_r_cr = black_color.color_g_y;
2169+
2170+
21622171 if (stream_res->tg->funcs->set_blank_color)
21632172 stream_res->tg->funcs->set_blank_color(
21642173 stream_res->tg,
@@ -2348,7 +2357,8 @@ static void dcn10_apply_ctx_for_surface( · 183 unmodified lines
23482357 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
23492358
23502359 /* Skip inactive pipes and ones already updated */
2351− if (!pipe_ctx->stream || pipe_ctx->stream == stream)
2360+ if (!pipe_ctx->stream || pipe_ctx->stream == stream
2361+ || !pipe_ctx->plane_state)
23522362 continue;
23532363
23542364 pipe_ctx->stream_res.tg->funcs->lock(pipe_ctx->stream_res.tg);
@@ -2362,7 +2372,8 @@ static void dcn10_apply_ctx_for_surface( · 7 unmodified lines
23622372 for (i = 0; i < dc->res_pool->pipe_count; i++) {
23632373 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
23642374
2365− if (!pipe_ctx->stream || pipe_ctx->stream == stream)
2375+ if (!pipe_ctx->stream || pipe_ctx->stream == stream
2376+ || !pipe_ctx->plane_state)
23662377 continue;
23672378
23682379 dcn10_pipe_control_lock(dc, pipe_ctx, false);
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c+1−0
@@ -79,6 +79,7 @@ bool dal_hw_factory_init( · 78 unmodified lines
7979 dal_hw_factory_dce110_init(factory);
8080 return true;
8181 case DCE_VERSION_12_0:
82+ case DCE_VERSION_12_1:
8283 dal_hw_factory_dce120_init(factory);
8384 return true;
8485 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c+1−0
@@ -76,6 +76,7 @@ bool dal_hw_translate_init( · 75 unmodified lines
7676 dal_hw_translate_dce110_init(translate);
7777 return true;
7878 case DCE_VERSION_12_0:
79+ case DCE_VERSION_12_1:
7980 dal_hw_translate_dce120_init(translate);
8081 return true;
8182 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c+1−0
@@ -90,6 +90,7 @@ struct i2caux *dal_i2caux_create( · 89 unmodified lines
9090 case DCE_VERSION_10_0:
9191 return dal_i2caux_dce100_create(ctx);
9292 case DCE_VERSION_12_0:
93+ case DCE_VERSION_12_1:
9394 return dal_i2caux_dce120_create(ctx);
9495 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
9596 case DCN_VERSION_1_0:
drivers/gpu/drm/amd/display/include/bios_parser_types.h+1−0
@@ -41,6 +41,7 @@ enum as_signal_type { · 40 unmodified lines
4141 AS_SIGNAL_TYPE_LVDS,
4242 AS_SIGNAL_TYPE_DISPLAY_PORT,
4343 AS_SIGNAL_TYPE_GPU_PLL,
44+ AS_SIGNAL_TYPE_XGMI,
4445 AS_SIGNAL_TYPE_UNKNOWN
4546 };
4647
drivers/gpu/drm/amd/display/include/dal_types.h+1−0
@@ -42,6 +42,7 @@ enum dce_version { · 41 unmodified lines
4242 DCE_VERSION_11_2,
4343 DCE_VERSION_11_22,
4444 DCE_VERSION_12_0,
45+ DCE_VERSION_12_1,
4546 DCE_VERSION_MAX,
4647 DCN_VERSION_1_0,
4748 #if defined(CONFIG_DRM_AMD_DC_DCN1_01)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c+43−0
@@ -49,6 +49,10 @@ · 48 unmodified lines
4949 #include "soc15_common.h"
5050 #include "smuio/smuio_9_0_offset.h"
5151 #include "smuio/smuio_9_0_sh_mask.h"
52+#include "nbio/nbio_7_4_sh_mask.h"
53+
54+#define smnPCIE_LC_SPEED_CNTL 0x11140290
55+#define smnPCIE_LC_LINK_WIDTH_CNTL 0x11140288
5256
5357 static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr)
5458 {
@@ -2282,6 +2286,18 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, · 2227 unmodified lines
22822286 break;
22832287
22842288 case PP_PCIE:
2289+ soft_min_level = mask ? (ffs(mask) - 1) : 0;
2290+ soft_max_level = mask ? (fls(mask) - 1) : 0;
2291+ if (soft_min_level >= NUM_LINK_LEVELS ||
2292+ soft_max_level >= NUM_LINK_LEVELS)
2293+ return -EINVAL;
2294+
2295+ ret = smum_send_msg_to_smc_with_parameter(hwmgr,
2296+ PPSMC_MSG_SetMinLinkDpmByIndex, soft_min_level);
2297+ PP_ASSERT_WITH_CODE(!ret,
2298+ "Failed to set min link dpm level!",
2299+ return ret);
2300+
22852301 break;
22862302
22872303 default:
@@ -2758,9 +2774,14 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 470 unmodified lines
27582774 data->od8_settings.od8_settings_array;
27592775 OverDriveTable_t *od_table =
27602776 &(data->smc_state_table.overdrive_table);
2777+ struct phm_ppt_v3_information *pptable_information =
2778+ (struct phm_ppt_v3_information *)hwmgr->pptable;
2779+ PPTable_t *pptable = (PPTable_t *)pptable_information->smc_pptable;
2780+ struct amdgpu_device *adev = hwmgr->adev;
27612781 struct pp_clock_levels_with_latency clocks;
27622782 int i, now, size = 0;
27632783 int ret = 0;
2784+ uint32_t gen_speed, lane_width;
27642785
27652786 switch (type) {
27662787 case PP_SCLK:
@@ -2798,6 +2819,28 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 31 unmodified lines
27982819 break;
27992820
28002821 case PP_PCIE:
2822+ gen_speed = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) &
2823+ PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK)
2824+ >> PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT;
2825+ lane_width = (RREG32_PCIE(smnPCIE_LC_LINK_WIDTH_CNTL) &
2826+ PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK)
2827+ >> PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT;
2828+ for (i = 0; i < NUM_LINK_LEVELS; i++)
2829+ size += sprintf(buf + size, "%d: %s %s %dMhz %s\n", i,
2830+ (pptable->PcieGenSpeed[i] == 0) ? "2.5GT/s," :
2831+ (pptable->PcieGenSpeed[i] == 1) ? "5.0GT/s," :
2832+ (pptable->PcieGenSpeed[i] == 2) ? "8.0GT/s," :
2833+ (pptable->PcieGenSpeed[i] == 3) ? "16.0GT/s," : "",
2834+ (pptable->PcieLaneCount[i] == 1) ? "x1" :
2835+ (pptable->PcieLaneCount[i] == 2) ? "x2" :
2836+ (pptable->PcieLaneCount[i] == 3) ? "x4" :
2837+ (pptable->PcieLaneCount[i] == 4) ? "x8" :
2838+ (pptable->PcieLaneCount[i] == 5) ? "x12" :
2839+ (pptable->PcieLaneCount[i] == 6) ? "x16" : "",
2840+ pptable->LclkFreq[i],
2841+ (gen_speed == pptable->PcieGenSpeed[i]) &&
2842+ (lane_width == pptable->PcieLaneCount[i]) ?
2843+ "*" : "");
28012844 break;
28022845
28032846 case OD_SCLK:
drivers/gpu/drm/drm_atomic_state_helper.c+3−0
@@ -241,6 +241,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, · 240 unmodified lines
241241
242242 state->fence = NULL;
243243 state->commit = NULL;
244+ state->fb_damage_clips = NULL;
244245 }
245246 EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state);
246247
@@ -285,6 +286,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) · 38 unmodified lines
285286
286287 if (state->commit)
287288 drm_crtc_commit_put(state->commit);
289+
290+ drm_property_blob_put(state->fb_damage_clips);
288291 }
289292 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
290293
drivers/gpu/drm/drm_damage_helper.c+2−1
@@ -178,7 +178,7 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, · 177 unmodified lines
178178 state = drm_atomic_state_alloc(fb->dev);
179179 if (!state) {
180180 ret = -ENOMEM;
181− goto out;
181+ goto out_drop_locks;
182182 }
183183 state->acquire_ctx = &ctx;
184184
@@ -238,6 +238,7 @@ out: · 53 unmodified lines
238238 kfree(rects);
239239 drm_atomic_state_put(state);
240240
241+out_drop_locks:
241242 drm_modeset_drop_locks(&ctx);
242243 drm_modeset_acquire_fini(&ctx);
243244
drivers/gpu/drm/i915/gvt/cmd_parser.c+3−3
@@ -1900,11 +1900,11 @@ static struct cmd_info cmd_info[] = { · 1899 unmodified lines
19001900
19011901 {"MI_URB_CLEAR", OP_MI_URB_CLEAR, F_LEN_VAR, R_RCS, D_ALL, 0, 8, NULL},
19021902
1903− {"ME_SEMAPHORE_SIGNAL", OP_MI_SEMAPHORE_SIGNAL, F_LEN_VAR, R_ALL,
1903+ {"MI_SEMAPHORE_SIGNAL", OP_MI_SEMAPHORE_SIGNAL, F_LEN_VAR, R_ALL,
19041904 D_BDW_PLUS, 0, 8, NULL},
19051905
1906− {"ME_SEMAPHORE_WAIT", OP_MI_SEMAPHORE_WAIT, F_LEN_VAR, R_ALL, D_BDW_PLUS,
1907− ADDR_FIX_1(2), 8, cmd_handler_mi_semaphore_wait},
1906+ {"MI_SEMAPHORE_WAIT", OP_MI_SEMAPHORE_WAIT, F_LEN_VAR, R_ALL,
1907+ D_BDW_PLUS, ADDR_FIX_1(2), 8, cmd_handler_mi_semaphore_wait},
19081908
19091909 {"MI_STORE_DATA_IMM", OP_MI_STORE_DATA_IMM, F_LEN_VAR, R_ALL, D_BDW_PLUS,
19101910 ADDR_FIX_1(1), 10, cmd_handler_mi_store_data_imm},
drivers/gpu/drm/i915/gvt/gvt.c+1−1
@@ -437,7 +437,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) · 436 unmodified lines
437437
438438 ret = intel_gvt_debugfs_init(gvt);
439439 if (ret)
440− gvt_err("debugfs registeration failed, go on.\n");
440+ gvt_err("debugfs registration failed, go on.\n");
441441
442442 gvt_dbg_core("gvt device initialization is done\n");
443443 dev_priv->gvt = gvt;
drivers/gpu/drm/i915/gvt/gvt.h+4−0
@@ -159,6 +159,10 @@ struct intel_vgpu_submission { · 158 unmodified lines
159159 struct kmem_cache *workloads;
160160 atomic_t running_workload_num;
161161 struct i915_gem_context *shadow_ctx;
162+ union {
163+ u64 i915_context_pml4;
164+ u64 i915_context_pdps[GEN8_3LVL_PDPES];
165+ };
162166 DECLARE_BITMAP(shadow_ctx_desc_updated, I915_NUM_ENGINES);
163167 DECLARE_BITMAP(tlb_handle_pending, I915_NUM_ENGINES);
164168 void *ring_scan_buffer[I915_NUM_ENGINES];
drivers/gpu/drm/i915/gvt/handlers.c+1−0
@@ -475,6 +475,7 @@ static i915_reg_t force_nonpriv_white_list[] = { · 474 unmodified lines
475475 _MMIO(0x7704),
476476 _MMIO(0x7708),
477477 _MMIO(0x770c),
478+ _MMIO(0x83a8),
478479 _MMIO(0xb110),
479480 GEN8_L3SQCREG4,//_MMIO(0xb118)
480481 _MMIO(0xe100),
drivers/gpu/drm/i915/gvt/interrupt.c+1−1
@@ -126,7 +126,7 @@ static const char * const irq_name[INTEL_GVT_EVENT_MAX] = { · 125 unmodified lines
126126 [FDI_RX_INTERRUPTS_TRANSCODER_C] = "FDI RX Interrupts Combined C",
127127 [AUDIO_CP_CHANGE_TRANSCODER_C] = "Audio CP Change Transcoder C",
128128 [AUDIO_CP_REQUEST_TRANSCODER_C] = "Audio CP Request Transcoder C",
129− [ERR_AND_DBG] = "South Error and Debug Interupts Combined",
129+ [ERR_AND_DBG] = "South Error and Debug Interrupts Combined",
130130 [GMBUS] = "Gmbus",
131131 [SDVO_B_HOTPLUG] = "SDVO B hotplug",
132132 [CRT_HOTPLUG] = "CRT Hotplug",
drivers/gpu/drm/i915/gvt/scheduler.c+33−0
@@ -1079,6 +1079,21 @@ err: · 1078 unmodified lines
10791079 return ret;
10801080 }
10811081
1082+static void
1083+i915_context_ppgtt_root_restore(struct intel_vgpu_submission *s)
1084+{
1085+ struct i915_hw_ppgtt *i915_ppgtt = s->shadow_ctx->ppgtt;
1086+ int i;
1087+
1088+ if (i915_vm_is_48bit(&i915_ppgtt->vm))
1089+ px_dma(&i915_ppgtt->pml4) = s->i915_context_pml4;
1090+ else {
1091+ for (i = 0; i < GEN8_3LVL_PDPES; i++)
1092+ px_dma(i915_ppgtt->pdp.page_directory[i]) =
1093+ s->i915_context_pdps[i];
1094+ }
1095+}
1096+
10821097 /**
10831098 * intel_vgpu_clean_submission - free submission-related resource for vGPU
10841099 * @vgpu: a vGPU
@@ -1091,6 +1106,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu) · 6 unmodified lines
10911106 struct intel_vgpu_submission *s = &vgpu->submission;
10921107
10931108 intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
1109+ i915_context_ppgtt_root_restore(s);
10941110 i915_gem_context_put(s->shadow_ctx);
10951111 kmem_cache_destroy(s->workloads);
10961112 }
@@ -1116,6 +1132,21 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu, · 19 unmodified lines
11161132 s->ops->reset(vgpu, engine_mask);
11171133 }
11181134
1135+static void
1136+i915_context_ppgtt_root_save(struct intel_vgpu_submission *s)
1137+{
1138+ struct i915_hw_ppgtt *i915_ppgtt = s->shadow_ctx->ppgtt;
1139+ int i;
1140+
1141+ if (i915_vm_is_48bit(&i915_ppgtt->vm))
1142+ s->i915_context_pml4 = px_dma(&i915_ppgtt->pml4);
1143+ else {
1144+ for (i = 0; i < GEN8_3LVL_PDPES; i++)
1145+ s->i915_context_pdps[i] =
1146+ px_dma(i915_ppgtt->pdp.page_directory[i]);
1147+ }
1148+}
1149+
11191150 /**
11201151 * intel_vgpu_setup_submission - setup submission-related resource for vGPU
11211152 * @vgpu: a vGPU
@@ -1138,6 +1169,8 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu) · 16 unmodified lines
11381169 if (IS_ERR(s->shadow_ctx))
11391170 return PTR_ERR(s->shadow_ctx);
11401171
1172+ i915_context_ppgtt_root_save(s);
1173+
11411174 bitmap_zero(s->shadow_ctx_desc_updated, I915_NUM_ENGINES);
11421175
11431176 s->workloads = kmem_cache_create_usercopy("gvt-g_vgpu_workload",
drivers/gpu/drm/ttm/ttm_bo.c+17−16
@@ -77,38 +77,39 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place, · 76 unmodified lines
7777 return 0;
7878 }
7979
80−static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)
80+static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p,
81+ int mem_type)
8182 {
8283 struct ttm_mem_type_manager *man = &bdev->man[mem_type];
83− struct drm_printer p = drm_debug_printer(TTM_PFX);
8484
85− pr_err(" has_type: %d\n", man->has_type);
86− pr_err(" use_type: %d\n", man->use_type);
87− pr_err(" flags: 0x%08X\n", man->flags);
88− pr_err(" gpu_offset: 0x%08llX\n", man->gpu_offset);
89− pr_err(" size: %llu\n", man->size);
90− pr_err(" available_caching: 0x%08X\n", man->available_caching);
91− pr_err(" default_caching: 0x%08X\n", man->default_caching);
85+ drm_printf(p, " has_type: %d\n", man->has_type);
86+ drm_printf(p, " use_type: %d\n", man->use_type);
87+ drm_printf(p, " flags: 0x%08X\n", man->flags);
88+ drm_printf(p, " gpu_offset: 0x%08llX\n", man->gpu_offset);
89+ drm_printf(p, " size: %llu\n", man->size);
90+ drm_printf(p, " available_caching: 0x%08X\n", man->available_caching);
91+ drm_printf(p, " default_caching: 0x%08X\n", man->default_caching);
9292 if (mem_type != TTM_PL_SYSTEM)
93− (*man->func->debug)(man, &p);
93+ (*man->func->debug)(man, p);
9494 }
9595
9696 static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo,
9797 struct ttm_placement *placement)
9898 {
99+ struct drm_printer p = drm_debug_printer(TTM_PFX);
99100 int i, ret, mem_type;
100101
101− pr_err("No space for %p (%lu pages, %luK, %luM)\n",
102− bo, bo->mem.num_pages, bo->mem.size >> 10,
103− bo->mem.size >> 20);
102+ drm_printf(&p, "No space for %p (%lu pages, %luK, %luM)\n",
103+ bo, bo->mem.num_pages, bo->mem.size >> 10,
104+ bo->mem.size >> 20);
104105 for (i = 0; i < placement->num_placement; i++) {
105106 ret = ttm_mem_type_from_place(&placement->placement[i],
106107 &mem_type);
107108 if (ret)
108109 return;
109− pr_err(" placement[%d]=0x%08X (%d)\n",
110− i, placement->placement[i].flags, mem_type);
111− ttm_mem_type_debug(bo->bdev, mem_type);
110+ drm_printf(&p, " placement[%d]=0x%08X (%d)\n",
111+ i, placement->placement[i].flags, mem_type);
112+ ttm_mem_type_debug(bo->bdev, &p, mem_type);
112113 }
113114 }
114115

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t