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>
Unified · Split
| @@ -16,4 +16,5 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures. · 15 unmodified lines | |||
| 16 | thermal | 16 | thermal |
| 17 | driver-misc | 17 | driver-misc |
| 18 | debugging | 18 | debugging |
| 19 | process-isolation | ||
| 19 | amdgpu-glossary | 20 | amdgpu-glossary |
| @@ -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. | ||
| @@ -299,6 +299,12 @@ extern int amdgpu_wbrf; · 298 unmodified lines | |||
| 299 | #define AMDGPU_RESET_VCE (1 << 13) | 299 | #define AMDGPU_RESET_VCE (1 << 13) |
| 300 | #define AMDGPU_RESET_VCE1 (1 << 14) | 300 | #define AMDGPU_RESET_VCE1 (1 << 14) |
| 301 | 301 | ||
| 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 | |||
| 302 | /* max cursor sizes (in pixels) */ | 308 | /* max cursor sizes (in pixels) */ |
| 303 | #define CIK_CURSOR_WIDTH 128 | 309 | #define CIK_CURSOR_WIDTH 128 |
| 304 | #define CIK_CURSOR_HEIGHT 128 | 310 | #define CIK_CURSOR_HEIGHT 128 |
| @@ -1464,6 +1470,8 @@ struct dma_fence *amdgpu_device_get_gang(struct amdgpu_device *adev); · 1159 unmodified lines | |||
| 1464 | struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev, | 1470 | struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev, |
| 1465 | struct dma_fence *gang); | 1471 | struct dma_fence *gang); |
| 1466 | bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev); | 1472 | 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); | ||
| 1467 | 1475 | ||
| 1468 | /* atpx handler */ | 1476 | /* atpx handler */ |
| 1469 | #if defined(CONFIG_VGA_SWITCHEROO) | 1477 | #if defined(CONFIG_VGA_SWITCHEROO) |
| @@ -158,7 +158,7 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_ · 157 unmodified lines | |||
| 158 | return -EINVAL; | 158 | return -EINVAL; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | if (start + count >= max_count) | 161 | if (start + count > max_count) |
| 162 | return -EINVAL; | 162 | return -EINVAL; |
| 163 | 163 | ||
| 164 | count = min_t(int, count, max_count); | 164 | count = min_t(int, count, max_count); |
| @@ -834,6 +834,9 @@ int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off, · 833 unmodified lines | |||
| 834 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) | 834 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) |
| 835 | return -EINVAL; | 835 | return -EINVAL; |
| 836 | 836 | ||
| 837 | if (!kiq_ring->sched.ready || adev->job_hang) | ||
| 838 | return 0; | ||
| 839 | |||
| 837 | ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL); | 840 | ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL); |
| 838 | if (!ring_funcs) | 841 | if (!ring_funcs) |
| 839 | return -ENOMEM; | 842 | return -ENOMEM; |
| @@ -858,8 +861,14 @@ int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off, · 18 unmodified lines | |||
| 858 | 861 | ||
| 859 | kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0); | 862 | kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0); |
| 860 | 863 | ||
| 861 | if (kiq_ring->sched.ready && !adev->job_hang) | 864 | /* Submit unmap queue packet */ |
| 862 | r = amdgpu_ring_test_helper(kiq_ring); | 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); | ||
| 863 | 872 | ||
| 864 | spin_unlock(&kiq->ring_lock); | 873 | spin_unlock(&kiq->ring_lock); |
| 865 | 874 | ||
| @@ -4236,7 +4236,10 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 4235 unmodified lines | |||
| 4236 | * for throttling interrupt) = 60 seconds. | 4236 | * for throttling interrupt) = 60 seconds. |
| 4237 | */ | 4237 | */ |
| 4238 | ratelimit_state_init(&adev->throttling_logging_rs, (60 - 1) * HZ, 1); | 4238 | ratelimit_state_init(&adev->throttling_logging_rs, (60 - 1) * HZ, 1); |
| 4239 | ratelimit_state_init(&adev->virt.ras_telemetry_rs, 5 * HZ, 1); | ||
| 4240 | |||
| 4239 | ratelimit_set_flags(&adev->throttling_logging_rs, RATELIMIT_MSG_ON_RELEASE); | 4241 | ratelimit_set_flags(&adev->throttling_logging_rs, RATELIMIT_MSG_ON_RELEASE); |
| 4242 | ratelimit_set_flags(&adev->virt.ras_telemetry_rs, RATELIMIT_MSG_ON_RELEASE); | ||
| 4240 | 4243 | ||
| 4241 | /* Registers mapping */ | 4244 | /* Registers mapping */ |
| 4242 | /* TODO: block userspace mapping of io register */ | 4245 | /* TODO: block userspace mapping of io register */ |
| @@ -5186,6 +5189,9 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · 943 unmodified lines | |||
| 5186 | amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) || | 5189 | amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) || |
| 5187 | amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 3)) | 5190 | amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 3)) |
| 5188 | amdgpu_ras_resume(adev); | 5191 | amdgpu_ras_resume(adev); |
| 5192 | |||
| 5193 | amdgpu_virt_ras_telemetry_post_reset(adev); | ||
| 5194 | |||
| 5189 | return 0; | 5195 | return 0; |
| 5190 | } | 5196 | } |
| 5191 | 5197 | ||
| @@ -6200,6 +6206,9 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev, · 1008 unmodified lines | |||
| 6200 | bool p2p_access = | 6206 | bool p2p_access = |
| 6201 | !adev->gmc.xgmi.connected_to_cpu && | 6207 | !adev->gmc.xgmi.connected_to_cpu && |
| 6202 | !(pci_p2pdma_distance(adev->pdev, peer_adev->dev, false) < 0); | 6208 | !(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)); | ||
| 6203 | 6212 | ||
| 6204 | bool is_large_bar = adev->gmc.visible_vram_size && | 6213 | bool is_large_bar = adev->gmc.visible_vram_size && |
| 6205 | adev->gmc.real_vram_size == adev->gmc.visible_vram_size; | 6214 | 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 | |||
| 6715 | } | 6724 | } |
| 6716 | return ret; | 6725 | return ret; |
| 6717 | } | 6726 | } |
| 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 | } | ||
| @@ -515,6 +515,9 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id) · 514 unmodified lines | |||
| 515 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) | 515 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) |
| 516 | return -EINVAL; | 516 | return -EINVAL; |
| 517 | 517 | ||
| 518 | if (!kiq_ring->sched.ready || adev->job_hang || amdgpu_in_reset(adev)) | ||
| 519 | return 0; | ||
| 520 | |||
| 518 | spin_lock(&kiq->ring_lock); | 521 | spin_lock(&kiq->ring_lock); |
| 519 | if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size * | 522 | if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size * |
| 520 | adev->gfx.num_compute_rings)) { | 523 | adev->gfx.num_compute_rings)) { |
| @@ -528,20 +531,15 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id) · 7 unmodified lines | |||
| 528 | &adev->gfx.compute_ring[j], | 531 | &adev->gfx.compute_ring[j], |
| 529 | RESET_QUEUES, 0, 0); | 532 | RESET_QUEUES, 0, 0); |
| 530 | } | 533 | } |
| 531 | 534 | /* Submit unmap queue packet */ | |
| 532 | /** | 535 | amdgpu_ring_commit(kiq_ring); |
| 533 | * This is workaround: only skip kiq_ring test | 536 | /* |
| 534 | * during ras recovery in suspend stage for gfx9.4.3 | 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. | ||
| 535 | */ | 540 | */ |
| 536 | if ((amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3) || | 541 | r = amdgpu_ring_test_helper(kiq_ring); |
| 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 | } | ||
| 542 | 542 | ||
| 543 | if (kiq_ring->sched.ready && !adev->job_hang) | ||
| 544 | r = amdgpu_ring_test_helper(kiq_ring); | ||
| 545 | spin_unlock(&kiq->ring_lock); | 543 | spin_unlock(&kiq->ring_lock); |
| 546 | 544 | ||
| 547 | return r; | 545 | return r; |
| @@ -569,8 +567,11 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id) · 21 unmodified lines | |||
| 569 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) | 567 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) |
| 570 | return -EINVAL; | 568 | return -EINVAL; |
| 571 | 569 | ||
| 572 | spin_lock(&kiq->ring_lock); | 570 | if (!adev->gfx.kiq[0].ring.sched.ready || adev->job_hang) |
| 571 | return 0; | ||
| 572 | |||
| 573 | if (amdgpu_gfx_is_master_xcc(adev, xcc_id)) { | 573 | if (amdgpu_gfx_is_master_xcc(adev, xcc_id)) { |
| 574 | spin_lock(&kiq->ring_lock); | ||
| 574 | if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size * | 575 | if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size * |
| 575 | adev->gfx.num_gfx_rings)) { | 576 | adev->gfx.num_gfx_rings)) { |
| 576 | spin_unlock(&kiq->ring_lock); | 577 | spin_unlock(&kiq->ring_lock); |
| @@ -583,11 +584,17 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id) · 6 unmodified lines | |||
| 583 | &adev->gfx.gfx_ring[j], | 584 | &adev->gfx.gfx_ring[j], |
| 584 | PREEMPT_QUEUES, 0, 0); | 585 | PREEMPT_QUEUES, 0, 0); |
| 585 | } | 586 | } |
| 586 | } | 587 | /* Submit unmap queue packet */ |
| 588 | amdgpu_ring_commit(kiq_ring); | ||
| 587 | 589 | ||
| 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 | */ | ||
| 589 | r = amdgpu_ring_test_helper(kiq_ring); | 595 | r = amdgpu_ring_test_helper(kiq_ring); |
| 590 | spin_unlock(&kiq->ring_lock); | 596 | spin_unlock(&kiq->ring_lock); |
| 597 | } | ||
| 591 | 598 | ||
| 592 | return r; | 599 | return r; |
| 593 | } | 600 | } |
| @@ -692,7 +699,13 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev, int xcc_id) · 98 unmodified lines | |||
| 692 | kiq->pmf->kiq_map_queues(kiq_ring, | 699 | kiq->pmf->kiq_map_queues(kiq_ring, |
| 693 | &adev->gfx.compute_ring[j]); | 700 | &adev->gfx.compute_ring[j]); |
| 694 | } | 701 | } |
| 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 | */ | ||
| 696 | r = amdgpu_ring_test_helper(kiq_ring); | 709 | r = amdgpu_ring_test_helper(kiq_ring); |
| 697 | spin_unlock(&kiq->ring_lock); | 710 | spin_unlock(&kiq->ring_lock); |
| 698 | if (r) | 711 | if (r) |
| @@ -743,7 +756,13 @@ int amdgpu_gfx_enable_kgq(struct amdgpu_device *adev, int xcc_id) · 44 unmodified lines | |||
| 743 | &adev->gfx.gfx_ring[j]); | 756 | &adev->gfx.gfx_ring[j]); |
| 744 | } | 757 | } |
| 745 | } | 758 | } |
| 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 | */ | ||
| 747 | r = amdgpu_ring_test_helper(kiq_ring); | 766 | r = amdgpu_ring_test_helper(kiq_ring); |
| 748 | spin_unlock(&kiq->ring_lock); | 767 | spin_unlock(&kiq->ring_lock); |
| 749 | if (r) | 768 | if (r) |
| @@ -885,6 +904,9 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *r · 135 unmodified lines | |||
| 885 | if (r) | 904 | if (r) |
| 886 | return r; | 905 | return r; |
| 887 | 906 | ||
| 907 | if (amdgpu_sriov_vf(adev)) | ||
| 908 | return r; | ||
| 909 | |||
| 888 | if (adev->gfx.cp_ecc_error_irq.funcs) { | 910 | if (adev->gfx.cp_ecc_error_irq.funcs) { |
| 889 | r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); | 911 | r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); |
| 890 | if (r) | 912 | if (r) |
| @@ -1576,9 +1598,11 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev, · 685 unmodified lines | |||
| 1576 | if (adev->enforce_isolation[i] && !partition_values[i]) { | 1598 | if (adev->enforce_isolation[i] && !partition_values[i]) { |
| 1577 | /* Going from enabled to disabled */ | 1599 | /* Going from enabled to disabled */ |
| 1578 | amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(i)); | 1600 | amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(i)); |
| 1601 | amdgpu_mes_set_enforce_isolation(adev, i, false); | ||
| 1579 | } else if (!adev->enforce_isolation[i] && partition_values[i]) { | 1602 | } else if (!adev->enforce_isolation[i] && partition_values[i]) { |
| 1580 | /* Going from disabled to enabled */ | 1603 | /* Going from disabled to enabled */ |
| 1581 | amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i)); | 1604 | amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i)); |
| 1605 | amdgpu_mes_set_enforce_isolation(adev, i, true); | ||
| 1582 | } | 1606 | } |
| 1583 | adev->enforce_isolation[i] = partition_values[i]; | 1607 | adev->enforce_isolation[i] = partition_values[i]; |
| 1584 | } | 1608 | } |
| @@ -1588,6 +1612,32 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev, · 3 unmodified lines | |||
| 1588 | return count; | 1612 | return count; |
| 1589 | } | 1613 | } |
| 1590 | 1614 | ||
| 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 | |||
| 1591 | static DEVICE_ATTR(run_cleaner_shader, 0200, | 1641 | static DEVICE_ATTR(run_cleaner_shader, 0200, |
| 1592 | NULL, amdgpu_gfx_set_run_cleaner_shader); | 1642 | NULL, amdgpu_gfx_set_run_cleaner_shader); |
| 1593 | 1643 | ||
| @@ -1601,6 +1651,11 @@ static DEVICE_ATTR(current_compute_partition, 0644, · 7 unmodified lines | |||
| 1601 | 1651 | ||
| 1602 | static DEVICE_ATTR(available_compute_partition, 0444, | 1652 | static DEVICE_ATTR(available_compute_partition, 0444, |
| 1603 | amdgpu_gfx_get_available_compute_partition, NULL); | 1653 | 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); | ||
| 1604 | 1659 | ||
| 1605 | static int amdgpu_gfx_sysfs_xcp_init(struct amdgpu_device *adev) | 1660 | static int amdgpu_gfx_sysfs_xcp_init(struct amdgpu_device *adev) |
| 1606 | { | 1661 | { |
| @@ -1666,6 +1721,40 @@ static void amdgpu_gfx_sysfs_isolation_shader_fini(struct amdgpu_device *adev) · 59 unmodified lines | |||
| 1666 | device_remove_file(adev->dev, &dev_attr_run_cleaner_shader); | 1721 | device_remove_file(adev->dev, &dev_attr_run_cleaner_shader); |
| 1667 | } | 1722 | } |
| 1668 | 1723 | ||
| 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 | |||
| 1669 | int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev) | 1758 | int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev) |
| 1670 | { | 1759 | { |
| 1671 | int r; | 1760 | int r; |
| @@ -1680,6 +1769,10 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev) · 8 unmodified lines | |||
| 1680 | if (r) | 1769 | if (r) |
| 1681 | dev_err(adev->dev, "failed to create isolation sysfs files"); | 1770 | dev_err(adev->dev, "failed to create isolation sysfs files"); |
| 1682 | 1771 | ||
| 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 | |||
| 1683 | return r; | 1776 | return r; |
| 1684 | } | 1777 | } |
| 1685 | 1778 | ||
| @@ -1687,6 +1780,7 @@ void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev) · 1 unmodified line | |||
| 1687 | { | 1780 | { |
| 1688 | amdgpu_gfx_sysfs_xcp_fini(adev); | 1781 | amdgpu_gfx_sysfs_xcp_fini(adev); |
| 1689 | amdgpu_gfx_sysfs_isolation_shader_fini(adev); | 1782 | amdgpu_gfx_sysfs_isolation_shader_fini(adev); |
| 1783 | amdgpu_gfx_sysfs_reset_mask_fini(adev); | ||
| 1690 | } | 1784 | } |
| 1691 | 1785 | ||
| 1692 | int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev, | 1786 | int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev, |
| @@ -424,6 +424,8 @@ struct amdgpu_gfx { · 423 unmodified lines | |||
| 424 | /* reset mask */ | 424 | /* reset mask */ |
| 425 | uint32_t grbm_soft_reset; | 425 | uint32_t grbm_soft_reset; |
| 426 | uint32_t srbm_soft_reset; | 426 | uint32_t srbm_soft_reset; |
| 427 | uint32_t gfx_supported_reset; | ||
| 428 | uint32_t compute_supported_reset; | ||
| 427 | 429 | ||
| 428 | /* gfx off */ | 430 | /* gfx off */ |
| 429 | bool gfx_off_state; /* true: enabled, false: disabled */ | 431 | bool gfx_off_state; /* true: enabled, false: disabled */ |
| @@ -47,7 +47,7 @@ int amdgpu_jpeg_sw_init(struct amdgpu_device *adev) · 46 unmodified lines | |||
| 47 | adev->jpeg.indirect_sram = true; | 47 | adev->jpeg.indirect_sram = true; |
| 48 | 48 | ||
| 49 | for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) { | 49 | 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)) |
| 51 | continue; | 51 | continue; |
| 52 | 52 | ||
| 53 | if (adev->jpeg.indirect_sram) { | 53 | if (adev->jpeg.indirect_sram) { |
| @@ -73,7 +73,7 @@ int amdgpu_jpeg_sw_fini(struct amdgpu_device *adev) · 19 unmodified lines | |||
| 73 | int i, j; | 73 | int i, j; |
| 74 | 74 | ||
| 75 | for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) { | 75 | 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)) |
| 77 | continue; | 77 | continue; |
| 78 | 78 | ||
| 79 | amdgpu_bo_free_kernel( | 79 | amdgpu_bo_free_kernel( |
| @@ -110,7 +110,7 @@ static void amdgpu_jpeg_idle_work_handler(struct work_struct *work) · 30 unmodified lines | |||
| 110 | unsigned int i, j; | 110 | unsigned int i, j; |
| 111 | 111 | ||
| 112 | for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) { | 112 | 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)) |
| 114 | continue; | 114 | continue; |
| 115 | 115 | ||
| 116 | for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j) | 116 | 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 | |||
| 357 | if (!adev) | 357 | if (!adev) |
| 358 | return -ENODEV; | 358 | return -ENODEV; |
| 359 | 359 | ||
| 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; |
| 361 | if ((val & mask) == 0) | 361 | if ((val & mask) == 0) |
| 362 | return -EINVAL; | 362 | return -EINVAL; |
| 363 | 363 | ||
| @@ -388,7 +388,7 @@ static int amdgpu_debugfs_jpeg_sched_mask_get(void *data, u64 *val) · 24 unmodified lines | |||
| 388 | for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j) { | 388 | for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j) { |
| 389 | ring = &adev->jpeg.inst[i].ring_dec[j]; | 389 | ring = &adev->jpeg.inst[i].ring_dec[j]; |
| 390 | if (ring->sched.ready) | 390 | if (ring->sched.ready) |
| 391 | mask |= 1 << ((i * adev->jpeg.num_jpeg_rings) + j); | 391 | mask |= 1ULL << ((i * adev->jpeg.num_jpeg_rings) + j); |
| 392 | } | 392 | } |
| 393 | } | 393 | } |
| 394 | *val = mask; | 394 | *val = mask; |
| @@ -415,3 +415,38 @@ void amdgpu_debugfs_jpeg_sched_mask_init(struct amdgpu_device *adev) · 20 unmodified lines | |||
| 415 | &amdgpu_debugfs_jpeg_sched_mask_fops); | 415 | &amdgpu_debugfs_jpeg_sched_mask_fops); |
| 416 | #endif | 416 | #endif |
| 417 | } | 417 | } |
| 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 | } | ||
| @@ -128,6 +128,7 @@ struct amdgpu_jpeg { · 127 unmodified lines | |||
| 128 | uint16_t inst_mask; | 128 | uint16_t inst_mask; |
| 129 | uint8_t num_inst_per_aid; | 129 | uint8_t num_inst_per_aid; |
| 130 | bool indirect_sram; | 130 | bool indirect_sram; |
| 131 | uint32_t supported_reset; | ||
| 131 | }; | 132 | }; |
| 132 | 133 | ||
| 133 | int amdgpu_jpeg_sw_init(struct amdgpu_device *adev); | 134 | 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 | |||
| 150 | int amdgpu_jpeg_psp_update_sram(struct amdgpu_device *adev, int inst_idx, | 151 | int amdgpu_jpeg_psp_update_sram(struct amdgpu_device *adev, int inst_idx, |
| 151 | enum AMDGPU_UCODE_ID ucode_id); | 152 | enum AMDGPU_UCODE_ID ucode_id); |
| 152 | void amdgpu_debugfs_jpeg_sched_mask_init(struct amdgpu_device *adev); | 153 | 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); | ||
| 153 | 156 | ||
| 154 | #endif /*__AMDGPU_JPEG_H__*/ | 157 | #endif /*__AMDGPU_JPEG_H__*/ |
| @@ -104,7 +104,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev) · 103 unmodified lines | |||
| 104 | return 0; | 104 | return 0; |
| 105 | 105 | ||
| 106 | r = amdgpu_bo_create_kernel(adev, adev->mes.event_log_size, PAGE_SIZE, | 106 | r = amdgpu_bo_create_kernel(adev, adev->mes.event_log_size, PAGE_SIZE, |
| 107 | AMDGPU_GEM_DOMAIN_GTT, | 107 | AMDGPU_GEM_DOMAIN_VRAM, |
| 108 | &adev->mes.event_log_gpu_obj, | 108 | &adev->mes.event_log_gpu_obj, |
| 109 | &adev->mes.event_log_gpu_addr, | 109 | &adev->mes.event_log_gpu_addr, |
| 110 | &adev->mes.event_log_cpu_addr); | 110 | &adev->mes.event_log_cpu_addr); |
| @@ -192,17 +192,6 @@ int amdgpu_mes_init(struct amdgpu_device *adev) · 81 unmodified lines | |||
| 192 | (uint64_t *)&adev->wb.wb[adev->mes.query_status_fence_offs[i]]; | 192 | (uint64_t *)&adev->wb.wb[adev->mes.query_status_fence_offs[i]]; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 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 | |||
| 206 | r = amdgpu_mes_doorbell_init(adev); | 195 | r = amdgpu_mes_doorbell_init(adev); |
| 207 | if (r) | 196 | if (r) |
| 208 | goto error; | 197 | goto error; |
| @@ -223,8 +212,6 @@ error: · 14 unmodified lines | |||
| 223 | amdgpu_device_wb_free(adev, | 212 | amdgpu_device_wb_free(adev, |
| 224 | adev->mes.query_status_fence_offs[i]); | 213 | adev->mes.query_status_fence_offs[i]); |
| 225 | } | 214 | } |
| 226 | if (adev->mes.read_val_ptr) | ||
| 227 | amdgpu_device_wb_free(adev, adev->mes.read_val_offs); | ||
| 228 | 215 | ||
| 229 | idr_destroy(&adev->mes.pasid_idr); | 216 | idr_destroy(&adev->mes.pasid_idr); |
| 230 | idr_destroy(&adev->mes.gang_id_idr); | 217 | idr_destroy(&adev->mes.gang_id_idr); |
| @@ -249,8 +236,6 @@ void amdgpu_mes_fini(struct amdgpu_device *adev) · 18 unmodified lines | |||
| 249 | amdgpu_device_wb_free(adev, | 236 | amdgpu_device_wb_free(adev, |
| 250 | adev->mes.query_status_fence_offs[i]); | 237 | adev->mes.query_status_fence_offs[i]); |
| 251 | } | 238 | } |
| 252 | if (adev->mes.read_val_ptr) | ||
| 253 | amdgpu_device_wb_free(adev, adev->mes.read_val_offs); | ||
| 254 | 239 | ||
| 255 | amdgpu_mes_doorbell_free(adev); | 240 | amdgpu_mes_doorbell_free(adev); |
| 256 | 241 | ||
| @@ -921,10 +906,19 @@ uint32_t amdgpu_mes_rreg(struct amdgpu_device *adev, uint32_t reg) · 664 unmodified lines | |||
| 921 | { | 906 | { |
| 922 | struct mes_misc_op_input op_input; | 907 | struct mes_misc_op_input op_input; |
| 923 | int r, val = 0; | 908 | int r, val = 0; |
| 909 | uint32_t addr_offset = 0; | ||
| 910 | uint64_t read_val_gpu_addr; | ||
| 911 | uint32_t *read_val_ptr; | ||
| 924 | 912 | ||
| 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]; | ||
| 925 | op_input.op = MES_MISC_OP_READ_REG; | 919 | op_input.op = MES_MISC_OP_READ_REG; |
| 926 | op_input.read_reg.reg_offset = reg; | 920 | 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; |
| 928 | 922 | ||
| 929 | if (!adev->mes.funcs->misc_op) { | 923 | if (!adev->mes.funcs->misc_op) { |
| 930 | DRM_ERROR("mes rreg is not supported!\n"); | 924 | 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 | |||
| 935 | if (r) | 929 | if (r) |
| 936 | DRM_ERROR("failed to read reg (0x%x)\n", reg); | 930 | DRM_ERROR("failed to read reg (0x%x)\n", reg); |
| 937 | else | 931 | else |
| 938 | val = *(adev->mes.read_val_ptr); | 932 | val = *(read_val_ptr); |
| 939 | 933 | ||
| 940 | error: | 934 | error: |
| 935 | if (addr_offset) | ||
| 936 | amdgpu_device_wb_free(adev, addr_offset); | ||
| 941 | return val; | 937 | return val; |
| 942 | } | 938 | } |
| 943 | 939 | ||
| @@ -1682,6 +1678,29 @@ bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev) · 738 unmodified lines | |||
| 1682 | return is_supported; | 1678 | return is_supported; |
| 1683 | } | 1679 | } |
| 1684 | 1680 | ||
| 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 | |||
| 1685 | #if defined(CONFIG_DEBUG_FS) | 1704 | #if defined(CONFIG_DEBUG_FS) |
| 1686 | 1705 | ||
| 1687 | static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused) | 1706 | static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused) |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | #define AMDGPU_MES_VERSION_MASK 0x00000fff | 40 | #define AMDGPU_MES_VERSION_MASK 0x00000fff |
| 41 | #define AMDGPU_MES_API_VERSION_MASK 0x00fff000 | 41 | #define AMDGPU_MES_API_VERSION_MASK 0x00fff000 |
| 42 | #define AMDGPU_MES_FEAT_VERSION_MASK 0xff000000 | 42 | #define AMDGPU_MES_FEAT_VERSION_MASK 0xff000000 |
| 43 | #define AMDGPU_MES_MSCRATCH_SIZE 0x8000 | ||
| 43 | 44 | ||
| 44 | enum amdgpu_mes_priority_level { | 45 | enum amdgpu_mes_priority_level { |
| 45 | AMDGPU_MES_PRIORITY_LEVEL_LOW = 0, | 46 | AMDGPU_MES_PRIORITY_LEVEL_LOW = 0, |
| @@ -120,9 +121,6 @@ struct amdgpu_mes { · 74 unmodified lines | |||
| 120 | uint32_t query_status_fence_offs[AMDGPU_MAX_MES_PIPES]; | 121 | uint32_t query_status_fence_offs[AMDGPU_MAX_MES_PIPES]; |
| 121 | uint64_t query_status_fence_gpu_addr[AMDGPU_MAX_MES_PIPES]; | 122 | uint64_t query_status_fence_gpu_addr[AMDGPU_MAX_MES_PIPES]; |
| 122 | uint64_t *query_status_fence_ptr[AMDGPU_MAX_MES_PIPES]; | 123 | 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; | ||
| 126 | 124 | ||
| 127 | uint32_t saved_flags; | 125 | uint32_t saved_flags; |
| 128 | 126 | ||
| @@ -311,6 +309,7 @@ enum mes_misc_opcode { · 182 unmodified lines | |||
| 311 | MES_MISC_OP_WRM_REG_WAIT, | 309 | MES_MISC_OP_WRM_REG_WAIT, |
| 312 | MES_MISC_OP_WRM_REG_WR_WAIT, | 310 | MES_MISC_OP_WRM_REG_WR_WAIT, |
| 313 | MES_MISC_OP_SET_SHADER_DEBUGGER, | 311 | MES_MISC_OP_SET_SHADER_DEBUGGER, |
| 312 | MES_MISC_OP_CHANGE_CONFIG, | ||
| 314 | }; | 313 | }; |
| 315 | 314 | ||
| 316 | struct mes_misc_op_input { | 315 | struct mes_misc_op_input { |
| @@ -349,6 +348,21 @@ struct mes_misc_op_input { · 32 unmodified lines | |||
| 349 | uint32_t tcp_watch_cntl[4]; | 348 | uint32_t tcp_watch_cntl[4]; |
| 350 | uint32_t trap_en; | 349 | uint32_t trap_en; |
| 351 | } set_shader_debugger; | 350 | } 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; | ||
| 352 | }; | 366 | }; |
| 353 | }; | 367 | }; |
| 354 | 368 | ||
| @@ -519,4 +533,7 @@ static inline void amdgpu_mes_unlock(struct amdgpu_mes *mes) · 164 unmodified lines | |||
| 519 | } | 533 | } |
| 520 | 534 | ||
| 521 | bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev); | 535 | 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 | |||
| 522 | #endif /* __AMDGPU_MES_H__ */ | 539 | #endif /* __AMDGPU_MES_H__ */ |
| @@ -162,7 +162,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) · 161 unmodified lines | |||
| 162 | * When GTT is just an alternative to VRAM make sure that we | 162 | * When GTT is just an alternative to VRAM make sure that we |
| 163 | * only use it as fallback and still try to fill up VRAM first. | 163 | * only use it as fallback and still try to fill up VRAM first. |
| 164 | */ | 164 | */ |
| 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)) | ||
| 166 | places[c].flags |= TTM_PL_FLAG_FALLBACK; | 167 | places[c].flags |= TTM_PL_FLAG_FALLBACK; |
| 167 | c++; | 168 | c++; |
| 168 | } | 169 | } |
| @@ -1214,6 +1214,42 @@ static void amdgpu_ras_error_generate_report(struct amdgpu_device *adev, · 1213 unmodified lines | |||
| 1214 | } | 1214 | } |
| 1215 | } | 1215 | } |
| 1216 | 1216 | ||
| 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 | |||
| 1217 | static void amdgpu_rasmgr_error_data_statistic_update(struct ras_manager *obj, struct ras_err_data *err_data) | 1253 | static void amdgpu_rasmgr_error_data_statistic_update(struct ras_manager *obj, struct ras_err_data *err_data) |
| 1218 | { | 1254 | { |
| 1219 | struct ras_err_node *err_node; | 1255 | 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 | |||
| 1237 | } | 1273 | } |
| 1238 | } | 1274 | } |
| 1239 | 1275 | ||
| 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 | |||
| 1240 | static struct ras_manager *get_ras_manager(struct amdgpu_device *adev, enum amdgpu_ras_block blk) | 1285 | static struct ras_manager *get_ras_manager(struct amdgpu_device *adev, enum amdgpu_ras_block blk) |
| 1241 | { | 1286 | { |
| 1242 | struct ras_common_if head; | 1287 | struct ras_common_if head; |
| @@ -1323,7 +1368,9 @@ static int amdgpu_ras_query_error_status_helper(struct amdgpu_device *adev, · 80 unmodified lines | |||
| 1323 | if (error_query_mode == AMDGPU_RAS_INVALID_ERROR_QUERY) | 1368 | if (error_query_mode == AMDGPU_RAS_INVALID_ERROR_QUERY) |
| 1324 | return -EINVAL; | 1369 | return -EINVAL; |
| 1325 | 1370 | ||
| 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) { | ||
| 1327 | if (info->head.block == AMDGPU_RAS_BLOCK__UMC) { | 1374 | if (info->head.block == AMDGPU_RAS_BLOCK__UMC) { |
| 1328 | amdgpu_ras_get_ecc_info(adev, err_data); | 1375 | amdgpu_ras_get_ecc_info(adev, err_data); |
| 1329 | } else { | 1376 | } else { |
| @@ -1405,14 +1452,22 @@ static int amdgpu_ras_query_error_status_with_event(struct amdgpu_device *adev, · 75 unmodified lines | |||
| 1405 | if (ret) | 1452 | if (ret) |
| 1406 | goto out_fini_err_data; | 1453 | goto out_fini_err_data; |
| 1407 | 1454 | ||
| 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 | } | ||
| 1409 | 1466 | ||
| 1410 | info->ue_count = obj->err_data.ue_count; | 1467 | info->ue_count = obj->err_data.ue_count; |
| 1411 | info->ce_count = obj->err_data.ce_count; | 1468 | info->ce_count = obj->err_data.ce_count; |
| 1412 | info->de_count = obj->err_data.de_count; | 1469 | info->de_count = obj->err_data.de_count; |
| 1413 | 1470 | ||
| 1414 | amdgpu_ras_error_generate_report(adev, info, &err_data, &qctx); | ||
| 1415 | |||
| 1416 | out_fini_err_data: | 1471 | out_fini_err_data: |
| 1417 | amdgpu_ras_error_data_fini(&err_data); | 1472 | amdgpu_ras_error_data_fini(&err_data); |
| 1418 | 1473 | ||
| @@ -3453,6 +3508,11 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev) · 2034 unmodified lines | |||
| 3453 | if (!amdgpu_ras_asic_supported(adev)) | 3508 | if (!amdgpu_ras_asic_supported(adev)) |
| 3454 | return; | 3509 | return; |
| 3455 | 3510 | ||
| 3511 | if (amdgpu_sriov_vf(adev)) { | ||
| 3512 | if (amdgpu_virt_get_ras_capability(adev)) | ||
| 3513 | goto init_ras_enabled_flag; | ||
| 3514 | } | ||
| 3515 | |||
| 3456 | /* query ras capability from psp */ | 3516 | /* query ras capability from psp */ |
| 3457 | if (amdgpu_psp_get_ras_capability(&adev->psp)) | 3517 | if (amdgpu_psp_get_ras_capability(&adev->psp)) |
| 3458 | goto init_ras_enabled_flag; | 3518 | goto init_ras_enabled_flag; |
| @@ -3925,7 +3985,7 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev) · 466 unmodified lines | |||
| 3925 | } | 3985 | } |
| 3926 | 3986 | ||
| 3927 | /* Guest side doesn't need init ras feature */ | 3987 | /* 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)) |
| 3929 | return 0; | 3989 | return 0; |
| 3930 | 3990 | ||
| 3931 | list_for_each_entry_safe(node, tmp, &adev->ras_list, node) { | 3991 | 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 | |||
| 4392 | return false; | 4452 | return false; |
| 4393 | } | 4453 | } |
| 4394 | 4454 | ||
| 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)) { | ||
| 4396 | *error_query_mode = | 4458 | *error_query_mode = |
| 4397 | (con->is_aca_debug_mode) ? AMDGPU_RAS_DIRECT_ERROR_QUERY : AMDGPU_RAS_FIRMWARE_ERROR_QUERY; | 4459 | (con->is_aca_debug_mode) ? AMDGPU_RAS_DIRECT_ERROR_QUERY : AMDGPU_RAS_FIRMWARE_ERROR_QUERY; |
| 4398 | else | 4460 | } else { |
| 4399 | *error_query_mode = AMDGPU_RAS_DIRECT_ERROR_QUERY; | 4461 | *error_query_mode = AMDGPU_RAS_DIRECT_ERROR_QUERY; |
| 4462 | } | ||
| 4400 | 4463 | ||
| 4401 | return true; | 4464 | return true; |
| 4402 | } | 4465 | } |
| @@ -365,6 +365,7 @@ enum amdgpu_ras_error_query_mode { · 364 unmodified lines | |||
| 365 | AMDGPU_RAS_INVALID_ERROR_QUERY = 0, | 365 | AMDGPU_RAS_INVALID_ERROR_QUERY = 0, |
| 366 | AMDGPU_RAS_DIRECT_ERROR_QUERY = 1, | 366 | AMDGPU_RAS_DIRECT_ERROR_QUERY = 1, |
| 367 | AMDGPU_RAS_FIRMWARE_ERROR_QUERY = 2, | 367 | AMDGPU_RAS_FIRMWARE_ERROR_QUERY = 2, |
| 368 | AMDGPU_RAS_VIRT_ERROR_COUNT_QUERY = 3, | ||
| 368 | }; | 369 | }; |
| 369 | 370 | ||
| 370 | /* ras error status reisger fields */ | 371 | /* ras error status reisger fields */ |
| @@ -413,3 +413,44 @@ void amdgpu_debugfs_sdma_sched_mask_init(struct amdgpu_device *adev) · 412 unmodified lines | |||
| 413 | &amdgpu_debugfs_sdma_sched_mask_fops); | 413 | &amdgpu_debugfs_sdma_sched_mask_fops); |
| 414 | #endif | 414 | #endif |
| 415 | } | 415 | } |
| 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 | } | ||
| @@ -116,6 +116,7 @@ struct amdgpu_sdma { · 115 unmodified lines | |||
| 116 | struct ras_common_if *ras_if; | 116 | struct ras_common_if *ras_if; |
| 117 | struct amdgpu_sdma_ras *ras; | 117 | struct amdgpu_sdma_ras *ras; |
| 118 | uint32_t *ip_dump; | 118 | uint32_t *ip_dump; |
| 119 | uint32_t supported_reset; | ||
| 119 | }; | 120 | }; |
| 120 | 121 | ||
| 121 | /* | 122 | /* |
| @@ -176,4 +177,6 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, · 54 unmodified lines | |||
| 176 | bool duplicate); | 177 | bool duplicate); |
| 177 | int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev); | 178 | int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev); |
| 178 | void amdgpu_debugfs_sdma_sched_mask_init(struct amdgpu_device *adev); | 179 | 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); | ||
| 179 | #endif | 182 | #endif |
| @@ -318,6 +318,9 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *r · 317 unmodified lines | |||
| 318 | if (r) | 318 | if (r) |
| 319 | return r; | 319 | return r; |
| 320 | 320 | ||
| 321 | if (amdgpu_sriov_vf(adev)) | ||
| 322 | return r; | ||
| 323 | |||
| 321 | if (amdgpu_ras_is_supported(adev, ras_block->block)) { | 324 | if (amdgpu_ras_is_supported(adev, ras_block->block)) { |
| 322 | r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); | 325 | r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); |
| 323 | if (r) | 326 | if (r) |
| @@ -523,6 +523,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) · 522 unmodified lines | |||
| 523 | 523 | ||
| 524 | adev->unique_id = | 524 | adev->unique_id = |
| 525 | ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; | 525 | ((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; | ||
| 526 | break; | 529 | break; |
| 527 | default: | 530 | default: |
| 528 | dev_err(adev->dev, "invalid pf2vf version: 0x%x\n", pf2vf_info->version); | 531 | 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 | |||
| 703 | adev->virt.fw_reserve.p_vf2pf = | 706 | adev->virt.fw_reserve.p_vf2pf = |
| 704 | (struct amd_sriov_msg_vf2pf_info_header *) | 707 | (struct amd_sriov_msg_vf2pf_info_header *) |
| 705 | (adev->mman.fw_vram_usage_va + (AMD_SRIOV_MSG_VF2PF_OFFSET_KB << 10)); | 708 | (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)); | ||
| 706 | } else if (adev->mman.drv_vram_usage_va) { | 711 | } else if (adev->mman.drv_vram_usage_va) { |
| 707 | adev->virt.fw_reserve.p_pf2vf = | 712 | adev->virt.fw_reserve.p_pf2vf = |
| 708 | (struct amd_sriov_msg_pf2vf_info_header *) | 713 | (struct amd_sriov_msg_pf2vf_info_header *) |
| @@ -710,6 +715,8 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev) · 1 unmodified line | |||
| 710 | adev->virt.fw_reserve.p_vf2pf = | 715 | adev->virt.fw_reserve.p_vf2pf = |
| 711 | (struct amd_sriov_msg_vf2pf_info_header *) | 716 | (struct amd_sriov_msg_vf2pf_info_header *) |
| 712 | (adev->mman.drv_vram_usage_va + (AMD_SRIOV_MSG_VF2PF_OFFSET_KB << 10)); | 717 | (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)); | ||
| 713 | } | 720 | } |
| 714 | 721 | ||
| 715 | amdgpu_virt_read_pf2vf_data(adev); | 722 | amdgpu_virt_read_pf2vf_data(adev); |
| @@ -1144,3 +1151,185 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev) · 428 unmodified lines | |||
| 1144 | 1151 | ||
| 1145 | return xnack_mode; | 1152 | return xnack_mode; |
| 1146 | } | 1153 | } |
| 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 | } | ||
| @@ -95,6 +95,7 @@ struct amdgpu_virt_ops { · 94 unmodified lines | |||
| 95 | void (*ras_poison_handler)(struct amdgpu_device *adev, | 95 | void (*ras_poison_handler)(struct amdgpu_device *adev, |
| 96 | enum amdgpu_ras_block block); | 96 | enum amdgpu_ras_block block); |
| 97 | bool (*rcvd_ras_intr)(struct amdgpu_device *adev); | 97 | bool (*rcvd_ras_intr)(struct amdgpu_device *adev); |
| 98 | int (*req_ras_err_count)(struct amdgpu_device *adev); | ||
| 98 | }; | 99 | }; |
| 99 | 100 | ||
| 100 | /* | 101 | /* |
| @@ -103,6 +104,7 @@ struct amdgpu_virt_ops { · 2 unmodified lines | |||
| 103 | struct amdgpu_virt_fw_reserve { | 104 | struct amdgpu_virt_fw_reserve { |
| 104 | struct amd_sriov_msg_pf2vf_info_header *p_pf2vf; | 105 | struct amd_sriov_msg_pf2vf_info_header *p_pf2vf; |
| 105 | struct amd_sriov_msg_vf2pf_info_header *p_vf2pf; | 106 | struct amd_sriov_msg_vf2pf_info_header *p_vf2pf; |
| 107 | void *ras_telemetry; | ||
| 106 | unsigned int checksum_key; | 108 | unsigned int checksum_key; |
| 107 | }; | 109 | }; |
| 108 | 110 | ||
| @@ -136,6 +138,8 @@ enum AMDGIM_FEATURE_FLAG { · 27 unmodified lines | |||
| 136 | AMDGIM_FEATURE_VCN_RB_DECOUPLE = (1 << 7), | 138 | AMDGIM_FEATURE_VCN_RB_DECOUPLE = (1 << 7), |
| 137 | /* MES info */ | 139 | /* MES info */ |
| 138 | AMDGIM_FEATURE_MES_INFO_ENABLE = (1 << 8), | 140 | AMDGIM_FEATURE_MES_INFO_ENABLE = (1 << 8), |
| 141 | AMDGIM_FEATURE_RAS_CAPS = (1 << 9), | ||
| 142 | AMDGIM_FEATURE_RAS_TELEMETRY = (1 << 10), | ||
| 139 | }; | 143 | }; |
| 140 | 144 | ||
| 141 | enum AMDGIM_REG_ACCESS_FLAG { | 145 | enum AMDGIM_REG_ACCESS_FLAG { |
| @@ -276,6 +280,12 @@ struct amdgpu_virt { · 134 unmodified lines | |||
| 276 | uint32_t autoload_ucode_id; | 280 | uint32_t autoload_ucode_id; |
| 277 | 281 | ||
| 278 | struct mutex rlcg_reg_lock; | 282 | 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; | ||
| 279 | }; | 289 | }; |
| 280 | 290 | ||
| 281 | struct amdgpu_video_codec_info; | 291 | struct amdgpu_video_codec_info; |
| @@ -320,6 +330,15 @@ struct amdgpu_video_codec_info; · 38 unmodified lines | |||
| 320 | #define amdgpu_sriov_vf_mmio_access_protection(adev) \ | 330 | #define amdgpu_sriov_vf_mmio_access_protection(adev) \ |
| 321 | ((adev)->virt.caps & AMDGPU_VF_MMIO_ACCESS_PROTECT) | 331 | ((adev)->virt.caps & AMDGPU_VF_MMIO_ACCESS_PROTECT) |
| 322 | 332 | ||
| 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 | |||
| 323 | static inline bool is_virtual_machine(void) | 342 | static inline bool is_virtual_machine(void) |
| 324 | { | 343 | { |
| 325 | #if defined(CONFIG_X86) | 344 | #if defined(CONFIG_X86) |
| @@ -383,4 +402,8 @@ bool amdgpu_virt_get_rlcg_reg_access_flag(struct amdgpu_device *adev, · 57 unmodified lines | |||
| 383 | u32 acc_flags, u32 hwip, | 402 | u32 acc_flags, u32 hwip, |
| 384 | bool write, u32 *rlcg_flag); | 403 | bool write, u32 *rlcg_flag); |
| 385 | u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag, u32 xcc_id); | 404 | 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); | ||
| 386 | #endif | 409 | #endif |
| @@ -377,6 +377,13 @@ static int vpe_sw_init(struct amdgpu_ip_block *ip_block) · 376 unmodified lines | |||
| 377 | ret = vpe_init_microcode(vpe); | 377 | ret = vpe_init_microcode(vpe); |
| 378 | if (ret) | 378 | if (ret) |
| 379 | goto out; | 379 | 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; | ||
| 380 | out: | 387 | out: |
| 381 | return ret; | 388 | return ret; |
| 382 | } | 389 | } |
| @@ -389,6 +396,7 @@ static int vpe_sw_fini(struct amdgpu_ip_block *ip_block) · 6 unmodified lines | |||
| 389 | release_firmware(vpe->fw); | 396 | release_firmware(vpe->fw); |
| 390 | vpe->fw = NULL; | 397 | vpe->fw = NULL; |
| 391 | 398 | ||
| 399 | amdgpu_vpe_sysfs_reset_mask_fini(adev); | ||
| 392 | vpe_ring_fini(vpe); | 400 | vpe_ring_fini(vpe); |
| 393 | 401 | ||
| 394 | amdgpu_bo_free_kernel(&adev->vpe.cmdbuf_obj, | 402 | 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 | |||
| 865 | schedule_delayed_work(&adev->vpe.idle_work, VPE_IDLE_TIMEOUT); | 873 | schedule_delayed_work(&adev->vpe.idle_work, VPE_IDLE_TIMEOUT); |
| 866 | } | 874 | } |
| 867 | 875 | ||
| 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 | |||
| 868 | static const struct amdgpu_ring_funcs vpe_ring_funcs = { | 911 | static const struct amdgpu_ring_funcs vpe_ring_funcs = { |
| 869 | .type = AMDGPU_RING_TYPE_VPE, | 912 | .type = AMDGPU_RING_TYPE_VPE, |
| 870 | .align_mask = 0xf, | 913 | .align_mask = 0xf, |
| @@ -79,6 +79,7 @@ struct amdgpu_vpe { · 78 unmodified lines | |||
| 79 | 79 | ||
| 80 | uint32_t num_instances; | 80 | uint32_t num_instances; |
| 81 | bool collaborate_mode; | 81 | bool collaborate_mode; |
| 82 | uint32_t supported_reset; | ||
| 82 | }; | 83 | }; |
| 83 | 84 | ||
| 84 | int amdgpu_vpe_psp_update_sram(struct amdgpu_device *adev); | 85 | 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 | |||
| 86 | int amdgpu_vpe_ring_init(struct amdgpu_vpe *vpe); | 87 | int amdgpu_vpe_ring_init(struct amdgpu_vpe *vpe); |
| 87 | int amdgpu_vpe_ring_fini(struct amdgpu_vpe *vpe); | 88 | int amdgpu_vpe_ring_fini(struct amdgpu_vpe *vpe); |
| 88 | int amdgpu_vpe_configure_dpm(struct amdgpu_vpe *vpe); | 89 | 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); | ||
| 89 | 92 | ||
| 90 | #define vpe_ring_init(vpe) ((vpe)->funcs->ring_init ? (vpe)->funcs->ring_init((vpe)) : 0) | 93 | #define vpe_ring_init(vpe) ((vpe)->funcs->ring_init ? (vpe)->funcs->ring_init((vpe)) : 0) |
| 91 | #define vpe_ring_start(vpe) ((vpe)->funcs->ring_start ? (vpe)->funcs->ring_start((vpe)) : 0) | 94 | #define vpe_ring_start(vpe) ((vpe)->funcs->ring_start ? (vpe)->funcs->ring_start((vpe)) : 0) |
| @@ -471,6 +471,16 @@ static const char *xcp_desc[] = { · 470 unmodified lines | |||
| 471 | [AMDGPU_CPX_PARTITION_MODE] = "CPX", | 471 | [AMDGPU_CPX_PARTITION_MODE] = "CPX", |
| 472 | }; | 472 | }; |
| 473 | 473 | ||
| 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 | |||
| 474 | ATTRIBUTE_GROUPS(xcp_cfg_res_sysfs); | 484 | ATTRIBUTE_GROUPS(xcp_cfg_res_sysfs); |
| 475 | 485 | ||
| 476 | #define to_xcp_attr(x) \ | 486 | #define to_xcp_attr(x) \ |
| @@ -540,6 +550,26 @@ static ssize_t supported_xcp_configs_show(struct kobject *kobj, · 63 unmodified lines | |||
| 540 | return size; | 550 | return size; |
| 541 | } | 551 | } |
| 542 | 552 | ||
| 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 | |||
| 543 | static ssize_t xcp_config_show(struct kobject *kobj, | 573 | static ssize_t xcp_config_show(struct kobject *kobj, |
| 544 | struct kobj_attribute *attr, char *buf) | 574 | struct kobj_attribute *attr, char *buf) |
| 545 | { | 575 | { |
| @@ -596,6 +626,9 @@ static const struct kobj_type xcp_cfg_sysfs_ktype = { · 50 unmodified lines | |||
| 596 | static struct kobj_attribute supp_part_sysfs_mode = | 626 | static struct kobj_attribute supp_part_sysfs_mode = |
| 597 | __ATTR_RO(supported_xcp_configs); | 627 | __ATTR_RO(supported_xcp_configs); |
| 598 | 628 | ||
| 629 | static struct kobj_attribute supp_nps_sysfs_mode = | ||
| 630 | __ATTR_RO(supported_nps_configs); | ||
| 631 | |||
| 599 | static const struct attribute *xcp_attrs[] = { | 632 | static const struct attribute *xcp_attrs[] = { |
| 600 | &supp_part_sysfs_mode.attr, | 633 | &supp_part_sysfs_mode.attr, |
| 601 | &xcp_cfg_sysfs_mode.attr, | 634 | &xcp_cfg_sysfs_mode.attr, |
| @@ -625,13 +658,24 @@ void amdgpu_xcp_cfg_sysfs_init(struct amdgpu_device *adev) · 23 unmodified lines | |||
| 625 | if (r) | 658 | if (r) |
| 626 | goto err1; | 659 | goto err1; |
| 627 | 660 | ||
| 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 | |||
| 628 | mode = (xcp_cfg->xcp_mgr->mode == | 669 | mode = (xcp_cfg->xcp_mgr->mode == |
| 629 | AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE) ? | 670 | AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE) ? |
| 630 | AMDGPU_SPX_PARTITION_MODE : | 671 | AMDGPU_SPX_PARTITION_MODE : |
| 631 | xcp_cfg->xcp_mgr->mode; | 672 | xcp_cfg->xcp_mgr->mode; |
| 632 | r = amdgpu_xcp_get_res_info(xcp_cfg->xcp_mgr, mode, xcp_cfg); | 673 | 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); | ||
| 634 | goto err1; | 677 | goto err1; |
| 678 | } | ||
| 635 | 679 | ||
| 636 | xcp_cfg->mode = mode; | 680 | xcp_cfg->mode = mode; |
| 637 | for (i = 0; i < xcp_cfg->num_res; i++) { | 681 | for (i = 0; i < xcp_cfg->num_res; i++) { |
| @@ -653,6 +697,7 @@ err: · 15 unmodified lines | |||
| 653 | kobject_put(&xcp_res->kobj); | 697 | kobject_put(&xcp_res->kobj); |
| 654 | } | 698 | } |
| 655 | 699 | ||
| 700 | sysfs_remove_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr); | ||
| 656 | sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs); | 701 | sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs); |
| 657 | err1: | 702 | err1: |
| 658 | kobject_put(&xcp_cfg->kobj); | 703 | kobject_put(&xcp_cfg->kobj); |
| @@ -673,6 +718,7 @@ void amdgpu_xcp_cfg_sysfs_fini(struct amdgpu_device *adev) · 14 unmodified lines | |||
| 673 | kobject_put(&xcp_res->kobj); | 718 | kobject_put(&xcp_res->kobj); |
| 674 | } | 719 | } |
| 675 | 720 | ||
| 721 | sysfs_remove_file(&xcp_cfg->kobj, &supp_nps_sysfs_mode.attr); | ||
| 676 | sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs); | 722 | sysfs_remove_files(&xcp_cfg->kobj, xcp_attrs); |
| 677 | kobject_put(&xcp_cfg->kobj); | 723 | kobject_put(&xcp_cfg->kobj); |
| 678 | } | 724 | } |
| @@ -28,17 +28,21 @@ · 27 unmodified lines | |||
| 28 | #define AMD_SRIOV_MSG_VBIOS_SIZE_KB 64 | 28 | #define AMD_SRIOV_MSG_VBIOS_SIZE_KB 64 |
| 29 | #define AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB AMD_SRIOV_MSG_VBIOS_SIZE_KB | 29 | #define AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB AMD_SRIOV_MSG_VBIOS_SIZE_KB |
| 30 | #define AMD_SRIOV_MSG_DATAEXCHANGE_SIZE_KB 4 | 30 | #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 | ||
| 32 | /* | 34 | /* |
| 33 | * layout | 35 | * layout |
| 34 | * 0 64KB 65KB 66KB | 36 | * 0 64KB 65KB 66KB 68KB 132KB |
| 35 | * | VBIOS | PF2VF | VF2PF | Bad Page | ... | 37 | * | VBIOS | PF2VF | VF2PF | Bad Page | RAS Telemetry Region | ... |
| 36 | * | 64KB | 1KB | 1KB | | 38 | * | 64KB | 1KB | 1KB | 2KB | 64KB | ... |
| 37 | */ | 39 | */ |
| 40 | |||
| 38 | #define AMD_SRIOV_MSG_SIZE_KB 1 | 41 | #define AMD_SRIOV_MSG_SIZE_KB 1 |
| 39 | #define AMD_SRIOV_MSG_PF2VF_OFFSET_KB AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB | 42 | #define AMD_SRIOV_MSG_PF2VF_OFFSET_KB AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB |
| 40 | #define AMD_SRIOV_MSG_VF2PF_OFFSET_KB (AMD_SRIOV_MSG_PF2VF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB) | 43 | #define AMD_SRIOV_MSG_VF2PF_OFFSET_KB (AMD_SRIOV_MSG_PF2VF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB) |
| 41 | #define AMD_SRIOV_MSG_BAD_PAGE_OFFSET_KB (AMD_SRIOV_MSG_VF2PF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB) | 44 | #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) | ||
| 42 | 46 | ||
| 43 | /* | 47 | /* |
| 44 | * PF2VF history log: | 48 | * PF2VF history log: |
| @@ -86,30 +90,59 @@ enum amd_sriov_ucode_engine_id { · 41 unmodified lines | |||
| 86 | 90 | ||
| 87 | union amd_sriov_msg_feature_flags { | 91 | union amd_sriov_msg_feature_flags { |
| 88 | struct { | 92 | struct { |
| 89 | uint32_t error_log_collect : 1; | 93 | uint32_t error_log_collect : 1; |
| 90 | uint32_t host_load_ucodes : 1; | 94 | uint32_t host_load_ucodes : 1; |
| 91 | uint32_t host_flr_vramlost : 1; | 95 | uint32_t host_flr_vramlost : 1; |
| 92 | uint32_t mm_bw_management : 1; | 96 | uint32_t mm_bw_management : 1; |
| 93 | uint32_t pp_one_vf_mode : 1; | 97 | uint32_t pp_one_vf_mode : 1; |
| 94 | uint32_t reg_indirect_acc : 1; | 98 | uint32_t reg_indirect_acc : 1; |
| 95 | uint32_t av1_support : 1; | 99 | uint32_t av1_support : 1; |
| 96 | uint32_t vcn_rb_decouple : 1; | 100 | uint32_t vcn_rb_decouple : 1; |
| 97 | uint32_t mes_info_enable : 1; | 101 | uint32_t mes_info_dump_enable : 1; |
| 98 | uint32_t reserved : 23; | 102 | uint32_t ras_caps : 1; |
| 103 | uint32_t ras_telemetry : 1; | ||
| 104 | uint32_t reserved : 21; | ||
| 99 | } flags; | 105 | } flags; |
| 100 | uint32_t all; | 106 | uint32_t all; |
| 101 | }; | 107 | }; |
| 102 | 108 | ||
| 103 | union amd_sriov_reg_access_flags { | 109 | union amd_sriov_reg_access_flags { |
| 104 | struct { | 110 | struct { |
| 105 | uint32_t vf_reg_access_ih : 1; | 111 | uint32_t vf_reg_access_ih : 1; |
| 106 | uint32_t vf_reg_access_mmhub : 1; | 112 | uint32_t vf_reg_access_mmhub : 1; |
| 107 | uint32_t vf_reg_access_gc : 1; | 113 | uint32_t vf_reg_access_gc : 1; |
| 108 | uint32_t reserved : 29; | 114 | uint32_t reserved : 29; |
| 109 | } flags; | 115 | } flags; |
| 110 | uint32_t all; | 116 | uint32_t all; |
| 111 | }; | 117 | }; |
| 112 | 118 | ||
| 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 | |||
| 113 | union amd_sriov_msg_os_info { | 146 | union amd_sriov_msg_os_info { |
| 114 | struct { | 147 | struct { |
| 115 | uint32_t windows : 1; | 148 | uint32_t windows : 1; |
| @@ -158,7 +191,7 @@ struct amd_sriov_msg_pf2vf_info_header { · 42 unmodified lines | |||
| 158 | uint32_t reserved[2]; | 191 | uint32_t reserved[2]; |
| 159 | }; | 192 | }; |
| 160 | 193 | ||
| 161 | #define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (49) | 194 | #define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (55) |
| 162 | struct amd_sriov_msg_pf2vf_info { | 195 | struct amd_sriov_msg_pf2vf_info { |
| 163 | /* header contains size and version */ | 196 | /* header contains size and version */ |
| 164 | struct amd_sriov_msg_pf2vf_info_header header; | 197 | struct amd_sriov_msg_pf2vf_info_header header; |
| @@ -211,6 +244,12 @@ struct amd_sriov_msg_pf2vf_info { · 46 unmodified lines | |||
| 211 | uint32_t pcie_atomic_ops_support_flags; | 244 | uint32_t pcie_atomic_ops_support_flags; |
| 212 | /* Portion of GPU memory occupied by VF. MAX value is 65535, but set to uint32_t to maintain alignment with reserved size */ | 245 | /* Portion of GPU memory occupied by VF. MAX value is 65535, but set to uint32_t to maintain alignment with reserved size */ |
| 213 | uint32_t gpu_capacity; | 246 | 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 | |||
| 214 | /* reserved */ | 253 | /* reserved */ |
| 215 | uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE]; | 254 | uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE]; |
| 216 | } __packed; | 255 | } __packed; |
| @@ -283,8 +322,12 @@ enum amd_sriov_mailbox_request_message { · 66 unmodified lines | |||
| 283 | MB_REQ_MSG_REL_GPU_FINI_ACCESS, | 322 | MB_REQ_MSG_REL_GPU_FINI_ACCESS, |
| 284 | MB_REQ_MSG_REQ_GPU_RESET_ACCESS, | 323 | MB_REQ_MSG_REQ_GPU_RESET_ACCESS, |
| 285 | MB_REQ_MSG_REQ_GPU_INIT_DATA, | 324 | MB_REQ_MSG_REQ_GPU_INIT_DATA, |
| 325 | MB_REQ_MSG_PSP_VF_CMD_RELAY, | ||
| 286 | 326 | ||
| 287 | MB_REQ_MSG_LOG_VF_ERROR = 200, | 327 | 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, | ||
| 288 | }; | 331 | }; |
| 289 | 332 | ||
| 290 | /* mailbox message send from host to guest */ | 333 | /* mailbox message send from host to guest */ |
| @@ -297,10 +340,60 @@ enum amd_sriov_mailbox_response_message { · 6 unmodified lines | |||
| 297 | MB_RES_MSG_FAIL, | 340 | MB_RES_MSG_FAIL, |
| 298 | MB_RES_MSG_QUERY_ALIVE, | 341 | MB_RES_MSG_QUERY_ALIVE, |
| 299 | MB_RES_MSG_GPU_INIT_DATA_READY, | 342 | MB_RES_MSG_GPU_INIT_DATA_READY, |
| 343 | MB_RES_MSG_RAS_ERROR_COUNT_READY = 11, | ||
| 300 | 344 | ||
| 301 | MB_RES_MSG_TEXT_MESSAGE = 255 | 345 | MB_RES_MSG_TEXT_MESSAGE = 255 |
| 302 | }; | 346 | }; |
| 303 | 347 | ||
| 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 | |||
| 304 | /* version data stored in MAILBOX_MSGBUF_RCV_DW1 for future expansion */ | 397 | /* version data stored in MAILBOX_MSGBUF_RCV_DW1 for future expansion */ |
| 305 | enum amd_sriov_gpu_init_data_version { | 398 | enum amd_sriov_gpu_init_data_version { |
| 306 | GPU_INIT_DATA_READY_V1 = 1, | 399 | GPU_INIT_DATA_READY_V1 = 1, |
| @@ -4825,6 +4825,11 @@ static int gfx_v10_0_sw_init(struct amdgpu_ip_block *ip_block) · 4824 unmodified lines | |||
| 4825 | } | 4825 | } |
| 4826 | } | 4826 | } |
| 4827 | } | 4827 | } |
| 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]); | ||
| 4828 | 4833 | ||
| 4829 | r = amdgpu_gfx_kiq_init(adev, GFX10_MEC_HPD_SIZE, 0); | 4834 | r = amdgpu_gfx_kiq_init(adev, GFX10_MEC_HPD_SIZE, 0); |
| 4830 | if (r) { | 4835 | if (r) { |
| @@ -1580,6 +1580,8 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block) · 1579 unmodified lines | |||
| 1580 | } | 1580 | } |
| 1581 | 1581 | ||
| 1582 | switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { | 1582 | switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { |
| 1583 | case IP_VERSION(11, 0, 0): | ||
| 1584 | case IP_VERSION(11, 0, 2): | ||
| 1583 | case IP_VERSION(11, 0, 3): | 1585 | case IP_VERSION(11, 0, 3): |
| 1584 | adev->gfx.cleaner_shader_ptr = gfx_11_0_3_cleaner_shader_hex; | 1586 | adev->gfx.cleaner_shader_ptr = gfx_11_0_3_cleaner_shader_hex; |
| 1585 | adev->gfx.cleaner_shader_size = sizeof(gfx_11_0_3_cleaner_shader_hex); | 1587 | 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 | |||
| 1691 | } | 1693 | } |
| 1692 | } | 1694 | } |
| 1693 | 1695 | ||
| 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 | |||
| 1694 | if (!adev->enable_mes_kiq) { | 1714 | if (!adev->enable_mes_kiq) { |
| 1695 | r = amdgpu_gfx_kiq_init(adev, GFX11_MEC_HPD_SIZE, 0); | 1715 | r = amdgpu_gfx_kiq_init(adev, GFX11_MEC_HPD_SIZE, 0); |
| 1696 | if (r) { | 1716 | if (r) { |
| @@ -1437,6 +1437,12 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block) · 1436 unmodified lines | |||
| 1437 | } | 1437 | } |
| 1438 | } | 1438 | } |
| 1439 | 1439 | ||
| 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 | |||
| 1440 | if (!adev->enable_mes_kiq) { | 1446 | if (!adev->enable_mes_kiq) { |
| 1441 | r = amdgpu_gfx_kiq_init(adev, GFX12_MEC_HPD_SIZE, 0); | 1447 | r = amdgpu_gfx_kiq_init(adev, GFX12_MEC_HPD_SIZE, 0); |
| 1442 | if (r) { | 1448 | if (r) { |
| @@ -4823,6 +4823,13 @@ static int gfx_v8_0_kcq_disable(struct amdgpu_device *adev) · 4822 unmodified lines | |||
| 4823 | amdgpu_ring_write(kiq_ring, 0); | 4823 | amdgpu_ring_write(kiq_ring, 0); |
| 4824 | amdgpu_ring_write(kiq_ring, 0); | 4824 | amdgpu_ring_write(kiq_ring, 0); |
| 4825 | } | 4825 | } |
| 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 | */ | ||
| 4826 | r = amdgpu_ring_test_helper(kiq_ring); | 4833 | r = amdgpu_ring_test_helper(kiq_ring); |
| 4827 | if (r) | 4834 | if (r) |
| 4828 | DRM_ERROR("KCQ disable failed\n"); | 4835 | DRM_ERROR("KCQ disable failed\n"); |
| @@ -2374,6 +2374,12 @@ static int gfx_v9_0_sw_init(struct amdgpu_ip_block *ip_block) · 2373 unmodified lines | |||
| 2374 | } | 2374 | } |
| 2375 | } | 2375 | } |
| 2376 | 2376 | ||
| 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 | |||
| 2377 | r = amdgpu_gfx_kiq_init(adev, GFX9_MEC_HPD_SIZE, 0); | 2383 | r = amdgpu_gfx_kiq_init(adev, GFX9_MEC_HPD_SIZE, 0); |
| 2378 | if (r) { | 2384 | if (r) { |
| 2379 | DRM_ERROR("Failed to init KIQ BOs!\n"); | 2385 | DRM_ERROR("Failed to init KIQ BOs!\n"); |
| @@ -1157,6 +1157,19 @@ static int gfx_v9_4_3_sw_init(struct amdgpu_ip_block *ip_block) · 1156 unmodified lines | |||
| 1157 | return r; | 1157 | return r; |
| 1158 | } | 1158 | } |
| 1159 | 1159 | ||
| 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 | } | ||
| 1160 | r = gfx_v9_4_3_gpu_early_init(adev); | 1173 | r = gfx_v9_4_3_gpu_early_init(adev); |
| 1161 | if (r) | 1174 | if (r) |
| 1162 | return r; | 1175 | return r; |
| @@ -1130,8 +1130,10 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev, · 1129 unmodified lines | |||
| 1130 | uint64_t *flags) | 1130 | uint64_t *flags) |
| 1131 | { | 1131 | { |
| 1132 | struct amdgpu_device *bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); | 1132 | struct amdgpu_device *bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); |
| 1133 | bool is_vram = bo->tbo.resource->mem_type == TTM_PL_VRAM; | 1133 | bool is_vram = bo->tbo.resource && |
| 1134 | bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT | AMDGPU_GEM_CREATE_EXT_COHERENT); | 1134 | bo->tbo.resource->mem_type == TTM_PL_VRAM; |
| 1135 | bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT | | ||
| 1136 | AMDGPU_GEM_CREATE_EXT_COHERENT); | ||
| 1135 | bool ext_coherent = bo->flags & AMDGPU_GEM_CREATE_EXT_COHERENT; | 1137 | bool ext_coherent = bo->flags & AMDGPU_GEM_CREATE_EXT_COHERENT; |
| 1136 | bool uncached = bo->flags & AMDGPU_GEM_CREATE_UNCACHED; | 1138 | bool uncached = bo->flags & AMDGPU_GEM_CREATE_UNCACHED; |
| 1137 | struct amdgpu_vm *vm = mapping->bo_va->base.vm; | 1139 | 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 | |||
| 1139 | bool snoop = false; | 1141 | bool snoop = false; |
| 1140 | bool is_local; | 1142 | bool is_local; |
| 1141 | 1143 | ||
| 1144 | dma_resv_assert_held(bo->tbo.base.resv); | ||
| 1145 | |||
| 1142 | switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { | 1146 | switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { |
| 1143 | case IP_VERSION(9, 4, 1): | 1147 | case IP_VERSION(9, 4, 1): |
| 1144 | case IP_VERSION(9, 4, 2): | 1148 | 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 | |||
| 1257 | *flags &= ~AMDGPU_PTE_VALID; | 1261 | *flags &= ~AMDGPU_PTE_VALID; |
| 1258 | } | 1262 | } |
| 1259 | 1263 | ||
| 1260 | if (bo && bo->tbo.resource) | 1264 | if ((*flags & AMDGPU_PTE_VALID) && bo) |
| 1261 | gmc_v9_0_get_coherence_flags(adev, mapping->bo_va->base.bo, | 1265 | gmc_v9_0_get_coherence_flags(adev, bo, mapping, flags); |
| 1262 | mapping, flags); | ||
| 1263 | } | 1266 | } |
| 1264 | 1267 | ||
| 1265 | static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev, | 1268 | static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev, |
| @@ -121,6 +121,12 @@ static int jpeg_v4_0_sw_init(struct amdgpu_ip_block *ip_block) · 120 unmodified lines | |||
| 121 | adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH); | 121 | adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH); |
| 122 | 122 | ||
| 123 | r = amdgpu_jpeg_ras_sw_init(adev); | 123 | 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); | ||
| 124 | if (r) | 130 | if (r) |
| 125 | return r; | 131 | return r; |
| 126 | 132 | ||
| @@ -143,6 +149,7 @@ static int jpeg_v4_0_sw_fini(struct amdgpu_ip_block *ip_block) · 16 unmodified lines | |||
| 143 | if (r) | 149 | if (r) |
| 144 | return r; | 150 | return r; |
| 145 | 151 | ||
| 152 | amdgpu_jpeg_sysfs_reset_mask_fini(adev); | ||
| 146 | r = amdgpu_jpeg_sw_fini(adev); | 153 | r = amdgpu_jpeg_sw_fini(adev); |
| 147 | 154 | ||
| 148 | return r; | 155 | return r; |
| @@ -159,6 +159,13 @@ static int jpeg_v4_0_3_sw_init(struct amdgpu_ip_block *ip_block) · 158 unmodified lines | |||
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 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 | |||
| 162 | return 0; | 169 | return 0; |
| 163 | } | 170 | } |
| 164 | 171 | ||
| @@ -178,6 +185,7 @@ static int jpeg_v4_0_3_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines | |||
| 178 | if (r) | 185 | if (r) |
| 179 | return r; | 186 | return r; |
| 180 | 187 | ||
| 188 | amdgpu_jpeg_sysfs_reset_mask_fini(adev); | ||
| 181 | r = amdgpu_jpeg_sw_fini(adev); | 189 | r = amdgpu_jpeg_sw_fini(adev); |
| 182 | 190 | ||
| 183 | return r; | 191 | return r; |
| @@ -153,6 +153,13 @@ static int jpeg_v4_0_5_sw_init(struct amdgpu_ip_block *ip_block) · 152 unmodified lines | |||
| 153 | adev->jpeg.inst[i].external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, i, regUVD_JPEG_PITCH); | 153 | adev->jpeg.inst[i].external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, i, regUVD_JPEG_PITCH); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 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 | |||
| 156 | return 0; | 163 | return 0; |
| 157 | } | 164 | } |
| 158 | 165 | ||
| @@ -172,6 +179,7 @@ static int jpeg_v4_0_5_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines | |||
| 172 | if (r) | 179 | if (r) |
| 173 | return r; | 180 | return r; |
| 174 | 181 | ||
| 182 | amdgpu_jpeg_sysfs_reset_mask_fini(adev); | ||
| 175 | r = amdgpu_jpeg_sw_fini(adev); | 183 | r = amdgpu_jpeg_sw_fini(adev); |
| 176 | 184 | ||
| 177 | return r; | 185 | return r; |
| @@ -100,6 +100,12 @@ static int jpeg_v5_0_0_sw_init(struct amdgpu_ip_block *ip_block) · 99 unmodified lines | |||
| 100 | adev->jpeg.internal.jpeg_pitch[0] = regUVD_JPEG_PITCH_INTERNAL_OFFSET; | 100 | adev->jpeg.internal.jpeg_pitch[0] = regUVD_JPEG_PITCH_INTERNAL_OFFSET; |
| 101 | adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH); | 101 | adev->jpeg.inst->external.jpeg_pitch[0] = SOC15_REG_OFFSET(JPEG, 0, regUVD_JPEG_PITCH); |
| 102 | 102 | ||
| 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; | ||
| 103 | return 0; | 109 | return 0; |
| 104 | } | 110 | } |
| 105 | 111 | ||
| @@ -119,6 +125,7 @@ static int jpeg_v5_0_0_sw_fini(struct amdgpu_ip_block *ip_block) · 13 unmodified lines | |||
| 119 | if (r) | 125 | if (r) |
| 120 | return r; | 126 | return r; |
| 121 | 127 | ||
| 128 | amdgpu_jpeg_sysfs_reset_mask_fini(adev); | ||
| 122 | r = amdgpu_jpeg_sw_fini(adev); | 129 | r = amdgpu_jpeg_sw_fini(adev); |
| 123 | 130 | ||
| 124 | return r; | 131 | return r; |
| @@ -644,6 +644,18 @@ static int mes_v11_0_misc_op(struct amdgpu_mes *mes, · 643 unmodified lines | |||
| 644 | sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl)); | 644 | sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl)); |
| 645 | misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en; | 645 | misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en; |
| 646 | break; | 646 | 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 | |||
| 647 | default: | 659 | default: |
| 648 | DRM_ERROR("unsupported misc op (%d) \n", input->op); | 660 | DRM_ERROR("unsupported misc op (%d) \n", input->op); |
| 649 | return -EINVAL; | 661 | return -EINVAL; |
| @@ -708,6 +720,9 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes) · 58 unmodified lines | |||
| 708 | mes->event_log_gpu_addr; | 720 | mes->event_log_gpu_addr; |
| 709 | } | 721 | } |
| 710 | 722 | ||
| 723 | if (enforce_isolation) | ||
| 724 | mes_set_hw_res_pkt.limit_single_process = 1; | ||
| 725 | |||
| 711 | return mes_v11_0_submit_pkt_and_poll_completion(mes, | 726 | return mes_v11_0_submit_pkt_and_poll_completion(mes, |
| 712 | &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt), | 727 | &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt), |
| 713 | offsetof(union MESAPI_SET_HW_RESOURCES, api_status)); | 728 | 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 | |||
| 908 | uint32_t pipe, data = 0; | 923 | uint32_t pipe, data = 0; |
| 909 | 924 | ||
| 910 | if (enable) { | 925 | 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 | |||
| 911 | data = RREG32_SOC15(GC, 0, regCP_MES_CNTL); | 936 | data = RREG32_SOC15(GC, 0, regCP_MES_CNTL); |
| 912 | data = REG_SET_FIELD(data, CP_MES_CNTL, MES_PIPE0_RESET, 1); | 937 | data = REG_SET_FIELD(data, CP_MES_CNTL, MES_PIPE0_RESET, 1); |
| 913 | data = REG_SET_FIELD(data, CP_MES_CNTL, | 938 | 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 | |||
| 1370 | adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init; | 1395 | adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init; |
| 1371 | adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini; | 1396 | adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini; |
| 1372 | 1397 | ||
| 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; |
| 1374 | 1399 | ||
| 1375 | r = amdgpu_mes_init(adev); | 1400 | r = amdgpu_mes_init(adev); |
| 1376 | if (r) | 1401 | if (r) |
| @@ -531,6 +531,14 @@ static int mes_v12_0_misc_op(struct amdgpu_mes *mes, · 530 unmodified lines | |||
| 531 | sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl)); | 531 | sizeof(misc_pkt.set_shader_debugger.tcp_watch_cntl)); |
| 532 | misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en; | 532 | misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en; |
| 533 | break; | 533 | 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 | |||
| 534 | default: | 542 | default: |
| 535 | DRM_ERROR("unsupported misc op (%d) \n", input->op); | 543 | DRM_ERROR("unsupported misc op (%d) \n", input->op); |
| 536 | return -EINVAL; | 544 | return -EINVAL; |
| @@ -550,7 +558,7 @@ static int mes_v12_0_set_hw_resources_1(struct amdgpu_mes *mes, int pipe) · 13 unmodified lines | |||
| 550 | mes_set_hw_res_1_pkt.header.type = MES_API_TYPE_SCHEDULER; | 558 | mes_set_hw_res_1_pkt.header.type = MES_API_TYPE_SCHEDULER; |
| 551 | mes_set_hw_res_1_pkt.header.opcode = MES_SCH_API_SET_HW_RSRC_1; | 559 | mes_set_hw_res_1_pkt.header.opcode = MES_SCH_API_SET_HW_RSRC_1; |
| 552 | mes_set_hw_res_1_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS; | 560 | 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; |
| 554 | 562 | ||
| 555 | return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe, | 563 | return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe, |
| 556 | &mes_set_hw_res_1_pkt, sizeof(mes_set_hw_res_1_pkt), | 564 | &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 | |||
| 624 | mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr + pipe * AMDGPU_MES_LOG_BUFFER_SIZE; | 632 | mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr + pipe * AMDGPU_MES_LOG_BUFFER_SIZE; |
| 625 | } | 633 | } |
| 626 | 634 | ||
| 635 | if (enforce_isolation) | ||
| 636 | mes_set_hw_res_pkt.limit_single_process = 1; | ||
| 637 | |||
| 627 | return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe, | 638 | return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe, |
| 628 | &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt), | 639 | &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt), |
| 629 | offsetof(union MESAPI_SET_HW_RESOURCES, api_status)); | 640 | offsetof(union MESAPI_SET_HW_RESOURCES, api_status)); |
| @@ -61,15 +61,18 @@ static enum idh_event xgpu_nv_mailbox_peek_msg(struct amdgpu_device *adev) · 60 unmodified lines | |||
| 61 | static int xgpu_nv_mailbox_rcv_msg(struct amdgpu_device *adev, | 61 | static int xgpu_nv_mailbox_rcv_msg(struct amdgpu_device *adev, |
| 62 | enum idh_event event) | 62 | enum idh_event event) |
| 63 | { | 63 | { |
| 64 | int r = 0; | ||
| 64 | u32 reg; | 65 | u32 reg; |
| 65 | 66 | ||
| 66 | reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0); | 67 | 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) | ||
| 68 | return -ENOENT; | 71 | return -ENOENT; |
| 69 | 72 | ||
| 70 | xgpu_nv_mailbox_send_ack(adev); | 73 | xgpu_nv_mailbox_send_ack(adev); |
| 71 | 74 | ||
| 72 | return 0; | 75 | return r; |
| 73 | } | 76 | } |
| 74 | 77 | ||
| 75 | static uint8_t xgpu_nv_peek_ack(struct amdgpu_device *adev) | 78 | static uint8_t xgpu_nv_peek_ack(struct amdgpu_device *adev) |
| @@ -178,6 +181,9 @@ send_request: · 102 unmodified lines | |||
| 178 | if (data1 != 0) | 181 | if (data1 != 0) |
| 179 | event = IDH_RAS_POISON_READY; | 182 | event = IDH_RAS_POISON_READY; |
| 180 | break; | 183 | break; |
| 184 | case IDH_REQ_RAS_ERROR_COUNT: | ||
| 185 | event = IDH_RAS_ERROR_COUNT_READY; | ||
| 186 | break; | ||
| 181 | default: | 187 | default: |
| 182 | break; | 188 | break; |
| 183 | } | 189 | } |
| @@ -456,6 +462,11 @@ static bool xgpu_nv_rcvd_ras_intr(struct amdgpu_device *adev) · 272 unmodified lines | |||
| 456 | return (msg == IDH_RAS_ERROR_DETECTED || msg == 0xFFFFFFFF); | 462 | return (msg == IDH_RAS_ERROR_DETECTED || msg == 0xFFFFFFFF); |
| 457 | } | 463 | } |
| 458 | 464 | ||
| 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 | |||
| 459 | const struct amdgpu_virt_ops xgpu_nv_virt_ops = { | 470 | const struct amdgpu_virt_ops xgpu_nv_virt_ops = { |
| 460 | .req_full_gpu = xgpu_nv_request_full_gpu_access, | 471 | .req_full_gpu = xgpu_nv_request_full_gpu_access, |
| 461 | .rel_full_gpu = xgpu_nv_release_full_gpu_access, | 472 | .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 | |||
| 466 | .trans_msg = xgpu_nv_mailbox_trans_msg, | 477 | .trans_msg = xgpu_nv_mailbox_trans_msg, |
| 467 | .ras_poison_handler = xgpu_nv_ras_poison_handler, | 478 | .ras_poison_handler = xgpu_nv_ras_poison_handler, |
| 468 | .rcvd_ras_intr = xgpu_nv_rcvd_ras_intr, | 479 | .rcvd_ras_intr = xgpu_nv_rcvd_ras_intr, |
| 480 | .req_ras_err_count = xgpu_nv_req_ras_err_count, | ||
| 469 | }; | 481 | }; |
| @@ -40,6 +40,7 @@ enum idh_request { · 39 unmodified lines | |||
| 40 | IDH_LOG_VF_ERROR = 200, | 40 | IDH_LOG_VF_ERROR = 200, |
| 41 | IDH_READY_TO_RESET = 201, | 41 | IDH_READY_TO_RESET = 201, |
| 42 | IDH_RAS_POISON = 202, | 42 | IDH_RAS_POISON = 202, |
| 43 | IDH_REQ_RAS_ERROR_COUNT = 203, | ||
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 45 | enum idh_event { | 46 | enum idh_event { |
| @@ -54,6 +55,8 @@ enum idh_event { · 8 unmodified lines | |||
| 54 | IDH_RAS_POISON_READY, | 55 | IDH_RAS_POISON_READY, |
| 55 | IDH_PF_SOFT_FLR_NOTIFICATION, | 56 | IDH_PF_SOFT_FLR_NOTIFICATION, |
| 56 | IDH_RAS_ERROR_DETECTED, | 57 | IDH_RAS_ERROR_DETECTED, |
| 58 | IDH_RAS_ERROR_COUNT_READY = 11, | ||
| 59 | |||
| 57 | IDH_TEXT_MESSAGE = 255, | 60 | IDH_TEXT_MESSAGE = 255, |
| 58 | }; | 61 | }; |
| 59 | 62 | ||
| @@ -247,6 +247,12 @@ static void nbio_v7_7_init_registers(struct amdgpu_device *adev) · 246 unmodified lines | |||
| 247 | if (def != data) | 247 | if (def != data) |
| 248 | WREG32_SOC15(NBIO, 0, regBIF0_PCIE_MST_CTRL_3, data); | 248 | WREG32_SOC15(NBIO, 0, regBIF0_PCIE_MST_CTRL_3, data); |
| 249 | 249 | ||
| 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 | } | ||
| 250 | } | 256 | } |
| 251 | 257 | ||
| 252 | static void nbio_v7_7_update_medium_grain_clock_gating(struct amdgpu_device *adev, | 258 | static void nbio_v7_7_update_medium_grain_clock_gating(struct amdgpu_device *adev, |
| @@ -67,8 +67,8 @@ static const struct amd_ip_funcs nv_common_ip_funcs; · 66 unmodified lines | |||
| 67 | 67 | ||
| 68 | /* Navi */ | 68 | /* Navi */ |
| 69 | static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] = { | 69 | 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)}, | 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, 2304, 0)}, | 71 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 0)}, |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | static const struct amdgpu_video_codecs nv_video_codecs_encode = { | 74 | 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 | |||
| 94 | 94 | ||
| 95 | /* Sienna Cichlid */ | 95 | /* Sienna Cichlid */ |
| 96 | static const struct amdgpu_video_codec_info sc_video_codecs_encode_array[] = { | 96 | 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)}, | 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, 7680, 4352, 0)}, | 98 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | static const struct amdgpu_video_codecs sc_video_codecs_encode = { | 101 | 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 | |||
| 136 | 136 | ||
| 137 | /* SRIOV Sienna Cichlid, not const since data is controlled by host */ | 137 | /* SRIOV Sienna Cichlid, not const since data is controlled by host */ |
| 138 | static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = { | 138 | 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)}, | 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, 7680, 4352, 0)}, | 140 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 141 | }; | 141 | }; |
| 142 | 142 | ||
| 143 | static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn0[] = { | 143 | static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn0[] = { |
| @@ -1430,6 +1430,10 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) · 1429 unmodified lines | |||
| 1430 | } | 1430 | } |
| 1431 | } | 1431 | } |
| 1432 | 1432 | ||
| 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 | |||
| 1433 | if (amdgpu_sdma_ras_sw_init(adev)) { | 1437 | if (amdgpu_sdma_ras_sw_init(adev)) { |
| 1434 | dev_err(adev->dev, "fail to initialize sdma ras block\n"); | 1438 | dev_err(adev->dev, "fail to initialize sdma ras block\n"); |
| 1435 | return -EINVAL; | 1439 | return -EINVAL; |
| @@ -1442,6 +1446,10 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) · 6 unmodified lines | |||
| 1442 | else | 1446 | else |
| 1443 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | 1447 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); |
| 1444 | 1448 | ||
| 1449 | r = amdgpu_sdma_sysfs_reset_mask_init(adev); | ||
| 1450 | if (r) | ||
| 1451 | return r; | ||
| 1452 | |||
| 1445 | return r; | 1453 | return r; |
| 1446 | } | 1454 | } |
| 1447 | 1455 | ||
| @@ -1456,6 +1464,7 @@ static int sdma_v4_4_2_sw_fini(struct amdgpu_ip_block *ip_block) · 8 unmodified lines | |||
| 1456 | amdgpu_ring_fini(&adev->sdma.instance[i].page); | 1464 | amdgpu_ring_fini(&adev->sdma.instance[i].page); |
| 1457 | } | 1465 | } |
| 1458 | 1466 | ||
| 1467 | amdgpu_sdma_sysfs_reset_mask_fini(adev); | ||
| 1459 | if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 2) || | 1468 | if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 2) || |
| 1460 | amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 5)) | 1469 | amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 5)) |
| 1461 | amdgpu_sdma_destroy_inst_ctx(adev, true); | 1470 | amdgpu_sdma_destroy_inst_ctx(adev, true); |
| @@ -1452,6 +1452,19 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block) · 1451 unmodified lines | |||
| 1452 | return r; | 1452 | return r; |
| 1453 | } | 1453 | } |
| 1454 | 1454 | ||
| 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 | |||
| 1455 | /* Allocate memory for SDMA IP Dump buffer */ | 1468 | /* Allocate memory for SDMA IP Dump buffer */ |
| 1456 | ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); | 1469 | ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); |
| 1457 | if (ptr) | 1470 | if (ptr) |
| @@ -1459,6 +1472,10 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block) · 1 unmodified line | |||
| 1459 | else | 1472 | else |
| 1460 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | 1473 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); |
| 1461 | 1474 | ||
| 1475 | r = amdgpu_sdma_sysfs_reset_mask_init(adev); | ||
| 1476 | if (r) | ||
| 1477 | return r; | ||
| 1478 | |||
| 1462 | return r; | 1479 | return r; |
| 1463 | } | 1480 | } |
| 1464 | 1481 | ||
| @@ -1470,6 +1487,7 @@ static int sdma_v5_0_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines | |||
| 1470 | for (i = 0; i < adev->sdma.num_instances; i++) | 1487 | for (i = 0; i < adev->sdma.num_instances; i++) |
| 1471 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); | 1488 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); |
| 1472 | 1489 | ||
| 1490 | amdgpu_sdma_sysfs_reset_mask_fini(adev); | ||
| 1473 | amdgpu_sdma_destroy_inst_ctx(adev, false); | 1491 | amdgpu_sdma_destroy_inst_ctx(adev, false); |
| 1474 | 1492 | ||
| 1475 | kfree(adev->sdma.ip_dump); | 1493 | kfree(adev->sdma.ip_dump); |
| @@ -1357,6 +1357,24 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block) · 1356 unmodified lines | |||
| 1357 | return r; | 1357 | return r; |
| 1358 | } | 1358 | } |
| 1359 | 1359 | ||
| 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 | |||
| 1360 | /* Allocate memory for SDMA IP Dump buffer */ | 1378 | /* Allocate memory for SDMA IP Dump buffer */ |
| 1361 | ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); | 1379 | ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); |
| 1362 | if (ptr) | 1380 | if (ptr) |
| @@ -1364,6 +1382,10 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block) · 1 unmodified line | |||
| 1364 | else | 1382 | else |
| 1365 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | 1383 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); |
| 1366 | 1384 | ||
| 1385 | r = amdgpu_sdma_sysfs_reset_mask_init(adev); | ||
| 1386 | if (r) | ||
| 1387 | return r; | ||
| 1388 | |||
| 1367 | return r; | 1389 | return r; |
| 1368 | } | 1390 | } |
| 1369 | 1391 | ||
| @@ -1375,6 +1397,7 @@ static int sdma_v5_2_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines | |||
| 1375 | for (i = 0; i < adev->sdma.num_instances; i++) | 1397 | for (i = 0; i < adev->sdma.num_instances; i++) |
| 1376 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); | 1398 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); |
| 1377 | 1399 | ||
| 1400 | amdgpu_sdma_sysfs_reset_mask_fini(adev); | ||
| 1378 | amdgpu_sdma_destroy_inst_ctx(adev, true); | 1401 | amdgpu_sdma_destroy_inst_ctx(adev, true); |
| 1379 | 1402 | ||
| 1380 | kfree(adev->sdma.ip_dump); | 1403 | kfree(adev->sdma.ip_dump); |
| @@ -1350,6 +1350,19 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block) · 1349 unmodified lines | |||
| 1350 | return r; | 1350 | return r; |
| 1351 | } | 1351 | } |
| 1352 | 1352 | ||
| 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 | |||
| 1353 | if (amdgpu_sdma_ras_sw_init(adev)) { | 1366 | if (amdgpu_sdma_ras_sw_init(adev)) { |
| 1354 | dev_err(adev->dev, "Failed to initialize sdma ras block!\n"); | 1367 | dev_err(adev->dev, "Failed to initialize sdma ras block!\n"); |
| 1355 | return -EINVAL; | 1368 | return -EINVAL; |
| @@ -1362,6 +1375,10 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block) · 6 unmodified lines | |||
| 1362 | else | 1375 | else |
| 1363 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | 1376 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); |
| 1364 | 1377 | ||
| 1378 | r = amdgpu_sdma_sysfs_reset_mask_init(adev); | ||
| 1379 | if (r) | ||
| 1380 | return r; | ||
| 1381 | |||
| 1365 | return r; | 1382 | return r; |
| 1366 | } | 1383 | } |
| 1367 | 1384 | ||
| @@ -1373,6 +1390,7 @@ static int sdma_v6_0_sw_fini(struct amdgpu_ip_block *ip_block) · 5 unmodified lines | |||
| 1373 | for (i = 0; i < adev->sdma.num_instances; i++) | 1390 | for (i = 0; i < adev->sdma.num_instances; i++) |
| 1374 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); | 1391 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); |
| 1375 | 1392 | ||
| 1393 | amdgpu_sdma_sysfs_reset_mask_fini(adev); | ||
| 1376 | amdgpu_sdma_destroy_inst_ctx(adev, true); | 1394 | amdgpu_sdma_destroy_inst_ctx(adev, true); |
| 1377 | 1395 | ||
| 1378 | kfree(adev->sdma.ip_dump); | 1396 | kfree(adev->sdma.ip_dump); |
| @@ -90,8 +90,8 @@ static const struct amd_ip_funcs soc15_common_ip_funcs; · 89 unmodified lines | |||
| 90 | /* Vega, Raven, Arcturus */ | 90 | /* Vega, Raven, Arcturus */ |
| 91 | static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] = | 91 | static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] = |
| 92 | { | 92 | { |
| 93 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 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, 2304, 0)}, | 94 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 0)}, |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | static const struct amdgpu_video_codecs vega_video_codecs_encode = | 97 | static const struct amdgpu_video_codecs vega_video_codecs_encode = |
| @@ -49,13 +49,13 @@ static const struct amd_ip_funcs soc21_common_ip_funcs; · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | /* SOC21 */ | 50 | /* SOC21 */ |
| 51 | static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn0[] = { | 51 | 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)}, |
| 53 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, | 53 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 54 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, | 54 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn1[] = { | 57 | 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)}, |
| 59 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, | 59 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| @@ -96,14 +96,14 @@ static const struct amdgpu_video_codecs vcn_4_0_0_video_codecs_decode_vcn1 = { · 34 unmodified lines | |||
| 96 | 96 | ||
| 97 | /* SRIOV SOC21, not const since data is controlled by host */ | 97 | /* SRIOV SOC21, not const since data is controlled by host */ |
| 98 | static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_encode_array_vcn0[] = { | 98 | 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)}, | 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, 4096, 2304, 0)}, | 100 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 101 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, | 101 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_encode_array_vcn1[] = { | 104 | 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)}, | 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, 4096, 2304, 0)}, | 106 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | static struct amdgpu_video_codecs sriov_vcn_4_0_0_video_codecs_encode_vcn0 = { | 109 | static struct amdgpu_video_codecs sriov_vcn_4_0_0_video_codecs_encode_vcn0 = { |
| @@ -48,7 +48,7 @@ · 47 unmodified lines | |||
| 48 | static const struct amd_ip_funcs soc24_common_ip_funcs; | 48 | static const struct amd_ip_funcs soc24_common_ip_funcs; |
| 49 | 49 | ||
| 50 | static const struct amdgpu_video_codec_info vcn_5_0_0_video_codecs_encode_array_vcn0[] = { | 50 | 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)}, |
| 52 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, | 52 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)}, |
| 53 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, | 53 | {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, |
| 54 | }; | 54 | }; |
| @@ -95,6 +95,13 @@ static void vcn_v4_0_3_unified_ring_set_wptr(struct amdgpu_ring *ring); · 94 unmodified lines | |||
| 95 | static void vcn_v4_0_3_set_ras_funcs(struct amdgpu_device *adev); | 95 | static void vcn_v4_0_3_set_ras_funcs(struct amdgpu_device *adev); |
| 96 | static void vcn_v4_0_3_enable_ras(struct amdgpu_device *adev, | 96 | static void vcn_v4_0_3_enable_ras(struct amdgpu_device *adev, |
| 97 | int inst_idx, bool indirect); | 97 | 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 | |||
| 98 | /** | 105 | /** |
| 99 | * vcn_v4_0_3_early_init - set function pointers | 106 | * vcn_v4_0_3_early_init - set function pointers |
| 100 | * | 107 | * |
| @@ -1428,8 +1435,8 @@ static uint64_t vcn_v4_0_3_unified_ring_get_wptr(struct amdgpu_ring *ring) · 1327 unmodified lines | |||
| 1428 | static void vcn_v4_0_3_enc_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg, | 1435 | static void vcn_v4_0_3_enc_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg, |
| 1429 | uint32_t val, uint32_t mask) | 1436 | uint32_t val, uint32_t mask) |
| 1430 | { | 1437 | { |
| 1431 | /* For VF, only local offsets should be used */ | 1438 | /* Use normalized offsets when required */ |
| 1432 | if (amdgpu_sriov_vf(ring->adev)) | 1439 | if (vcn_v4_0_3_normalizn_reqd(ring->adev)) |
| 1433 | reg = NORMALIZE_VCN_REG_OFFSET(reg); | 1440 | reg = NORMALIZE_VCN_REG_OFFSET(reg); |
| 1434 | 1441 | ||
| 1435 | amdgpu_ring_write(ring, VCN_ENC_CMD_REG_WAIT); | 1442 | 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 | |||
| 1440 | 1447 | ||
| 1441 | static void vcn_v4_0_3_enc_ring_emit_wreg(struct amdgpu_ring *ring, uint32_t reg, uint32_t val) | 1448 | static void vcn_v4_0_3_enc_ring_emit_wreg(struct amdgpu_ring *ring, uint32_t reg, uint32_t val) |
| 1442 | { | 1449 | { |
| 1443 | /* For VF, only local offsets should be used */ | 1450 | /* Use normalized offsets when required */ |
| 1444 | if (amdgpu_sriov_vf(ring->adev)) | 1451 | if (vcn_v4_0_3_normalizn_reqd(ring->adev)) |
| 1445 | reg = NORMALIZE_VCN_REG_OFFSET(reg); | 1452 | reg = NORMALIZE_VCN_REG_OFFSET(reg); |
| 1446 | 1453 | ||
| 1447 | amdgpu_ring_write(ring, VCN_ENC_CMD_REG_WRITE); | 1454 | amdgpu_ring_write(ring, VCN_ENC_CMD_REG_WRITE); |
| @@ -136,15 +136,15 @@ static const struct amdgpu_video_codec_info polaris_video_codecs_encode_array[] · 135 unmodified lines | |||
| 136 | { | 136 | { |
| 137 | .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | 137 | .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, |
| 138 | .max_width = 4096, | 138 | .max_width = 4096, |
| 139 | .max_height = 2304, | 139 | .max_height = 4096, |
| 140 | .max_pixels_per_frame = 4096 * 2304, | 140 | .max_pixels_per_frame = 4096 * 4096, |
| 141 | .max_level = 0, | 141 | .max_level = 0, |
| 142 | }, | 142 | }, |
| 143 | { | 143 | { |
| 144 | .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | 144 | .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, |
| 145 | .max_width = 4096, | 145 | .max_width = 4096, |
| 146 | .max_height = 2304, | 146 | .max_height = 4096, |
| 147 | .max_pixels_per_frame = 4096 * 2304, | 147 | .max_pixels_per_frame = 4096 * 4096, |
| 148 | .max_level = 0, | 148 | .max_level = 0, |
| 149 | }, | 149 | }, |
| 150 | }; | 150 | }; |
| @@ -534,7 +534,8 @@ static void kfd_cwsr_init(struct kfd_dev *kfd) · 533 unmodified lines | |||
| 534 | kfd->cwsr_isa = cwsr_trap_gfx11_hex; | 534 | kfd->cwsr_isa = cwsr_trap_gfx11_hex; |
| 535 | kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx11_hex); | 535 | kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx11_hex); |
| 536 | } else { | 536 | } 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); | ||
| 538 | kfd->cwsr_isa = cwsr_trap_gfx12_hex; | 539 | kfd->cwsr_isa = cwsr_trap_gfx12_hex; |
| 539 | kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx12_hex); | 540 | kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx12_hex); |
| 540 | } | 541 | } |
| @@ -202,6 +202,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 201 unmodified lines | |||
| 202 | int r, queue_type; | 202 | int r, queue_type; |
| 203 | uint64_t wptr_addr_off; | 203 | uint64_t wptr_addr_off; |
| 204 | 204 | ||
| 205 | if (!dqm->sched_running || dqm->sched_halt) | ||
| 206 | return 0; | ||
| 205 | if (!down_read_trylock(&adev->reset_domain->sem)) | 207 | if (!down_read_trylock(&adev->reset_domain->sem)) |
| 206 | return -EIO; | 208 | return -EIO; |
| 207 | 209 | ||
| @@ -270,6 +272,8 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 62 unmodified lines | |||
| 270 | int r; | 272 | int r; |
| 271 | struct mes_remove_queue_input queue_input; | 273 | struct mes_remove_queue_input queue_input; |
| 272 | 274 | ||
| 275 | if (!dqm->sched_running || dqm->sched_halt) | ||
| 276 | return 0; | ||
| 273 | if (!down_read_trylock(&adev->reset_domain->sem)) | 277 | if (!down_read_trylock(&adev->reset_domain->sem)) |
| 274 | return -EIO; | 278 | return -EIO; |
| 275 | 279 | ||
| @@ -292,7 +296,7 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 16 unmodified lines | |||
| 292 | return r; | 296 | return r; |
| 293 | } | 297 | } |
| 294 | 298 | ||
| 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) |
| 296 | { | 300 | { |
| 297 | struct device_process_node *cur; | 301 | struct device_process_node *cur; |
| 298 | struct device *dev = dqm->dev->adev->dev; | 302 | 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 | |||
| 319 | return retval; | 323 | return retval; |
| 320 | } | 324 | } |
| 321 | 325 | ||
| 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 | |||
| 322 | static int suspend_all_queues_mes(struct device_queue_manager *dqm) | 353 | static int suspend_all_queues_mes(struct device_queue_manager *dqm) |
| 323 | { | 354 | { |
| 324 | struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev; | 355 | 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 | |||
| 1742 | KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, | 1773 | KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, |
| 1743 | USE_DEFAULT_GRACE_PERIOD, false); | 1774 | USE_DEFAULT_GRACE_PERIOD, false); |
| 1744 | else | 1775 | else |
| 1745 | ret = remove_all_queues_mes(dqm); | 1776 | ret = remove_all_kfd_queues_mes(dqm); |
| 1746 | } | 1777 | } |
| 1747 | dqm->sched_halt = true; | 1778 | dqm->sched_halt = true; |
| 1748 | dqm_unlock(dqm); | 1779 | dqm_unlock(dqm); |
| @@ -1768,6 +1799,9 @@ static int unhalt_cpsch(struct device_queue_manager *dqm) · 19 unmodified lines | |||
| 1768 | ret = execute_queues_cpsch(dqm, | 1799 | ret = execute_queues_cpsch(dqm, |
| 1769 | KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, | 1800 | KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, |
| 1770 | 0, USE_DEFAULT_GRACE_PERIOD); | 1801 | 0, USE_DEFAULT_GRACE_PERIOD); |
| 1802 | else | ||
| 1803 | ret = add_all_kfd_queues_mes(dqm); | ||
| 1804 | |||
| 1771 | dqm_unlock(dqm); | 1805 | dqm_unlock(dqm); |
| 1772 | 1806 | ||
| 1773 | return ret; | 1807 | return ret; |
| @@ -1867,7 +1901,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) · 93 unmodified lines | |||
| 1867 | if (!dqm->dev->kfd->shared_resources.enable_mes) | 1901 | if (!dqm->dev->kfd->shared_resources.enable_mes) |
| 1868 | unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, USE_DEFAULT_GRACE_PERIOD, false); | 1902 | unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, USE_DEFAULT_GRACE_PERIOD, false); |
| 1869 | else | 1903 | else |
| 1870 | remove_all_queues_mes(dqm); | 1904 | remove_all_kfd_queues_mes(dqm); |
| 1871 | 1905 | ||
| 1872 | dqm->sched_running = false; | 1906 | dqm->sched_running = false; |
| 1873 | 1907 | ||
| @@ -341,8 +341,8 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr, · 340 unmodified lines | |||
| 341 | attr_sdma); | 341 | attr_sdma); |
| 342 | struct kfd_sdma_activity_handler_workarea sdma_activity_work_handler; | 342 | struct kfd_sdma_activity_handler_workarea sdma_activity_work_handler; |
| 343 | 343 | ||
| 344 | INIT_WORK(&sdma_activity_work_handler.sdma_activity_work, | 344 | INIT_WORK_ONSTACK(&sdma_activity_work_handler.sdma_activity_work, |
| 345 | kfd_sdma_activity_worker); | 345 | kfd_sdma_activity_worker); |
| 346 | 346 | ||
| 347 | sdma_activity_work_handler.pdd = pdd; | 347 | sdma_activity_work_handler.pdd = pdd; |
| 348 | sdma_activity_work_handler.sdma_activity_counter = 0; | 348 | 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 | |||
| 350 | schedule_work(&sdma_activity_work_handler.sdma_activity_work); | 350 | schedule_work(&sdma_activity_work_handler.sdma_activity_work); |
| 351 | 351 | ||
| 352 | flush_work(&sdma_activity_work_handler.sdma_activity_work); | 352 | flush_work(&sdma_activity_work_handler.sdma_activity_work); |
| 353 | destroy_work_on_stack(&sdma_activity_work_handler.sdma_activity_work); | ||
| 353 | 354 | ||
| 354 | return snprintf(buffer, PAGE_SIZE, "%llu\n", | 355 | return snprintf(buffer, PAGE_SIZE, "%llu\n", |
| 355 | (sdma_activity_work_handler.sdma_activity_counter)/ | 356 | (sdma_activity_work_handler.sdma_activity_counter)/ |
| @@ -853,8 +854,10 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) · 497 unmodified lines | |||
| 853 | goto out; | 854 | goto out; |
| 854 | } | 855 | } |
| 855 | 856 | ||
| 856 | /* A prior open of /dev/kfd could have already created the process. */ | 857 | /* A prior open of /dev/kfd could have already created the process. |
| 857 | process = find_process(thread, false); | 858 | * find_process will increase process kref in this case |
| 859 | */ | ||
| 860 | process = find_process(thread, true); | ||
| 858 | if (process) { | 861 | if (process) { |
| 859 | pr_debug("Process already found\n"); | 862 | pr_debug("Process already found\n"); |
| 860 | } else { | 863 | } else { |
| @@ -902,8 +905,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) · 41 unmodified lines | |||
| 902 | init_waitqueue_head(&process->wait_irq_drain); | 905 | init_waitqueue_head(&process->wait_irq_drain); |
| 903 | } | 906 | } |
| 904 | out: | 907 | out: |
| 905 | if (!IS_ERR(process)) | ||
| 906 | kref_get(&process->ref); | ||
| 907 | mutex_unlock(&kfd_processes_mutex); | 908 | mutex_unlock(&kfd_processes_mutex); |
| 908 | mmput(thread->mm); | 909 | mmput(thread->mm); |
| 909 | 910 | ||
| @@ -1189,10 +1190,8 @@ static void kfd_process_ref_release(struct kref *ref) · 279 unmodified lines | |||
| 1189 | 1190 | ||
| 1190 | static struct mmu_notifier *kfd_process_alloc_notifier(struct mm_struct *mm) | 1191 | static struct mmu_notifier *kfd_process_alloc_notifier(struct mm_struct *mm) |
| 1191 | { | 1192 | { |
| 1192 | int idx = srcu_read_lock(&kfd_processes_srcu); | 1193 | /* This increments p->ref counter if kfd process p exists */ |
| 1193 | struct kfd_process *p = find_process_by_mm(mm); | 1194 | struct kfd_process *p = kfd_lookup_process_by_mm(mm); |
| 1194 | |||
| 1195 | srcu_read_unlock(&kfd_processes_srcu, idx); | ||
| 1196 | 1195 | ||
| 1197 | return p ? &p->mmu_notifier : ERR_PTR(-ESRCH); | 1196 | return p ? &p->mmu_notifier : ERR_PTR(-ESRCH); |
| 1198 | } | 1197 | } |
| @@ -1307,6 +1307,29 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev) · 1306 unmodified lines | |||
| 1307 | DRM_INFO("DMUB hardware initialized: version=0x%08X\n", | 1307 | DRM_INFO("DMUB hardware initialized: version=0x%08X\n", |
| 1308 | adev->dm.dmcub_fw_version); | 1308 | adev->dm.dmcub_fw_version); |
| 1309 | 1309 | ||
| 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 | |||
| 1310 | return 0; | 1333 | return 0; |
| 1311 | } | 1334 | } |
| 1312 | 1335 | ||
| @@ -6790,7 +6813,7 @@ create_stream_for_sink(struct drm_connector *connector, · 5477 unmodified lines | |||
| 6790 | if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) | 6813 | if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) |
| 6791 | tf = TRANSFER_FUNC_GAMMA_22; | 6814 | tf = TRANSFER_FUNC_GAMMA_22; |
| 6792 | mod_build_vsc_infopacket(stream, &stream->vsc_infopacket, stream->output_color_space, tf); | 6815 | 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; |
| 6794 | 6817 | ||
| 6795 | } | 6818 | } |
| 6796 | finish: | 6819 | finish: |
| @@ -8894,6 +8917,56 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane, · 2097 unmodified lines | |||
| 8894 | } | 8917 | } |
| 8895 | } | 8918 | } |
| 8896 | 8919 | ||
| 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 | |||
| 8897 | static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, | 8970 | static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, |
| 8898 | struct drm_device *dev, | 8971 | struct drm_device *dev, |
| 8899 | struct amdgpu_display_manager *dm, | 8972 | struct amdgpu_display_manager *dm, |
| @@ -9047,7 +9120,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 147 unmodified lines | |||
| 9047 | * during the PSR-SU was disabled. | 9120 | * during the PSR-SU was disabled. |
| 9048 | */ | 9121 | */ |
| 9049 | if (acrtc_state->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 && | 9122 | 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 && |
| 9051 | #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | 9124 | #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY |
| 9052 | !amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) && | 9125 | !amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) && |
| 9053 | #endif | 9126 | #endif |
| @@ -9222,9 +9295,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 168 unmodified lines | |||
| 9222 | bundle->stream_update.abm_level = &acrtc_state->abm_level; | 9295 | bundle->stream_update.abm_level = &acrtc_state->abm_level; |
| 9223 | 9296 | ||
| 9224 | mutex_lock(&dm->dc_lock); | 9297 | mutex_lock(&dm->dc_lock); |
| 9225 | if ((acrtc_state->update_type > UPDATE_TYPE_FAST) && | 9298 | if (acrtc_state->update_type > UPDATE_TYPE_FAST) { |
| 9226 | acrtc_state->stream->link->psr_settings.psr_allow_active) | 9299 | if (acrtc_state->stream->link->replay_settings.replay_allow_active) |
| 9227 | amdgpu_dm_psr_disable(acrtc_state->stream); | 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 | } | ||
| 9228 | mutex_unlock(&dm->dc_lock); | 9304 | mutex_unlock(&dm->dc_lock); |
| 9229 | 9305 | ||
| 9230 | /* | 9306 | /* |
| @@ -9265,57 +9341,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 34 unmodified lines | |||
| 9265 | dm_update_pflip_irq_state(drm_to_adev(dev), | 9341 | dm_update_pflip_irq_state(drm_to_adev(dev), |
| 9266 | acrtc_attach); | 9342 | acrtc_attach); |
| 9267 | 9343 | ||
| 9268 | if (acrtc_state->update_type > UPDATE_TYPE_FAST) { | 9344 | amdgpu_dm_enable_self_refresh(acrtc_attach, acrtc_state, timestamp_ns); |
| 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 | |||
| 9319 | mutex_unlock(&dm->dc_lock); | 9345 | mutex_unlock(&dm->dc_lock); |
| 9320 | } | 9346 | } |
| 9321 | 9347 | ||
| @@ -12101,7 +12127,7 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector, · 2779 unmodified lines | |||
| 12101 | break; | 12127 | break; |
| 12102 | } | 12128 | } |
| 12103 | 12129 | ||
| 12104 | while (j < EDID_LENGTH) { | 12130 | while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) { |
| 12105 | struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j]; | 12131 | struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j]; |
| 12106 | unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]); | 12132 | unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]); |
| 12107 | 12133 | ||
| @@ -727,7 +727,7 @@ struct amdgpu_dm_connector { · 726 unmodified lines | |||
| 727 | /* Cached display modes */ | 727 | /* Cached display modes */ |
| 728 | struct drm_display_mode freesync_vid_base; | 728 | struct drm_display_mode freesync_vid_base; |
| 729 | 729 | ||
| 730 | int psr_skip_count; | 730 | int sr_skip_count; |
| 731 | bool disallow_edp_enter_psr; | 731 | bool disallow_edp_enter_psr; |
| 732 | 732 | ||
| 733 | /* Record progress status of mst*/ | 733 | /* Record progress status of mst*/ |
| @@ -265,11 +265,10 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work) · 264 unmodified lines | |||
| 265 | * where the SU region is the full hactive*vactive region. See | 265 | * where the SU region is the full hactive*vactive region. See |
| 266 | * fill_dc_dirty_rects(). | 266 | * fill_dc_dirty_rects(). |
| 267 | */ | 267 | */ |
| 268 | if (vblank_work->stream && vblank_work->stream->link) { | 268 | if (vblank_work->stream && vblank_work->stream->link && vblank_work->acrtc) { |
| 269 | amdgpu_dm_crtc_set_panel_sr_feature( | 269 | amdgpu_dm_crtc_set_panel_sr_feature( |
| 270 | vblank_work, vblank_work->enable, | 270 | vblank_work, vblank_work->enable, |
| 271 | vblank_work->acrtc->dm_irq_params.allow_psr_entry || | 271 | vblank_work->acrtc->dm_irq_params.allow_sr_entry); |
| 272 | vblank_work->stream->link->replay_settings.replay_feature_enabled); | ||
| 273 | } | 272 | } |
| 274 | 273 | ||
| 275 | if (dm->active_vblank_irq_count == 0) | 274 | if (dm->active_vblank_irq_count == 0) |
| @@ -33,7 +33,7 @@ struct dm_irq_params { · 32 unmodified lines | |||
| 33 | struct mod_vrr_params vrr_params; | 33 | struct mod_vrr_params vrr_params; |
| 34 | struct dc_stream_state *stream; | 34 | struct dc_stream_state *stream; |
| 35 | int active_planes; | 35 | int active_planes; |
| 36 | bool allow_psr_entry; | 36 | bool allow_sr_entry; |
| 37 | struct mod_freesync_config freesync_config; | 37 | struct mod_freesync_config freesync_config; |
| 38 | 38 | ||
| 39 | #ifdef CONFIG_DEBUG_FS | 39 | #ifdef CONFIG_DEBUG_FS |
| @@ -3122,14 +3122,12 @@ static enum bp_result bios_parser_get_vram_info( · 3121 unmodified lines | |||
| 3122 | struct dc_vram_info *info) | 3122 | struct dc_vram_info *info) |
| 3123 | { | 3123 | { |
| 3124 | struct bios_parser *bp = BP_FROM_DCB(dcb); | 3124 | 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; |
| 3126 | struct atom_common_table_header *header; | 3126 | struct atom_common_table_header *header; |
| 3127 | struct atom_data_revision revision; | 3127 | struct atom_data_revision revision; |
| 3128 | 3128 | ||
| 3129 | // vram info moved to umc_info for DCN4x | 3129 | // vram info moved to umc_info for DCN4x |
| 3130 | if (dcb->ctx->dce_version >= DCN_VERSION_4_01 && | 3130 | if (info && DATA_TABLES(umc_info)) { |
| 3131 | dcb->ctx->dce_version < DCN_VERSION_MAX && | ||
| 3132 | info && DATA_TABLES(umc_info)) { | ||
| 3133 | header = GET_IMAGE(struct atom_common_table_header, | 3131 | header = GET_IMAGE(struct atom_common_table_header, |
| 3134 | DATA_TABLES(umc_info)); | 3132 | DATA_TABLES(umc_info)); |
| 3135 | 3133 | ||
| @@ -265,6 +265,9 @@ struct dc_state *dc_state_create_copy(struct dc_state *src_state) · 264 unmodified lines | |||
| 265 | dc_state_copy_internal(new_state, src_state); | 265 | dc_state_copy_internal(new_state, src_state); |
| 266 | 266 | ||
| 267 | #ifdef CONFIG_DRM_AMD_DC_FP | 267 | #ifdef CONFIG_DRM_AMD_DC_FP |
| 268 | new_state->bw_ctx.dml2 = NULL; | ||
| 269 | new_state->bw_ctx.dml2_dc_power_source = NULL; | ||
| 270 | |||
| 268 | if (src_state->bw_ctx.dml2 && | 271 | if (src_state->bw_ctx.dml2 && |
| 269 | !dml2_create_copy(&new_state->bw_ctx.dml2, src_state->bw_ctx.dml2)) { | 272 | !dml2_create_copy(&new_state->bw_ctx.dml2, src_state->bw_ctx.dml2)) { |
| 270 | dc_state_release(new_state); | 273 | dc_state_release(new_state); |
| @@ -55,7 +55,7 @@ struct aux_payload; · 54 unmodified lines | |||
| 55 | struct set_config_cmd_payload; | 55 | struct set_config_cmd_payload; |
| 56 | struct dmub_notification; | 56 | struct dmub_notification; |
| 57 | 57 | ||
| 58 | #define DC_VER "3.2.308" | 58 | #define DC_VER "3.2.309" |
| 59 | 59 | ||
| 60 | #define MAX_SURFACES 3 | 60 | #define MAX_SURFACES 3 |
| 61 | #define MAX_PLANES 6 | 61 | #define MAX_PLANES 6 |
| @@ -181,6 +181,7 @@ struct dc_panel_patch { · 180 unmodified lines | |||
| 181 | unsigned int disable_colorimetry; | 181 | unsigned int disable_colorimetry; |
| 182 | uint8_t blankstream_before_otg_off; | 182 | uint8_t blankstream_before_otg_off; |
| 183 | bool oled_optimize_display_on; | 183 | bool oled_optimize_display_on; |
| 184 | unsigned int force_mst_blocked_discovery; | ||
| 184 | }; | 185 | }; |
| 185 | 186 | ||
| 186 | struct dc_edid_caps { | 187 | struct dc_edid_caps { |
| @@ -46,7 +46,7 @@ · 45 unmodified lines | |||
| 46 | #include "clk_mgr.h" | 46 | #include "clk_mgr.h" |
| 47 | 47 | ||
| 48 | __printf(3, 4) | 48 | __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, ...) |
| 50 | { | 50 | { |
| 51 | int ret_vsnprintf; | 51 | int ret_vsnprintf; |
| 52 | unsigned int chars_printed; | 52 | unsigned int chars_printed; |
| @@ -143,7 +143,7 @@ void generic_reg_wait(const struct dc_context *ctx, · 142 unmodified lines | |||
| 143 | unsigned int delay_between_poll_us, unsigned int time_out_num_tries, | 143 | unsigned int delay_between_poll_us, unsigned int time_out_num_tries, |
| 144 | const char *func_name, int line); | 144 | const char *func_name, int line); |
| 145 | 145 | ||
| 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, ...); |
| 147 | 147 | ||
| 148 | /* These macros need to be used with soc15 registers in order to retrieve | 148 | /* These macros need to be used with soc15 registers in order to retrieve |
| 149 | * the actual offset. | 149 | * the actual offset. |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | |||
| 8 | #include "dml2_pmo_dcn4_fams2.h" | 8 | #include "dml2_pmo_dcn4_fams2.h" |
| 9 | 9 | ||
| 10 | 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 | 10 | 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; | ||
| 11 | 12 | ||
| 12 | static const struct dml2_pmo_pstate_strategy base_strategy_list_1_display[] = { | 13 | static const struct dml2_pmo_pstate_strategy base_strategy_list_1_display[] = { |
| 13 | // VActive Preferred | 14 | // 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 | |||
| 2140 | struct dml2_pmo_instance *pmo = in_out->instance; | 2141 | struct dml2_pmo_instance *pmo = in_out->instance; |
| 2141 | bool stutter_period_meets_z8_eco = true; | 2142 | bool stutter_period_meets_z8_eco = true; |
| 2142 | bool z8_stutter_optimization_too_expensive = false; | 2143 | bool z8_stutter_optimization_too_expensive = false; |
| 2144 | bool stutter_optimization_too_expensive = false; | ||
| 2143 | double line_time_us, vblank_nom_time_us; | 2145 | double line_time_us, vblank_nom_time_us; |
| 2144 | 2146 | ||
| 2145 | unsigned int i; | 2147 | 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 | |||
| 2161 | 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; | 2163 | 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; |
| 2162 | vblank_nom_time_us = line_time_us * in_out->base_display_config->display_config.stream_descriptors[i].timing.vblank_nom; | 2164 | vblank_nom_time_us = line_time_us * in_out->base_display_config->display_config.stream_descriptors[i].timing.vblank_nom; |
| 2163 | 2165 | ||
| 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) { |
| 2165 | z8_stutter_optimization_too_expensive = true; | 2167 | z8_stutter_optimization_too_expensive = true; |
| 2166 | break; | 2168 | break; |
| 2167 | } | 2169 | } |
| 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 | } | ||
| 2168 | } | 2175 | } |
| 2169 | 2176 | ||
| 2170 | pmo->scratch.pmo_dcn4.num_stutter_candidates = 0; | 2177 | 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 | |||
| 2180 | pmo->scratch.pmo_dcn4.z8_vblank_optimizable = false; | 2187 | pmo->scratch.pmo_dcn4.z8_vblank_optimizable = false; |
| 2181 | } | 2188 | } |
| 2182 | 2189 | ||
| 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) { |
| 2184 | 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; | 2191 | 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; |
| 2185 | pmo->scratch.pmo_dcn4.num_stutter_candidates++; | 2192 | pmo->scratch.pmo_dcn4.num_stutter_candidates++; |
| 2186 | } | 2193 | } |
| @@ -519,15 +519,18 @@ static void dcn31_reset_back_end_for_pipe( · 518 unmodified lines | |||
| 519 | 519 | ||
| 520 | dc->hwss.set_abm_immediate_disable(pipe_ctx); | 520 | dc->hwss.set_abm_immediate_disable(pipe_ctx); |
| 521 | 521 | ||
| 522 | if ((!pipe_ctx->stream->dpms_off || pipe_ctx->stream->link->link_status.link_active) | 522 | link = pipe_ctx->stream->link; |
| 523 | && pipe_ctx->stream->sink && pipe_ctx->stream->sink->edid_caps.panel_patch.blankstream_before_otg_off) { | 523 | |
| 524 | if ((!pipe_ctx->stream->dpms_off || link->link_status.link_active) && | ||
| 525 | (link->connector_signal == SIGNAL_TYPE_EDP)) | ||
| 524 | dc->hwss.blank_stream(pipe_ctx); | 526 | dc->hwss.blank_stream(pipe_ctx); |
| 525 | } | ||
| 526 | 527 | ||
| 527 | pipe_ctx->stream_res.tg->funcs->set_dsc_config( | 528 | pipe_ctx->stream_res.tg->funcs->set_dsc_config( |
| 528 | pipe_ctx->stream_res.tg, | 529 | pipe_ctx->stream_res.tg, |
| 529 | OPTC_DSC_DISABLED, 0, 0); | 530 | OPTC_DSC_DISABLED, 0, 0); |
| 531 | |||
| 530 | pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg); | 532 | pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg); |
| 533 | |||
| 531 | pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false); | 534 | pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false); |
| 532 | if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass) | 535 | if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass) |
| 533 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( | 536 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( |
| @@ -539,7 +542,6 @@ static void dcn31_reset_back_end_for_pipe( · 5 unmodified lines | |||
| 539 | pipe_ctx->stream_res.tg->funcs->set_drr( | 542 | pipe_ctx->stream_res.tg->funcs->set_drr( |
| 540 | pipe_ctx->stream_res.tg, NULL); | 543 | pipe_ctx->stream_res.tg, NULL); |
| 541 | 544 | ||
| 542 | link = pipe_ctx->stream->link; | ||
| 543 | /* DPMS may already disable or */ | 545 | /* DPMS may already disable or */ |
| 544 | /* dpms_off status is incorrect due to fastboot | 546 | /* dpms_off status is incorrect due to fastboot |
| 545 | * feature. When system resume from S4 with second | 547 | * 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 | |||
| 651 | cmd.abm_set_backlight.header.sub_type = DMUB_CMD__ABM_SET_BACKLIGHT; | 653 | cmd.abm_set_backlight.header.sub_type = DMUB_CMD__ABM_SET_BACKLIGHT; |
| 652 | cmd.abm_set_backlight.abm_set_backlight_data.frame_ramp = backlight_level_params->frame_ramp; | 654 | cmd.abm_set_backlight.abm_set_backlight_data.frame_ramp = backlight_level_params->frame_ramp; |
| 653 | cmd.abm_set_backlight.abm_set_backlight_data.backlight_user_level = backlight_level_params->backlight_pwm_u16_16; | 655 | 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; | ||
| 655 | cmd.abm_set_backlight.abm_set_backlight_data.min_luminance = backlight_level_params->min_luminance; | 658 | cmd.abm_set_backlight.abm_set_backlight_data.min_luminance = backlight_level_params->min_luminance; |
| 656 | cmd.abm_set_backlight.abm_set_backlight_data.max_luminance = backlight_level_params->max_luminance; | 659 | cmd.abm_set_backlight.abm_set_backlight_data.max_luminance = backlight_level_params->max_luminance; |
| 657 | cmd.abm_set_backlight.abm_set_backlight_data.min_backlight_pwm = backlight_level_params->min_backlight_pwm; | 660 | cmd.abm_set_backlight.abm_set_backlight_data.min_backlight_pwm = backlight_level_params->min_backlight_pwm; |
| @@ -1633,9 +1633,11 @@ static bool retrieve_link_cap(struct dc_link *link) · 1632 unmodified lines | |||
| 1633 | } | 1633 | } |
| 1634 | 1634 | ||
| 1635 | /* Read DP tunneling information. */ | 1635 | /* Read DP tunneling information. */ |
| 1636 | status = dpcd_get_tunneling_device_data(link); | 1636 | if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) { |
| 1637 | if (status != DC_OK) | 1637 | status = dpcd_get_tunneling_device_data(link); |
| 1638 | dm_error("%s: Read tunneling device data failed.\n", __func__); | 1638 | if (status != DC_OK) |
| 1639 | dm_error("%s: Read tunneling device data failed.\n", __func__); | ||
| 1640 | } | ||
| 1639 | 1641 | ||
| 1640 | dpcd_set_source_specific_data(link); | 1642 | dpcd_set_source_specific_data(link); |
| 1641 | /* Sink may need to configure internals based on vendor, so allow some | 1643 | /* Sink may need to configure internals based on vendor, so allow some |
| @@ -221,21 +221,11 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link) · 220 unmodified lines | |||
| 221 | &replay_error_status.raw, | 221 | &replay_error_status.raw, |
| 222 | sizeof(replay_error_status.raw)); | 222 | sizeof(replay_error_status.raw)); |
| 223 | 223 | ||
| 224 | link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR = | 224 | if (replay_error_status.bits.LINK_CRC_ERROR || |
| 225 | replay_error_status.bits.LINK_CRC_ERROR; | 225 | replay_configuration.bits.DESYNC_ERROR_STATUS || |
| 226 | link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR = | 226 | replay_configuration.bits.STATE_TRANSITION_ERROR_STATUS) { |
| 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) { | ||
| 234 | bool allow_active; | 227 | bool allow_active; |
| 235 | 228 | ||
| 236 | if (link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR) | ||
| 237 | link->replay_settings.config.received_desync_error_hpd = 1; | ||
| 238 | |||
| 239 | if (link->replay_settings.config.force_disable_desync_error_check) | 229 | if (link->replay_settings.config.force_disable_desync_error_check) |
| 240 | return; | 230 | return; |
| 241 | 231 | ||
| @@ -559,17 +559,6 @@ static const struct dc_debug_options debug_defaults_drv = { · 558 unmodified lines | |||
| 559 | .using_dml2 = false, | 559 | .using_dml2 = false, |
| 560 | }; | 560 | }; |
| 561 | 561 | ||
| 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 | |||
| 573 | static void dcn10_dpp_destroy(struct dpp **dpp) | 562 | static void dcn10_dpp_destroy(struct dpp **dpp) |
| 574 | { | 563 | { |
| 575 | kfree(TO_DCN10_DPP(*dpp)); | 564 | kfree(TO_DCN10_DPP(*dpp)); |
| @@ -1398,8 +1387,6 @@ static bool dcn10_resource_construct( · 822 unmodified lines | |||
| 1398 | 1387 | ||
| 1399 | if (dc->ctx->dce_environment == DCE_ENV_PRODUCTION_DRV) | 1388 | if (dc->ctx->dce_environment == DCE_ENV_PRODUCTION_DRV) |
| 1400 | dc->debug = debug_defaults_drv; | 1389 | dc->debug = debug_defaults_drv; |
| 1401 | else | ||
| 1402 | dc->debug = debug_defaults_diags; | ||
| 1403 | 1390 | ||
| 1404 | /************************************************* | 1391 | /************************************************* |
| 1405 | * Create resources * | 1392 | * Create resources * |
| @@ -868,7 +868,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 867 unmodified lines | |||
| 868 | .max_downscale_src_width = 4096,/*upto true 4K*/ | 868 | .max_downscale_src_width = 4096,/*upto true 4K*/ |
| 869 | .disable_pplib_wm_range = false, | 869 | .disable_pplib_wm_range = false, |
| 870 | .scl_reset_length10 = true, | 870 | .scl_reset_length10 = true, |
| 871 | .sanity_checks = true, | 871 | .sanity_checks = false, |
| 872 | .underflow_assert_delay_us = 0xFFFFFFFF, | 872 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 873 | .dwb_fi_phase = -1, // -1 = disable, | 873 | .dwb_fi_phase = -1, // -1 = disable, |
| 874 | .dmub_command_table = true, | 874 | .dmub_command_table = true, |
| @@ -888,7 +888,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 887 unmodified lines | |||
| 888 | .max_downscale_src_width = 4096,/*upto true 4k*/ | 888 | .max_downscale_src_width = 4096,/*upto true 4k*/ |
| 889 | .disable_pplib_wm_range = false, | 889 | .disable_pplib_wm_range = false, |
| 890 | .scl_reset_length10 = true, | 890 | .scl_reset_length10 = true, |
| 891 | .sanity_checks = true, | 891 | .sanity_checks = false, |
| 892 | .underflow_assert_delay_us = 0xFFFFFFFF, | 892 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 893 | .dwb_fi_phase = -1, // -1 = disable, | 893 | .dwb_fi_phase = -1, // -1 = disable, |
| 894 | .dmub_command_table = true, | 894 | .dmub_command_table = true, |
| @@ -910,6 +910,16 @@ static void spl_get_taps_non_adaptive_scaler( · 909 unmodified lines | |||
| 910 | spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c - 1; | 910 | spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c - 1; |
| 911 | else | 911 | else |
| 912 | spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c; | 912 | 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 | |||
| 913 | } | 923 | } |
| 914 | 924 | ||
| 915 | /* Calculate optimal number of taps */ | 925 | /* Calculate optimal number of taps */ |
| @@ -936,10 +946,7 @@ static bool spl_get_optimal_number_of_taps( · 20 unmodified lines | |||
| 936 | 946 | ||
| 937 | /* Disable adaptive scaler and sharpener when integer scaling is enabled */ | 947 | /* Disable adaptive scaler and sharpener when integer scaling is enabled */ |
| 938 | if (spl_in->scaling_quality.integer_scaling) { | 948 | if (spl_in->scaling_quality.integer_scaling) { |
| 939 | spl_scratch->scl_data.taps.h_taps = 1; | 949 | spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps); |
| 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; | ||
| 943 | *enable_easf_v = false; | 950 | *enable_easf_v = false; |
| 944 | *enable_easf_h = false; | 951 | *enable_easf_h = false; |
| 945 | *enable_isharp = false; | 952 | *enable_isharp = false; |
| @@ -4426,6 +4426,24 @@ struct dmub_rb_cmd_abm_set_pipe { · 4425 unmodified lines | |||
| 4426 | struct dmub_cmd_abm_set_pipe_data abm_set_pipe_data; | 4426 | struct dmub_cmd_abm_set_pipe_data abm_set_pipe_data; |
| 4427 | }; | 4427 | }; |
| 4428 | 4428 | ||
| 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 | |||
| 4429 | /** | 4447 | /** |
| 4430 | * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command. | 4448 | * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command. |
| 4431 | */ | 4449 | */ |
| @@ -4452,18 +4470,23 @@ struct dmub_cmd_abm_set_backlight_data { · 20 unmodified lines | |||
| 4452 | */ | 4470 | */ |
| 4453 | uint8_t panel_mask; | 4471 | uint8_t panel_mask; |
| 4454 | 4472 | ||
| 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 | |||
| 4455 | /** | 4483 | /** |
| 4456 | * Backlight control type. | 4484 | * Backlight control type. |
| 4457 | * Value 0 is PWM backlight control. | 4485 | * Value 0 is PWM backlight control. |
| 4458 | * Value 1 is VAUX backlight control. | 4486 | * Value 1 is VAUX backlight control. |
| 4459 | * Value 2 is AMD DPCD AUX backlight control. | 4487 | * Value 2 is AMD DPCD AUX backlight control. |
| 4460 | */ | 4488 | */ |
| 4461 | uint8_t backlight_control_type; | 4489 | enum dmub_backlight_control_type backlight_control_type; |
| 4462 | |||
| 4463 | /** | ||
| 4464 | * AUX HW instance. | ||
| 4465 | */ | ||
| 4466 | uint8_t aux_inst; | ||
| 4467 | 4490 | ||
| 4468 | /** | 4491 | /** |
| 4469 | * Minimum luminance in nits. | 4492 | * Minimum luminance in nits. |
| @@ -497,6 +497,7 @@ enum dmub_status · 496 unmodified lines | |||
| 497 | const struct dmub_fw_meta_info *fw_info; | 497 | const struct dmub_fw_meta_info *fw_info; |
| 498 | uint32_t fw_state_size = DMUB_FW_STATE_SIZE; | 498 | uint32_t fw_state_size = DMUB_FW_STATE_SIZE; |
| 499 | uint32_t trace_buffer_size = DMUB_TRACE_BUFFER_SIZE; | 499 | uint32_t trace_buffer_size = DMUB_TRACE_BUFFER_SIZE; |
| 500 | uint32_t shared_state_size = DMUB_FW_HEADER_SHARED_STATE_SIZE; | ||
| 500 | uint32_t window_sizes[DMUB_WINDOW_TOTAL] = { 0 }; | 501 | uint32_t window_sizes[DMUB_WINDOW_TOTAL] = { 0 }; |
| 501 | 502 | ||
| 502 | if (!dmub->sw_init) | 503 | if (!dmub->sw_init) |
| @@ -514,6 +515,7 @@ enum dmub_status · 11 unmodified lines | |||
| 514 | 515 | ||
| 515 | fw_state_size = fw_info->fw_region_size; | 516 | fw_state_size = fw_info->fw_region_size; |
| 516 | trace_buffer_size = fw_info->trace_buffer_size; | 517 | trace_buffer_size = fw_info->trace_buffer_size; |
| 518 | shared_state_size = fw_info->shared_state_size; | ||
| 517 | 519 | ||
| 518 | /** | 520 | /** |
| 519 | * If DM didn't fill in a version, then fill it in based on | 521 | * If DM didn't fill in a version, then fill it in based on |
| @@ -534,7 +536,7 @@ enum dmub_status · 14 unmodified lines | |||
| 534 | window_sizes[DMUB_WINDOW_5_TRACEBUFF] = trace_buffer_size; | 536 | window_sizes[DMUB_WINDOW_5_TRACEBUFF] = trace_buffer_size; |
| 535 | window_sizes[DMUB_WINDOW_6_FW_STATE] = fw_state_size; | 537 | window_sizes[DMUB_WINDOW_6_FW_STATE] = fw_state_size; |
| 536 | window_sizes[DMUB_WINDOW_7_SCRATCH_MEM] = DMUB_SCRATCH_MEM_SIZE; | 538 | 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); |
| 538 | 540 | ||
| 539 | out->fb_size = | 541 | out->fb_size = |
| 540 | dmub_srv_calc_regions_for_memory_type(params, out, window_sizes, DMUB_WINDOW_MEMORY_TYPE_FB); | 542 | dmub_srv_calc_regions_for_memory_type(params, out, window_sizes, DMUB_WINDOW_MEMORY_TYPE_FB); |
| @@ -230,13 +230,23 @@ union MESAPI_SET_HW_RESOURCES { · 229 unmodified lines | |||
| 230 | uint32_t disable_add_queue_wptr_mc_addr : 1; | 230 | uint32_t disable_add_queue_wptr_mc_addr : 1; |
| 231 | uint32_t enable_mes_event_int_logging : 1; | 231 | uint32_t enable_mes_event_int_logging : 1; |
| 232 | uint32_t enable_reg_active_poll : 1; | 232 | 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; | ||
| 234 | }; | 242 | }; |
| 235 | uint32_t uint32_t_all; | 243 | uint32_t uint32_t_all; |
| 236 | }; | 244 | }; |
| 237 | uint32_t oversubscription_timer; | 245 | uint32_t oversubscription_timer; |
| 238 | uint64_t doorbell_info; | 246 | uint64_t doorbell_info; |
| 239 | uint64_t event_intr_history_gpu_mc_ptr; | 247 | uint64_t event_intr_history_gpu_mc_ptr; |
| 248 | uint64_t timestamp; | ||
| 249 | uint32_t os_tdr_timeout_in_sec; | ||
| 240 | }; | 250 | }; |
| 241 | 251 | ||
| 242 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 252 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -563,6 +573,11 @@ enum MESAPI_MISC_OPCODE { · 320 unmodified lines | |||
| 563 | MESAPI_MISC__READ_REG, | 573 | MESAPI_MISC__READ_REG, |
| 564 | MESAPI_MISC__WAIT_REG_MEM, | 574 | MESAPI_MISC__WAIT_REG_MEM, |
| 565 | MESAPI_MISC__SET_SHADER_DEBUGGER, | 575 | 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 | |||
| 566 | MESAPI_MISC__MAX, | 581 | MESAPI_MISC__MAX, |
| 567 | }; | 582 | }; |
| 568 | 583 | ||
| @@ -617,6 +632,31 @@ struct SET_SHADER_DEBUGGER { · 48 unmodified lines | |||
| 617 | uint32_t trap_en; | 632 | uint32_t trap_en; |
| 618 | }; | 633 | }; |
| 619 | 634 | ||
| 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 | |||
| 620 | union MESAPI__MISC { | 660 | union MESAPI__MISC { |
| 621 | struct { | 661 | struct { |
| 622 | union MES_API_HEADER header; | 662 | union MES_API_HEADER header; |
| @@ -631,6 +671,7 @@ union MESAPI__MISC { · 8 unmodified lines | |||
| 631 | struct WAIT_REG_MEM wait_reg_mem; | 671 | struct WAIT_REG_MEM wait_reg_mem; |
| 632 | struct SET_SHADER_DEBUGGER set_shader_debugger; | 672 | struct SET_SHADER_DEBUGGER set_shader_debugger; |
| 633 | enum MES_AMD_PRIORITY_LEVEL queue_sch_level; | 673 | enum MES_AMD_PRIORITY_LEVEL queue_sch_level; |
| 674 | struct CHANGE_CONFIG change_config; | ||
| 634 | 675 | ||
| 635 | uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS]; | 676 | uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS]; |
| 636 | }; | 677 | }; |
| @@ -643,6 +643,10 @@ enum MESAPI_MISC_OPCODE { · 642 unmodified lines | |||
| 643 | MESAPI_MISC__SET_SHADER_DEBUGGER, | 643 | MESAPI_MISC__SET_SHADER_DEBUGGER, |
| 644 | MESAPI_MISC__NOTIFY_WORK_ON_UNMAPPED_QUEUE, | 644 | MESAPI_MISC__NOTIFY_WORK_ON_UNMAPPED_QUEUE, |
| 645 | MESAPI_MISC__NOTIFY_TO_UNMAP_PROCESSES, | 645 | 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, | ||
| 646 | 650 | ||
| 647 | MESAPI_MISC__MAX, | 651 | MESAPI_MISC__MAX, |
| 648 | }; | 652 | }; |
| @@ -713,6 +717,31 @@ struct SET_GANG_SUBMIT { · 64 unmodified lines | |||
| 713 | uint32_t slave_gang_context_array_index; | 717 | uint32_t slave_gang_context_array_index; |
| 714 | }; | 718 | }; |
| 715 | 719 | ||
| 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 | |||
| 716 | union MESAPI__MISC { | 745 | union MESAPI__MISC { |
| 717 | struct { | 746 | struct { |
| 718 | union MES_API_HEADER header; | 747 | union MES_API_HEADER header; |
| @@ -726,7 +755,7 @@ union MESAPI__MISC { · 7 unmodified lines | |||
| 726 | struct WAIT_REG_MEM wait_reg_mem; | 755 | struct WAIT_REG_MEM wait_reg_mem; |
| 727 | struct SET_SHADER_DEBUGGER set_shader_debugger; | 756 | struct SET_SHADER_DEBUGGER set_shader_debugger; |
| 728 | enum MES_AMD_PRIORITY_LEVEL queue_sch_level; | 757 | enum MES_AMD_PRIORITY_LEVEL queue_sch_level; |
| 729 | 758 | struct CHANGE_CONFIG change_config; | |
| 730 | uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS]; | 759 | uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS]; |
| 731 | }; | 760 | }; |
| 732 | uint64_t timestamp; | 761 | uint64_t timestamp; |
| @@ -3041,6 +3041,16 @@ static int mmhub_err_codes[] = { · 3040 unmodified lines | |||
| 3041 | CODE_VML2, CODE_VML2_WALKER, CODE_MMCANE, | 3041 | CODE_VML2, CODE_VML2_WALKER, CODE_MMCANE, |
| 3042 | }; | 3042 | }; |
| 3043 | 3043 | ||
| 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 | |||
| 3044 | static const struct mca_ras_info mca_ras_table[] = { | 3054 | static const struct mca_ras_info mca_ras_table[] = { |
| 3045 | { | 3055 | { |
| 3046 | .blkid = AMDGPU_RAS_BLOCK__UMC, | 3056 | .blkid = AMDGPU_RAS_BLOCK__UMC, |
| @@ -3069,6 +3079,20 @@ static const struct mca_ras_info mca_ras_table[] = { · 22 unmodified lines | |||
| 3069 | .blkid = AMDGPU_RAS_BLOCK__XGMI_WAFL, | 3079 | .blkid = AMDGPU_RAS_BLOCK__XGMI_WAFL, |
| 3070 | .ip = AMDGPU_MCA_IP_PCS_XGMI, | 3080 | .ip = AMDGPU_MCA_IP_PCS_XGMI, |
| 3071 | .get_err_count = mca_pcs_xgmi_mca_get_err_count, | 3081 | .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, | ||
| 3072 | }, | 3096 | }, |
| 3073 | }; | 3097 | }; |
| 3074 | 3098 | ||
| @@ -1132,7 +1132,7 @@ static int smu_v14_0_common_get_dpm_level_count(struct smu_context *smu, · 1131 unmodified lines | |||
| 1132 | static int smu_v14_0_0_print_clk_levels(struct smu_context *smu, | 1132 | static int smu_v14_0_0_print_clk_levels(struct smu_context *smu, |
| 1133 | enum smu_clk_type clk_type, char *buf) | 1133 | enum smu_clk_type clk_type, char *buf) |
| 1134 | { | 1134 | { |
| 1135 | int i, size = 0, ret = 0; | 1135 | int i, idx, ret = 0, size = 0; |
| 1136 | uint32_t cur_value = 0, value = 0, count = 0; | 1136 | uint32_t cur_value = 0, value = 0, count = 0; |
| 1137 | uint32_t min, max; | 1137 | uint32_t min, max; |
| 1138 | 1138 | ||
| @@ -1168,7 +1168,8 @@ static int smu_v14_0_0_print_clk_levels(struct smu_context *smu, · 29 unmodified lines | |||
| 1168 | break; | 1168 | break; |
| 1169 | 1169 | ||
| 1170 | for (i = 0; i < count; i++) { | 1170 | 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); | ||
| 1172 | if (ret) | 1173 | if (ret) |
| 1173 | break; | 1174 | break; |
| 1174 | 1175 | ||
| @@ -1516,6 +1516,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) · 1515 unmodified lines | |||
| 1516 | * 64K_D_2D on GFX12 is identical to 64K_D on GFX11. | 1516 | * 64K_D_2D on GFX12 is identical to 64K_D on GFX11. |
| 1517 | */ | 1517 | */ |
| 1518 | #define AMD_FMT_MOD_TILE_GFX9_64K_D 10 | 1518 | #define AMD_FMT_MOD_TILE_GFX9_64K_D 10 |
| 1519 | #define AMD_FMT_MOD_TILE_GFX9_4K_D_X 22 | ||
| 1519 | #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 | 1520 | #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 |
| 1520 | #define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 | 1521 | #define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 |
| 1521 | #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 | 1522 | #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 |