History

Merge tag 'amd-drm-next-6.13-2024-11-15' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.13-2024-11-15: amdgpu: - Parition fixes - GFX 12 fixes - SR-IOV fixes - MES fixes - RAS fixes - GC queue handling fixes - VCN fixes - Add sysfs reset masks - Better error messages for P2P failurs - SMU fixes - Documentation updates - GFX11 enforce isolation updates - Display HPD fixes - PSR fixes - Panel replay fixes - DP MST fixes - USB4 fixes - Misc display fixes and cleanups - VRAM handling fix for APUs - NBIO fix amdkfd: - INIT_WORK fix - Refcount fix - KFD MES scheduling fixes drm/fourcc: - Add missing tiling mode Signed-off-by: Dave Airlie <airlied@redhat.com>

Dave Airlie committed 1 year ago

Commit ade5add2 parents 56b70bf 447a54a78 files · +1452 −243Browse files

Unified · Split

78 files
  1. Documentation/gpu/amdgpu/index.rst +1 −0
  2. Documentation/gpu/amdgpu/process-isolation.rst +59 −0
  3. drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 −0
  4. drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1 −1
  5. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +11 −2
  6. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +53 −0
  7. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +112 −18
  8. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 −0
  9. drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +40 −5
  10. drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.h +3 −0
  11. drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +37 −18
  12. drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +20 −3
  13. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 −1
  14. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +70 −7
  15. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 −0
  16. drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +41 −0
  17. drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3 −0
  18. drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +3 −0
  19. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +189 −0
  20. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +23 −0
  21. drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +43 −0
  22. drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.h +3 −0
  23. drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +47 −1
  24. drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +112 −19
  25. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 −0
  26. drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +20 −0
  27. drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6 −0
  28. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 −0
  29. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 −0
  30. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +13 −0
  31. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 −5
  32. drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +7 −0
  33. drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c +8 −0
  34. drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c +8 −0
  35. drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c +7 −0
  36. drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +26 −1
  37. drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +12 −1
  38. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +14 −2
  39. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h +3 −0
  40. drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c +6 −0
  41. drivers/gpu/drm/amd/amdgpu/nv.c +6 −6
  42. drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +9 −0
  43. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +18 −0
  44. drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +23 −0
  45. drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +18 −0
  46. drivers/gpu/drm/amd/amdgpu/soc15.c +2 −2
  47. drivers/gpu/drm/amd/amdgpu/soc21.c +6 −6
  48. drivers/gpu/drm/amd/amdgpu/soc24.c +1 −1
  49. drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +11 −4
  50. drivers/gpu/drm/amd/amdgpu/vi.c +4 −4
  51. drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 −1
  52. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +37 −3
  53. drivers/gpu/drm/amd/amdkfd/kfd_process.c +9 −10
  54. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +83 −57
  55. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 −1
  56. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +2 −3
  57. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq_params.h +1 −1
  58. drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 −4
  59. drivers/gpu/drm/amd/display/dc/core/dc_state.c +3 −0
  60. drivers/gpu/drm/amd/display/dc/dc.h +1 −1
  61. drivers/gpu/drm/amd/display/dc/dc_types.h +1 −0
  62. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +1 −1
  63. drivers/gpu/drm/amd/display/dc/dm_services.h +1 −1
  64. drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +9 −2
  65. drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +8 −5
  66. drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +5 −3
  67. drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +3 −13
  68. drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c +0 −13
  69. drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c +1 −1
  70. drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +1 −1
  71. drivers/gpu/drm/amd/display/dc/spl/dc_spl.c +11 −4
  72. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +29 −6
  73. drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +3 −1
  74. drivers/gpu/drm/amd/include/mes_v11_api_def.h +42 −1
  75. drivers/gpu/drm/amd/include/mes_v12_api_def.h +30 −1
  76. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +24 −0
  77. drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c +3 −2
  78. include/uapi/drm/drm_fourcc.h +1 −0
Documentation/gpu/amdgpu/index.rst+1−0
@@ -16,4 +16,5 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures. · 15 unmodified lines
1616 thermal
1717 driver-misc
1818 debugging
19+ process-isolation
1920 amdgpu-glossary
Documentation/gpu/amdgpu/process-isolation.rst+59−0
@@ -0,0 +1,59 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+
3+=========================
4+ AMDGPU Process Isolation
5+=========================
6+
7+The AMDGPU driver includes a feature that enables automatic process isolation on the graphics engine. This feature serializes access to the graphics engine and adds a cleaner shader which clears the Local Data Store (LDS) and General Purpose Registers (GPRs) between jobs. All processes using the GPU, including both graphics and compute workloads, are serialized when this feature is enabled. On GPUs that support partitionable graphics engines, this feature can be enabled on a per-partition basis.
8+
9+In addition, there is an interface to manually run the cleaner shader when the use of the GPU is complete. This may be preferable in some use cases, such as a single-user system where the login manager triggers the cleaner shader when the user logs out.
10+
11+Process Isolation
12+=================
13+
14+The `run_cleaner_shader` and `enforce_isolation` sysfs interfaces allow users to manually execute the cleaner shader and control the process isolation feature, respectively.
15+
16+Partition Handling
17+------------------
18+
19+The `enforce_isolation` file in sysfs can be used to enable process isolation and automatic shader cleanup between processes. On GPUs that support graphics engine partitioning, this can be enabled per partition. The partition and its current setting (0 disabled, 1 enabled) can be read from sysfs. On GPUs that do not support graphics engine partitioning, only a single partition will be present. Writing 1 to the partition position enables enforce isolation, writing 0 disables it.
20+
21+Example of enabling enforce isolation on a GPU with multiple partitions:
22+
23+.. code-block:: console
24+
25+ $ echo 1 0 1 0 > /sys/class/drm/card0/device/enforce_isolation
26+ $ cat /sys/class/drm/card0/device/enforce_isolation
27+ 1 0 1 0
28+
29+The output indicates that enforce isolation is enabled on zeroth and second parition and disabled on first and fourth parition.
30+
31+For devices with a single partition or those that do not support partitions, there will be only one element:
32+
33+.. code-block:: console
34+
35+ $ echo 1 > /sys/class/drm/card0/device/enforce_isolation
36+ $ cat /sys/class/drm/card0/device/enforce_isolation
37+ 1
38+
39+Cleaner Shader Execution
40+========================
41+
42+The driver can trigger a cleaner shader to clean up the LDS and GPR state on the graphics engine. When process isolation is enabled, this happens automatically between processes. In addition, there is a sysfs file to manually trigger cleaner shader execution.
43+
44+To manually trigger the execution of the cleaner shader, write `0` to the `run_cleaner_shader` sysfs file:
45+
46+.. code-block:: console
47+
48+ $ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader
49+
50+For multi-partition devices, you can specify the partition index when triggering the cleaner shader:
51+
52+.. code-block:: console
53+
54+ $ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 0
55+ $ echo 1 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 1
56+ $ echo 2 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 2
57+ # ... and so on for each partition
58+
59+This command initiates the cleaner shader, which will run and complete before any new tasks are scheduled on the GPU.
drivers/gpu/drm/amd/amdgpu/amdgpu.h+8−0
@@ -299,6 +299,12 @@ extern int amdgpu_wbrf; · 298 unmodified lines
299299 #define AMDGPU_RESET_VCE (1 << 13)
300300 #define AMDGPU_RESET_VCE1 (1 << 14)
301301
302+/* reset mask */
303+#define AMDGPU_RESET_TYPE_FULL (1 << 0) /* full adapter reset, mode1/mode2/BACO/etc. */
304+#define AMDGPU_RESET_TYPE_SOFT_RESET (1 << 1) /* IP level soft reset */
305+#define AMDGPU_RESET_TYPE_PER_QUEUE (1 << 2) /* per queue */
306+#define AMDGPU_RESET_TYPE_PER_PIPE (1 << 3) /* per pipe */
307+
302308 /* max cursor sizes (in pixels) */
303309 #define CIK_CURSOR_WIDTH 128
304310 #define CIK_CURSOR_HEIGHT 128
@@ -1464,6 +1470,8 @@ struct dma_fence *amdgpu_device_get_gang(struct amdgpu_device *adev); · 1159 unmodified lines
14641470 struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
14651471 struct dma_fence *gang);
14661472 bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev);
1473+ssize_t amdgpu_get_soft_full_reset_mask(struct amdgpu_ring *ring);
1474+ssize_t amdgpu_show_reset_mask(char *buf, uint32_t supported_reset);
14671475
14681476 /* atpx handler */
14691477 #if defined(CONFIG_VGA_SWITCHEROO)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c+1−1
@@ -158,7 +158,7 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_ · 157 unmodified lines
158158 return -EINVAL;
159159 }
160160
161− if (start + count >= max_count)
161+ if (start + count > max_count)
162162 return -EINVAL;
163163
164164 count = min_t(int, count, max_count);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+11−2
@@ -834,6 +834,9 @@ int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off, · 833 unmodified lines
834834 if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
835835 return -EINVAL;
836836
837+ if (!kiq_ring->sched.ready || adev->job_hang)
838+ return 0;
839+
837840 ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL);
838841 if (!ring_funcs)
839842 return -ENOMEM;
@@ -858,8 +861,14 @@ int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off, · 18 unmodified lines
858861
859862 kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0);
860863
861− if (kiq_ring->sched.ready && !adev->job_hang)
862− r = amdgpu_ring_test_helper(kiq_ring);
864+ /* Submit unmap queue packet */
865+ amdgpu_ring_commit(kiq_ring);
866+ /*
867+ * Ring test will do a basic scratch register change check. Just run
868+ * this to ensure that unmap queues that is submitted before got
869+ * processed successfully before returning.
870+ */
871+ r = amdgpu_ring_test_helper(kiq_ring);
863872
864873 spin_unlock(&kiq->ring_lock);
865874
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+53−0
@@ -4236,7 +4236,10 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 4235 unmodified lines
42364236 * for throttling interrupt) = 60 seconds.
42374237 */
42384238 ratelimit_state_init(&adev->throttling_logging_rs, (60 - 1) * HZ, 1);
4239+ ratelimit_state_init(&adev->virt.ras_telemetry_rs, 5 * HZ, 1);
4240+
42394241 ratelimit_set_flags(&adev->throttling_logging_rs, RATELIMIT_MSG_ON_RELEASE);
4242+ ratelimit_set_flags(&adev->virt.ras_telemetry_rs, RATELIMIT_MSG_ON_RELEASE);
42404243
42414244 /* Registers mapping */
42424245 /* TODO: block userspace mapping of io register */
@@ -5186,6 +5189,9 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · 943 unmodified lines
51865189 amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) ||
51875190 amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 3))
51885191 amdgpu_ras_resume(adev);
5192+
5193+ amdgpu_virt_ras_telemetry_post_reset(adev);
5194+
51895195 return 0;
51905196 }
51915197
@@ -6200,6 +6206,9 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev, · 1008 unmodified lines
62006206 bool p2p_access =
62016207 !adev->gmc.xgmi.connected_to_cpu &&
62026208 !(pci_p2pdma_distance(adev->pdev, peer_adev->dev, false) < 0);
6209+ if (!p2p_access)
6210+ dev_info(adev->dev, "PCIe P2P access from peer device %s is not supported by the chipset\n",
6211+ pci_name(peer_adev->pdev));
62036212
62046213 bool is_large_bar = adev->gmc.visible_vram_size &&
62056214 adev->gmc.real_vram_size == adev->gmc.visible_vram_size;
@@ -6715,3 +6724,47 @@ uint32_t amdgpu_device_wait_on_rreg(struct amdgpu_device *adev, · 509 unmodified lines
67156724 }
67166725 return ret;
67176726 }
6727+
6728+ssize_t amdgpu_get_soft_full_reset_mask(struct amdgpu_ring *ring)
6729+{
6730+ ssize_t size = 0;
6731+
6732+ if (!ring || !ring->adev)
6733+ return size;
6734+
6735+ if (amdgpu_device_should_recover_gpu(ring->adev))
6736+ size |= AMDGPU_RESET_TYPE_FULL;
6737+
6738+ if (unlikely(!ring->adev->debug_disable_soft_recovery) &&
6739+ !amdgpu_sriov_vf(ring->adev) && ring->funcs->soft_recovery)
6740+ size |= AMDGPU_RESET_TYPE_SOFT_RESET;
6741+
6742+ return size;
6743+}
6744+
6745+ssize_t amdgpu_show_reset_mask(char *buf, uint32_t supported_reset)
6746+{
6747+ ssize_t size = 0;
6748+
6749+ if (supported_reset == 0) {
6750+ size += sysfs_emit_at(buf, size, "unsupported");
6751+ size += sysfs_emit_at(buf, size, "\n");
6752+ return size;
6753+
6754+ }
6755+
6756+ if (supported_reset & AMDGPU_RESET_TYPE_SOFT_RESET)
6757+ size += sysfs_emit_at(buf, size, "soft ");
6758+
6759+ if (supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE)
6760+ size += sysfs_emit_at(buf, size, "queue ");
6761+
6762+ if (supported_reset & AMDGPU_RESET_TYPE_PER_PIPE)
6763+ size += sysfs_emit_at(buf, size, "pipe ");
6764+
6765+ if (supported_reset & AMDGPU_RESET_TYPE_FULL)
6766+ size += sysfs_emit_at(buf, size, "full ");
6767+
6768+ size += sysfs_emit_at(buf, size, "\n");
6769+ return size;
6770+}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c+112−18
@@ -515,6 +515,9 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id) · 514 unmodified lines
515515 if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
516516 return -EINVAL;
517517
518+ if (!kiq_ring->sched.ready || adev->job_hang || amdgpu_in_reset(adev))
519+ return 0;
520+
518521 spin_lock(&kiq->ring_lock);
519522 if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size *
520523 adev->gfx.num_compute_rings)) {
@@ -528,20 +531,15 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id) · 7 unmodified lines
528531 &adev->gfx.compute_ring[j],
529532 RESET_QUEUES, 0, 0);
530533 }
531−
532− /**
533− * This is workaround: only skip kiq_ring test
534− * during ras recovery in suspend stage for gfx9.4.3
534+ /* Submit unmap queue packet */
535+ amdgpu_ring_commit(kiq_ring);
536+ /*
537+ * Ring test will do a basic scratch register change check. Just run
538+ * this to ensure that unmap queues that is submitted before got
539+ * processed successfully before returning.
535540 */
536− if ((amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3) ||
537− amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4)) &&
538− amdgpu_ras_in_recovery(adev)) {
539− spin_unlock(&kiq->ring_lock);
540− return 0;
541− }
541+ r = amdgpu_ring_test_helper(kiq_ring);
542542
543− if (kiq_ring->sched.ready && !adev->job_hang)
544− r = amdgpu_ring_test_helper(kiq_ring);
545543 spin_unlock(&kiq->ring_lock);
546544
547545 return r;
@@ -569,8 +567,11 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id) · 21 unmodified lines
569567 if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
570568 return -EINVAL;
571569
572− spin_lock(&kiq->ring_lock);
570+ if (!adev->gfx.kiq[0].ring.sched.ready || adev->job_hang)
571+ return 0;
572+
573573 if (amdgpu_gfx_is_master_xcc(adev, xcc_id)) {
574+ spin_lock(&kiq->ring_lock);
574575 if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size *
575576 adev->gfx.num_gfx_rings)) {
576577 spin_unlock(&kiq->ring_lock);
@@ -583,11 +584,17 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id) · 6 unmodified lines
583584 &adev->gfx.gfx_ring[j],
584585 PREEMPT_QUEUES, 0, 0);
585586 }
586− }
587+ /* Submit unmap queue packet */
588+ amdgpu_ring_commit(kiq_ring);
587589
588− if (adev->gfx.kiq[0].ring.sched.ready && !adev->job_hang)
590+ /*
591+ * Ring test will do a basic scratch register change check.
592+ * Just run this to ensure that unmap queues that is submitted
593+ * before got processed successfully before returning.
594+ */
589595 r = amdgpu_ring_test_helper(kiq_ring);
590− spin_unlock(&kiq->ring_lock);
596+ spin_unlock(&kiq->ring_lock);
597+ }
591598
592599 return r;
593600 }
@@ -692,7 +699,13 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev, int xcc_id) · 98 unmodified lines
692699 kiq->pmf->kiq_map_queues(kiq_ring,
693700 &adev->gfx.compute_ring[j]);
694701 }
695−
702+ /* Submit map queue packet */
703+ amdgpu_ring_commit(kiq_ring);
704+ /*
705+ * Ring test will do a basic scratch register change check. Just run
706+ * this to ensure that map queues that is submitted before got
707+ * processed successfully before returning.
708+ */
696709 r = amdgpu_ring_test_helper(kiq_ring);
697710 spin_unlock(&kiq->ring_lock);
698711 if (r)
@@ -743,7 +756,13 @@ int amdgpu_gfx_enable_kgq(struct amdgpu_device *adev, int xcc_id) · 44 unmodified lines
743756 &adev->gfx.gfx_ring[j]);
744757 }
745758 }
746−
759+ /* Submit map queue packet */
760+ amdgpu_ring_commit(kiq_ring);
761+ /*
762+ * Ring test will do a basic scratch register change check. Just run
763+ * this to ensure that map queues that is submitted before got
764+ * processed successfully before returning.
765+ */
747766 r = amdgpu_ring_test_helper(kiq_ring);
748767 spin_unlock(&kiq->ring_lock);
749768 if (r)
@@ -885,6 +904,9 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *r · 135 unmodified lines
885904 if (r)
886905 return r;
887906
907+ if (amdgpu_sriov_vf(adev))
908+ return r;
909+
888910 if (adev->gfx.cp_ecc_error_irq.funcs) {
889911 r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0);
890912 if (r)
@@ -1576,9 +1598,11 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev, · 685 unmodified lines
15761598 if (adev->enforce_isolation[i] && !partition_values[i]) {
15771599 /* Going from enabled to disabled */
15781600 amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(i));
1601+ amdgpu_mes_set_enforce_isolation(adev, i, false);
15791602 } else if (!adev->enforce_isolation[i] && partition_values[i]) {
15801603 /* Going from disabled to enabled */
15811604 amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i));
1605+ amdgpu_mes_set_enforce_isolation(adev, i, true);
15821606 }
15831607 adev->enforce_isolation[i] = partition_values[i];
15841608 }
@@ -1588,6 +1612,32 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev, · 3 unmodified lines
15881612 return count;
15891613 }
15901614
1615+static ssize_t amdgpu_gfx_get_gfx_reset_mask(struct device *dev,
1616+ struct device_attribute *attr,
1617+ char *buf)
1618+{
1619+ struct drm_device *ddev = dev_get_drvdata(dev);
1620+ struct amdgpu_device *adev = drm_to_adev(ddev);
1621+
1622+ if (!adev)
1623+ return -ENODEV;
1624+
1625+ return amdgpu_show_reset_mask(buf, adev->gfx.gfx_supported_reset);
1626+}
1627+
1628+static ssize_t amdgpu_gfx_get_compute_reset_mask(struct device *dev,
1629+ struct device_attribute *attr,
1630+ char *buf)
1631+{
1632+ struct drm_device *ddev = dev_get_drvdata(dev);
1633+ struct amdgpu_device *adev = drm_to_adev(ddev);
1634+
1635+ if (!adev)
1636+ return -ENODEV;
1637+
1638+ return amdgpu_show_reset_mask(buf, adev->gfx.compute_supported_reset);
1639+}
1640+
15911641 static DEVICE_ATTR(run_cleaner_shader, 0200,
15921642 NULL, amdgpu_gfx_set_run_cleaner_shader);
15931643
@@ -1601,6 +1651,11 @@ static DEVICE_ATTR(current_compute_partition, 0644, · 7 unmodified lines
16011651
16021652 static DEVICE_ATTR(available_compute_partition, 0444,
16031653 amdgpu_gfx_get_available_compute_partition, NULL);
1654+static DEVICE_ATTR(gfx_reset_mask, 0444,
1655+ amdgpu_gfx_get_gfx_reset_mask, NULL);
1656+
1657+static DEVICE_ATTR(compute_reset_mask, 0444,
1658+ amdgpu_gfx_get_compute_reset_mask, NULL);
16041659
16051660 static int amdgpu_gfx_sysfs_xcp_init(struct amdgpu_device *adev)
16061661 {
@@ -1666,6 +1721,40 @@ static void amdgpu_gfx_sysfs_isolation_shader_fini(struct amdgpu_device *adev) · 59 unmodified lines
16661721 device_remove_file(adev->dev, &dev_attr_run_cleaner_shader);
16671722 }
16681723
1724+static int amdgpu_gfx_sysfs_reset_mask_init(struct amdgpu_device *adev)
1725+{
1726+ int r = 0;
1727+
1728+ if (!amdgpu_gpu_recovery)
1729+ return r;
1730+
1731+ if (adev->gfx.num_gfx_rings) {
1732+ r = device_create_file(adev->dev, &dev_attr_gfx_reset_mask);
1733+ if (r)
1734+ return r;
1735+ }
1736+
1737+ if (adev->gfx.num_compute_rings) {
1738+ r = device_create_file(adev->dev, &dev_attr_compute_reset_mask);
1739+ if (r)
1740+ return r;
1741+ }
1742+
1743+ return r;
1744+}
1745+
1746+static void amdgpu_gfx_sysfs_reset_mask_fini(struct amdgpu_device *adev)
1747+{
1748+ if (!amdgpu_gpu_recovery)
1749+ return;
1750+
1751+ if (adev->gfx.num_gfx_rings)
1752+ device_remove_file(adev->dev, &dev_attr_gfx_reset_mask);
1753+
1754+ if (adev->gfx.num_compute_rings)
1755+ device_remove_file(adev->dev, &dev_attr_compute_reset_mask);
1756+}
1757+
16691758 int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)
16701759 {
16711760 int r;
@@ -1680,6 +1769,10 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev) · 8 unmodified lines
16801769 if (r)
16811770 dev_err(adev->dev, "failed to create isolation sysfs files");
16821771
1772+ r = amdgpu_gfx_sysfs_reset_mask_init(adev);
1773+ if (r)
1774+ dev_err(adev->dev, "failed to create reset mask sysfs files");
1775+
16831776 return r;
16841777 }
16851778
@@ -1687,6 +1780,7 @@ void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev) · 1 unmodified line
16871780 {
16881781 amdgpu_gfx_sysfs_xcp_fini(adev);
16891782 amdgpu_gfx_sysfs_isolation_shader_fini(adev);
1783+ amdgpu_gfx_sysfs_reset_mask_fini(adev);
16901784 }
16911785
16921786 int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h+2−0
@@ -424,6 +424,8 @@ struct amdgpu_gfx { · 423 unmodified lines
424424 /* reset mask */
425425 uint32_t grbm_soft_reset;
426426 uint32_t srbm_soft_reset;
427+ uint32_t gfx_supported_reset;
428+ uint32_t compute_supported_reset;
427429
428430 /* gfx off */
429431 bool gfx_off_state; /* true: enabled, false: disabled */
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c+40−5
@@ -47,7 +47,7 @@ int amdgpu_jpeg_sw_init(struct amdgpu_device *adev) · 46 unmodified lines
4747 adev->jpeg.indirect_sram = true;
4848
4949 for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) {
50− if (adev->jpeg.harvest_config & (1 << i))
50+ if (adev->jpeg.harvest_config & (1U << i))
5151 continue;
5252
5353 if (adev->jpeg.indirect_sram) {
@@ -73,7 +73,7 @@ int amdgpu_jpeg_sw_fini(struct amdgpu_device *adev) · 19 unmodified lines
7373 int i, j;
7474
7575 for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
76− if (adev->jpeg.harvest_config & (1 << i))
76+ if (adev->jpeg.harvest_config & (1U << i))
7777 continue;
7878
7979 amdgpu_bo_free_kernel(
@@ -110,7 +110,7 @@ static void amdgpu_jpeg_idle_work_handler(struct work_struct *work) · 30 unmodified lines
110110 unsigned int i, j;
111111
112112 for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
113− if (adev->jpeg.harvest_config & (1 << i))
113+ if (adev->jpeg.harvest_config & (1U << i))
114114 continue;
115115
116116 for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j)
@@ -357,7 +357,7 @@ static int amdgpu_debugfs_jpeg_sched_mask_set(void *data, u64 val) · 240 unmodified lines
357357 if (!adev)
358358 return -ENODEV;
359359
360− mask = (1 << (adev->jpeg.num_jpeg_inst * adev->jpeg.num_jpeg_rings)) - 1;
360+ mask = (1ULL << (adev->jpeg.num_jpeg_inst * adev->jpeg.num_jpeg_rings)) - 1;
361361 if ((val & mask) == 0)
362362 return -EINVAL;
363363
@@ -388,7 +388,7 @@ static int amdgpu_debugfs_jpeg_sched_mask_get(void *data, u64 *val) · 24 unmodified lines
388388 for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j) {
389389 ring = &adev->jpeg.inst[i].ring_dec[j];
390390 if (ring->sched.ready)
391− mask |= 1 << ((i * adev->jpeg.num_jpeg_rings) + j);
391+ mask |= 1ULL << ((i * adev->jpeg.num_jpeg_rings) + j);
392392 }
393393 }
394394 *val = mask;
@@ -415,3 +415,38 @@ void amdgpu_debugfs_jpeg_sched_mask_init(struct amdgpu_device *adev) · 20 unmodified lines
415415 &amdgpu_debugfs_jpeg_sched_mask_fops);
416416 #endif
417417 }
418+
419+static ssize_t amdgpu_get_jpeg_reset_mask(struct device *dev,
420+ struct device_attribute *attr,
421+ char *buf)
422+{
423+ struct drm_device *ddev = dev_get_drvdata(dev);
424+ struct amdgpu_device *adev = drm_to_adev(ddev);
425+
426+ if (!adev)
427+ return -ENODEV;
428+
429+ return amdgpu_show_reset_mask(buf, adev->jpeg.supported_reset);
430+}
431+
432+static DEVICE_ATTR(jpeg_reset_mask, 0444,
433+ amdgpu_get_jpeg_reset_mask, NULL);
434+
435+int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)
436+{
437+ int r = 0;
438+
439+ if (adev->jpeg.num_jpeg_inst) {
440+ r = device_create_file(adev->dev, &dev_attr_jpeg_reset_mask);
441+ if (r)
442+ return r;
443+ }
444+
445+ return r;
446+}
447+
448+void amdgpu_jpeg_sysfs_reset_mask_fini(struct amdgpu_device *adev)
449+{
450+ if (adev->jpeg.num_jpeg_inst)
451+ device_remove_file(adev->dev, &dev_attr_jpeg_reset_mask);
452+}
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.h+3−0
@@ -128,6 +128,7 @@ struct amdgpu_jpeg { · 127 unmodified lines
128128 uint16_t inst_mask;
129129 uint8_t num_inst_per_aid;
130130 bool indirect_sram;
131+ uint32_t supported_reset;
131132 };
132133
133134 int amdgpu_jpeg_sw_init(struct amdgpu_device *adev);
@@ -150,5 +151,7 @@ int amdgpu_jpeg_ras_sw_init(struct amdgpu_device *adev); · 16 unmodified lines
150151 int amdgpu_jpeg_psp_update_sram(struct amdgpu_device *adev, int inst_idx,
151152 enum AMDGPU_UCODE_ID ucode_id);
152153 void amdgpu_debugfs_jpeg_sched_mask_init(struct amdgpu_device *adev);
154+int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev);
155+void amdgpu_jpeg_sysfs_reset_mask_fini(struct amdgpu_device *adev);
153156
154157 #endif /*__AMDGPU_JPEG_H__*/
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c+37−18
@@ -104,7 +104,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev) · 103 unmodified lines
104104 return 0;
105105
106106 r = amdgpu_bo_create_kernel(adev, adev->mes.event_log_size, PAGE_SIZE,
107− AMDGPU_GEM_DOMAIN_GTT,
107+ AMDGPU_GEM_DOMAIN_VRAM,
108108 &adev->mes.event_log_gpu_obj,
109109 &adev->mes.event_log_gpu_addr,
110110 &adev->mes.event_log_cpu_addr);
@@ -192,17 +192,6 @@ int amdgpu_mes_init(struct amdgpu_device *adev) · 81 unmodified lines
192192 (uint64_t *)&adev->wb.wb[adev->mes.query_status_fence_offs[i]];
193193 }
194194
195− r = amdgpu_device_wb_get(adev, &adev->mes.read_val_offs);
196− if (r) {
197− dev_err(adev->dev,
198− "(%d) read_val_offs alloc failed\n", r);
199− goto error;
200− }
201− adev->mes.read_val_gpu_addr =
202− adev->wb.gpu_addr + (adev->mes.read_val_offs * 4);
203− adev->mes.read_val_ptr =
204− (uint32_t *)&adev->wb.wb[adev->mes.read_val_offs];
205−
206195 r = amdgpu_mes_doorbell_init(adev);
207196 if (r)
208197 goto error;
@@ -223,8 +212,6 @@ error: · 14 unmodified lines
223212 amdgpu_device_wb_free(adev,
224213 adev->mes.query_status_fence_offs[i]);
225214 }
226− if (adev->mes.read_val_ptr)
227− amdgpu_device_wb_free(adev, adev->mes.read_val_offs);
228215
229216 idr_destroy(&adev->mes.pasid_idr);
230217 idr_destroy(&adev->mes.gang_id_idr);
@@ -249,8 +236,6 @@ void amdgpu_mes_fini(struct amdgpu_device *adev) · 18 unmodified lines
249236 amdgpu_device_wb_free(adev,
250237 adev->mes.query_status_fence_offs[i]);
251238 }
252− if (adev->mes.read_val_ptr)
253− amdgpu_device_wb_free(adev, adev->mes.read_val_offs);
254239
255240 amdgpu_mes_doorbell_free(adev);
256241
@@ -921,10 +906,19 @@ uint32_t amdgpu_mes_rreg(struct amdgpu_device *adev, uint32_t reg) · 664 unmodified lines
921906 {
922907 struct mes_misc_op_input op_input;
923908 int r, val = 0;
909+ uint32_t addr_offset = 0;
910+ uint64_t read_val_gpu_addr;
911+ uint32_t *read_val_ptr;
924912
913+ if (amdgpu_device_wb_get(adev, &addr_offset)) {
914+ DRM_ERROR("critical bug! too many mes readers\n");
915+ goto error;
916+ }
917+ read_val_gpu_addr = adev->wb.gpu_addr + (addr_offset * 4);
918+ read_val_ptr = (uint32_t *)&adev->wb.wb[addr_offset];
925919 op_input.op = MES_MISC_OP_READ_REG;
926920 op_input.read_reg.reg_offset = reg;
927− op_input.read_reg.buffer_addr = adev->mes.read_val_gpu_addr;
921+ op_input.read_reg.buffer_addr = read_val_gpu_addr;
928922
929923 if (!adev->mes.funcs->misc_op) {
930924 DRM_ERROR("mes rreg is not supported!\n");
@@ -935,9 +929,11 @@ uint32_t amdgpu_mes_rreg(struct amdgpu_device *adev, uint32_t reg) · 4 unmodified lines
935929 if (r)
936930 DRM_ERROR("failed to read reg (0x%x)\n", reg);
937931 else
938− val = *(adev->mes.read_val_ptr);
932+ val = *(read_val_ptr);
939933
940934 error:
935+ if (addr_offset)
936+ amdgpu_device_wb_free(adev, addr_offset);
941937 return val;
942938 }
943939
@@ -1682,6 +1678,29 @@ bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev) · 738 unmodified lines
16821678 return is_supported;
16831679 }
16841680
1681+/* Fix me -- node_id is used to identify the correct MES instances in the future */
1682+int amdgpu_mes_set_enforce_isolation(struct amdgpu_device *adev, uint32_t node_id, bool enable)
1683+{
1684+ struct mes_misc_op_input op_input = {0};
1685+ int r;
1686+
1687+ op_input.op = MES_MISC_OP_CHANGE_CONFIG;
1688+ op_input.change_config.option.limit_single_process = enable ? 1 : 0;
1689+
1690+ if (!adev->mes.funcs->misc_op) {
1691+ dev_err(adev->dev, "mes change config is not supported!\n");
1692+ r = -EINVAL;
1693+ goto error;
1694+ }
1695+
1696+ r = adev->mes.funcs->misc_op(&adev->mes, &op_input);
1697+ if (r)
1698+ dev_err(adev->dev, "failed to change_config.\n");
1699+
1700+error:
1701+ return r;
1702+}
1703+
16851704 #if defined(CONFIG_DEBUG_FS)
16861705
16871706 static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h+20−3
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #define AMDGPU_MES_VERSION_MASK 0x00000fff
4141 #define AMDGPU_MES_API_VERSION_MASK 0x00fff000
4242 #define AMDGPU_MES_FEAT_VERSION_MASK 0xff000000
43+#define AMDGPU_MES_MSCRATCH_SIZE 0x8000
4344
4445 enum amdgpu_mes_priority_level {
4546 AMDGPU_MES_PRIORITY_LEVEL_LOW = 0,
@@ -120,9 +121,6 @@ struct amdgpu_mes { · 74 unmodified lines
120121 uint32_t query_status_fence_offs[AMDGPU_MAX_MES_PIPES];
121122 uint64_t query_status_fence_gpu_addr[AMDGPU_MAX_MES_PIPES];
122123 uint64_t *query_status_fence_ptr[AMDGPU_MAX_MES_PIPES];
123− uint32_t read_val_offs;
124− uint64_t read_val_gpu_addr;
125− uint32_t *read_val_ptr;
126124
127125 uint32_t saved_flags;
128126
@@ -311,6 +309,7 @@ enum mes_misc_opcode { · 182 unmodified lines
311309 MES_MISC_OP_WRM_REG_WAIT,
312310 MES_MISC_OP_WRM_REG_WR_WAIT,
313311 MES_MISC_OP_SET_SHADER_DEBUGGER,
312+ MES_MISC_OP_CHANGE_CONFIG,
314313 };
315314
316315 struct mes_misc_op_input {
@@ -349,6 +348,21 @@ struct mes_misc_op_input { · 32 unmodified lines
349348 uint32_t tcp_watch_cntl[4];
350349 uint32_t trap_en;
351350 } set_shader_debugger;
351+
352+ struct {
353+ union {
354+ struct {
355+ uint32_t limit_single_process : 1;
356+ uint32_t enable_hws_logging_buffer : 1;
357+ uint32_t reserved : 30;
358+ };
359+ uint32_t all;
360+ } option;
361+ struct {
362+ uint32_t tdr_level;
363+ uint32_t tdr_delay;
364+ } tdr_config;
365+ } change_config;
352366 };
353367 };
354368
@@ -519,4 +533,7 @@ static inline void amdgpu_mes_unlock(struct amdgpu_mes *mes) · 164 unmodified lines
519533 }
520534
521535 bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev);
536+
537+int amdgpu_mes_set_enforce_isolation(struct amdgpu_device *adev, uint32_t node_id, bool enable);
538+
522539 #endif /* __AMDGPU_MES_H__ */
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+2−1
@@ -162,7 +162,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) · 161 unmodified lines
162162 * When GTT is just an alternative to VRAM make sure that we
163163 * only use it as fallback and still try to fill up VRAM first.
164164 */
165− if (domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM)
165+ if (domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM &&
166+ !(adev->flags & AMD_IS_APU))
166167 places[c].flags |= TTM_PL_FLAG_FALLBACK;
167168 c++;
168169 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+70−7
@@ -1214,6 +1214,42 @@ static void amdgpu_ras_error_generate_report(struct amdgpu_device *adev, · 1213 unmodified lines
12141214 }
12151215 }
12161216
1217+static void amdgpu_ras_virt_error_generate_report(struct amdgpu_device *adev,
1218+ struct ras_query_if *query_if,
1219+ struct ras_err_data *err_data,
1220+ struct ras_query_context *qctx)
1221+{
1222+ unsigned long new_ue, new_ce, new_de;
1223+ struct ras_manager *obj = amdgpu_ras_find_obj(adev, &query_if->head);
1224+ const char *blk_name = get_ras_block_str(&query_if->head);
1225+ u64 event_id = qctx->evid.event_id;
1226+
1227+ new_ce = err_data->ce_count - obj->err_data.ce_count;
1228+ new_ue = err_data->ue_count - obj->err_data.ue_count;
1229+ new_de = err_data->de_count - obj->err_data.de_count;
1230+
1231+ if (new_ce) {
1232+ RAS_EVENT_LOG(adev, event_id, "%lu correctable hardware errors "
1233+ "detected in %s block\n",
1234+ new_ce,
1235+ blk_name);
1236+ }
1237+
1238+ if (new_ue) {
1239+ RAS_EVENT_LOG(adev, event_id, "%lu uncorrectable hardware errors "
1240+ "detected in %s block\n",
1241+ new_ue,
1242+ blk_name);
1243+ }
1244+
1245+ if (new_de) {
1246+ RAS_EVENT_LOG(adev, event_id, "%lu deferred hardware errors "
1247+ "detected in %s block\n",
1248+ new_de,
1249+ blk_name);
1250+ }
1251+}
1252+
12171253 static void amdgpu_rasmgr_error_data_statistic_update(struct ras_manager *obj, struct ras_err_data *err_data)
12181254 {
12191255 struct ras_err_node *err_node;
@@ -1237,6 +1273,15 @@ static void amdgpu_rasmgr_error_data_statistic_update(struct ras_manager *obj, s · 17 unmodified lines
12371273 }
12381274 }
12391275
1276+static void amdgpu_ras_mgr_virt_error_data_statistics_update(struct ras_manager *obj,
1277+ struct ras_err_data *err_data)
1278+{
1279+ /* Host reports absolute counts */
1280+ obj->err_data.ue_count = err_data->ue_count;
1281+ obj->err_data.ce_count = err_data->ce_count;
1282+ obj->err_data.de_count = err_data->de_count;
1283+}
1284+
12401285 static struct ras_manager *get_ras_manager(struct amdgpu_device *adev, enum amdgpu_ras_block blk)
12411286 {
12421287 struct ras_common_if head;
@@ -1323,7 +1368,9 @@ static int amdgpu_ras_query_error_status_helper(struct amdgpu_device *adev, · 80 unmodified lines
13231368 if (error_query_mode == AMDGPU_RAS_INVALID_ERROR_QUERY)
13241369 return -EINVAL;
13251370
1326− if (error_query_mode == AMDGPU_RAS_DIRECT_ERROR_QUERY) {
1371+ if (error_query_mode == AMDGPU_RAS_VIRT_ERROR_COUNT_QUERY) {
1372+ return amdgpu_virt_req_ras_err_count(adev, blk, err_data);
1373+ } else if (error_query_mode == AMDGPU_RAS_DIRECT_ERROR_QUERY) {
13271374 if (info->head.block == AMDGPU_RAS_BLOCK__UMC) {
13281375 amdgpu_ras_get_ecc_info(adev, err_data);
13291376 } else {
@@ -1405,14 +1452,22 @@ static int amdgpu_ras_query_error_status_with_event(struct amdgpu_device *adev, · 75 unmodified lines
14051452 if (ret)
14061453 goto out_fini_err_data;
14071454
1408− amdgpu_rasmgr_error_data_statistic_update(obj, &err_data);
1455+ if (error_query_mode != AMDGPU_RAS_VIRT_ERROR_COUNT_QUERY) {
1456+ amdgpu_rasmgr_error_data_statistic_update(obj, &err_data);
1457+ amdgpu_ras_error_generate_report(adev, info, &err_data, &qctx);
1458+ } else {
1459+ /* Host provides absolute error counts. First generate the report
1460+ * using the previous VF internal count against new host count.
1461+ * Then Update VF internal count.
1462+ */
1463+ amdgpu_ras_virt_error_generate_report(adev, info, &err_data, &qctx);
1464+ amdgpu_ras_mgr_virt_error_data_statistics_update(obj, &err_data);
1465+ }
14091466
14101467 info->ue_count = obj->err_data.ue_count;
14111468 info->ce_count = obj->err_data.ce_count;
14121469 info->de_count = obj->err_data.de_count;
14131470
1414− amdgpu_ras_error_generate_report(adev, info, &err_data, &qctx);
1415−
14161471 out_fini_err_data:
14171472 amdgpu_ras_error_data_fini(&err_data);
14181473
@@ -3453,6 +3508,11 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev) · 2034 unmodified lines
34533508 if (!amdgpu_ras_asic_supported(adev))
34543509 return;
34553510
3511+ if (amdgpu_sriov_vf(adev)) {
3512+ if (amdgpu_virt_get_ras_capability(adev))
3513+ goto init_ras_enabled_flag;
3514+ }
3515+
34563516 /* query ras capability from psp */
34573517 if (amdgpu_psp_get_ras_capability(&adev->psp))
34583518 goto init_ras_enabled_flag;
@@ -3925,7 +3985,7 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev) · 466 unmodified lines
39253985 }
39263986
39273987 /* Guest side doesn't need init ras feature */
3928− if (amdgpu_sriov_vf(adev))
3988+ if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_ras_telemetry_en(adev))
39293989 return 0;
39303990
39313991 list_for_each_entry_safe(node, tmp, &adev->ras_list, node) {
@@ -4392,11 +4452,14 @@ bool amdgpu_ras_get_error_query_mode(struct amdgpu_device *adev, · 460 unmodified lines
43924452 return false;
43934453 }
43944454
4395− if ((smu_funcs && smu_funcs->set_debug_mode) || (mca_funcs && mca_funcs->mca_set_debug_mode))
4455+ if (amdgpu_sriov_vf(adev)) {
4456+ *error_query_mode = AMDGPU_RAS_VIRT_ERROR_COUNT_QUERY;
4457+ } else if ((smu_funcs && smu_funcs->set_debug_mode) || (mca_funcs && mca_funcs->mca_set_debug_mode)) {
43964458 *error_query_mode =
43974459 (con->is_aca_debug_mode) ? AMDGPU_RAS_DIRECT_ERROR_QUERY : AMDGPU_RAS_FIRMWARE_ERROR_QUERY;
4398− else
4460+ } else {
43994461 *error_query_mode = AMDGPU_RAS_DIRECT_ERROR_QUERY;
4462+ }
44004463
44014464 return true;
44024465 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h+1−0
@@ -365,6 +365,7 @@ enum amdgpu_ras_error_query_mode { · 364 unmodified lines
365365 AMDGPU_RAS_INVALID_ERROR_QUERY = 0,
366366 AMDGPU_RAS_DIRECT_ERROR_QUERY = 1,
367367 AMDGPU_RAS_FIRMWARE_ERROR_QUERY = 2,
368+ AMDGPU_RAS_VIRT_ERROR_COUNT_QUERY = 3,
368369 };
369370
370371 /* ras error status reisger fields */
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c+41−0
@@ -413,3 +413,44 @@ void amdgpu_debugfs_sdma_sched_mask_init(struct amdgpu_device *adev) · 412 unmodified lines
413413 &amdgpu_debugfs_sdma_sched_mask_fops);
414414 #endif
415415 }
416+
417+static ssize_t amdgpu_get_sdma_reset_mask(struct device *dev,
418+ struct device_attribute *attr,
419+ char *buf)
420+{
421+ struct drm_device *ddev = dev_get_drvdata(dev);
422+ struct amdgpu_device *adev = drm_to_adev(ddev);
423+
424+ if (!adev)
425+ return -ENODEV;
426+
427+ return amdgpu_show_reset_mask(buf, adev->sdma.supported_reset);
428+}
429+
430+static DEVICE_ATTR(sdma_reset_mask, 0444,
431+ amdgpu_get_sdma_reset_mask, NULL);
432+
433+int amdgpu_sdma_sysfs_reset_mask_init(struct amdgpu_device *adev)
434+{
435+ int r = 0;
436+
437+ if (!amdgpu_gpu_recovery)
438+ return r;
439+
440+ if (adev->sdma.num_instances) {
441+ r = device_create_file(adev->dev, &dev_attr_sdma_reset_mask);
442+ if (r)
443+ return r;
444+ }
445+
446+ return r;
447+}
448+
449+void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)
450+{
451+ if (!amdgpu_gpu_recovery)
452+ return;
453+
454+ if (adev->sdma.num_instances)
455+ device_remove_file(adev->dev, &dev_attr_sdma_reset_mask);
456+}
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h+3−0
@@ -116,6 +116,7 @@ struct amdgpu_sdma { · 115 unmodified lines
116116 struct ras_common_if *ras_if;
117117 struct amdgpu_sdma_ras *ras;
118118 uint32_t *ip_dump;
119+ uint32_t supported_reset;
119120 };
120121
121122 /*
@@ -176,4 +177,6 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, · 54 unmodified lines
176177 bool duplicate);
177178 int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev);
178179 void amdgpu_debugfs_sdma_sched_mask_init(struct amdgpu_device *adev);
180+int amdgpu_sdma_sysfs_reset_mask_init(struct amdgpu_device *adev);
181+void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev);
179182 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c+3−0
@@ -318,6 +318,9 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *r · 317 unmodified lines
318318 if (r)
319319 return r;
320320
321+ if (amdgpu_sriov_vf(adev))
322+ return r;
323+
321324 if (amdgpu_ras_is_supported(adev, ras_block->block)) {
322325 r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0);
323326 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c+189−0
@@ -523,6 +523,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) · 522 unmodified lines
523523
524524 adev->unique_id =
525525 ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid;
526+ adev->virt.ras_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_en_caps.all;
527+ adev->virt.ras_telemetry_en_caps.all =
528+ ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_telemetry_en_caps.all;
526529 break;
527530 default:
528531 dev_err(adev->dev, "invalid pf2vf version: 0x%x\n", pf2vf_info->version);
@@ -703,6 +706,8 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev) · 174 unmodified lines
703706 adev->virt.fw_reserve.p_vf2pf =
704707 (struct amd_sriov_msg_vf2pf_info_header *)
705708 (adev->mman.fw_vram_usage_va + (AMD_SRIOV_MSG_VF2PF_OFFSET_KB << 10));
709+ adev->virt.fw_reserve.ras_telemetry =
710+ (adev->mman.fw_vram_usage_va + (AMD_SRIOV_MSG_RAS_TELEMETRY_OFFSET_KB << 10));
706711 } else if (adev->mman.drv_vram_usage_va) {
707712 adev->virt.fw_reserve.p_pf2vf =
708713 (struct amd_sriov_msg_pf2vf_info_header *)
@@ -710,6 +715,8 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev) · 1 unmodified line
710715 adev->virt.fw_reserve.p_vf2pf =
711716 (struct amd_sriov_msg_vf2pf_info_header *)
712717 (adev->mman.drv_vram_usage_va + (AMD_SRIOV_MSG_VF2PF_OFFSET_KB << 10));
718+ adev->virt.fw_reserve.ras_telemetry =
719+ (adev->mman.drv_vram_usage_va + (AMD_SRIOV_MSG_RAS_TELEMETRY_OFFSET_KB << 10));
713720 }
714721
715722 amdgpu_virt_read_pf2vf_data(adev);
@@ -1144,3 +1151,185 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev) · 428 unmodified lines
11441151
11451152 return xnack_mode;
11461153 }
1154+
1155+bool amdgpu_virt_get_ras_capability(struct amdgpu_device *adev)
1156+{
1157+ struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
1158+
1159+ if (!amdgpu_sriov_ras_caps_en(adev))
1160+ return false;
1161+
1162+ if (adev->virt.ras_en_caps.bits.block_umc)
1163+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__UMC);
1164+ if (adev->virt.ras_en_caps.bits.block_sdma)
1165+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__SDMA);
1166+ if (adev->virt.ras_en_caps.bits.block_gfx)
1167+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__GFX);
1168+ if (adev->virt.ras_en_caps.bits.block_mmhub)
1169+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__MMHUB);
1170+ if (adev->virt.ras_en_caps.bits.block_athub)
1171+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__ATHUB);
1172+ if (adev->virt.ras_en_caps.bits.block_pcie_bif)
1173+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__PCIE_BIF);
1174+ if (adev->virt.ras_en_caps.bits.block_hdp)
1175+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__HDP);
1176+ if (adev->virt.ras_en_caps.bits.block_xgmi_wafl)
1177+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__XGMI_WAFL);
1178+ if (adev->virt.ras_en_caps.bits.block_df)
1179+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__DF);
1180+ if (adev->virt.ras_en_caps.bits.block_smn)
1181+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__SMN);
1182+ if (adev->virt.ras_en_caps.bits.block_sem)
1183+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__SEM);
1184+ if (adev->virt.ras_en_caps.bits.block_mp0)
1185+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__MP0);
1186+ if (adev->virt.ras_en_caps.bits.block_mp1)
1187+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__MP1);
1188+ if (adev->virt.ras_en_caps.bits.block_fuse)
1189+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__FUSE);
1190+ if (adev->virt.ras_en_caps.bits.block_mca)
1191+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__MCA);
1192+ if (adev->virt.ras_en_caps.bits.block_vcn)
1193+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__VCN);
1194+ if (adev->virt.ras_en_caps.bits.block_jpeg)
1195+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__JPEG);
1196+ if (adev->virt.ras_en_caps.bits.block_ih)
1197+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__IH);
1198+ if (adev->virt.ras_en_caps.bits.block_mpio)
1199+ adev->ras_hw_enabled |= BIT(AMDGPU_RAS_BLOCK__MPIO);
1200+
1201+ if (adev->virt.ras_en_caps.bits.poison_propogation_mode)
1202+ con->poison_supported = true; /* Poison is handled by host */
1203+
1204+ return true;
1205+}
1206+
1207+static inline enum amd_sriov_ras_telemetry_gpu_block
1208+amdgpu_ras_block_to_sriov(struct amdgpu_device *adev, enum amdgpu_ras_block block) {
1209+ switch (block) {
1210+ case AMDGPU_RAS_BLOCK__UMC:
1211+ return RAS_TELEMETRY_GPU_BLOCK_UMC;
1212+ case AMDGPU_RAS_BLOCK__SDMA:
1213+ return RAS_TELEMETRY_GPU_BLOCK_SDMA;
1214+ case AMDGPU_RAS_BLOCK__GFX:
1215+ return RAS_TELEMETRY_GPU_BLOCK_GFX;
1216+ case AMDGPU_RAS_BLOCK__MMHUB:
1217+ return RAS_TELEMETRY_GPU_BLOCK_MMHUB;
1218+ case AMDGPU_RAS_BLOCK__ATHUB:
1219+ return RAS_TELEMETRY_GPU_BLOCK_ATHUB;
1220+ case AMDGPU_RAS_BLOCK__PCIE_BIF:
1221+ return RAS_TELEMETRY_GPU_BLOCK_PCIE_BIF;
1222+ case AMDGPU_RAS_BLOCK__HDP:
1223+ return RAS_TELEMETRY_GPU_BLOCK_HDP;
1224+ case AMDGPU_RAS_BLOCK__XGMI_WAFL:
1225+ return RAS_TELEMETRY_GPU_BLOCK_XGMI_WAFL;
1226+ case AMDGPU_RAS_BLOCK__DF:
1227+ return RAS_TELEMETRY_GPU_BLOCK_DF;
1228+ case AMDGPU_RAS_BLOCK__SMN:
1229+ return RAS_TELEMETRY_GPU_BLOCK_SMN;
1230+ case AMDGPU_RAS_BLOCK__SEM:
1231+ return RAS_TELEMETRY_GPU_BLOCK_SEM;
1232+ case AMDGPU_RAS_BLOCK__MP0:
1233+ return RAS_TELEMETRY_GPU_BLOCK_MP0;
1234+ case AMDGPU_RAS_BLOCK__MP1:
1235+ return RAS_TELEMETRY_GPU_BLOCK_MP1;
1236+ case AMDGPU_RAS_BLOCK__FUSE:
1237+ return RAS_TELEMETRY_GPU_BLOCK_FUSE;
1238+ case AMDGPU_RAS_BLOCK__MCA:
1239+ return RAS_TELEMETRY_GPU_BLOCK_MCA;
1240+ case AMDGPU_RAS_BLOCK__VCN:
1241+ return RAS_TELEMETRY_GPU_BLOCK_VCN;
1242+ case AMDGPU_RAS_BLOCK__JPEG:
1243+ return RAS_TELEMETRY_GPU_BLOCK_JPEG;
1244+ case AMDGPU_RAS_BLOCK__IH:
1245+ return RAS_TELEMETRY_GPU_BLOCK_IH;
1246+ case AMDGPU_RAS_BLOCK__MPIO:
1247+ return RAS_TELEMETRY_GPU_BLOCK_MPIO;
1248+ default:
1249+ dev_err(adev->dev, "Unsupported SRIOV RAS telemetry block 0x%x\n", block);
1250+ return RAS_TELEMETRY_GPU_BLOCK_COUNT;
1251+ }
1252+}
1253+
1254+static int amdgpu_virt_cache_host_error_counts(struct amdgpu_device *adev,
1255+ struct amdsriov_ras_telemetry *host_telemetry)
1256+{
1257+ struct amd_sriov_ras_telemetry_error_count *tmp = NULL;
1258+ uint32_t checksum, used_size;
1259+
1260+ checksum = host_telemetry->header.checksum;
1261+ used_size = host_telemetry->header.used_size;
1262+
1263+ if (used_size > (AMD_SRIOV_RAS_TELEMETRY_SIZE_KB << 10))
1264+ return 0;
1265+
1266+ tmp = kmalloc(used_size, GFP_KERNEL);
1267+ if (!tmp)
1268+ return -ENOMEM;
1269+
1270+ memcpy(tmp, &host_telemetry->body.error_count, used_size);
1271+
1272+ if (checksum != amd_sriov_msg_checksum(tmp, used_size, 0, 0))
1273+ goto out;
1274+
1275+ memcpy(&adev->virt.count_cache, tmp,
1276+ min(used_size, sizeof(adev->virt.count_cache)));
1277+out:
1278+ kfree(tmp);
1279+
1280+ return 0;
1281+}
1282+
1283+static int amdgpu_virt_req_ras_err_count_internal(struct amdgpu_device *adev, bool force_update)
1284+{
1285+ struct amdgpu_virt *virt = &adev->virt;
1286+
1287+ /* Host allows 15 ras telemetry requests per 60 seconds. Afterwhich, the Host
1288+ * will ignore incoming guest messages. Ratelimit the guest messages to
1289+ * prevent guest self DOS.
1290+ */
1291+ if (__ratelimit(&adev->virt.ras_telemetry_rs) || force_update) {
1292+ if (!virt->ops->req_ras_err_count(adev))
1293+ amdgpu_virt_cache_host_error_counts(adev,
1294+ adev->virt.fw_reserve.ras_telemetry);
1295+ }
1296+
1297+ return 0;
1298+}
1299+
1300+/* Bypass ACA interface and query ECC counts directly from host */
1301+int amdgpu_virt_req_ras_err_count(struct amdgpu_device *adev, enum amdgpu_ras_block block,
1302+ struct ras_err_data *err_data)
1303+{
1304+ enum amd_sriov_ras_telemetry_gpu_block sriov_block;
1305+
1306+ sriov_block = amdgpu_ras_block_to_sriov(adev, block);
1307+
1308+ if (sriov_block >= RAS_TELEMETRY_GPU_BLOCK_COUNT ||
1309+ !amdgpu_sriov_ras_telemetry_block_en(adev, sriov_block))
1310+ return -EOPNOTSUPP;
1311+
1312+ /* Host Access may be lost during reset, just return last cached data. */
1313+ if (down_read_trylock(&adev->reset_domain->sem)) {
1314+ amdgpu_virt_req_ras_err_count_internal(adev, false);
1315+ up_read(&adev->reset_domain->sem);
1316+ }
1317+
1318+ err_data->ue_count = adev->virt.count_cache.block[sriov_block].ue_count;
1319+ err_data->ce_count = adev->virt.count_cache.block[sriov_block].ce_count;
1320+ err_data->de_count = adev->virt.count_cache.block[sriov_block].de_count;
1321+
1322+ return 0;
1323+}
1324+
1325+int amdgpu_virt_ras_telemetry_post_reset(struct amdgpu_device *adev)
1326+{
1327+ unsigned long ue_count, ce_count;
1328+
1329+ if (amdgpu_sriov_ras_telemetry_en(adev)) {
1330+ amdgpu_virt_req_ras_err_count_internal(adev, true);
1331+ amdgpu_ras_query_error_count(adev, &ce_count, &ue_count, NULL);
1332+ }
1333+
1334+ return 0;
1335+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h+23−0
@@ -95,6 +95,7 @@ struct amdgpu_virt_ops { · 94 unmodified lines
9595 void (*ras_poison_handler)(struct amdgpu_device *adev,
9696 enum amdgpu_ras_block block);
9797 bool (*rcvd_ras_intr)(struct amdgpu_device *adev);
98+ int (*req_ras_err_count)(struct amdgpu_device *adev);
9899 };
99100
100101 /*
@@ -103,6 +104,7 @@ struct amdgpu_virt_ops { · 2 unmodified lines
103104 struct amdgpu_virt_fw_reserve {
104105 struct amd_sriov_msg_pf2vf_info_header *p_pf2vf;
105106 struct amd_sriov_msg_vf2pf_info_header *p_vf2pf;
107+ void *ras_telemetry;
106108 unsigned int checksum_key;
107109 };
108110
@@ -136,6 +138,8 @@ enum AMDGIM_FEATURE_FLAG { · 27 unmodified lines
136138 AMDGIM_FEATURE_VCN_RB_DECOUPLE = (1 << 7),
137139 /* MES info */
138140 AMDGIM_FEATURE_MES_INFO_ENABLE = (1 << 8),
141+ AMDGIM_FEATURE_RAS_CAPS = (1 << 9),
142+ AMDGIM_FEATURE_RAS_TELEMETRY = (1 << 10),
139143 };
140144
141145 enum AMDGIM_REG_ACCESS_FLAG {
@@ -276,6 +280,12 @@ struct amdgpu_virt { · 134 unmodified lines
276280 uint32_t autoload_ucode_id;
277281
278282 struct mutex rlcg_reg_lock;
283+
284+ union amd_sriov_ras_caps ras_en_caps;
285+ union amd_sriov_ras_caps ras_telemetry_en_caps;
286+
287+ struct ratelimit_state ras_telemetry_rs;
288+ struct amd_sriov_ras_telemetry_error_count count_cache;
279289 };
280290
281291 struct amdgpu_video_codec_info;
@@ -320,6 +330,15 @@ struct amdgpu_video_codec_info; · 38 unmodified lines
320330 #define amdgpu_sriov_vf_mmio_access_protection(adev) \
321331 ((adev)->virt.caps & AMDGPU_VF_MMIO_ACCESS_PROTECT)
322332
333+#define amdgpu_sriov_ras_caps_en(adev) \
334+((adev)->virt.gim_feature & AMDGIM_FEATURE_RAS_CAPS)
335+
336+#define amdgpu_sriov_ras_telemetry_en(adev) \
337+(((adev)->virt.gim_feature & AMDGIM_FEATURE_RAS_TELEMETRY) && (adev)->virt.fw_reserve.ras_telemetry)
338+
339+#define amdgpu_sriov_ras_telemetry_block_en(adev, sriov_blk) \
340+(amdgpu_sriov_ras_telemetry_en((adev)) && (adev)->virt.ras_telemetry_en_caps.all & BIT(sriov_blk))
341+
323342 static inline bool is_virtual_machine(void)
324343 {
325344 #if defined(CONFIG_X86)
@@ -383,4 +402,8 @@ bool amdgpu_virt_get_rlcg_reg_access_flag(struct amdgpu_device *adev, · 57 unmodified lines
383402 u32 acc_flags, u32 hwip,
384403 bool write, u32 *rlcg_flag);
385404 u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag, u32 xcc_id);
405+bool amdgpu_virt_get_ras_capability(struct amdgpu_device *adev);
406+int amdgpu_virt_req_ras_err_count(struct amdgpu_device *adev, enum amdgpu_ras_block block,
407+ struct ras_err_data *err_data);
408+int amdgpu_virt_ras_telemetry_post_reset(struct amdgpu_device *adev);
386409 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c+43−0
@@ -377,6 +377,13 @@ static int vpe_sw_init(struct amdgpu_ip_block *ip_block) · 376 unmodified lines
377377 ret = vpe_init_microcode(vpe);
378378 if (ret)
379379 goto out;
380+
381+ /* TODO: Add queue reset mask when FW fully supports it */
382+ adev->vpe.supported_reset =
383+ amdgpu_get_soft_full_reset_mask(&adev->vpe.ring);
384+ ret = amdgpu_vpe_sysfs_reset_mask_init(adev);
385+ if (ret)
386+ goto out;
380387 out:
381388 return ret;
382389 }
@@ -389,6 +396,7 @@ static int vpe_sw_fini(struct amdgpu_ip_block *ip_block) · 6 unmodified lines
389396 release_firmware(vpe->fw);
390397 vpe->fw = NULL;
391398
399+ amdgpu_vpe_sysfs_reset_mask_fini(adev);
392400 vpe_ring_fini(vpe);
393401
394402 amdgpu_bo_free_kernel(&adev->vpe.cmdbuf_obj,
@@ -865,6 +873,41 @@ static void vpe_ring_end_use(struct amdgpu_ring *ring) · 470 unmodified lines
865873 schedule_delayed_work(&adev->vpe.idle_work, VPE_IDLE_TIMEOUT);
866874 }
867875
876+static ssize_t amdgpu_get_vpe_reset_mask(struct device *dev,
877+ struct device_attribute *attr,
878+ char *buf)
879+{
880+ struct drm_device *ddev = dev_get_drvdata(dev);
881+ struct amdgpu_device *adev = drm_to_adev(ddev);
882+
883+ if (!adev)
884+ return -ENODEV;
885+
886+ return amdgpu_show_reset_mask(buf, adev->vpe.supported_reset);
887+}
888+
889+static DEVICE_ATTR(vpe_reset_mask, 0444,
890+ amdgpu_get_vpe_reset_mask, NULL);
891+
892+int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)
893+{
894+ int r = 0;
895+
896+ if (adev->vpe.num_instances) {
897+ r = device_create_file(adev->dev, &dev_attr_vpe_reset_mask);
898+ if (r)
899+ return r;
900+ }
901+
902+ return r;
903+}
904+
905+void amdgpu_vpe_sysfs_reset_mask_fini(struct amdgpu_device *adev)
906+{
907+ if (adev->vpe.num_instances)
908+ device_remove_file(adev->dev, &dev_attr_vpe_reset_mask);
909+}
910+
868911 static const struct amdgpu_ring_funcs vpe_ring_funcs = {
869912 .type = AMDGPU_RING_TYPE_VPE,
870913 .align_mask = 0xf,
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.h+3−0
@@ -79,6 +79,7 @@ struct amdgpu_vpe { · 78 unmodified lines
7979
8080 uint32_t num_instances;
8181 bool collaborate_mode;
82+ uint32_t supported_reset;
8283 };
8384
8485 int amdgpu_vpe_psp_update_sram(struct amdgpu_device *adev);
@@ -86,6 +87,8 @@ int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe); · 1 unmodified line
8687 int amdgpu_vpe_ring_init(struct amdgpu_vpe *vpe);
8788 int amdgpu_vpe_ring_fini(struct amdgpu_vpe *vpe);
8889 int amdgpu_vpe_configure_dpm(struct amdgpu_vpe *vpe);
90+void amdgpu_vpe_sysfs_reset_mask_fini(struct amdgpu_device *adev);
91+int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev);
8992
9093 #define vpe_ring_init(vpe) ((vpe)->funcs->ring_init ? (vpe)->funcs->ring_init((vpe)) : 0)
9194 #define vpe_ring_start(vpe) ((vpe)->funcs->ring_start ? (vpe)->funcs->ring_start((vpe)) : 0)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c+47−1
@@ -471,6 +471,16 @@ static const char *xcp_desc[] = { · 470 unmodified lines
471471 [AMDGPU_CPX_PARTITION_MODE] = "CPX",
472472 };
473473
474+static const char *nps_desc[] = {
475+ [UNKNOWN_MEMORY_PARTITION_MODE] = "UNKNOWN",
476+ [AMDGPU_NPS1_PARTITION_MODE] = "NPS1",
477+ [AMDGPU_NPS2_PARTITION_MODE] = "NPS2",
478+ [AMDGPU_NPS3_PARTITION_MODE] = "NPS3",
479+ [AMDGPU_NPS4_PARTITION_MODE] = "NPS4",
480+ [AMDGPU_NPS6_PARTITION_MODE] = "NPS6",
481+ [AMDGPU_NPS8_PARTITION_MODE] = "NPS8",
482+};
483+
474484 ATTRIBUTE_GROUPS(xcp_cfg_res_sysfs);
475485
476486 #define to_xcp_attr(x) \
@@ -540,6 +550,26 @@ static ssize_t supported_xcp_configs_show(struct kobject *kobj, · 63 unmodified lines
540550 return size;
541551 }
542552
553+static ssize_t supported_nps_configs_show(struct kobject *kobj,
554+ struct kobj_attribute *attr, char *buf)
555+{
556+ struct amdgpu_xcp_cfg *xcp_cfg = to_xcp_cfg(kobj);
557+ int size = 0, mode;
558+ char *sep = "";
559+
560+ if (!xcp_cfg || !xcp_cfg->compatible_nps_modes)
561+ return sysfs_emit(buf, "Not supported\n");
562+
563+ for_each_inst(mode, xcp_cfg->compatible_nps_modes) {
564+ size += sysfs_emit_at(buf, size, "%s%s", sep, nps_desc[mode]);
565+ sep = ", ";
566+ }
567+
568+ size += sysfs_emit_at(buf, size, "\n");
569+
570+ return size;
571+}
572+
543573 static ssize_t xcp_config_show(struct kobject *kobj,
544574 struct kobj_attribute *attr, char *buf)
545575 {
@@ -596,6 +626,9 @@ static const struct kobj_type xcp_cfg_sysfs_ktype = { · 50 unmodified lines
596626 static struct kobj_attribute supp_part_sysfs_mode =
597627 __ATTR_RO(supported_xcp_configs);
598628
629+static struct kobj_attribute supp_nps_sysfs_mode =
630+ __ATTR_RO(supported_nps_configs);
631+
599632 static const struct attribute *xcp_attrs[] = {
600633 &supp_part_sysfs_mode.attr,
601634 &xcp_cfg_sysfs_mode.attr,
@@ -625,13 +658,24 @@ void amdgpu_xcp_cfg_sysfs_init(struct amdgpu_device *adev) · 23 unmodified lines
625658 if (r)
626659 goto err1;
627660
661+ if (adev->gmc.supported_nps_modes != 0) {
662+ r = sysfs_create_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr);
663+ if (r) {
664+ sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs);
665+ goto err1;
666+ }
667+ }
668+
628669 mode = (xcp_cfg->xcp_mgr->mode ==
629670 AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE) ?
630671 AMDGPU_SPX_PARTITION_MODE :
631672 xcp_cfg->xcp_mgr->mode;
632673 r = amdgpu_xcp_get_res_info(xcp_cfg->xcp_mgr, mode, xcp_cfg);
633− if (r)
674+ if (r) {
675+ sysfs_remove_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr);
676+ sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs);
634677 goto err1;
678+ }
635679
636680 xcp_cfg->mode = mode;
637681 for (i = 0; i < xcp_cfg->num_res; i++) {
@@ -653,6 +697,7 @@ err: · 15 unmodified lines
653697 kobject_put(&xcp_res->kobj);
654698 }
655699
700+ sysfs_remove_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr);
656701 sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs);
657702 err1:
658703 kobject_put(&xcp_cfg->kobj);
@@ -673,6 +718,7 @@ void amdgpu_xcp_cfg_sysfs_fini(struct amdgpu_device *adev) · 14 unmodified lines
673718 kobject_put(&xcp_res->kobj);
674719 }
675720
721+ sysfs_remove_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr);
676722 sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs);
677723 kobject_put(&xcp_cfg->kobj);
678724 }
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h+112−19
@@ -28,17 +28,21 @@ · 27 unmodified lines
2828 #define AMD_SRIOV_MSG_VBIOS_SIZE_KB 64
2929 #define AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB AMD_SRIOV_MSG_VBIOS_SIZE_KB
3030 #define AMD_SRIOV_MSG_DATAEXCHANGE_SIZE_KB 4
31−
31+#define AMD_SRIOV_MSG_TMR_OFFSET_KB 2048
32+#define AMD_SRIOV_MSG_BAD_PAGE_SIZE_KB 2
33+#define AMD_SRIOV_RAS_TELEMETRY_SIZE_KB 64
3234 /*
3335 * layout
34− * 0 64KB 65KB 66KB
35− * | VBIOS | PF2VF | VF2PF | Bad Page | ...
36− * | 64KB | 1KB | 1KB |
36+ * 0 64KB 65KB 66KB 68KB 132KB
37+ * | VBIOS | PF2VF | VF2PF | Bad Page | RAS Telemetry Region | ...
38+ * | 64KB | 1KB | 1KB | 2KB | 64KB | ...
3739 */
40+
3841 #define AMD_SRIOV_MSG_SIZE_KB 1
3942 #define AMD_SRIOV_MSG_PF2VF_OFFSET_KB AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB
4043 #define AMD_SRIOV_MSG_VF2PF_OFFSET_KB (AMD_SRIOV_MSG_PF2VF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB)
4144 #define AMD_SRIOV_MSG_BAD_PAGE_OFFSET_KB (AMD_SRIOV_MSG_VF2PF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB)
45+#define AMD_SRIOV_MSG_RAS_TELEMETRY_OFFSET_KB (AMD_SRIOV_MSG_BAD_PAGE_OFFSET_KB + AMD_SRIOV_MSG_BAD_PAGE_SIZE_KB)
4246
4347 /*
4448 * PF2VF history log:
@@ -86,30 +90,59 @@ enum amd_sriov_ucode_engine_id { · 41 unmodified lines
8690
8791 union amd_sriov_msg_feature_flags {
8892 struct {
89− uint32_t error_log_collect : 1;
90− uint32_t host_load_ucodes : 1;
91− uint32_t host_flr_vramlost : 1;
92− uint32_t mm_bw_management : 1;
93− uint32_t pp_one_vf_mode : 1;
94− uint32_t reg_indirect_acc : 1;
95− uint32_t av1_support : 1;
96− uint32_t vcn_rb_decouple : 1;
97− uint32_t mes_info_enable : 1;
98− uint32_t reserved : 23;
93+ uint32_t error_log_collect : 1;
94+ uint32_t host_load_ucodes : 1;
95+ uint32_t host_flr_vramlost : 1;
96+ uint32_t mm_bw_management : 1;
97+ uint32_t pp_one_vf_mode : 1;
98+ uint32_t reg_indirect_acc : 1;
99+ uint32_t av1_support : 1;
100+ uint32_t vcn_rb_decouple : 1;
101+ uint32_t mes_info_dump_enable : 1;
102+ uint32_t ras_caps : 1;
103+ uint32_t ras_telemetry : 1;
104+ uint32_t reserved : 21;
99105 } flags;
100106 uint32_t all;
101107 };
102108
103109 union amd_sriov_reg_access_flags {
104110 struct {
105− uint32_t vf_reg_access_ih : 1;
106− uint32_t vf_reg_access_mmhub : 1;
107− uint32_t vf_reg_access_gc : 1;
108− uint32_t reserved : 29;
111+ uint32_t vf_reg_access_ih : 1;
112+ uint32_t vf_reg_access_mmhub : 1;
113+ uint32_t vf_reg_access_gc : 1;
114+ uint32_t reserved : 29;
109115 } flags;
110116 uint32_t all;
111117 };
112118
119+union amd_sriov_ras_caps {
120+ struct {
121+ uint64_t block_umc : 1;
122+ uint64_t block_sdma : 1;
123+ uint64_t block_gfx : 1;
124+ uint64_t block_mmhub : 1;
125+ uint64_t block_athub : 1;
126+ uint64_t block_pcie_bif : 1;
127+ uint64_t block_hdp : 1;
128+ uint64_t block_xgmi_wafl : 1;
129+ uint64_t block_df : 1;
130+ uint64_t block_smn : 1;
131+ uint64_t block_sem : 1;
132+ uint64_t block_mp0 : 1;
133+ uint64_t block_mp1 : 1;
134+ uint64_t block_fuse : 1;
135+ uint64_t block_mca : 1;
136+ uint64_t block_vcn : 1;
137+ uint64_t block_jpeg : 1;
138+ uint64_t block_ih : 1;
139+ uint64_t block_mpio : 1;
140+ uint64_t poison_propogation_mode : 1;
141+ uint64_t reserved : 44;
142+ } bits;
143+ uint64_t all;
144+};
145+
113146 union amd_sriov_msg_os_info {
114147 struct {
115148 uint32_t windows : 1;
@@ -158,7 +191,7 @@ struct amd_sriov_msg_pf2vf_info_header { · 42 unmodified lines
158191 uint32_t reserved[2];
159192 };
160193
161−#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (49)
194+#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (55)
162195 struct amd_sriov_msg_pf2vf_info {
163196 /* header contains size and version */
164197 struct amd_sriov_msg_pf2vf_info_header header;
@@ -211,6 +244,12 @@ struct amd_sriov_msg_pf2vf_info { · 46 unmodified lines
211244 uint32_t pcie_atomic_ops_support_flags;
212245 /* Portion of GPU memory occupied by VF. MAX value is 65535, but set to uint32_t to maintain alignment with reserved size */
213246 uint32_t gpu_capacity;
247+ /* vf bdf on host pci tree for debug only */
248+ uint32_t bdf_on_host;
249+ uint32_t more_bp; //Reserved for future use.
250+ union amd_sriov_ras_caps ras_en_caps;
251+ union amd_sriov_ras_caps ras_telemetry_en_caps;
252+
214253 /* reserved */
215254 uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE];
216255 } __packed;
@@ -283,8 +322,12 @@ enum amd_sriov_mailbox_request_message { · 66 unmodified lines
283322 MB_REQ_MSG_REL_GPU_FINI_ACCESS,
284323 MB_REQ_MSG_REQ_GPU_RESET_ACCESS,
285324 MB_REQ_MSG_REQ_GPU_INIT_DATA,
325+ MB_REQ_MSG_PSP_VF_CMD_RELAY,
286326
287327 MB_REQ_MSG_LOG_VF_ERROR = 200,
328+ MB_REQ_MSG_READY_TO_RESET = 201,
329+ MB_REQ_MSG_RAS_POISON = 202,
330+ MB_REQ_RAS_ERROR_COUNT = 203,
288331 };
289332
290333 /* mailbox message send from host to guest */
@@ -297,10 +340,60 @@ enum amd_sriov_mailbox_response_message { · 6 unmodified lines
297340 MB_RES_MSG_FAIL,
298341 MB_RES_MSG_QUERY_ALIVE,
299342 MB_RES_MSG_GPU_INIT_DATA_READY,
343+ MB_RES_MSG_RAS_ERROR_COUNT_READY = 11,
300344
301345 MB_RES_MSG_TEXT_MESSAGE = 255
302346 };
303347
348+enum amd_sriov_ras_telemetry_gpu_block {
349+ RAS_TELEMETRY_GPU_BLOCK_UMC = 0,
350+ RAS_TELEMETRY_GPU_BLOCK_SDMA = 1,
351+ RAS_TELEMETRY_GPU_BLOCK_GFX = 2,
352+ RAS_TELEMETRY_GPU_BLOCK_MMHUB = 3,
353+ RAS_TELEMETRY_GPU_BLOCK_ATHUB = 4,
354+ RAS_TELEMETRY_GPU_BLOCK_PCIE_BIF = 5,
355+ RAS_TELEMETRY_GPU_BLOCK_HDP = 6,
356+ RAS_TELEMETRY_GPU_BLOCK_XGMI_WAFL = 7,
357+ RAS_TELEMETRY_GPU_BLOCK_DF = 8,
358+ RAS_TELEMETRY_GPU_BLOCK_SMN = 9,
359+ RAS_TELEMETRY_GPU_BLOCK_SEM = 10,
360+ RAS_TELEMETRY_GPU_BLOCK_MP0 = 11,
361+ RAS_TELEMETRY_GPU_BLOCK_MP1 = 12,
362+ RAS_TELEMETRY_GPU_BLOCK_FUSE = 13,
363+ RAS_TELEMETRY_GPU_BLOCK_MCA = 14,
364+ RAS_TELEMETRY_GPU_BLOCK_VCN = 15,
365+ RAS_TELEMETRY_GPU_BLOCK_JPEG = 16,
366+ RAS_TELEMETRY_GPU_BLOCK_IH = 17,
367+ RAS_TELEMETRY_GPU_BLOCK_MPIO = 18,
368+ RAS_TELEMETRY_GPU_BLOCK_COUNT = 19,
369+};
370+
371+struct amd_sriov_ras_telemetry_header {
372+ uint32_t checksum;
373+ uint32_t used_size;
374+ uint32_t reserved[2];
375+};
376+
377+struct amd_sriov_ras_telemetry_error_count {
378+ struct {
379+ uint32_t ce_count;
380+ uint32_t ue_count;
381+ uint32_t de_count;
382+ uint32_t ce_overflow_count;
383+ uint32_t ue_overflow_count;
384+ uint32_t de_overflow_count;
385+ uint32_t reserved[6];
386+ } block[RAS_TELEMETRY_GPU_BLOCK_COUNT];
387+};
388+
389+struct amdsriov_ras_telemetry {
390+ struct amd_sriov_ras_telemetry_header header;
391+
392+ union {
393+ struct amd_sriov_ras_telemetry_error_count error_count;
394+ } body;
395+};
396+
304397 /* version data stored in MAILBOX_MSGBUF_RCV_DW1 for future expansion */
305398 enum amd_sriov_gpu_init_data_version {
306399 GPU_INIT_DATA_READY_V1 = 1,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+5−0
@@ -4825,6 +4825,11 @@ static int gfx_v10_0_sw_init(struct amdgpu_ip_block *ip_block) · 4824 unmodified lines
48254825 }
48264826 }
48274827 }
4828+ /* TODO: Add queue reset mask when FW fully supports it */
4829+ adev->gfx.gfx_supported_reset =
4830+ amdgpu_get_soft_full_reset_mask(&adev->gfx.gfx_ring[0]);
4831+ adev->gfx.compute_supported_reset =
4832+ amdgpu_get_soft_full_reset_mask(&adev->gfx.compute_ring[0]);
48284833
48294834 r = amdgpu_gfx_kiq_init(adev, GFX10_MEC_HPD_SIZE, 0);
48304835 if (r) {
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c+20−0
@@ -1580,6 +1580,8 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block) · 1579 unmodified lines
15801580 }
15811581
15821582 switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
1583+ case IP_VERSION(11, 0, 0):
1584+ case IP_VERSION(11, 0, 2):
15831585 case IP_VERSION(11, 0, 3):
15841586 adev->gfx.cleaner_shader_ptr = gfx_11_0_3_cleaner_shader_hex;
15851587 adev->gfx.cleaner_shader_size = sizeof(gfx_11_0_3_cleaner_shader_hex);
@@ -1691,6 +1693,24 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block) · 105 unmodified lines
16911693 }
16921694 }
16931695
1696+ adev->gfx.gfx_supported_reset =
1697+ amdgpu_get_soft_full_reset_mask(&adev->gfx.gfx_ring[0]);
1698+ adev->gfx.compute_supported_reset =
1699+ amdgpu_get_soft_full_reset_mask(&adev->gfx.compute_ring[0]);
1700+ switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
1701+ case IP_VERSION(11, 0, 0):
1702+ case IP_VERSION(11, 0, 2):
1703+ case IP_VERSION(11, 0, 3):
1704+ if ((adev->gfx.me_fw_version >= 2280) &&
1705+ (adev->gfx.mec_fw_version >= 2410)) {
1706+ adev->gfx.compute_supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1707+ adev->gfx.gfx_supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1708+ }
1709+ break;
1710+ default:
1711+ break;
1712+ }
1713+
16941714 if (!adev->enable_mes_kiq) {
16951715 r = amdgpu_gfx_kiq_init(adev, GFX11_MEC_HPD_SIZE, 0);
16961716 if (r) {
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c+6−0
@@ -1437,6 +1437,12 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block) · 1436 unmodified lines
14371437 }
14381438 }
14391439
1440+ /* TODO: Add queue reset mask when FW fully supports it */
1441+ adev->gfx.gfx_supported_reset =
1442+ amdgpu_get_soft_full_reset_mask(&adev->gfx.gfx_ring[0]);
1443+ adev->gfx.compute_supported_reset =
1444+ amdgpu_get_soft_full_reset_mask(&adev->gfx.compute_ring[0]);
1445+
14401446 if (!adev->enable_mes_kiq) {
14411447 r = amdgpu_gfx_kiq_init(adev, GFX12_MEC_HPD_SIZE, 0);
14421448 if (r) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+7−0
@@ -4823,6 +4823,13 @@ static int gfx_v8_0_kcq_disable(struct amdgpu_device *adev) · 4822 unmodified lines
48234823 amdgpu_ring_write(kiq_ring, 0);
48244824 amdgpu_ring_write(kiq_ring, 0);
48254825 }
4826+ /* Submit unmap queue packet */
4827+ amdgpu_ring_commit(kiq_ring);
4828+ /*
4829+ * Ring test will do a basic scratch register change check. Just run
4830+ * this to ensure that unmap queues that is submitted before got
4831+ * processed successfully before returning.
4832+ */
48264833 r = amdgpu_ring_test_helper(kiq_ring);
48274834 if (r)
48284835 DRM_ERROR("KCQ disable failed\n");
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+6−0
@@ -2374,6 +2374,12 @@ static int gfx_v9_0_sw_init(struct amdgpu_ip_block *ip_block) · 2373 unmodified lines
23742374 }
23752375 }
23762376
2377+ /* TODO: Add queue reset mask when FW fully supports it */
2378+ adev->gfx.gfx_supported_reset =
2379+ amdgpu_get_soft_full_reset_mask(&adev->gfx.gfx_ring[0]);
2380+ adev->gfx.compute_supported_reset =
2381+ amdgpu_get_soft_full_reset_mask(&adev->gfx.compute_ring[0]);
2382+
23772383 r = amdgpu_gfx_kiq_init(adev, GFX9_MEC_HPD_SIZE, 0);
23782384 if (r) {
23792385 DRM_ERROR("Failed to init KIQ BOs!\n");
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c+13−0
@@ -1157,6 +1157,19 @@ static int gfx_v9_4_3_sw_init(struct amdgpu_ip_block *ip_block) · 1156 unmodified lines
11571157 return r;
11581158 }
11591159
1160+ adev->gfx.compute_supported_reset =
1161+ amdgpu_get_soft_full_reset_mask(&adev->gfx.compute_ring[0]);
1162+ switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
1163+ case IP_VERSION(9, 4, 3):
1164+ case IP_VERSION(9, 4, 4):
1165+ if (adev->gfx.mec_fw_version >= 155) {
1166+ adev->gfx.compute_supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1167+ adev->gfx.compute_supported_reset |= AMDGPU_RESET_TYPE_PER_PIPE;
1168+ }
1169+ break;
1170+ default:
1171+ break;
1172+ }
11601173 r = gfx_v9_4_3_gpu_early_init(adev);
11611174 if (r)
11621175 return r;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+8−5
@@ -1130,8 +1130,10 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev, · 1129 unmodified lines
11301130 uint64_t *flags)
11311131 {
11321132 struct amdgpu_device *bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
1133− bool is_vram = bo->tbo.resource->mem_type == TTM_PL_VRAM;
1134− bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT | AMDGPU_GEM_CREATE_EXT_COHERENT);
1133+ bool is_vram = bo->tbo.resource &&
1134+ bo->tbo.resource->mem_type == TTM_PL_VRAM;
1135+ bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT |
1136+ AMDGPU_GEM_CREATE_EXT_COHERENT);
11351137 bool ext_coherent = bo->flags & AMDGPU_GEM_CREATE_EXT_COHERENT;
11361138 bool uncached = bo->flags & AMDGPU_GEM_CREATE_UNCACHED;
11371139 struct amdgpu_vm *vm = mapping->bo_va->base.vm;
@@ -1139,6 +1141,8 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev, · 1 unmodified line
11391141 bool snoop = false;
11401142 bool is_local;
11411143
1144+ dma_resv_assert_held(bo->tbo.base.resv);
1145+
11421146 switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
11431147 case IP_VERSION(9, 4, 1):
11441148 case IP_VERSION(9, 4, 2):
@@ -1257,9 +1261,8 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, · 112 unmodified lines
12571261 *flags &= ~AMDGPU_PTE_VALID;
12581262 }
12591263
1260− if (bo && bo->tbo.resource)
1261− gmc_v9_0_get_coherence_flags(adev, mapping->bo_va->base.bo,
1262− mapping, flags);
1264+ if ((*flags & AMDGPU_PTE_VALID) && bo)
1265+ gmc_v9_0_get_coherence_flags(adev, bo, mapping, flags);
12631266 }
12641267
12651268 static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c+7−0
@@ -121,6 +121,12 @@ static int jpeg_v4_0_sw_init(struct amdgpu_ip_block *ip_block) · 120 unmodified lines
121121 adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH);
122122
123123 r = amdgpu_jpeg_ras_sw_init(adev);
124+ if (r)
125+ return r;
126+ /* TODO: Add queue reset mask when FW fully supports it */
127+ adev->jpeg.supported_reset =
128+ amdgpu_get_soft_full_reset_mask(&adev->jpeg.inst[0].ring_dec[0]);
129+ r = amdgpu_jpeg_sysfs_reset_mask_init(adev);
124130 if (r)
125131 return r;
126132
@@ -143,6 +149,7 @@ static int jpeg_v4_0_sw_fini(struct amdgpu_ip_block *ip_block) · 16 unmodified lines
143149 if (r)
144150 return r;
145151
152+ amdgpu_jpeg_sysfs_reset_mask_fini(adev);
146153 r = amdgpu_jpeg_sw_fini(adev);
147154
148155 return r;
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c+8−0
@@ -159,6 +159,13 @@ static int jpeg_v4_0_3_sw_init(struct amdgpu_ip_block *ip_block) · 158 unmodified lines
159159 }
160160 }
161161
162+ /* TODO: Add queue reset mask when FW fully supports it */
163+ adev->jpeg.supported_reset =
164+ amdgpu_get_soft_full_reset_mask(&adev->jpeg.inst[0].ring_dec[0]);
165+ r = amdgpu_jpeg_sysfs_reset_mask_init(adev);
166+ if (r)
167+ return r;
168+
162169 return 0;
163170 }
164171
@@ -178,6 +185,7 @@ static int jpeg_v4_0_3_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines
178185 if (r)
179186 return r;
180187
188+ amdgpu_jpeg_sysfs_reset_mask_fini(adev);
181189 r = amdgpu_jpeg_sw_fini(adev);
182190
183191 return r;
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c+8−0
@@ -153,6 +153,13 @@ static int jpeg_v4_0_5_sw_init(struct amdgpu_ip_block *ip_block) · 152 unmodified lines
153153 adev->jpeg.inst[i].external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, i, regUVD_JPEG_PITCH);
154154 }
155155
156+ /* TODO: Add queue reset mask when FW fully supports it */
157+ adev->jpeg.supported_reset =
158+ amdgpu_get_soft_full_reset_mask(&adev->jpeg.inst[0].ring_dec[0]);
159+ r = amdgpu_jpeg_sysfs_reset_mask_init(adev);
160+ if (r)
161+ return r;
162+
156163 return 0;
157164 }
158165
@@ -172,6 +179,7 @@ static int jpeg_v4_0_5_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines
172179 if (r)
173180 return r;
174181
182+ amdgpu_jpeg_sysfs_reset_mask_fini(adev);
175183 r = amdgpu_jpeg_sw_fini(adev);
176184
177185 return r;
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c+7−0
@@ -100,6 +100,12 @@ static int jpeg_v5_0_0_sw_init(struct amdgpu_ip_block *ip_block) · 99 unmodified lines
100100 adev->jpeg.internal.jpeg_pitch[0] = regUVD_JPEG_PITCH_INTERNAL_OFFSET;
101101 adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH);
102102
103+ /* TODO: Add queue reset mask when FW fully supports it */
104+ adev->jpeg.supported_reset =
105+ amdgpu_get_soft_full_reset_mask(&adev->jpeg.inst[0].ring_dec[0]);
106+ r = amdgpu_jpeg_sysfs_reset_mask_init(adev);
107+ if (r)
108+ return r;
103109 return 0;
104110 }
105111
@@ -119,6 +125,7 @@ static int jpeg_v5_0_0_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines
119125 if (r)
120126 return r;
121127
128+ amdgpu_jpeg_sysfs_reset_mask_fini(adev);
122129 r = amdgpu_jpeg_sw_fini(adev);
123130
124131 return r;
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c+26−1
@@ -644,6 +644,18 @@ static int mes_v11_0_misc_op(struct amdgpu_mes *mes, · 643 unmodified lines
644644 sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl));
645645 misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en;
646646 break;
647+ case MES_MISC_OP_CHANGE_CONFIG:
648+ if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) < 0x63) {
649+ dev_err(mes->adev->dev, "MES FW versoin must be larger than 0x63 to support limit single process feature.\n");
650+ return -EINVAL;
651+ }
652+ misc_pkt.opcode = MESAPI_MISC__CHANGE_CONFIG;
653+ misc_pkt.change_config.opcode =
654+ MESAPI_MISC__CHANGE_CONFIG_OPTION_LIMIT_SINGLE_PROCESS;
655+ misc_pkt.change_config.option.bits.limit_single_process =
656+ input->change_config.option.limit_single_process;
657+ break;
658+
647659 default:
648660 DRM_ERROR("unsupported misc op (%d) \n", input->op);
649661 return -EINVAL;
@@ -708,6 +720,9 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes) · 58 unmodified lines
708720 mes->event_log_gpu_addr;
709721 }
710722
723+ if (enforce_isolation)
724+ mes_set_hw_res_pkt.limit_single_process = 1;
725+
711726 return mes_v11_0_submit_pkt_and_poll_completion(mes,
712727 &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),
713728 offsetof(union MESAPI_SET_HW_RESOURCES, api_status));
@@ -908,6 +923,16 @@ static void mes_v11_0_enable(struct amdgpu_device *adev, bool enable) · 194 unmodified lines
908923 uint32_t pipe, data = 0;
909924
910925 if (enable) {
926+ if (amdgpu_mes_log_enable) {
927+ WREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_LO,
928+ lower_32_bits(adev->mes.event_log_gpu_addr + AMDGPU_MES_LOG_BUFFER_SIZE));
929+ WREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_HI,
930+ upper_32_bits(adev->mes.event_log_gpu_addr + AMDGPU_MES_LOG_BUFFER_SIZE));
931+ dev_info(adev->dev, "Setup CP MES MSCRATCH address : 0x%x. 0x%x\n",
932+ RREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_HI),
933+ RREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_LO));
934+ }
935+
911936 data = RREG32_SOC15(GC, 0, regCP_MES_CNTL);
912937 data = REG_SET_FIELD(data, CP_MES_CNTL, MES_PIPE0_RESET, 1);
913938 data = REG_SET_FIELD(data, CP_MES_CNTL,
@@ -1370,7 +1395,7 @@ static int mes_v11_0_sw_init(struct amdgpu_ip_block *ip_block) · 456 unmodified lines
13701395 adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init;
13711396 adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini;
13721397
1373− adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE;
1398+ adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE + AMDGPU_MES_MSCRATCH_SIZE;
13741399
13751400 r = amdgpu_mes_init(adev);
13761401 if (r)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c+12−1
@@ -531,6 +531,14 @@ static int mes_v12_0_misc_op(struct amdgpu_mes *mes, · 530 unmodified lines
531531 sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl));
532532 misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en;
533533 break;
534+ case MES_MISC_OP_CHANGE_CONFIG:
535+ misc_pkt.opcode = MESAPI_MISC__CHANGE_CONFIG;
536+ misc_pkt.change_config.opcode =
537+ MESAPI_MISC__CHANGE_CONFIG_OPTION_LIMIT_SINGLE_PROCESS;
538+ misc_pkt.change_config.option.bits.limit_single_process =
539+ input->change_config.option.limit_single_process;
540+ break;
541+
534542 default:
535543 DRM_ERROR("unsupported misc op (%d) \n", input->op);
536544 return -EINVAL;
@@ -550,7 +558,7 @@ static int mes_v12_0_set_hw_resources_1(struct amdgpu_mes *mes, int pipe) · 13 unmodified lines
550558 mes_set_hw_res_1_pkt.header.type = MES_API_TYPE_SCHEDULER;
551559 mes_set_hw_res_1_pkt.header.opcode = MES_SCH_API_SET_HW_RSRC_1;
552560 mes_set_hw_res_1_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS;
553− mes_set_hw_res_1_pkt.mes_kiq_unmap_timeout = 100;
561+ mes_set_hw_res_1_pkt.mes_kiq_unmap_timeout = 0xa;
554562
555563 return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe,
556564 &mes_set_hw_res_1_pkt, sizeof(mes_set_hw_res_1_pkt),
@@ -624,6 +632,9 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes, int pipe) · 67 unmodified lines
624632 mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr + pipe * AMDGPU_MES_LOG_BUFFER_SIZE;
625633 }
626634
635+ if (enforce_isolation)
636+ mes_set_hw_res_pkt.limit_single_process = 1;
637+
627638 return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe,
628639 &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),
629640 offsetof(union MESAPI_SET_HW_RESOURCES, api_status));
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c+14−2
@@ -61,15 +61,18 @@ static enum idh_event xgpu_nv_mailbox_peek_msg(struct amdgpu_device *adev) · 60 unmodified lines
6161 static int xgpu_nv_mailbox_rcv_msg(struct amdgpu_device *adev,
6262 enum idh_event event)
6363 {
64+ int r = 0;
6465 u32 reg;
6566
6667 reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0);
67− if (reg != event)
68+ if (reg == IDH_FAIL)
69+ r = -EINVAL;
70+ else if (reg != event)
6871 return -ENOENT;
6972
7073 xgpu_nv_mailbox_send_ack(adev);
7174
72− return 0;
75+ return r;
7376 }
7477
7578 static uint8_t xgpu_nv_peek_ack(struct amdgpu_device *adev)
@@ -178,6 +181,9 @@ send_request: · 102 unmodified lines
178181 if (data1 != 0)
179182 event = IDH_RAS_POISON_READY;
180183 break;
184+ case IDH_REQ_RAS_ERROR_COUNT:
185+ event = IDH_RAS_ERROR_COUNT_READY;
186+ break;
181187 default:
182188 break;
183189 }
@@ -456,6 +462,11 @@ static bool xgpu_nv_rcvd_ras_intr(struct amdgpu_device *adev) · 272 unmodified lines
456462 return (msg == IDH_RAS_ERROR_DETECTED || msg == 0xFFFFFFFF);
457463 }
458464
465+static int xgpu_nv_req_ras_err_count(struct amdgpu_device *adev)
466+{
467+ return xgpu_nv_send_access_requests(adev, IDH_REQ_RAS_ERROR_COUNT);
468+}
469+
459470 const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
460471 .req_full_gpu = xgpu_nv_request_full_gpu_access,
461472 .rel_full_gpu = xgpu_nv_release_full_gpu_access,
@@ -466,4 +477,5 @@ const struct amdgpu_virt_ops xgpu_nv_virt_ops = { · 4 unmodified lines
466477 .trans_msg = xgpu_nv_mailbox_trans_msg,
467478 .ras_poison_handler = xgpu_nv_ras_poison_handler,
468479 .rcvd_ras_intr = xgpu_nv_rcvd_ras_intr,
480+ .req_ras_err_count = xgpu_nv_req_ras_err_count,
469481 };
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h+3−0
@@ -40,6 +40,7 @@ enum idh_request { · 39 unmodified lines
4040 IDH_LOG_VF_ERROR = 200,
4141 IDH_READY_TO_RESET = 201,
4242 IDH_RAS_POISON = 202,
43+ IDH_REQ_RAS_ERROR_COUNT = 203,
4344 };
4445
4546 enum idh_event {
@@ -54,6 +55,8 @@ enum idh_event { · 8 unmodified lines
5455 IDH_RAS_POISON_READY,
5556 IDH_PF_SOFT_FLR_NOTIFICATION,
5657 IDH_RAS_ERROR_DETECTED,
58+ IDH_RAS_ERROR_COUNT_READY = 11,
59+
5760 IDH_TEXT_MESSAGE = 255,
5861 };
5962
drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c+6−0
@@ -247,6 +247,12 @@ static void nbio_v7_7_init_registers(struct amdgpu_device *adev) · 246 unmodified lines
247247 if (def != data)
248248 WREG32_SOC15(NBIO, 0, regBIF0_PCIE_MST_CTRL_3, data);
249249
250+ switch (adev->ip_versions[NBIO_HWIP][0]) {
251+ case IP_VERSION(7, 7, 0):
252+ data = RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF5_STRAP4) & ~BIT(23);
253+ WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF5_STRAP4, data);
254+ break;
255+ }
250256 }
251257
252258 static void nbio_v7_7_update_medium_grain_clock_gating(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/nv.c+6−6
@@ -67,8 +67,8 @@ static const struct amd_ip_funcs nv_common_ip_funcs; · 66 unmodified lines
6767
6868 /* Navi */
6969 static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] = {
70− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
71− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
70+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
71+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 0)},
7272 };
7373
7474 static const struct amdgpu_video_codecs nv_video_codecs_encode = {
@@ -94,8 +94,8 @@ static const struct amdgpu_video_codecs nv_video_codecs_decode = { · 19 unmodified lines
9494
9595 /* Sienna Cichlid */
9696 static const struct amdgpu_video_codec_info sc_video_codecs_encode_array[] = {
97− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2160, 0)},
98− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 7680, 4352, 0)},
97+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
98+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
9999 };
100100
101101 static const struct amdgpu_video_codecs sc_video_codecs_encode = {
@@ -136,8 +136,8 @@ static const struct amdgpu_video_codecs sc_video_codecs_decode_vcn1 = { · 34 unmodified lines
136136
137137 /* SRIOV Sienna Cichlid, not const since data is controlled by host */
138138 static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = {
139− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2160, 0)},
140− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 7680, 4352, 0)},
139+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
140+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
141141 };
142142
143143 static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn0[] = {
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c+9−0
@@ -1430,6 +1430,10 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) · 1429 unmodified lines
14301430 }
14311431 }
14321432
1433+ /* TODO: Add queue reset mask when FW fully supports it */
1434+ adev->sdma.supported_reset =
1435+ amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
1436+
14331437 if (amdgpu_sdma_ras_sw_init(adev)) {
14341438 dev_err(adev->dev, "fail to initialize sdma ras block\n");
14351439 return -EINVAL;
@@ -1442,6 +1446,10 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) · 6 unmodified lines
14421446 else
14431447 DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
14441448
1449+ r = amdgpu_sdma_sysfs_reset_mask_init(adev);
1450+ if (r)
1451+ return r;
1452+
14451453 return r;
14461454 }
14471455
@@ -1456,6 +1464,7 @@ static int sdma_v4_4_2_sw_fini(struct amdgpu_ip_block *ip_block) · 8 unmodified lines
14561464 amdgpu_ring_fini(&adev->sdma.instance[i].page);
14571465 }
14581466
1467+ amdgpu_sdma_sysfs_reset_mask_fini(adev);
14591468 if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 2) ||
14601469 amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 5))
14611470 amdgpu_sdma_destroy_inst_ctx(adev, true);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+18−0
@@ -1452,6 +1452,19 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block) · 1451 unmodified lines
14521452 return r;
14531453 }
14541454
1455+ adev->sdma.supported_reset =
1456+ amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
1457+ switch (amdgpu_ip_version(adev, SDMA0_HWIP, 0)) {
1458+ case IP_VERSION(5, 0, 0):
1459+ case IP_VERSION(5, 0, 2):
1460+ case IP_VERSION(5, 0, 5):
1461+ if (adev->sdma.instance[0].fw_version >= 35)
1462+ adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1463+ break;
1464+ default:
1465+ break;
1466+ }
1467+
14551468 /* Allocate memory for SDMA IP Dump buffer */
14561469 ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL);
14571470 if (ptr)
@@ -1459,6 +1472,10 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block) · 1 unmodified line
14591472 else
14601473 DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
14611474
1475+ r = amdgpu_sdma_sysfs_reset_mask_init(adev);
1476+ if (r)
1477+ return r;
1478+
14621479 return r;
14631480 }
14641481
@@ -1470,6 +1487,7 @@ static int sdma_v5_0_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines
14701487 for (i = 0; i < adev->sdma.num_instances; i++)
14711488 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
14721489
1490+ amdgpu_sdma_sysfs_reset_mask_fini(adev);
14731491 amdgpu_sdma_destroy_inst_ctx(adev, false);
14741492
14751493 kfree(adev->sdma.ip_dump);
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c+23−0
@@ -1357,6 +1357,24 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block) · 1356 unmodified lines
13571357 return r;
13581358 }
13591359
1360+ adev->sdma.supported_reset =
1361+ amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
1362+ switch (amdgpu_ip_version(adev, SDMA0_HWIP, 0)) {
1363+ case IP_VERSION(5, 2, 0):
1364+ case IP_VERSION(5, 2, 2):
1365+ case IP_VERSION(5, 2, 3):
1366+ case IP_VERSION(5, 2, 4):
1367+ if (adev->sdma.instance[0].fw_version >= 76)
1368+ adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1369+ break;
1370+ case IP_VERSION(5, 2, 5):
1371+ if (adev->sdma.instance[0].fw_version >= 34)
1372+ adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1373+ break;
1374+ default:
1375+ break;
1376+ }
1377+
13601378 /* Allocate memory for SDMA IP Dump buffer */
13611379 ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL);
13621380 if (ptr)
@@ -1364,6 +1382,10 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block) · 1 unmodified line
13641382 else
13651383 DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
13661384
1385+ r = amdgpu_sdma_sysfs_reset_mask_init(adev);
1386+ if (r)
1387+ return r;
1388+
13671389 return r;
13681390 }
13691391
@@ -1375,6 +1397,7 @@ static int sdma_v5_2_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines
13751397 for (i = 0; i < adev->sdma.num_instances; i++)
13761398 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
13771399
1400+ amdgpu_sdma_sysfs_reset_mask_fini(adev);
13781401 amdgpu_sdma_destroy_inst_ctx(adev, true);
13791402
13801403 kfree(adev->sdma.ip_dump);
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c+18−0
@@ -1350,6 +1350,19 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block) · 1349 unmodified lines
13501350 return r;
13511351 }
13521352
1353+ adev->sdma.supported_reset =
1354+ amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
1355+ switch (amdgpu_ip_version(adev, SDMA0_HWIP, 0)) {
1356+ case IP_VERSION(6, 0, 0):
1357+ case IP_VERSION(6, 0, 2):
1358+ case IP_VERSION(6, 0, 3):
1359+ if (adev->sdma.instance[0].fw_version >= 21)
1360+ adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
1361+ break;
1362+ default:
1363+ break;
1364+ }
1365+
13531366 if (amdgpu_sdma_ras_sw_init(adev)) {
13541367 dev_err(adev->dev, "Failed to initialize sdma ras block!\n");
13551368 return -EINVAL;
@@ -1362,6 +1375,10 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block) · 6 unmodified lines
13621375 else
13631376 DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
13641377
1378+ r = amdgpu_sdma_sysfs_reset_mask_init(adev);
1379+ if (r)
1380+ return r;
1381+
13651382 return r;
13661383 }
13671384
@@ -1373,6 +1390,7 @@ static int sdma_v6_0_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines
13731390 for (i = 0; i < adev->sdma.num_instances; i++)
13741391 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
13751392
1393+ amdgpu_sdma_sysfs_reset_mask_fini(adev);
13761394 amdgpu_sdma_destroy_inst_ctx(adev, true);
13771395
13781396 kfree(adev->sdma.ip_dump);
drivers/gpu/drm/amd/amdgpu/soc15.c+2−2
@@ -90,8 +90,8 @@ static const struct amd_ip_funcs soc15_common_ip_funcs; · 89 unmodified lines
9090 /* Vega, Raven, Arcturus */
9191 static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] =
9292 {
93− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
94− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
93+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
94+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 0)},
9595 };
9696
9797 static const struct amdgpu_video_codecs vega_video_codecs_encode =
drivers/gpu/drm/amd/amdgpu/soc21.c+6−6
@@ -49,13 +49,13 @@ static const struct amd_ip_funcs soc21_common_ip_funcs; · 48 unmodified lines
4949
5050 /* SOC21 */
5151 static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn0[] = {
52− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
52+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
5353 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
5454 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
5555 };
5656
5757 static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn1[] = {
58− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
58+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
5959 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
6060 };
6161
@@ -96,14 +96,14 @@ static const struct amdgpu_video_codecs vcn_4_0_0_video_codecs_decode_vcn1 = { · 34 unmodified lines
9696
9797 /* SRIOV SOC21, not const since data is controlled by host */
9898 static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_encode_array_vcn0[] = {
99− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
100− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
99+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
100+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
101101 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
102102 };
103103
104104 static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_encode_array_vcn1[] = {
105− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
106− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
105+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
106+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
107107 };
108108
109109 static struct amdgpu_video_codecs sriov_vcn_4_0_0_video_codecs_encode_vcn0 = {
drivers/gpu/drm/amd/amdgpu/soc24.c+1−1
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848 static const struct amd_ip_funcs soc24_common_ip_funcs;
4949
5050 static const struct amdgpu_video_codec_info vcn_5_0_0_video_codecs_encode_array_vcn0[] = {
51− {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
51+ {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
5252 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
5353 {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
5454 };
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c+11−4
@@ -95,6 +95,13 @@ static void vcn_v4_0_3_unified_ring_set_wptr(struct amdgpu_ring *ring); · 94 unmodified lines
9595 static void vcn_v4_0_3_set_ras_funcs(struct amdgpu_device *adev);
9696 static void vcn_v4_0_3_enable_ras(struct amdgpu_device *adev,
9797 int inst_idx, bool indirect);
98+
99+static inline bool vcn_v4_0_3_normalizn_reqd(struct amdgpu_device *adev)
100+{
101+ return (amdgpu_sriov_vf(adev) ||
102+ (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4)));
103+}
104+
98105 /**
99106 * vcn_v4_0_3_early_init - set function pointers
100107 *
@@ -1428,8 +1435,8 @@ static uint64_t vcn_v4_0_3_unified_ring_get_wptr(struct amdgpu_ring *ring) · 1327 unmodified lines
14281435 static void vcn_v4_0_3_enc_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
14291436 uint32_t val, uint32_t mask)
14301437 {
1431− /* For VF, only local offsets should be used */
1432− if (amdgpu_sriov_vf(ring->adev))
1438+ /* Use normalized offsets when required */
1439+ if (vcn_v4_0_3_normalizn_reqd(ring->adev))
14331440 reg = NORMALIZE_VCN_REG_OFFSET(reg);
14341441
14351442 amdgpu_ring_write(ring, VCN_ENC_CMD_REG_WAIT);
@@ -1440,8 +1447,8 @@ static void vcn_v4_0_3_enc_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t · 4 unmodified lines
14401447
14411448 static void vcn_v4_0_3_enc_ring_emit_wreg(struct amdgpu_ring *ring, uint32_t reg, uint32_t val)
14421449 {
1443− /* For VF, only local offsets should be used */
1444− if (amdgpu_sriov_vf(ring->adev))
1450+ /* Use normalized offsets when required */
1451+ if (vcn_v4_0_3_normalizn_reqd(ring->adev))
14451452 reg = NORMALIZE_VCN_REG_OFFSET(reg);
14461453
14471454 amdgpu_ring_write(ring, VCN_ENC_CMD_REG_WRITE);
drivers/gpu/drm/amd/amdgpu/vi.c+4−4
@@ -136,15 +136,15 @@ static const struct amdgpu_video_codec_info polaris_video_codecs_encode_array[] · 135 unmodified lines
136136 {
137137 .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
138138 .max_width = 4096,
139− .max_height = 2304,
140− .max_pixels_per_frame = 4096 * 2304,
139+ .max_height = 4096,
140+ .max_pixels_per_frame = 4096 * 4096,
141141 .max_level = 0,
142142 },
143143 {
144144 .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC,
145145 .max_width = 4096,
146− .max_height = 2304,
147− .max_pixels_per_frame = 4096 * 2304,
146+ .max_height = 4096,
147+ .max_pixels_per_frame = 4096 * 4096,
148148 .max_level = 0,
149149 },
150150 };
drivers/gpu/drm/amd/amdkfd/kfd_device.c+2−1
@@ -534,7 +534,8 @@ static void kfd_cwsr_init(struct kfd_dev *kfd) · 533 unmodified lines
534534 kfd->cwsr_isa = cwsr_trap_gfx11_hex;
535535 kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx11_hex);
536536 } else {
537− BUILD_BUG_ON(sizeof(cwsr_trap_gfx12_hex) > PAGE_SIZE);
537+ BUILD_BUG_ON(sizeof(cwsr_trap_gfx12_hex)
538+ > KFD_CWSR_TMA_OFFSET);
538539 kfd->cwsr_isa = cwsr_trap_gfx12_hex;
539540 kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx12_hex);
540541 }
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+37−3
@@ -202,6 +202,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 201 unmodified lines
202202 int r, queue_type;
203203 uint64_t wptr_addr_off;
204204
205+ if (!dqm->sched_running || dqm->sched_halt)
206+ return 0;
205207 if (!down_read_trylock(&adev->reset_domain->sem))
206208 return -EIO;
207209
@@ -270,6 +272,8 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 62 unmodified lines
270272 int r;
271273 struct mes_remove_queue_input queue_input;
272274
275+ if (!dqm->sched_running || dqm->sched_halt)
276+ return 0;
273277 if (!down_read_trylock(&adev->reset_domain->sem))
274278 return -EIO;
275279
@@ -292,7 +296,7 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 16 unmodified lines
292296 return r;
293297 }
294298
295−static int remove_all_queues_mes(struct device_queue_manager *dqm)
299+static int remove_all_kfd_queues_mes(struct device_queue_manager *dqm)
296300 {
297301 struct device_process_node *cur;
298302 struct device *dev = dqm->dev->adev->dev;
@@ -319,6 +323,33 @@ static int remove_all_queues_mes(struct device_queue_manager *dqm) · 20 unmodified lines
319323 return retval;
320324 }
321325
326+static int add_all_kfd_queues_mes(struct device_queue_manager *dqm)
327+{
328+ struct device_process_node *cur;
329+ struct device *dev = dqm->dev->adev->dev;
330+ struct qcm_process_device *qpd;
331+ struct queue *q;
332+ int retval = 0;
333+
334+ list_for_each_entry(cur, &dqm->queues, list) {
335+ qpd = cur->qpd;
336+ list_for_each_entry(q, &qpd->queues_list, list) {
337+ if (!q->properties.is_active)
338+ continue;
339+ retval = add_queue_mes(dqm, q, qpd);
340+ if (retval) {
341+ dev_err(dev, "%s: Failed to add queue %d for dev %d",
342+ __func__,
343+ q->properties.queue_id,
344+ dqm->dev->id);
345+ return retval;
346+ }
347+ }
348+ }
349+
350+ return retval;
351+}
352+
322353 static int suspend_all_queues_mes(struct device_queue_manager *dqm)
323354 {
324355 struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
@@ -1742,7 +1773,7 @@ static int halt_cpsch(struct device_queue_manager *dqm) · 1417 unmodified lines
17421773 KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0,
17431774 USE_DEFAULT_GRACE_PERIOD, false);
17441775 else
1745− ret = remove_all_queues_mes(dqm);
1776+ ret = remove_all_kfd_queues_mes(dqm);
17461777 }
17471778 dqm->sched_halt = true;
17481779 dqm_unlock(dqm);
@@ -1768,6 +1799,9 @@ static int unhalt_cpsch(struct device_queue_manager *dqm) · 19 unmodified lines
17681799 ret = execute_queues_cpsch(dqm,
17691800 KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES,
17701801 0, USE_DEFAULT_GRACE_PERIOD);
1802+ else
1803+ ret = add_all_kfd_queues_mes(dqm);
1804+
17711805 dqm_unlock(dqm);
17721806
17731807 return ret;
@@ -1867,7 +1901,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) · 93 unmodified lines
18671901 if (!dqm->dev->kfd->shared_resources.enable_mes)
18681902 unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, USE_DEFAULT_GRACE_PERIOD, false);
18691903 else
1870− remove_all_queues_mes(dqm);
1904+ remove_all_kfd_queues_mes(dqm);
18711905
18721906 dqm->sched_running = false;
18731907
drivers/gpu/drm/amd/amdkfd/kfd_process.c+9−10
@@ -341,8 +341,8 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr, · 340 unmodified lines
341341 attr_sdma);
342342 struct kfd_sdma_activity_handler_workarea sdma_activity_work_handler;
343343
344− INIT_WORK(&sdma_activity_work_handler.sdma_activity_work,
345− kfd_sdma_activity_worker);
344+ INIT_WORK_ONSTACK(&sdma_activity_work_handler.sdma_activity_work,
345+ kfd_sdma_activity_worker);
346346
347347 sdma_activity_work_handler.pdd = pdd;
348348 sdma_activity_work_handler.sdma_activity_counter = 0;
@@ -350,6 +350,7 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr, · 1 unmodified line
350350 schedule_work(&sdma_activity_work_handler.sdma_activity_work);
351351
352352 flush_work(&sdma_activity_work_handler.sdma_activity_work);
353+ destroy_work_on_stack(&sdma_activity_work_handler.sdma_activity_work);
353354
354355 return snprintf(buffer, PAGE_SIZE, "%llu\n",
355356 (sdma_activity_work_handler.sdma_activity_counter)/
@@ -853,8 +854,10 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) · 497 unmodified lines
853854 goto out;
854855 }
855856
856− /* A prior open of /dev/kfd could have already created the process. */
857− process = find_process(thread, false);
857+ /* A prior open of /dev/kfd could have already created the process.
858+ * find_process will increase process kref in this case
859+ */
860+ process = find_process(thread, true);
858861 if (process) {
859862 pr_debug("Process already found\n");
860863 } else {
@@ -902,8 +905,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) · 41 unmodified lines
902905 init_waitqueue_head(&process->wait_irq_drain);
903906 }
904907 out:
905− if (!IS_ERR(process))
906− kref_get(&process->ref);
907908 mutex_unlock(&kfd_processes_mutex);
908909 mmput(thread->mm);
909910
@@ -1189,10 +1190,8 @@ static void kfd_process_ref_release(struct kref *ref) · 279 unmodified lines
11891190
11901191 static struct mmu_notifier *kfd_process_alloc_notifier(struct mm_struct *mm)
11911192 {
1192− int idx = srcu_read_lock(&kfd_processes_srcu);
1193− struct kfd_process *p = find_process_by_mm(mm);
1194−
1195− srcu_read_unlock(&kfd_processes_srcu, idx);
1193+ /* This increments p->ref counter if kfd process p exists */
1194+ struct kfd_process *p = kfd_lookup_process_by_mm(mm);
11961195
11971196 return p ? &p->mmu_notifier : ERR_PTR(-ESRCH);
11981197 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+83−57
@@ -1307,6 +1307,29 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev) · 1306 unmodified lines
13071307 DRM_INFO("DMUB hardware initialized: version=0x%08X\n",
13081308 adev->dm.dmcub_fw_version);
13091309
1310+ /* Keeping sanity checks off if
1311+ * DCN31 >= 4.0.59.0
1312+ * DCN314 >= 8.0.16.0
1313+ * Otherwise, turn on sanity checks
1314+ */
1315+ switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
1316+ case IP_VERSION(3, 1, 2):
1317+ case IP_VERSION(3, 1, 3):
1318+ if (adev->dm.dmcub_fw_version &&
1319+ adev->dm.dmcub_fw_version >= DMUB_FW_VERSION(4, 0, 0) &&
1320+ adev->dm.dmcub_fw_version < DMUB_FW_VERSION(4, 0, 59))
1321+ adev->dm.dc->debug.sanity_checks = true;
1322+ break;
1323+ case IP_VERSION(3, 1, 4):
1324+ if (adev->dm.dmcub_fw_version &&
1325+ adev->dm.dmcub_fw_version >= DMUB_FW_VERSION(4, 0, 0) &&
1326+ adev->dm.dmcub_fw_version < DMUB_FW_VERSION(8, 0, 16))
1327+ adev->dm.dc->debug.sanity_checks = true;
1328+ break;
1329+ default:
1330+ break;
1331+ }
1332+
13101333 return 0;
13111334 }
13121335
@@ -6790,7 +6813,7 @@ create_stream_for_sink(struct drm_connector *connector, · 5477 unmodified lines
67906813 if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22)
67916814 tf = TRANSFER_FUNC_GAMMA_22;
67926815 mod_build_vsc_infopacket(stream, &stream->vsc_infopacket, stream->output_color_space, tf);
6793− aconnector->psr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY;
6816+ aconnector->sr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY;
67946817
67956818 }
67966819 finish:
@@ -8894,6 +8917,56 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane, · 2097 unmodified lines
88948917 }
88958918 }
88968919
8920+static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
8921+ const struct dm_crtc_state *acrtc_state,
8922+ const u64 current_ts)
8923+{
8924+ struct psr_settings *psr = &acrtc_state->stream->link->psr_settings;
8925+ struct replay_settings *pr = &acrtc_state->stream->link->replay_settings;
8926+ struct amdgpu_dm_connector *aconn =
8927+ (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
8928+
8929+ if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
8930+ if (pr->config.replay_supported && !pr->replay_feature_enabled)
8931+ amdgpu_dm_link_setup_replay(acrtc_state->stream->link, aconn);
8932+ else if (psr->psr_version != DC_PSR_VERSION_UNSUPPORTED &&
8933+ !psr->psr_feature_enabled)
8934+ if (!aconn->disallow_edp_enter_psr)
8935+ amdgpu_dm_link_setup_psr(acrtc_state->stream);
8936+ }
8937+
8938+ /* Decrement skip count when SR is enabled and we're doing fast updates. */
8939+ if (acrtc_state->update_type == UPDATE_TYPE_FAST &&
8940+ (psr->psr_feature_enabled || pr->config.replay_supported)) {
8941+ if (aconn->sr_skip_count > 0)
8942+ aconn->sr_skip_count--;
8943+
8944+ /* Allow SR when skip count is 0. */
8945+ acrtc_attach->dm_irq_params.allow_sr_entry = !aconn->sr_skip_count;
8946+
8947+ /*
8948+ * If sink supports PSR SU/Panel Replay, there is no need to rely on
8949+ * a vblank event disable request to enable PSR/RP. PSR SU/RP
8950+ * can be enabled immediately once OS demonstrates an
8951+ * adequate number of fast atomic commits to notify KMD
8952+ * of update events. See `vblank_control_worker()`.
8953+ */
8954+ if (acrtc_attach->dm_irq_params.allow_sr_entry &&
8955+#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
8956+ !amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
8957+#endif
8958+ (current_ts - psr->psr_dirty_rects_change_timestamp_ns) > 500000000) {
8959+ if (pr->replay_feature_enabled && !pr->replay_allow_active)
8960+ amdgpu_dm_replay_enable(acrtc_state->stream, true);
8961+ if (psr->psr_version >= DC_PSR_VERSION_SU_1 &&
8962+ !psr->psr_allow_active && !aconn->disallow_edp_enter_psr)
8963+ amdgpu_dm_psr_enable(acrtc_state->stream);
8964+ }
8965+ } else {
8966+ acrtc_attach->dm_irq_params.allow_sr_entry = false;
8967+ }
8968+}
8969+
88978970 static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
88988971 struct drm_device *dev,
88998972 struct amdgpu_display_manager *dm,
@@ -9047,7 +9120,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 147 unmodified lines
90479120 * during the PSR-SU was disabled.
90489121 */
90499122 if (acrtc_state->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
9050− acrtc_attach->dm_irq_params.allow_psr_entry &&
9123+ acrtc_attach->dm_irq_params.allow_sr_entry &&
90519124 #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
90529125 !amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
90539126 #endif
@@ -9222,9 +9295,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 168 unmodified lines
92229295 bundle->stream_update.abm_level = &acrtc_state->abm_level;
92239296
92249297 mutex_lock(&dm->dc_lock);
9225− if ((acrtc_state->update_type > UPDATE_TYPE_FAST) &&
9226− acrtc_state->stream->link->psr_settings.psr_allow_active)
9227− amdgpu_dm_psr_disable(acrtc_state->stream);
9298+ if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
9299+ if (acrtc_state->stream->link->replay_settings.replay_allow_active)
9300+ amdgpu_dm_replay_disable(acrtc_state->stream);
9301+ if (acrtc_state->stream->link->psr_settings.psr_allow_active)
9302+ amdgpu_dm_psr_disable(acrtc_state->stream);
9303+ }
92289304 mutex_unlock(&dm->dc_lock);
92299305
92309306 /*
@@ -9265,57 +9341,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 34 unmodified lines
92659341 dm_update_pflip_irq_state(drm_to_adev(dev),
92669342 acrtc_attach);
92679343
9268− if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
9269− if (acrtc_state->stream->link->replay_settings.config.replay_supported &&
9270− !acrtc_state->stream->link->replay_settings.replay_feature_enabled) {
9271− struct amdgpu_dm_connector *aconn =
9272− (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
9273− amdgpu_dm_link_setup_replay(acrtc_state->stream->link, aconn);
9274− } else if (acrtc_state->stream->link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED &&
9275− !acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
9276−
9277− struct amdgpu_dm_connector *aconn = (struct amdgpu_dm_connector *)
9278− acrtc_state->stream->dm_stream_context;
9279−
9280− if (!aconn->disallow_edp_enter_psr)
9281− amdgpu_dm_link_setup_psr(acrtc_state->stream);
9282− }
9283− }
9284−
9285− /* Decrement skip count when PSR is enabled and we're doing fast updates. */
9286− if (acrtc_state->update_type == UPDATE_TYPE_FAST &&
9287− acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
9288− struct amdgpu_dm_connector *aconn =
9289− (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
9290−
9291− if (aconn->psr_skip_count > 0)
9292− aconn->psr_skip_count--;
9293−
9294− /* Allow PSR when skip count is 0. */
9295− acrtc_attach->dm_irq_params.allow_psr_entry = !aconn->psr_skip_count;
9296−
9297− /*
9298− * If sink supports PSR SU, there is no need to rely on
9299− * a vblank event disable request to enable PSR. PSR SU
9300− * can be enabled immediately once OS demonstrates an
9301− * adequate number of fast atomic commits to notify KMD
9302− * of update events. See `vblank_control_worker()`.
9303− */
9304− if (acrtc_state->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
9305− acrtc_attach->dm_irq_params.allow_psr_entry &&
9306−#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
9307− !amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
9308−#endif
9309− !acrtc_state->stream->link->psr_settings.psr_allow_active &&
9310− !aconn->disallow_edp_enter_psr &&
9311− (timestamp_ns -
9312− acrtc_state->stream->link->psr_settings.psr_dirty_rects_change_timestamp_ns) >
9313− 500000000)
9314− amdgpu_dm_psr_enable(acrtc_state->stream);
9315− } else {
9316− acrtc_attach->dm_irq_params.allow_psr_entry = false;
9317− }
9318−
9344+ amdgpu_dm_enable_self_refresh(acrtc_attach, acrtc_state, timestamp_ns);
93199345 mutex_unlock(&dm->dc_lock);
93209346 }
93219347
@@ -12101,7 +12127,7 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector, · 2779 unmodified lines
1210112127 break;
1210212128 }
1210312129
12104− while (j < EDID_LENGTH) {
12130+ while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) {
1210512131 struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
1210612132 unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);
1210712133
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+1−1
@@ -727,7 +727,7 @@ struct amdgpu_dm_connector { · 726 unmodified lines
727727 /* Cached display modes */
728728 struct drm_display_mode freesync_vid_base;
729729
730− int psr_skip_count;
730+ int sr_skip_count;
731731 bool disallow_edp_enter_psr;
732732
733733 /* Record progress status of mst*/
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c+2−3
@@ -265,11 +265,10 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work) · 264 unmodified lines
265265 * where the SU region is the full hactive*vactive region. See
266266 * fill_dc_dirty_rects().
267267 */
268− if (vblank_work->stream && vblank_work->stream->link) {
268+ if (vblank_work->stream && vblank_work->stream->link && vblank_work->acrtc) {
269269 amdgpu_dm_crtc_set_panel_sr_feature(
270270 vblank_work, vblank_work->enable,
271− vblank_work->acrtc->dm_irq_params.allow_psr_entry ||
272− vblank_work->stream->link->replay_settings.replay_feature_enabled);
271+ vblank_work->acrtc->dm_irq_params.allow_sr_entry);
273272 }
274273
275274 if (dm->active_vblank_irq_count == 0)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq_params.h+1−1
@@ -33,7 +33,7 @@ struct dm_irq_params { · 32 unmodified lines
3333 struct mod_vrr_params vrr_params;
3434 struct dc_stream_state *stream;
3535 int active_planes;
36− bool allow_psr_entry;
36+ bool allow_sr_entry;
3737 struct mod_freesync_config freesync_config;
3838
3939 #ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c+2−4
@@ -3122,14 +3122,12 @@ static enum bp_result bios_parser_get_vram_info( · 3121 unmodified lines
31223122 struct dc_vram_info *info)
31233123 {
31243124 struct bios_parser *bp = BP_FROM_DCB(dcb);
3125− static enum bp_result result = BP_RESULT_BADBIOSTABLE;
3125+ enum bp_result result = BP_RESULT_BADBIOSTABLE;
31263126 struct atom_common_table_header *header;
31273127 struct atom_data_revision revision;
31283128
31293129 // vram info moved to umc_info for DCN4x
3130− if (dcb->ctx->dce_version >= DCN_VERSION_4_01 &&
3131− dcb->ctx->dce_version < DCN_VERSION_MAX &&
3132− info && DATA_TABLES(umc_info)) {
3130+ if (info && DATA_TABLES(umc_info)) {
31333131 header = GET_IMAGE(struct atom_common_table_header,
31343132 DATA_TABLES(umc_info));
31353133
drivers/gpu/drm/amd/display/dc/core/dc_state.c+3−0
@@ -265,6 +265,9 @@ struct dc_state *dc_state_create_copy(struct dc_state *src_state) · 264 unmodified lines
265265 dc_state_copy_internal(new_state, src_state);
266266
267267 #ifdef CONFIG_DRM_AMD_DC_FP
268+ new_state->bw_ctx.dml2 = NULL;
269+ new_state->bw_ctx.dml2_dc_power_source = NULL;
270+
268271 if (src_state->bw_ctx.dml2 &&
269272 !dml2_create_copy(&new_state->bw_ctx.dml2, src_state->bw_ctx.dml2)) {
270273 dc_state_release(new_state);
drivers/gpu/drm/amd/display/dc/dc.h+1−1
@@ -55,7 +55,7 @@ struct aux_payload; · 54 unmodified lines
5555 struct set_config_cmd_payload;
5656 struct dmub_notification;
5757
58−#define DC_VER "3.2.308"
58+#define DC_VER "3.2.309"
5959
6060 #define MAX_SURFACES 3
6161 #define MAX_PLANES 6
drivers/gpu/drm/amd/display/dc/dc_types.h+1−0
@@ -181,6 +181,7 @@ struct dc_panel_patch { · 180 unmodified lines
181181 unsigned int disable_colorimetry;
182182 uint8_t blankstream_before_otg_off;
183183 bool oled_optimize_display_on;
184+ unsigned int force_mst_blocked_discovery;
184185 };
185186
186187 struct dc_edid_caps {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c+1−1
@@ -46,7 +46,7 @@ · 45 unmodified lines
4646 #include "clk_mgr.h"
4747
4848 __printf(3, 4)
49−unsigned int snprintf_count(char *pbuf, unsigned int bufsize, char *fmt, ...)
49+unsigned int snprintf_count(char *pbuf, unsigned int bufsize, const char *fmt, ...)
5050 {
5151 int ret_vsnprintf;
5252 unsigned int chars_printed;
drivers/gpu/drm/amd/display/dc/dm_services.h+1−1
@@ -143,7 +143,7 @@ void generic_reg_wait(const struct dc_context *ctx, · 142 unmodified lines
143143 unsigned int delay_between_poll_us, unsigned int time_out_num_tries,
144144 const char *func_name, int line);
145145
146−unsigned int snprintf_count(char *pBuf, unsigned int bufSize, char *fmt, ...);
146+unsigned int snprintf_count(char *pBuf, unsigned int bufSize, const char *fmt, ...);
147147
148148 /* These macros need to be used with soc15 registers in order to retrieve
149149 * the actual offset.
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c+9−2
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include "dml2_pmo_dcn4_fams2.h"
99
1010 static const double MIN_VACTIVE_MARGIN_PCT = 0.25; // We need more than non-zero margin because DET buffer granularity can alter vactive latency hiding
11+static const double MIN_BLANK_STUTTER_FACTOR = 3.0;
1112
1213 static const struct dml2_pmo_pstate_strategy base_strategy_list_1_display[] = {
1314 // VActive Preferred
@@ -2140,6 +2141,7 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in · 2126 unmodified lines
21402141 struct dml2_pmo_instance *pmo = in_out->instance;
21412142 bool stutter_period_meets_z8_eco = true;
21422143 bool z8_stutter_optimization_too_expensive = false;
2144+ bool stutter_optimization_too_expensive = false;
21432145 double line_time_us, vblank_nom_time_us;
21442146
21452147 unsigned int i;
@@ -2161,10 +2163,15 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in · 15 unmodified lines
21612163 line_time_us = (double)in_out->base_display_config->display_config.stream_descriptors[i].timing.h_total / (in_out->base_display_config->display_config.stream_descriptors[i].timing.pixel_clock_khz * 1000) * 1000000;
21622164 vblank_nom_time_us = line_time_us * in_out->base_display_config->display_config.stream_descriptors[i].timing.vblank_nom;
21632165
2164− if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.z8_stutter_exit_latency_us) {
2166+ if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.z8_stutter_exit_latency_us * MIN_BLANK_STUTTER_FACTOR) {
21652167 z8_stutter_optimization_too_expensive = true;
21662168 break;
21672169 }
2170+
2171+ if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us * MIN_BLANK_STUTTER_FACTOR) {
2172+ stutter_optimization_too_expensive = true;
2173+ break;
2174+ }
21682175 }
21692176
21702177 pmo->scratch.pmo_dcn4.num_stutter_candidates = 0;
@@ -2180,7 +2187,7 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in · 9 unmodified lines
21802187 pmo->scratch.pmo_dcn4.z8_vblank_optimizable = false;
21812188 }
21822189
2183− if (pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us > 0) {
2190+ if (!stutter_optimization_too_expensive && pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us > 0) {
21842191 pmo->scratch.pmo_dcn4.optimal_vblank_reserved_time_for_stutter_us[pmo->scratch.pmo_dcn4.num_stutter_candidates] = (unsigned int)pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us;
21852192 pmo->scratch.pmo_dcn4.num_stutter_candidates++;
21862193 }
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c+8−5
@@ -519,15 +519,18 @@ static void dcn31_reset_back_end_for_pipe( · 518 unmodified lines
519519
520520 dc->hwss.set_abm_immediate_disable(pipe_ctx);
521521
522− if ((!pipe_ctx->stream->dpms_off || pipe_ctx->stream->link->link_status.link_active)
523− && pipe_ctx->stream->sink && pipe_ctx->stream->sink->edid_caps.panel_patch.blankstream_before_otg_off) {
522+ link = pipe_ctx->stream->link;
523+
524+ if ((!pipe_ctx->stream->dpms_off || link->link_status.link_active) &&
525+ (link->connector_signal == SIGNAL_TYPE_EDP))
524526 dc->hwss.blank_stream(pipe_ctx);
525− }
526527
527528 pipe_ctx->stream_res.tg->funcs->set_dsc_config(
528529 pipe_ctx->stream_res.tg,
529530 OPTC_DSC_DISABLED, 0, 0);
531+
530532 pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
533+
531534 pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
532535 if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass)
533536 pipe_ctx->stream_res.tg->funcs->set_odm_bypass(
@@ -539,7 +542,6 @@ static void dcn31_reset_back_end_for_pipe( · 5 unmodified lines
539542 pipe_ctx->stream_res.tg->funcs->set_drr(
540543 pipe_ctx->stream_res.tg, NULL);
541544
542− link = pipe_ctx->stream->link;
543545 /* DPMS may already disable or */
544546 /* dpms_off status is incorrect due to fastboot
545547 * feature. When system resume from S4 with second
@@ -651,7 +653,8 @@ static void dmub_abm_set_backlight(struct dc_context *dc, · 105 unmodified lines
651653 cmd.abm_set_backlight.header.sub_type = DMUB_CMD__ABM_SET_BACKLIGHT;
652654 cmd.abm_set_backlight.abm_set_backlight_data.frame_ramp = backlight_level_params->frame_ramp;
653655 cmd.abm_set_backlight.abm_set_backlight_data.backlight_user_level = backlight_level_params->backlight_pwm_u16_16;
654− cmd.abm_set_backlight.abm_set_backlight_data.backlight_control_type = backlight_level_params->control_type;
656+ cmd.abm_set_backlight.abm_set_backlight_data.backlight_control_type =
657+ (enum dmub_backlight_control_type) backlight_level_params->control_type;
655658 cmd.abm_set_backlight.abm_set_backlight_data.min_luminance = backlight_level_params->min_luminance;
656659 cmd.abm_set_backlight.abm_set_backlight_data.max_luminance = backlight_level_params->max_luminance;
657660 cmd.abm_set_backlight.abm_set_backlight_data.min_backlight_pwm = backlight_level_params->min_backlight_pwm;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c+5−3
@@ -1633,9 +1633,11 @@ static bool retrieve_link_cap(struct dc_link *link) · 1632 unmodified lines
16331633 }
16341634
16351635 /* Read DP tunneling information. */
1636− status = dpcd_get_tunneling_device_data(link);
1637− if (status != DC_OK)
1638− dm_error("%s: Read tunneling device data failed.\n", __func__);
1636+ if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) {
1637+ status = dpcd_get_tunneling_device_data(link);
1638+ if (status != DC_OK)
1639+ dm_error("%s: Read tunneling device data failed.\n", __func__);
1640+ }
16391641
16401642 dpcd_set_source_specific_data(link);
16411643 /* Sink may need to configure internals based on vendor, so allow some
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c+3−13
@@ -221,21 +221,11 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link) · 220 unmodified lines
221221 &replay_error_status.raw,
222222 sizeof(replay_error_status.raw));
223223
224− link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR =
225− replay_error_status.bits.LINK_CRC_ERROR;
226− link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR =
227− replay_configuration.bits.DESYNC_ERROR_STATUS;
228− link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR =
229− replay_configuration.bits.STATE_TRANSITION_ERROR_STATUS;
230−
231− if (link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR ||
232− link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR ||
233− link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR) {
224+ if (replay_error_status.bits.LINK_CRC_ERROR ||
225+ replay_configuration.bits.DESYNC_ERROR_STATUS ||
226+ replay_configuration.bits.STATE_TRANSITION_ERROR_STATUS) {
234227 bool allow_active;
235228
236− if (link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR)
237− link->replay_settings.config.received_desync_error_hpd = 1;
238−
239229 if (link->replay_settings.config.force_disable_desync_error_check)
240230 return;
241231
drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c+0−13
@@ -559,17 +559,6 @@ static const struct dc_debug_options debug_defaults_drv = { · 558 unmodified lines
559559 .using_dml2 = false,
560560 };
561561
562−static const struct dc_debug_options debug_defaults_diags = {
563− .disable_dmcu = false,
564− .force_abm_enable = false,
565− .clock_trace = true,
566− .disable_stutter = true,
567− .disable_pplib_clock_request = true,
568− .disable_pplib_wm_range = true,
569− .underflow_assert_delay_us = 0xFFFFFFFF,
570− .enable_legacy_fast_update = true,
571−};
572−
573562 static void dcn10_dpp_destroy(struct dpp **dpp)
574563 {
575564 kfree(TO_DCN10_DPP(*dpp));
@@ -1398,8 +1387,6 @@ static bool dcn10_resource_construct( · 822 unmodified lines
13981387
13991388 if (dc->ctx->dce_environment == DCE_ENV_PRODUCTION_DRV)
14001389 dc->debug = debug_defaults_drv;
1401− else
1402− dc->debug = debug_defaults_diags;
14031390
14041391 /*************************************************
14051392 * Create resources *
drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c+1−1
@@ -868,7 +868,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 867 unmodified lines
868868 .max_downscale_src_width = 4096,/*upto true 4K*/
869869 .disable_pplib_wm_range = false,
870870 .scl_reset_length10 = true,
871− .sanity_checks = true,
871+ .sanity_checks = false,
872872 .underflow_assert_delay_us = 0xFFFFFFFF,
873873 .dwb_fi_phase = -1, // -1 = disable,
874874 .dmub_command_table = true,
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c+1−1
@@ -888,7 +888,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 887 unmodified lines
888888 .max_downscale_src_width = 4096,/*upto true 4k*/
889889 .disable_pplib_wm_range = false,
890890 .scl_reset_length10 = true,
891− .sanity_checks = true,
891+ .sanity_checks = false,
892892 .underflow_assert_delay_us = 0xFFFFFFFF,
893893 .dwb_fi_phase = -1, // -1 = disable,
894894 .dmub_command_table = true,
drivers/gpu/drm/amd/display/dc/spl/dc_spl.c+11−4
@@ -910,6 +910,16 @@ static void spl_get_taps_non_adaptive_scaler( · 909 unmodified lines
910910 spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c - 1;
911911 else
912912 spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c;
913+
914+ if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz))
915+ spl_scratch->scl_data.taps.h_taps = 1;
916+ if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert))
917+ spl_scratch->scl_data.taps.v_taps = 1;
918+ if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c))
919+ spl_scratch->scl_data.taps.h_taps_c = 1;
920+ if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c))
921+ spl_scratch->scl_data.taps.v_taps_c = 1;
922+
913923 }
914924
915925 /* Calculate optimal number of taps */
@@ -936,10 +946,7 @@ static bool spl_get_optimal_number_of_taps( · 20 unmodified lines
936946
937947 /* Disable adaptive scaler and sharpener when integer scaling is enabled */
938948 if (spl_in->scaling_quality.integer_scaling) {
939− spl_scratch->scl_data.taps.h_taps = 1;
940− spl_scratch->scl_data.taps.v_taps = 1;
941− spl_scratch->scl_data.taps.v_taps_c = 1;
942− spl_scratch->scl_data.taps.h_taps_c = 1;
949+ spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps);
943950 *enable_easf_v = false;
944951 *enable_easf_h = false;
945952 *enable_isharp = false;
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+29−6
@@ -4426,6 +4426,24 @@ struct dmub_rb_cmd_abm_set_pipe { · 4425 unmodified lines
44264426 struct dmub_cmd_abm_set_pipe_data abm_set_pipe_data;
44274427 };
44284428
4429+/**
4430+ * Type of backlight control method to be used by ABM module
4431+ */
4432+enum dmub_backlight_control_type {
4433+ /**
4434+ * PWM Backlight control
4435+ */
4436+ DMU_BACKLIGHT_CONTROL_PWM = 0,
4437+ /**
4438+ * VESA Aux-based backlight control
4439+ */
4440+ DMU_BACKLIGHT_CONTROL_VESA_AUX = 1,
4441+ /**
4442+ * AMD DPCD Aux-based backlight control
4443+ */
4444+ DMU_BACKLIGHT_CONTROL_AMD_AUX = 2,
4445+};
4446+
44294447 /**
44304448 * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command.
44314449 */
@@ -4452,18 +4470,23 @@ struct dmub_cmd_abm_set_backlight_data { · 20 unmodified lines
44524470 */
44534471 uint8_t panel_mask;
44544472
4473+ /**
4474+ * AUX HW Instance.
4475+ */
4476+ uint8_t aux_inst;
4477+
4478+ /**
4479+ * Explicit padding to 4 byte boundary.
4480+ */
4481+ uint8_t pad[1];
4482+
44554483 /**
44564484 * Backlight control type.
44574485 * Value 0 is PWM backlight control.
44584486 * Value 1 is VAUX backlight control.
44594487 * Value 2 is AMD DPCD AUX backlight control.
44604488 */
4461− uint8_t backlight_control_type;
4462−
4463− /**
4464− * AUX HW instance.
4465− */
4466− uint8_t aux_inst;
4489+ enum dmub_backlight_control_type backlight_control_type;
44674490
44684491 /**
44694492 * Minimum luminance in nits.
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c+3−1
@@ -497,6 +497,7 @@ enum dmub_status · 496 unmodified lines
497497 const struct dmub_fw_meta_info *fw_info;
498498 uint32_t fw_state_size = DMUB_FW_STATE_SIZE;
499499 uint32_t trace_buffer_size = DMUB_TRACE_BUFFER_SIZE;
500+ uint32_t shared_state_size = DMUB_FW_HEADER_SHARED_STATE_SIZE;
500501 uint32_t window_sizes[DMUB_WINDOW_TOTAL] = { 0 };
501502
502503 if (!dmub->sw_init)
@@ -514,6 +515,7 @@ enum dmub_status · 11 unmodified lines
514515
515516 fw_state_size = fw_info->fw_region_size;
516517 trace_buffer_size = fw_info->trace_buffer_size;
518+ shared_state_size = fw_info->shared_state_size;
517519
518520 /**
519521 * If DM didn't fill in a version, then fill it in based on
@@ -534,7 +536,7 @@ enum dmub_status · 14 unmodified lines
534536 window_sizes[DMUB_WINDOW_5_TRACEBUFF] = trace_buffer_size;
535537 window_sizes[DMUB_WINDOW_6_FW_STATE] = fw_state_size;
536538 window_sizes[DMUB_WINDOW_7_SCRATCH_MEM] = DMUB_SCRATCH_MEM_SIZE;
537− window_sizes[DMUB_WINDOW_SHARED_STATE] = DMUB_FW_HEADER_SHARED_STATE_SIZE;
539+ window_sizes[DMUB_WINDOW_SHARED_STATE] = max(DMUB_FW_HEADER_SHARED_STATE_SIZE, shared_state_size);
538540
539541 out->fb_size =
540542 dmub_srv_calc_regions_for_memory_type(params, out, window_sizes, DMUB_WINDOW_MEMORY_TYPE_FB);
drivers/gpu/drm/amd/include/mes_v11_api_def.h+42−1
@@ -230,13 +230,23 @@ union MESAPI_SET_HW_RESOURCES { · 229 unmodified lines
230230 uint32_t disable_add_queue_wptr_mc_addr : 1;
231231 uint32_t enable_mes_event_int_logging : 1;
232232 uint32_t enable_reg_active_poll : 1;
233− uint32_t reserved : 21;
233+ uint32_t use_disable_queue_in_legacy_uq_preemption : 1;
234+ uint32_t send_write_data : 1;
235+ uint32_t os_tdr_timeout_override : 1;
236+ uint32_t use_rs64mem_for_proc_gang_ctx : 1;
237+ uint32_t use_add_queue_unmap_flag_addr : 1;
238+ uint32_t enable_mes_sch_stb_log : 1;
239+ uint32_t limit_single_process : 1;
240+ uint32_t is_strix_tmz_wa_enabled :1;
241+ uint32_t reserved : 13;
234242 };
235243 uint32_t uint32_t_all;
236244 };
237245 uint32_t oversubscription_timer;
238246 uint64_t doorbell_info;
239247 uint64_t event_intr_history_gpu_mc_ptr;
248+ uint64_t timestamp;
249+ uint32_t os_tdr_timeout_in_sec;
240250 };
241251
242252 uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS];
@@ -563,6 +573,11 @@ enum MESAPI_MISC_OPCODE { · 320 unmodified lines
563573 MESAPI_MISC__READ_REG,
564574 MESAPI_MISC__WAIT_REG_MEM,
565575 MESAPI_MISC__SET_SHADER_DEBUGGER,
576+ MESAPI_MISC__NOTIFY_WORK_ON_UNMAPPED_QUEUE,
577+ MESAPI_MISC__NOTIFY_TO_UNMAP_PROCESSES,
578+ MESAPI_MISC__CHANGE_CONFIG,
579+ MESAPI_MISC__LAUNCH_CLEANER_SHADER,
580+
566581 MESAPI_MISC__MAX,
567582 };
568583
@@ -617,6 +632,31 @@ struct SET_SHADER_DEBUGGER { · 48 unmodified lines
617632 uint32_t trap_en;
618633 };
619634
635+enum MESAPI_MISC__CHANGE_CONFIG_OPTION {
636+ MESAPI_MISC__CHANGE_CONFIG_OPTION_LIMIT_SINGLE_PROCESS = 0,
637+ MESAPI_MISC__CHANGE_CONFIG_OPTION_ENABLE_HWS_LOGGING_BUFFER = 1,
638+ MESAPI_MISC__CHANGE_CONFIG_OPTION_CHANGE_TDR_CONFIG = 2,
639+
640+ MESAPI_MISC__CHANGE_CONFIG_OPTION_MAX = 0x1F
641+};
642+
643+struct CHANGE_CONFIG {
644+ enum MESAPI_MISC__CHANGE_CONFIG_OPTION opcode;
645+ union {
646+ struct {
647+ uint32_t limit_single_process : 1;
648+ uint32_t enable_hws_logging_buffer : 1;
649+ uint32_t reserved : 31;
650+ } bits;
651+ uint32_t all;
652+ } option;
653+
654+ struct {
655+ uint32_t tdr_level;
656+ uint32_t tdr_delay;
657+ } tdr_config;
658+};
659+
620660 union MESAPI__MISC {
621661 struct {
622662 union MES_API_HEADER header;
@@ -631,6 +671,7 @@ union MESAPI__MISC { · 8 unmodified lines
631671 struct WAIT_REG_MEM wait_reg_mem;
632672 struct SET_SHADER_DEBUGGER set_shader_debugger;
633673 enum MES_AMD_PRIORITY_LEVEL queue_sch_level;
674+ struct CHANGE_CONFIG change_config;
634675
635676 uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS];
636677 };
drivers/gpu/drm/amd/include/mes_v12_api_def.h+30−1
@@ -643,6 +643,10 @@ enum MESAPI_MISC_OPCODE { · 642 unmodified lines
643643 MESAPI_MISC__SET_SHADER_DEBUGGER,
644644 MESAPI_MISC__NOTIFY_WORK_ON_UNMAPPED_QUEUE,
645645 MESAPI_MISC__NOTIFY_TO_UNMAP_PROCESSES,
646+ MESAPI_MISC__QUERY_HUNG_ENGINE_ID,
647+ MESAPI_MISC__CHANGE_CONFIG,
648+ MESAPI_MISC__LAUNCH_CLEANER_SHADER,
649+ MESAPI_MISC__SETUP_MES_DBGEXT,
646650
647651 MESAPI_MISC__MAX,
648652 };
@@ -713,6 +717,31 @@ struct SET_GANG_SUBMIT { · 64 unmodified lines
713717 uint32_t slave_gang_context_array_index;
714718 };
715719
720+enum MESAPI_MISC__CHANGE_CONFIG_OPTION {
721+ MESAPI_MISC__CHANGE_CONFIG_OPTION_LIMIT_SINGLE_PROCESS = 0,
722+ MESAPI_MISC__CHANGE_CONFIG_OPTION_ENABLE_HWS_LOGGING_BUFFER = 1,
723+ MESAPI_MISC__CHANGE_CONFIG_OPTION_CHANGE_TDR_CONFIG = 2,
724+
725+ MESAPI_MISC__CHANGE_CONFIG_OPTION_MAX = 0x1F
726+};
727+
728+struct CHANGE_CONFIG {
729+ enum MESAPI_MISC__CHANGE_CONFIG_OPTION opcode;
730+ union {
731+ struct {
732+ uint32_t limit_single_process : 1;
733+ uint32_t enable_hws_logging_buffer : 1;
734+ uint32_t reserved : 30;
735+ } bits;
736+ uint32_t all;
737+ } option;
738+
739+ struct {
740+ uint32_t tdr_level;
741+ uint32_t tdr_delay;
742+ } tdr_config;
743+};
744+
716745 union MESAPI__MISC {
717746 struct {
718747 union MES_API_HEADER header;
@@ -726,7 +755,7 @@ union MESAPI__MISC { · 7 unmodified lines
726755 struct WAIT_REG_MEM wait_reg_mem;
727756 struct SET_SHADER_DEBUGGER set_shader_debugger;
728757 enum MES_AMD_PRIORITY_LEVEL queue_sch_level;
729−
758+ struct CHANGE_CONFIG change_config;
730759 uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS];
731760 };
732761 uint64_t timestamp;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c+24−0
@@ -3041,6 +3041,16 @@ static int mmhub_err_codes[] = { · 3040 unmodified lines
30413041 CODE_VML2, CODE_VML2_WALKER, CODE_MMCANE,
30423042 };
30433043
3044+static int vcn_err_codes[] = {
3045+ CODE_VIDD, CODE_VIDV,
3046+};
3047+static int jpeg_err_codes[] = {
3048+ CODE_JPEG0S, CODE_JPEG0D, CODE_JPEG1S, CODE_JPEG1D,
3049+ CODE_JPEG2S, CODE_JPEG2D, CODE_JPEG3S, CODE_JPEG3D,
3050+ CODE_JPEG4S, CODE_JPEG4D, CODE_JPEG5S, CODE_JPEG5D,
3051+ CODE_JPEG6S, CODE_JPEG6D, CODE_JPEG7S, CODE_JPEG7D,
3052+};
3053+
30443054 static const struct mca_ras_info mca_ras_table[] = {
30453055 {
30463056 .blkid = AMDGPU_RAS_BLOCK__UMC,
@@ -3069,6 +3079,20 @@ static const struct mca_ras_info mca_ras_table[] = { · 22 unmodified lines
30693079 .blkid = AMDGPU_RAS_BLOCK__XGMI_WAFL,
30703080 .ip = AMDGPU_MCA_IP_PCS_XGMI,
30713081 .get_err_count = mca_pcs_xgmi_mca_get_err_count,
3082+ }, {
3083+ .blkid = AMDGPU_RAS_BLOCK__VCN,
3084+ .ip = AMDGPU_MCA_IP_SMU,
3085+ .err_code_array = vcn_err_codes,
3086+ .err_code_count = ARRAY_SIZE(vcn_err_codes),
3087+ .get_err_count = mca_smu_mca_get_err_count,
3088+ .bank_is_valid = mca_smu_bank_is_valid,
3089+ }, {
3090+ .blkid = AMDGPU_RAS_BLOCK__JPEG,
3091+ .ip = AMDGPU_MCA_IP_SMU,
3092+ .err_code_array = jpeg_err_codes,
3093+ .err_code_count = ARRAY_SIZE(jpeg_err_codes),
3094+ .get_err_count = mca_smu_mca_get_err_count,
3095+ .bank_is_valid = mca_smu_bank_is_valid,
30723096 },
30733097 };
30743098
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c+3−2
@@ -1132,7 +1132,7 @@ static int smu_v14_0_common_get_dpm_level_count(struct smu_context *smu, · 1131 unmodified lines
11321132 static int smu_v14_0_0_print_clk_levels(struct smu_context *smu,
11331133 enum smu_clk_type clk_type, char *buf)
11341134 {
1135− int i, size = 0, ret = 0;
1135+ int i, idx, ret = 0, size = 0;
11361136 uint32_t cur_value = 0, value = 0, count = 0;
11371137 uint32_t min, max;
11381138
@@ -1168,7 +1168,8 @@ static int smu_v14_0_0_print_clk_levels(struct smu_context *smu, · 29 unmodified lines
11681168 break;
11691169
11701170 for (i = 0; i < count; i++) {
1171− ret = smu_v14_0_common_get_dpm_freq_by_index(smu, clk_type, i, &value);
1171+ idx = (clk_type == SMU_MCLK) ? (count - i - 1) : i;
1172+ ret = smu_v14_0_common_get_dpm_freq_by_index(smu, clk_type, idx, &value);
11721173 if (ret)
11731174 break;
11741175
include/uapi/drm/drm_fourcc.h+1−0
@@ -1516,6 +1516,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) · 1515 unmodified lines
15161516 * 64K_D_2D on GFX12 is identical to 64K_D on GFX11.
15171517 */
15181518 #define AMD_FMT_MOD_TILE_GFX9_64K_D 10
1519+#define AMD_FMT_MOD_TILE_GFX9_4K_D_X 22
15191520 #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
15201521 #define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26
15211522 #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27

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