amd-drm-next-6.18-2025-09-26: amdgpu: - Misc fixes - Misc cleanups - SMU 13.x fixes - MES fix - VCN 5.0.1 reset fixes - DCN 3.2 watermark fixes - AVI infoframe fixes - PSR fix - Brightness fixes - DCN 3.1.4 fixes - DCN 3.1+ DTM fixes - DCN powergating fixes - DMUB fixes - DCN/SMU cleanup - DCN stutter fixes - DCN 3.5 fixes - GAMMA_LUT fixes - Add UserQ documentation - GC 9.4 reset fixes - Enforce isolation cleanups - UserQ fixes - DC/non-DC common modes cleanup - DCE6-10 fixes amdkfd: - Fix a race in sw_fini - Switch partition fix Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -12,6 +12,7 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures. · 11 unmodified lines | |||
| 12 | module-parameters | 12 | module-parameters |
| 13 | gc/index | 13 | gc/index |
| 14 | display/index | 14 | display/index |
| 15 | userq | ||
| 15 | flashing | 16 | flashing |
| 16 | xgmi | 17 | xgmi |
| 17 | ras | 18 | ras |
| @@ -0,0 +1,203 @@ | |||
| 1 | ================== | ||
| 2 | User Mode Queues | ||
| 3 | ================== | ||
| 4 | |||
| 5 | Introduction | ||
| 6 | ============ | ||
| 7 | |||
| 8 | Similar to the KFD, GPU engine queues move into userspace. The idea is to let | ||
| 9 | user processes manage their submissions to the GPU engines directly, bypassing | ||
| 10 | IOCTL calls to the driver to submit work. This reduces overhead and also allows | ||
| 11 | the GPU to submit work to itself. Applications can set up work graphs of jobs | ||
| 12 | across multiple GPU engines without needing trips through the CPU. | ||
| 13 | |||
| 14 | UMDs directly interface with firmware via per application shared memory areas. | ||
| 15 | The main vehicle for this is queue. A queue is a ring buffer with a read | ||
| 16 | pointer (rptr) and a write pointer (wptr). The UMD writes IP specific packets | ||
| 17 | into the queue and the firmware processes those packets, kicking off work on the | ||
| 18 | GPU engines. The CPU in the application (or another queue or device) updates | ||
| 19 | the wptr to tell the firmware how far into the ring buffer to process packets | ||
| 20 | and the rtpr provides feedback to the UMD on how far the firmware has progressed | ||
| 21 | in executing those packets. When the wptr and the rptr are equal, the queue is | ||
| 22 | idle. | ||
| 23 | |||
| 24 | Theory of Operation | ||
| 25 | =================== | ||
| 26 | |||
| 27 | The various engines on modern AMD GPUs support multiple queues per engine with a | ||
| 28 | scheduling firmware which handles dynamically scheduling user queues on the | ||
| 29 | available hardware queue slots. When the number of user queues outnumbers the | ||
| 30 | available hardware queue slots, the scheduling firmware dynamically maps and | ||
| 31 | unmaps queues based on priority and time quanta. The state of each user queue | ||
| 32 | is managed in the kernel driver in an MQD (Memory Queue Descriptor). This is a | ||
| 33 | buffer in GPU accessible memory that stores the state of a user queue. The | ||
| 34 | scheduling firmware uses the MQD to load the queue state into an HQD (Hardware | ||
| 35 | Queue Descriptor) when a user queue is mapped. Each user queue requires a | ||
| 36 | number of additional buffers which represent the ring buffer and any metadata | ||
| 37 | needed by the engine for runtime operation. On most engines this consists of | ||
| 38 | the ring buffer itself, a rptr buffer (where the firmware will shadow the rptr | ||
| 39 | to userspace), a wptr buffer (where the application will write the wptr for the | ||
| 40 | firmware to fetch it), and a doorbell. A doorbell is a piece of one of the | ||
| 41 | device's MMIO BARs which can be mapped to specific user queues. When the | ||
| 42 | application writes to the doorbell, it will signal the firmware to take some | ||
| 43 | action. Writing to the doorbell wakes the firmware and causes it to fetch the | ||
| 44 | wptr and start processing the packets in the queue. Each 4K page of the doorbell | ||
| 45 | BAR supports specific offset ranges for specific engines. The doorbell of a | ||
| 46 | queue must be mapped into the aperture aligned to the IP used by the queue | ||
| 47 | (e.g., GFX, VCN, SDMA, etc.). These doorbell apertures are set up via NBIO | ||
| 48 | registers. Doorbells are 32 bit or 64 bit (depending on the engine) chunks of | ||
| 49 | the doorbell BAR. A 4K doorbell page provides 512 64-bit doorbells for up to | ||
| 50 | 512 user queues. A subset of each page is reserved for each IP type supported | ||
| 51 | on the device. The user can query the doorbell ranges for each IP via the INFO | ||
| 52 | IOCTL. See the IOCTL Interfaces section for more information. | ||
| 53 | |||
| 54 | When an application wants to create a user queue, it allocates the necessary | ||
| 55 | buffers for the queue (ring buffer, wptr and rptr, context save areas, etc.). | ||
| 56 | These can be separate buffers or all part of one larger buffer. The application | ||
| 57 | would map the buffer(s) into its GPUVM and use the GPU virtual addresses of for | ||
| 58 | the areas of memory they want to use for the user queue. They would also | ||
| 59 | allocate a doorbell page for the doorbells used by the user queues. The | ||
| 60 | application would then populate the MQD in the USERQ IOCTL structure with the | ||
| 61 | GPU virtual addresses and doorbell index they want to use. The user can also | ||
| 62 | specify the attributes for the user queue (priority, whether the queue is secure | ||
| 63 | for protected content, etc.). The application would then call the USERQ | ||
| 64 | CREATE IOCTL to create the queue using the specified MQD details in the IOCTL. | ||
| 65 | The kernel driver then validates the MQD provided by the application and | ||
| 66 | translates the MQD into the engine specific MQD format for the IP. The IP | ||
| 67 | specific MQD would be allocated and the queue would be added to the run list | ||
| 68 | maintained by the scheduling firmware. Once the queue has been created, the | ||
| 69 | application can write packets directly into the queue, update the wptr, and | ||
| 70 | write to the doorbell offset to kick off work in the user queue. | ||
| 71 | |||
| 72 | When the application is done with the user queue, it would call the USERQ | ||
| 73 | FREE IOCTL to destroy it. The kernel driver would preempt the queue and | ||
| 74 | remove it from the scheduling firmware's run list. Then the IP specific MQD | ||
| 75 | would be freed and the user queue state would be cleaned up. | ||
| 76 | |||
| 77 | Some engines may require the aggregated doorbell too if the engine does not | ||
| 78 | support doorbells from unmapped queues. The aggregated doorbell is a special | ||
| 79 | page of doorbell space which wakes the scheduler. In cases where the engine may | ||
| 80 | be oversubscribed, some queues may not be mapped. If the doorbell is rung when | ||
| 81 | the queue is not mapped, the engine firmware may miss the request. Some | ||
| 82 | scheduling firmware may work around this by polling wptr shadows when the | ||
| 83 | hardware is oversubscribed, other engines may support doorbell updates from | ||
| 84 | unmapped queues. In the event that one of these options is not available, the | ||
| 85 | kernel driver will map a page of aggregated doorbell space into each GPUVM | ||
| 86 | space. The UMD will then update the doorbell and wptr as normal and then write | ||
| 87 | to the aggregated doorbell as well. | ||
| 88 | |||
| 89 | Special Packets | ||
| 90 | --------------- | ||
| 91 | |||
| 92 | In order to support legacy implicit synchronization, as well as mixed user and | ||
| 93 | kernel queues, we need a synchronization mechanism that is secure. Because | ||
| 94 | kernel queues or memory management tasks depend on kernel fences, we need a way | ||
| 95 | for user queues to update memory that the kernel can use for a fence, that can't | ||
| 96 | be messed with by a bad actor. To support this, we've added a protected fence | ||
| 97 | packet. This packet works by writing a monotonically increasing value to | ||
| 98 | a memory location that only privileged clients have write access to. User | ||
| 99 | queues only have read access. When this packet is executed, the memory location | ||
| 100 | is updated and other queues (kernel or user) can see the results. The | ||
| 101 | user application would submit this packet in their command stream. The actual | ||
| 102 | packet format varies from IP to IP (GFX/Compute, SDMA, VCN, etc.), but the | ||
| 103 | behavior is the same. The packet submission is handled in userspace. The | ||
| 104 | kernel driver sets up the privileged memory used for each user queue when it | ||
| 105 | sets the queues up when the application creates them. | ||
| 106 | |||
| 107 | |||
| 108 | Memory Management | ||
| 109 | ================= | ||
| 110 | |||
| 111 | It is assumed that all buffers mapped into the GPUVM space for the process are | ||
| 112 | valid when engines on the GPU are running. The kernel driver will only allow | ||
| 113 | user queues to run when all buffers are mapped. If there is a memory event that | ||
| 114 | requires buffer migration, the kernel driver will preempt the user queues, | ||
| 115 | migrate buffers to where they need to be, update the GPUVM page tables and | ||
| 116 | invaldidate the TLB, and then resume the user queues. | ||
| 117 | |||
| 118 | Interaction with Kernel Queues | ||
| 119 | ============================== | ||
| 120 | |||
| 121 | Depending on the IP and the scheduling firmware, you can enable kernel queues | ||
| 122 | and user queues at the same time, however, you are limited by the HQD slots. | ||
| 123 | Kernel queues are always mapped so any work that goes into kernel queues will | ||
| 124 | take priority. This limits the available HQD slots for user queues. | ||
| 125 | |||
| 126 | Not all IPs will support user queues on all GPUs. As such, UMDs will need to | ||
| 127 | support both user queues and kernel queues depending on the IP. For example, a | ||
| 128 | GPU may support user queues for GFX, compute, and SDMA, but not for VCN, JPEG, | ||
| 129 | and VPE. UMDs need to support both. The kernel driver provides a way to | ||
| 130 | determine if user queues and kernel queues are supported on a per IP basis. | ||
| 131 | UMDs can query this information via the INFO IOCTL and determine whether to use | ||
| 132 | kernel queues or user queues for each IP. | ||
| 133 | |||
| 134 | Queue Resets | ||
| 135 | ============ | ||
| 136 | |||
| 137 | For most engines, queues can be reset individually. GFX, compute, and SDMA | ||
| 138 | queues can be reset individually. When a hung queue is detected, it can be | ||
| 139 | reset either via the scheduling firmware or MMIO. Since there are no kernel | ||
| 140 | fences for most user queues, they will usually only be detected when some other | ||
| 141 | event happens; e.g., a memory event which requires migration of buffers. When | ||
| 142 | the queues are preempted, if the queue is hung, the preemption will fail. | ||
| 143 | Driver will then look up the queues that failed to preempt and reset them and | ||
| 144 | record which queues are hung. | ||
| 145 | |||
| 146 | On the UMD side, we will add a USERQ QUERY_STATUS IOCTL to query the queue | ||
| 147 | status. UMD will provide the queue id in the IOCTL and the kernel driver | ||
| 148 | will check if it has already recorded the queue as hung (e.g., due to failed | ||
| 149 | peemption) and report back the status. | ||
| 150 | |||
| 151 | IOCTL Interfaces | ||
| 152 | ================ | ||
| 153 | |||
| 154 | GPU virtual addresses used for queues and related data (rptrs, wptrs, context | ||
| 155 | save areas, etc.) should be validated by the kernel mode driver to prevent the | ||
| 156 | user from specifying invalid GPU virtual addresses. If the user provides | ||
| 157 | invalid GPU virtual addresses or doorbell indicies, the IOCTL should return an | ||
| 158 | error message. These buffers should also be tracked in the kernel driver so | ||
| 159 | that if the user attempts to unmap the buffer(s) from the GPUVM, the umap call | ||
| 160 | would return an error. | ||
| 161 | |||
| 162 | INFO | ||
| 163 | ---- | ||
| 164 | There are several new INFO queries related to user queues in order to query the | ||
| 165 | size of user queue meta data needed for a user queue (e.g., context save areas | ||
| 166 | or shadow buffers), whether kernel or user queues or both are supported | ||
| 167 | for each IP type, and the offsets for each IP type in each doorbell page. | ||
| 168 | |||
| 169 | USERQ | ||
| 170 | ----- | ||
| 171 | The USERQ IOCTL is used for creating, freeing, and querying the status of user | ||
| 172 | queues. It supports 3 opcodes: | ||
| 173 | |||
| 174 | 1. CREATE - Create a user queue. The application provides an MQD-like structure | ||
| 175 | that defines the type of queue and associated metadata and flags for that | ||
| 176 | queue type. Returns the queue id. | ||
| 177 | 2. FREE - Free a user queue. | ||
| 178 | 3. QUERY_STATUS - Query that status of a queue. Used to check if the queue is | ||
| 179 | healthy or not. E.g., if the queue has been reset. (WIP) | ||
| 180 | |||
| 181 | USERQ_SIGNAL | ||
| 182 | ------------ | ||
| 183 | The USERQ_SIGNAL IOCTL is used to provide a list of sync objects to be signaled. | ||
| 184 | |||
| 185 | USERQ_WAIT | ||
| 186 | ---------- | ||
| 187 | The USERQ_WAIT IOCTL is used to provide a list of sync object to be waited on. | ||
| 188 | |||
| 189 | Kernel and User Queues | ||
| 190 | ====================== | ||
| 191 | |||
| 192 | In order to properly validate and test performance, we have a driver option to | ||
| 193 | select what type of queues are enabled (kernel queues, user queues or both). | ||
| 194 | The user_queue driver parameter allows you to enable kernel queues only (0), | ||
| 195 | user queues and kernel queues (1), and user queues only (2). Enabling user | ||
| 196 | queues only will free up static queue assignments that would otherwise be used | ||
| 197 | by kernel queues for use by the scheduling firmware. Some kernel queues are | ||
| 198 | required for kernel driver operation and they will always be created. When the | ||
| 199 | kernel queues are not enabled, they are not registered with the drm scheduler | ||
| 200 | and the CS IOCTL will reject any incoming command submissions which target those | ||
| 201 | queue types. Kernel queues only mirrors the behavior on all existing GPUs. | ||
| 202 | Enabling both queues allows for backwards compatibility with old userspace while | ||
| 203 | still supporting user queues. | ||
| @@ -352,7 +352,7 @@ static int kgd_hqd_dump(struct amdgpu_device *adev, · 351 unmodified lines | |||
| 352 | (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \ | 352 | (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \ |
| 353 | } while (0) | 353 | } while (0) |
| 354 | 354 | ||
| 355 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 355 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 356 | if (*dump == NULL) | 356 | if (*dump == NULL) |
| 357 | return -ENOMEM; | 357 | return -ENOMEM; |
| 358 | 358 | ||
| @@ -449,7 +449,7 @@ static int kgd_hqd_sdma_dump(struct amdgpu_device *adev, · 90 unmodified lines | |||
| 449 | #undef HQD_N_REGS | 449 | #undef HQD_N_REGS |
| 450 | #define HQD_N_REGS (19+6+7+10) | 450 | #define HQD_N_REGS (19+6+7+10) |
| 451 | 451 | ||
| 452 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 452 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 453 | if (*dump == NULL) | 453 | if (*dump == NULL) |
| 454 | return -ENOMEM; | 454 | return -ENOMEM; |
| 455 | 455 | ||
| @@ -338,7 +338,7 @@ static int hqd_dump_v10_3(struct amdgpu_device *adev, · 337 unmodified lines | |||
| 338 | (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \ | 338 | (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \ |
| 339 | } while (0) | 339 | } while (0) |
| 340 | 340 | ||
| 341 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 341 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 342 | if (*dump == NULL) | 342 | if (*dump == NULL) |
| 343 | return -ENOMEM; | 343 | return -ENOMEM; |
| 344 | 344 | ||
| @@ -435,7 +435,7 @@ static int hqd_sdma_dump_v10_3(struct amdgpu_device *adev, · 90 unmodified lines | |||
| 435 | #undef HQD_N_REGS | 435 | #undef HQD_N_REGS |
| 436 | #define HQD_N_REGS (19+6+7+12) | 436 | #define HQD_N_REGS (19+6+7+12) |
| 437 | 437 | ||
| 438 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 438 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 439 | if (*dump == NULL) | 439 | if (*dump == NULL) |
| 440 | return -ENOMEM; | 440 | return -ENOMEM; |
| 441 | 441 | ||
| @@ -323,7 +323,7 @@ static int hqd_dump_v11(struct amdgpu_device *adev, · 322 unmodified lines | |||
| 323 | (*dump)[i++][1] = RREG32(addr); \ | 323 | (*dump)[i++][1] = RREG32(addr); \ |
| 324 | } while (0) | 324 | } while (0) |
| 325 | 325 | ||
| 326 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 326 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 327 | if (*dump == NULL) | 327 | if (*dump == NULL) |
| 328 | return -ENOMEM; | 328 | return -ENOMEM; |
| 329 | 329 | ||
| @@ -420,7 +420,7 @@ static int hqd_sdma_dump_v11(struct amdgpu_device *adev, · 90 unmodified lines | |||
| 420 | #undef HQD_N_REGS | 420 | #undef HQD_N_REGS |
| 421 | #define HQD_N_REGS (7+11+1+12+12) | 421 | #define HQD_N_REGS (7+11+1+12+12) |
| 422 | 422 | ||
| 423 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 423 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 424 | if (*dump == NULL) | 424 | if (*dump == NULL) |
| 425 | return -ENOMEM; | 425 | return -ENOMEM; |
| 426 | 426 | ||
| @@ -115,7 +115,7 @@ static int hqd_dump_v12(struct amdgpu_device *adev, · 114 unmodified lines | |||
| 115 | (*dump)[i++][1] = RREG32(addr); \ | 115 | (*dump)[i++][1] = RREG32(addr); \ |
| 116 | } while (0) | 116 | } while (0) |
| 117 | 117 | ||
| 118 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 118 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 119 | if (*dump == NULL) | 119 | if (*dump == NULL) |
| 120 | return -ENOMEM; | 120 | return -ENOMEM; |
| 121 | 121 | ||
| @@ -146,7 +146,7 @@ static int hqd_sdma_dump_v12(struct amdgpu_device *adev, · 24 unmodified lines | |||
| 146 | #undef HQD_N_REGS | 146 | #undef HQD_N_REGS |
| 147 | #define HQD_N_REGS (last_reg - first_reg + 1) | 147 | #define HQD_N_REGS (last_reg - first_reg + 1) |
| 148 | 148 | ||
| 149 | *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); | 149 | *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); |
| 150 | if (*dump == NULL) | 150 | if (*dump == NULL) |
| 151 | return -ENOMEM; | 151 | return -ENOMEM; |
| 152 | 152 | ||
| @@ -1089,7 +1089,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr, · 1088 unmodified lines | |||
| 1089 | return 0; | 1089 | return 0; |
| 1090 | } | 1090 | } |
| 1091 | 1091 | ||
| 1092 | ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages, &range); | 1092 | ret = amdgpu_ttm_tt_get_user_pages(bo, &range); |
| 1093 | if (ret) { | 1093 | if (ret) { |
| 1094 | if (ret == -EAGAIN) | 1094 | if (ret == -EAGAIN) |
| 1095 | pr_debug("Failed to get user pages, try again\n"); | 1095 | pr_debug("Failed to get user pages, try again\n"); |
| @@ -1103,6 +1103,9 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr, · 7 unmodified lines | |||
| 1103 | pr_err("%s: Failed to reserve BO\n", __func__); | 1103 | pr_err("%s: Failed to reserve BO\n", __func__); |
| 1104 | goto release_out; | 1104 | goto release_out; |
| 1105 | } | 1105 | } |
| 1106 | |||
| 1107 | amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, range); | ||
| 1108 | |||
| 1106 | amdgpu_bo_placement_from_domain(bo, mem->domain); | 1109 | amdgpu_bo_placement_from_domain(bo, mem->domain); |
| 1107 | ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); | 1110 | ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); |
| 1108 | if (ret) | 1111 | if (ret) |
| @@ -2565,8 +2568,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info, · 1456 unmodified lines | |||
| 2565 | } | 2568 | } |
| 2566 | 2569 | ||
| 2567 | /* Get updated user pages */ | 2570 | /* Get updated user pages */ |
| 2568 | ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages, | 2571 | ret = amdgpu_ttm_tt_get_user_pages(bo, &mem->range); |
| 2569 | &mem->range); | ||
| 2570 | if (ret) { | 2572 | if (ret) { |
| 2571 | pr_debug("Failed %d to get user pages\n", ret); | 2573 | pr_debug("Failed %d to get user pages\n", ret); |
| 2572 | 2574 | ||
| @@ -2595,6 +2597,8 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info, · 22 unmodified lines | |||
| 2595 | ret = 0; | 2597 | ret = 0; |
| 2596 | } | 2598 | } |
| 2597 | 2599 | ||
| 2600 | amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, mem->range); | ||
| 2601 | |||
| 2598 | mutex_lock(&process_info->notifier_lock); | 2602 | mutex_lock(&process_info->notifier_lock); |
| 2599 | 2603 | ||
| 2600 | /* Mark the BO as valid unless it was invalidated | 2604 | /* Mark the BO as valid unless it was invalidated |
| @@ -38,7 +38,6 @@ struct amdgpu_bo_list_entry { · 37 unmodified lines | |||
| 38 | struct amdgpu_bo *bo; | 38 | struct amdgpu_bo *bo; |
| 39 | struct amdgpu_bo_va *bo_va; | 39 | struct amdgpu_bo_va *bo_va; |
| 40 | uint32_t priority; | 40 | uint32_t priority; |
| 41 | struct page **user_pages; | ||
| 42 | struct hmm_range *range; | 41 | struct hmm_range *range; |
| 43 | bool user_invalidated; | 42 | bool user_invalidated; |
| 44 | }; | 43 | }; |
| @@ -398,30 +398,28 @@ static void amdgpu_connector_add_common_modes(struct drm_encoder *encoder, · 397 unmodified lines | |||
| 398 | struct drm_display_mode *mode = NULL; | 398 | struct drm_display_mode *mode = NULL; |
| 399 | struct drm_display_mode *native_mode = &amdgpu_encoder->native_mode; | 399 | struct drm_display_mode *native_mode = &amdgpu_encoder->native_mode; |
| 400 | int i; | 400 | int i; |
| 401 | static const struct mode_size { | 401 | int n; |
| 402 | struct mode_size { | ||
| 403 | char name[DRM_DISPLAY_MODE_LEN]; | ||
| 402 | int w; | 404 | int w; |
| 403 | int h; | 405 | int h; |
| 404 | } common_modes[17] = { | 406 | } common_modes[] = { |
| 405 | { 640, 480}, | 407 | { "640x480", 640, 480}, |
| 406 | { 720, 480}, | 408 | { "800x600", 800, 600}, |
| 407 | { 800, 600}, | 409 | { "1024x768", 1024, 768}, |
| 408 | { 848, 480}, | 410 | { "1280x720", 1280, 720}, |
| 409 | {1024, 768}, | 411 | { "1280x800", 1280, 800}, |
| 410 | {1152, 768}, | 412 | {"1280x1024", 1280, 1024}, |
| 411 | {1280, 720}, | 413 | { "1440x900", 1440, 900}, |
| 412 | {1280, 800}, | 414 | {"1680x1050", 1680, 1050}, |
| 413 | {1280, 854}, | 415 | {"1600x1200", 1600, 1200}, |
| 414 | {1280, 960}, | 416 | {"1920x1080", 1920, 1080}, |
| 415 | {1280, 1024}, | 417 | {"1920x1200", 1920, 1200} |
| 416 | {1440, 900}, | ||
| 417 | {1400, 1050}, | ||
| 418 | {1680, 1050}, | ||
| 419 | {1600, 1200}, | ||
| 420 | {1920, 1080}, | ||
| 421 | {1920, 1200} | ||
| 422 | }; | 418 | }; |
| 423 | 419 | ||
| 424 | for (i = 0; i < 17; i++) { | 420 | n = ARRAY_SIZE(common_modes); |
| 421 | |||
| 422 | for (i = 0; i < n; i++) { | ||
| 425 | if (amdgpu_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) { | 423 | if (amdgpu_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) { |
| 426 | if (common_modes[i].w > 1024 || | 424 | if (common_modes[i].w > 1024 || |
| 427 | common_modes[i].h > 768) | 425 | common_modes[i].h > 768) |
| @@ -434,12 +432,11 @@ static void amdgpu_connector_add_common_modes(struct drm_encoder *encoder, · 6 unmodified lines | |||
| 434 | common_modes[i].h == native_mode->vdisplay)) | 432 | common_modes[i].h == native_mode->vdisplay)) |
| 435 | continue; | 433 | continue; |
| 436 | } | 434 | } |
| 437 | if (common_modes[i].w < 320 || common_modes[i].h < 200) | ||
| 438 | continue; | ||
| 439 | 435 | ||
| 440 | mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false); | 436 | mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false); |
| 441 | if (!mode) | 437 | if (!mode) |
| 442 | return; | 438 | return; |
| 439 | strscpy(mode->name, common_modes[i].name, DRM_DISPLAY_MODE_LEN); | ||
| 443 | 440 | ||
| 444 | drm_mode_probed_add(connector, mode); | 441 | drm_mode_probed_add(connector, mode); |
| 445 | } | 442 | } |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
| 30 | #include <linux/sync_file.h> | 30 | #include <linux/sync_file.h> |
| 31 | #include <linux/dma-buf.h> | 31 | #include <linux/dma-buf.h> |
| 32 | #include <linux/hmm.h> | ||
| 32 | 33 | ||
| 33 | #include <drm/amdgpu_drm.h> | 34 | #include <drm/amdgpu_drm.h> |
| 34 | #include <drm/drm_syncobj.h> | 35 | #include <drm/drm_syncobj.h> |
| @@ -883,26 +884,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 848 unmodified lines | |||
| 883 | amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) { | 884 | amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) { |
| 884 | bool userpage_invalidated = false; | 885 | bool userpage_invalidated = false; |
| 885 | struct amdgpu_bo *bo = e->bo; | 886 | struct amdgpu_bo *bo = e->bo; |
| 886 | int i; | ||
| 887 | |||
| 888 | e->user_pages = kvcalloc(bo->tbo.ttm->num_pages, | ||
| 889 | sizeof(struct page *), | ||
| 890 | GFP_KERNEL); | ||
| 891 | if (!e->user_pages) { | ||
| 892 | drm_err(adev_to_drm(p->adev), "kvmalloc_array failure\n"); | ||
| 893 | r = -ENOMEM; | ||
| 894 | goto out_free_user_pages; | ||
| 895 | } | ||
| 896 | 887 | ||
| 897 | r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages, &e->range); | 888 | r = amdgpu_ttm_tt_get_user_pages(bo, &e->range); |
| 898 | if (r) { | 889 | if (r) |
| 899 | kvfree(e->user_pages); | ||
| 900 | e->user_pages = NULL; | ||
| 901 | goto out_free_user_pages; | 890 | goto out_free_user_pages; |
| 902 | } | ||
| 903 | 891 | ||
| 904 | for (i = 0; i < bo->tbo.ttm->num_pages; i++) { | 892 | for (i = 0; i < bo->tbo.ttm->num_pages; i++) { |
| 905 | if (bo->tbo.ttm->pages[i] != e->user_pages[i]) { | 893 | if (bo->tbo.ttm->pages[i] != hmm_pfn_to_page(e->range->hmm_pfns[i])) { |
| 906 | userpage_invalidated = true; | 894 | userpage_invalidated = true; |
| 907 | break; | 895 | break; |
| 908 | } | 896 | } |
| @@ -946,7 +934,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 37 unmodified lines | |||
| 946 | } | 934 | } |
| 947 | 935 | ||
| 948 | if (amdgpu_ttm_tt_is_userptr(e->bo->tbo.ttm) && | 936 | if (amdgpu_ttm_tt_is_userptr(e->bo->tbo.ttm) && |
| 949 | e->user_invalidated && e->user_pages) { | 937 | e->user_invalidated) { |
| 950 | amdgpu_bo_placement_from_domain(e->bo, | 938 | amdgpu_bo_placement_from_domain(e->bo, |
| 951 | AMDGPU_GEM_DOMAIN_CPU); | 939 | AMDGPU_GEM_DOMAIN_CPU); |
| 952 | r = ttm_bo_validate(&e->bo->tbo, &e->bo->placement, | 940 | r = ttm_bo_validate(&e->bo->tbo, &e->bo->placement, |
| @@ -955,11 +943,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 2 unmodified lines | |||
| 955 | goto out_free_user_pages; | 943 | goto out_free_user_pages; |
| 956 | 944 | ||
| 957 | amdgpu_ttm_tt_set_user_pages(e->bo->tbo.ttm, | 945 | amdgpu_ttm_tt_set_user_pages(e->bo->tbo.ttm, |
| 958 | e->user_pages); | 946 | e->range); |
| 959 | } | 947 | } |
| 960 | |||
| 961 | kvfree(e->user_pages); | ||
| 962 | e->user_pages = NULL; | ||
| 963 | } | 948 | } |
| 964 | 949 | ||
| 965 | amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold, | 950 | amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold, |
| @@ -1001,11 +986,7 @@ out_free_user_pages: · 35 unmodified lines | |||
| 1001 | amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) { | 986 | amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) { |
| 1002 | struct amdgpu_bo *bo = e->bo; | 987 | struct amdgpu_bo *bo = e->bo; |
| 1003 | 988 | ||
| 1004 | if (!e->user_pages) | ||
| 1005 | continue; | ||
| 1006 | amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, e->range); | 989 | amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, e->range); |
| 1007 | kvfree(e->user_pages); | ||
| 1008 | e->user_pages = NULL; | ||
| 1009 | e->range = NULL; | 990 | e->range = NULL; |
| 1010 | } | 991 | } |
| 1011 | mutex_unlock(&p->bo_list->bo_list_mutex); | 992 | mutex_unlock(&p->bo_list->bo_list_mutex); |
| @@ -960,7 +960,7 @@ module_param_named(tmz, amdgpu_tmz, int, 0444); · 959 unmodified lines | |||
| 960 | */ | 960 | */ |
| 961 | MODULE_PARM_DESC( | 961 | MODULE_PARM_DESC( |
| 962 | freesync_video, | 962 | freesync_video, |
| 963 | "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)"); | 963 | "Adds additional modes via VRR for refresh changes without a full modeset (0 = off (default), 1 = on)"); |
| 964 | module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444); | 964 | module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444); |
| 965 | 965 | ||
| 966 | /** | 966 | /** |
| @@ -572,8 +572,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · 571 unmodified lines | |||
| 572 | goto release_object; | 572 | goto release_object; |
| 573 | 573 | ||
| 574 | if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) { | 574 | if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) { |
| 575 | r = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages, | 575 | r = amdgpu_ttm_tt_get_user_pages(bo, &range); |
| 576 | &range); | ||
| 577 | if (r) | 576 | if (r) |
| 578 | goto release_object; | 577 | goto release_object; |
| 579 | 578 | ||
| @@ -581,6 +580,8 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · 1 unmodified line | |||
| 581 | if (r) | 580 | if (r) |
| 582 | goto user_pages_done; | 581 | goto user_pages_done; |
| 583 | 582 | ||
| 583 | amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, range); | ||
| 584 | |||
| 584 | amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT); | 585 | amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT); |
| 585 | r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); | 586 | r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); |
| 586 | amdgpu_bo_unreserve(bo); | 587 | amdgpu_bo_unreserve(bo); |
| @@ -167,13 +167,12 @@ void amdgpu_hmm_unregister(struct amdgpu_bo *bo) · 166 unmodified lines | |||
| 167 | 167 | ||
| 168 | int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier, | 168 | int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier, |
| 169 | uint64_t start, uint64_t npages, bool readonly, | 169 | uint64_t start, uint64_t npages, bool readonly, |
| 170 | void *owner, struct page **pages, | 170 | void *owner, |
| 171 | struct hmm_range **phmm_range) | 171 | struct hmm_range **phmm_range) |
| 172 | { | 172 | { |
| 173 | struct hmm_range *hmm_range; | 173 | struct hmm_range *hmm_range; |
| 174 | unsigned long end; | 174 | unsigned long end; |
| 175 | unsigned long timeout; | 175 | unsigned long timeout; |
| 176 | unsigned long i; | ||
| 177 | unsigned long *pfns; | 176 | unsigned long *pfns; |
| 178 | int r = 0; | 177 | int r = 0; |
| 179 | 178 | ||
| @@ -222,14 +221,6 @@ retry: · 42 unmodified lines | |||
| 222 | hmm_range->start = start; | 221 | hmm_range->start = start; |
| 223 | hmm_range->hmm_pfns = pfns; | 222 | hmm_range->hmm_pfns = pfns; |
| 224 | 223 | ||
| 225 | /* | ||
| 226 | * Due to default_flags, all pages are HMM_PFN_VALID or | ||
| 227 | * hmm_range_fault() fails. FIXME: The pages cannot be touched outside | ||
| 228 | * the notifier_lock, and mmu_interval_read_retry() must be done first. | ||
| 229 | */ | ||
| 230 | for (i = 0; pages && i < npages; i++) | ||
| 231 | pages[i] = hmm_pfn_to_page(pfns[i]); | ||
| 232 | |||
| 233 | *phmm_range = hmm_range; | 224 | *phmm_range = hmm_range; |
| 234 | 225 | ||
| 235 | return 0; | 226 | return 0; |
| @@ -33,7 +33,7 @@ · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier, | 34 | int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier, |
| 35 | uint64_t start, uint64_t npages, bool readonly, | 35 | uint64_t start, uint64_t npages, bool readonly, |
| 36 | void *owner, struct page **pages, | 36 | void *owner, |
| 37 | struct hmm_range **phmm_range); | 37 | struct hmm_range **phmm_range); |
| 38 | bool amdgpu_hmm_range_get_pages_done(struct hmm_range *hmm_range); | 38 | bool amdgpu_hmm_range_get_pages_done(struct hmm_range *hmm_range); |
| 39 | 39 | ||
| @@ -275,13 +275,12 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm, · 274 unmodified lines | |||
| 275 | { | 275 | { |
| 276 | struct amdgpu_device *adev = ring->adev; | 276 | struct amdgpu_device *adev = ring->adev; |
| 277 | unsigned vmhub = ring->vm_hub; | 277 | unsigned vmhub = ring->vm_hub; |
| 278 | struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; | ||
| 279 | uint64_t fence_context = adev->fence_context + ring->idx; | 278 | uint64_t fence_context = adev->fence_context + ring->idx; |
| 280 | bool needs_flush = vm->use_cpu_for_update; | 279 | bool needs_flush = vm->use_cpu_for_update; |
| 281 | uint64_t updates = amdgpu_vm_tlb_seq(vm); | 280 | uint64_t updates = amdgpu_vm_tlb_seq(vm); |
| 282 | int r; | 281 | int r; |
| 283 | 282 | ||
| 284 | *id = id_mgr->reserved; | 283 | *id = vm->reserved_vmid[vmhub]; |
| 285 | if ((*id)->owner != vm->immediate.fence_context || | 284 | if ((*id)->owner != vm->immediate.fence_context || |
| 286 | !amdgpu_vmid_compatible(*id, job) || | 285 | !amdgpu_vmid_compatible(*id, job) || |
| 287 | (*id)->flushed_updates < updates || | 286 | (*id)->flushed_updates < updates || |
| @@ -474,40 +473,61 @@ bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub) · 186 unmodified lines | |||
| 474 | return vm->reserved_vmid[vmhub]; | 473 | return vm->reserved_vmid[vmhub]; |
| 475 | } | 474 | } |
| 476 | 475 | ||
| 477 | int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, | 476 | /* |
| 477 | * amdgpu_vmid_alloc_reserved - reserve a specific VMID for this vm | ||
| 478 | * @adev: amdgpu device structure | ||
| 479 | * @vm: the VM to reserve an ID for | ||
| 480 | * @vmhub: the VMHUB which should be used | ||
| 481 | * | ||
| 482 | * Mostly used to have a reserved VMID for debugging and SPM. | ||
| 483 | * | ||
| 484 | * Returns: 0 for success, -ENOENT if an ID is already reserved. | ||
| 485 | */ | ||
| 486 | int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, | ||
| 478 | unsigned vmhub) | 487 | unsigned vmhub) |
| 479 | { | 488 | { |
| 480 | struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; | 489 | struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; |
| 490 | struct amdgpu_vmid *id; | ||
| 491 | int r = 0; | ||
| 481 | 492 | ||
| 482 | mutex_lock(&id_mgr->lock); | 493 | mutex_lock(&id_mgr->lock); |
| 483 | 494 | if (vm->reserved_vmid[vmhub]) | |
| 484 | ++id_mgr->reserved_use_count; | 495 | goto unlock; |
| 485 | if (!id_mgr->reserved) { | 496 | if (id_mgr->reserved_vmid) { |
| 486 | struct amdgpu_vmid *id; | 497 | r = -ENOENT; |
| 487 | 498 | goto unlock; | |
| 488 | id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid, | ||
| 489 | list); | ||
| 490 | /* Remove from normal round robin handling */ | ||
| 491 | list_del_init(&id->list); | ||
| 492 | id_mgr->reserved = id; | ||
| 493 | } | 499 | } |
| 494 | 500 | /* Remove from normal round robin handling */ | |
| 501 | id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid, list); | ||
| 502 | list_del_init(&id->list); | ||
| 503 | vm->reserved_vmid[vmhub] = id; | ||
| 504 | id_mgr->reserved_vmid = true; | ||
| 495 | mutex_unlock(&id_mgr->lock); | 505 | mutex_unlock(&id_mgr->lock); |
| 506 | |||
| 496 | return 0; | 507 | return 0; |
| 508 | unlock: | ||
| 509 | mutex_unlock(&id_mgr->lock); | ||
| 510 | return r; | ||
| 497 | } | 511 | } |
| 498 | 512 | ||
| 499 | void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, | 513 | /* |
| 514 | * amdgpu_vmid_free_reserved - free up a reserved VMID again | ||
| 515 | * @adev: amdgpu device structure | ||
| 516 | * @vm: the VM with the reserved ID | ||
| 517 | * @vmhub: the VMHUB which should be used | ||
| 518 | */ | ||
| 519 | void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, | ||
| 500 | unsigned vmhub) | 520 | unsigned vmhub) |
| 501 | { | 521 | { |
| 502 | struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; | 522 | struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; |
| 503 | 523 | ||
| 504 | mutex_lock(&id_mgr->lock); | 524 | mutex_lock(&id_mgr->lock); |
| 505 | if (!--id_mgr->reserved_use_count) { | 525 | if (vm->reserved_vmid[vmhub]) { |
| 506 | /* give the reserved ID back to normal round robin */ | 526 | list_add(&vm->reserved_vmid[vmhub]->list, |
| 507 | list_add(&id_mgr->reserved->list, &id_mgr->ids_lru); | 527 | &id_mgr->ids_lru); |
| 508 | id_mgr->reserved = NULL; | 528 | vm->reserved_vmid[vmhub] = NULL; |
| 529 | id_mgr->reserved_vmid = false; | ||
| 509 | } | 530 | } |
| 510 | |||
| 511 | mutex_unlock(&id_mgr->lock); | 531 | mutex_unlock(&id_mgr->lock); |
| 512 | } | 532 | } |
| 513 | 533 | ||
| @@ -574,7 +594,6 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) · 60 unmodified lines | |||
| 574 | 594 | ||
| 575 | mutex_init(&id_mgr->lock); | 595 | mutex_init(&id_mgr->lock); |
| 576 | INIT_LIST_HEAD(&id_mgr->ids_lru); | 596 | INIT_LIST_HEAD(&id_mgr->ids_lru); |
| 577 | id_mgr->reserved_use_count = 0; | ||
| 578 | 597 | ||
| 579 | /* for GC <10, SDMA uses MMHUB so use first_kfd_vmid for both GC and MM */ | 598 | /* for GC <10, SDMA uses MMHUB so use first_kfd_vmid for both GC and MM */ |
| 580 | if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0)) | 599 | if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0)) |
| @@ -594,11 +613,6 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) · 13 unmodified lines | |||
| 594 | list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru); | 613 | list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru); |
| 595 | } | 614 | } |
| 596 | } | 615 | } |
| 597 | /* alloc a default reserved vmid to enforce isolation */ | ||
| 598 | for (i = 0; i < (adev->xcp_mgr ? adev->xcp_mgr->num_xcps : 1); i++) { | ||
| 599 | if (adev->enforce_isolation[i] != AMDGPU_ENFORCE_ISOLATION_DISABLE) | ||
| 600 | amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i)); | ||
| 601 | } | ||
| 602 | } | 616 | } |
| 603 | 617 | ||
| 604 | /** | 618 | /** |
| @@ -67,8 +67,7 @@ struct amdgpu_vmid_mgr { · 66 unmodified lines | |||
| 67 | unsigned num_ids; | 67 | unsigned num_ids; |
| 68 | struct list_head ids_lru; | 68 | struct list_head ids_lru; |
| 69 | struct amdgpu_vmid ids[AMDGPU_NUM_VMID]; | 69 | struct amdgpu_vmid ids[AMDGPU_NUM_VMID]; |
| 70 | struct amdgpu_vmid *reserved; | 70 | bool reserved_vmid; |
| 71 | unsigned int reserved_use_count; | ||
| 72 | }; | 71 | }; |
| 73 | 72 | ||
| 74 | int amdgpu_pasid_alloc(unsigned int bits); | 73 | int amdgpu_pasid_alloc(unsigned int bits); |
| @@ -79,10 +78,10 @@ void amdgpu_pasid_free_delayed(struct dma_resv *resv, · 4 unmodified lines | |||
| 79 | bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev, | 78 | bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev, |
| 80 | struct amdgpu_vmid *id); | 79 | struct amdgpu_vmid *id); |
| 81 | bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub); | 80 | bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub); |
| 82 | int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, | 81 | int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
| 83 | unsigned vmhub); | 82 | unsigned vmhub); |
| 84 | void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, | 83 | void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
| 85 | unsigned vmhub); | 84 | unsigned vmhub); |
| 86 | int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | 85 | int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, |
| 87 | struct amdgpu_job *job, struct dma_fence **fence); | 86 | struct amdgpu_job *job, struct dma_fence **fence); |
| 88 | void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub, | 87 | void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub, |
| @@ -708,7 +708,7 @@ struct amdgpu_ttm_tt { · 707 unmodified lines | |||
| 708 | * Calling function must call amdgpu_ttm_tt_userptr_range_done() once and only | 708 | * Calling function must call amdgpu_ttm_tt_userptr_range_done() once and only |
| 709 | * once afterwards to stop HMM tracking | 709 | * once afterwards to stop HMM tracking |
| 710 | */ | 710 | */ |
| 711 | int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages, | 711 | int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, |
| 712 | struct hmm_range **range) | 712 | struct hmm_range **range) |
| 713 | { | 713 | { |
| 714 | struct ttm_tt *ttm = bo->tbo.ttm; | 714 | struct ttm_tt *ttm = bo->tbo.ttm; |
| @@ -745,7 +745,7 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages, · 30 unmodified lines | |||
| 745 | 745 | ||
| 746 | readonly = amdgpu_ttm_tt_is_readonly(ttm); | 746 | readonly = amdgpu_ttm_tt_is_readonly(ttm); |
| 747 | r = amdgpu_hmm_range_get_pages(&bo->notifier, start, ttm->num_pages, | 747 | r = amdgpu_hmm_range_get_pages(&bo->notifier, start, ttm->num_pages, |
| 748 | readonly, NULL, pages, range); | 748 | readonly, NULL, range); |
| 749 | out_unlock: | 749 | out_unlock: |
| 750 | mmap_read_unlock(mm); | 750 | mmap_read_unlock(mm); |
| 751 | if (r) | 751 | if (r) |
| @@ -797,12 +797,12 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 45 unmodified lines | |||
| 797 | * that backs user memory and will ultimately be mapped into the device | 797 | * that backs user memory and will ultimately be mapped into the device |
| 798 | * address space. | 798 | * address space. |
| 799 | */ | 799 | */ |
| 800 | void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages) | 800 | void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct hmm_range *range) |
| 801 | { | 801 | { |
| 802 | unsigned long i; | 802 | unsigned long i; |
| 803 | 803 | ||
| 804 | for (i = 0; i < ttm->num_pages; ++i) | 804 | for (i = 0; i < ttm->num_pages; ++i) |
| 805 | ttm->pages[i] = pages ? pages[i] : NULL; | 805 | ttm->pages[i] = range ? hmm_pfn_to_page(range->hmm_pfns[i]) : NULL; |
| 806 | } | 806 | } |
| 807 | 807 | ||
| 808 | /* | 808 | /* |
| @@ -191,7 +191,7 @@ void amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); · 190 unmodified lines | |||
| 191 | uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type); | 191 | uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type); |
| 192 | 192 | ||
| 193 | #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR) | 193 | #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR) |
| 194 | int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages, | 194 | int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, |
| 195 | struct hmm_range **range); | 195 | struct hmm_range **range); |
| 196 | void amdgpu_ttm_tt_discard_user_pages(struct ttm_tt *ttm, | 196 | void amdgpu_ttm_tt_discard_user_pages(struct ttm_tt *ttm, |
| 197 | struct hmm_range *range); | 197 | struct hmm_range *range); |
| @@ -199,7 +199,6 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 1 unmodified line | |||
| 199 | struct hmm_range *range); | 199 | struct hmm_range *range); |
| 200 | #else | 200 | #else |
| 201 | static inline int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, | 201 | static inline int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, |
| 202 | struct page **pages, | ||
| 203 | struct hmm_range **range) | 202 | struct hmm_range **range) |
| 204 | { | 203 | { |
| 205 | return -EPERM; | 204 | return -EPERM; |
| @@ -215,7 +214,7 @@ static inline bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 9 unmodified lines | |||
| 215 | } | 214 | } |
| 216 | #endif | 215 | #endif |
| 217 | 216 | ||
| 218 | void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages); | 217 | void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct hmm_range *range); |
| 219 | int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo, | 218 | int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo, |
| 220 | uint64_t *user_addr); | 219 | uint64_t *user_addr); |
| 221 | int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo, | 220 | int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo, |
| @@ -71,6 +71,7 @@ int amdgpu_userq_input_va_validate(struct amdgpu_vm *vm, u64 addr, · 70 unmodified lines | |||
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | r = -EINVAL; | ||
| 74 | out_err: | 75 | out_err: |
| 75 | amdgpu_bo_unreserve(vm->root.bo); | 76 | amdgpu_bo_unreserve(vm->root.bo); |
| 76 | return r; | 77 | return r; |
| @@ -508,6 +509,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args) · 431 unmodified lines | |||
| 508 | if (amdgpu_userq_input_va_validate(&fpriv->vm, args->in.queue_va, args->in.queue_size) || | 509 | if (amdgpu_userq_input_va_validate(&fpriv->vm, args->in.queue_va, args->in.queue_size) || |
| 509 | amdgpu_userq_input_va_validate(&fpriv->vm, args->in.rptr_va, AMDGPU_GPU_PAGE_SIZE) || | 510 | amdgpu_userq_input_va_validate(&fpriv->vm, args->in.rptr_va, AMDGPU_GPU_PAGE_SIZE) || |
| 510 | amdgpu_userq_input_va_validate(&fpriv->vm, args->in.wptr_va, AMDGPU_GPU_PAGE_SIZE)) { | 511 | amdgpu_userq_input_va_validate(&fpriv->vm, args->in.wptr_va, AMDGPU_GPU_PAGE_SIZE)) { |
| 512 | r = -EINVAL; | ||
| 511 | kfree(queue); | 513 | kfree(queue); |
| 512 | goto unlock; | 514 | goto unlock; |
| 513 | } | 515 | } |
| @@ -284,7 +284,7 @@ static int amdgpu_userq_fence_create(struct amdgpu_usermode_queue *userq, · 283 unmodified lines | |||
| 284 | 284 | ||
| 285 | /* Check if hardware has already processed the job */ | 285 | /* Check if hardware has already processed the job */ |
| 286 | spin_lock_irqsave(&fence_drv->fence_list_lock, flags); | 286 | spin_lock_irqsave(&fence_drv->fence_list_lock, flags); |
| 287 | if (!dma_fence_is_signaled_locked(fence)) | 287 | if (!dma_fence_is_signaled(fence)) |
| 288 | list_add_tail(&userq_fence->link, &fence_drv->fences); | 288 | list_add_tail(&userq_fence->link, &fence_drv->fences); |
| 289 | else | 289 | else |
| 290 | dma_fence_put(fence); | 290 | dma_fence_put(fence); |
| @@ -501,7 +501,7 @@ struct amdgpu_vcn5_fw_shared { · 500 unmodified lines | |||
| 501 | struct amdgpu_fw_shared_rb_setup rb_setup; | 501 | struct amdgpu_fw_shared_rb_setup rb_setup; |
| 502 | struct amdgpu_fw_shared_smu_interface_info smu_dpm_interface; | 502 | struct amdgpu_fw_shared_smu_interface_info smu_dpm_interface; |
| 503 | struct amdgpu_fw_shared_drm_key_wa drm_key_wa; | 503 | struct amdgpu_fw_shared_drm_key_wa drm_key_wa; |
| 504 | uint8_t pad3[9]; | 504 | uint8_t pad3[404]; |
| 505 | }; | 505 | }; |
| 506 | 506 | ||
| 507 | #define VCN_BLOCK_ENCODE_DISABLE_MASK 0x80 | 507 | #define VCN_BLOCK_ENCODE_DISABLE_MASK 0x80 |
| @@ -2790,10 +2790,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 2789 unmodified lines | |||
| 2790 | dma_fence_put(vm->last_update); | 2790 | dma_fence_put(vm->last_update); |
| 2791 | 2791 | ||
| 2792 | for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) { | 2792 | for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) { |
| 2793 | if (vm->reserved_vmid[i]) { | 2793 | amdgpu_vmid_free_reserved(adev, vm, i); |
| 2794 | amdgpu_vmid_free_reserved(adev, i); | ||
| 2795 | vm->reserved_vmid[i] = false; | ||
| 2796 | } | ||
| 2797 | } | 2794 | } |
| 2798 | 2795 | ||
| 2799 | ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move); | 2796 | ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move); |
| @@ -2889,6 +2886,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 89 unmodified lines | |||
| 2889 | union drm_amdgpu_vm *args = data; | 2886 | union drm_amdgpu_vm *args = data; |
| 2890 | struct amdgpu_device *adev = drm_to_adev(dev); | 2887 | struct amdgpu_device *adev = drm_to_adev(dev); |
| 2891 | struct amdgpu_fpriv *fpriv = filp->driver_priv; | 2888 | struct amdgpu_fpriv *fpriv = filp->driver_priv; |
| 2889 | struct amdgpu_vm *vm = &fpriv->vm; | ||
| 2892 | 2890 | ||
| 2893 | /* No valid flags defined yet */ | 2891 | /* No valid flags defined yet */ |
| 2894 | if (args->in.flags) | 2892 | if (args->in.flags) |
| @@ -2897,17 +2895,10 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 2 unmodified lines | |||
| 2897 | switch (args->in.op) { | 2895 | switch (args->in.op) { |
| 2898 | case AMDGPU_VM_OP_RESERVE_VMID: | 2896 | case AMDGPU_VM_OP_RESERVE_VMID: |
| 2899 | /* We only have requirement to reserve vmid from gfxhub */ | 2897 | /* We only have requirement to reserve vmid from gfxhub */ |
| 2900 | if (!fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) { | 2898 | amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0)); |
| 2901 | amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(0)); | ||
| 2902 | fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)] = true; | ||
| 2903 | } | ||
| 2904 | |||
| 2905 | break; | 2899 | break; |
| 2906 | case AMDGPU_VM_OP_UNRESERVE_VMID: | 2900 | case AMDGPU_VM_OP_UNRESERVE_VMID: |
| 2907 | if (fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) { | 2901 | amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0)); |
| 2908 | amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(0)); | ||
| 2909 | fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)] = false; | ||
| 2910 | } | ||
| 2911 | break; | 2902 | break; |
| 2912 | default: | 2903 | default: |
| 2913 | return -EINVAL; | 2904 | return -EINVAL; |
| @@ -415,7 +415,7 @@ struct amdgpu_vm { · 414 unmodified lines | |||
| 415 | struct dma_fence *last_unlocked; | 415 | struct dma_fence *last_unlocked; |
| 416 | 416 | ||
| 417 | unsigned int pasid; | 417 | unsigned int pasid; |
| 418 | bool reserved_vmid[AMDGPU_MAX_VMHUBS]; | 418 | struct amdgpu_vmid *reserved_vmid[AMDGPU_MAX_VMHUBS]; |
| 419 | 419 | ||
| 420 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ | 420 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ |
| 421 | bool use_cpu_for_update; | 421 | bool use_cpu_for_update; |
| @@ -1502,7 +1502,7 @@ static void atom_get_vbios_build(struct atom_context *ctx) · 1501 unmodified lines | |||
| 1502 | { | 1502 | { |
| 1503 | unsigned char *atom_rom_hdr; | 1503 | unsigned char *atom_rom_hdr; |
| 1504 | unsigned char *str; | 1504 | unsigned char *str; |
| 1505 | uint16_t base; | 1505 | uint16_t base, len; |
| 1506 | 1506 | ||
| 1507 | base = CU16(ATOM_ROM_TABLE_PTR); | 1507 | base = CU16(ATOM_ROM_TABLE_PTR); |
| 1508 | atom_rom_hdr = CSTR(base); | 1508 | atom_rom_hdr = CSTR(base); |
| @@ -1515,8 +1515,9 @@ static void atom_get_vbios_build(struct atom_context *ctx) · 6 unmodified lines | |||
| 1515 | while (str < atom_rom_hdr && *str++) | 1515 | while (str < atom_rom_hdr && *str++) |
| 1516 | ; | 1516 | ; |
| 1517 | 1517 | ||
| 1518 | if ((str + STRLEN_NORMAL) < atom_rom_hdr) | 1518 | len = min(atom_rom_hdr - str, STRLEN_NORMAL); |
| 1519 | strscpy(ctx->build_num, str, STRLEN_NORMAL); | 1519 | if (len) |
| 1520 | strscpy(ctx->build_num, str, len); | ||
| 1520 | } | 1521 | } |
| 1521 | 1522 | ||
| 1522 | struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) | 1523 | struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) |
| @@ -3560,6 +3560,7 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring, · 3559 unmodified lines | |||
| 3560 | struct amdgpu_device *adev = ring->adev; | 3560 | struct amdgpu_device *adev = ring->adev; |
| 3561 | struct amdgpu_kiq *kiq = &adev->gfx.kiq[ring->xcc_id]; | 3561 | struct amdgpu_kiq *kiq = &adev->gfx.kiq[ring->xcc_id]; |
| 3562 | struct amdgpu_ring *kiq_ring = &kiq->ring; | 3562 | struct amdgpu_ring *kiq_ring = &kiq->ring; |
| 3563 | int reset_mode = AMDGPU_RESET_TYPE_PER_QUEUE; | ||
| 3563 | unsigned long flags; | 3564 | unsigned long flags; |
| 3564 | int r; | 3565 | int r; |
| 3565 | 3566 | ||
| @@ -3597,6 +3598,7 @@ pipe_reset: · 31 unmodified lines | |||
| 3597 | if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_PIPE)) | 3598 | if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_PIPE)) |
| 3598 | return -EOPNOTSUPP; | 3599 | return -EOPNOTSUPP; |
| 3599 | r = gfx_v9_4_3_reset_hw_pipe(ring); | 3600 | r = gfx_v9_4_3_reset_hw_pipe(ring); |
| 3601 | reset_mode = AMDGPU_RESET_TYPE_PER_PIPE; | ||
| 3600 | dev_info(adev->dev, "ring: %s pipe reset :%s\n", ring->name, | 3602 | dev_info(adev->dev, "ring: %s pipe reset :%s\n", ring->name, |
| 3601 | r ? "failed" : "successfully"); | 3603 | r ? "failed" : "successfully"); |
| 3602 | if (r) | 3604 | if (r) |
| @@ -3619,10 +3621,20 @@ pipe_reset: · 16 unmodified lines | |||
| 3619 | r = amdgpu_ring_test_ring(kiq_ring); | 3621 | r = amdgpu_ring_test_ring(kiq_ring); |
| 3620 | spin_unlock_irqrestore(&kiq->ring_lock, flags); | 3622 | spin_unlock_irqrestore(&kiq->ring_lock, flags); |
| 3621 | if (r) { | 3623 | if (r) { |
| 3624 | if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE) | ||
| 3625 | goto pipe_reset; | ||
| 3626 | |||
| 3622 | dev_err(adev->dev, "fail to remap queue\n"); | 3627 | dev_err(adev->dev, "fail to remap queue\n"); |
| 3623 | return r; | 3628 | return r; |
| 3624 | } | 3629 | } |
| 3625 | 3630 | ||
| 3631 | if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE) { | ||
| 3632 | r = amdgpu_ring_test_ring(ring); | ||
| 3633 | if (r) | ||
| 3634 | goto pipe_reset; | ||
| 3635 | } | ||
| 3636 | |||
| 3637 | |||
| 3626 | return amdgpu_ring_reset_helper_end(ring, timedout_fence); | 3638 | return amdgpu_ring_reset_helper_end(ring, timedout_fence); |
| 3627 | } | 3639 | } |
| 3628 | 3640 | ||
| @@ -713,6 +713,12 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes) · 712 unmodified lines | |||
| 713 | mes_set_hw_res_pkt.enable_reg_active_poll = 1; | 713 | mes_set_hw_res_pkt.enable_reg_active_poll = 1; |
| 714 | mes_set_hw_res_pkt.enable_level_process_quantum_check = 1; | 714 | mes_set_hw_res_pkt.enable_level_process_quantum_check = 1; |
| 715 | mes_set_hw_res_pkt.oversubscription_timer = 50; | 715 | mes_set_hw_res_pkt.oversubscription_timer = 50; |
| 716 | if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x7f) | ||
| 717 | mes_set_hw_res_pkt.enable_lr_compute_wa = 1; | ||
| 718 | else | ||
| 719 | dev_info_once(mes->adev->dev, | ||
| 720 | "MES FW version must be >= 0x7f to enable LR compute workaround.\n"); | ||
| 721 | |||
| 716 | if (amdgpu_mes_log_enable) { | 722 | if (amdgpu_mes_log_enable) { |
| 717 | mes_set_hw_res_pkt.enable_mes_event_int_logging = 1; | 723 | mes_set_hw_res_pkt.enable_mes_event_int_logging = 1; |
| 718 | mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = | 724 | mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = |
| @@ -769,6 +769,11 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes, int pipe) · 768 unmodified lines | |||
| 769 | mes_set_hw_res_pkt.use_different_vmid_compute = 1; | 769 | mes_set_hw_res_pkt.use_different_vmid_compute = 1; |
| 770 | mes_set_hw_res_pkt.enable_reg_active_poll = 1; | 770 | mes_set_hw_res_pkt.enable_reg_active_poll = 1; |
| 771 | mes_set_hw_res_pkt.enable_level_process_quantum_check = 1; | 771 | mes_set_hw_res_pkt.enable_level_process_quantum_check = 1; |
| 772 | if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x82) | ||
| 773 | mes_set_hw_res_pkt.enable_lr_compute_wa = 1; | ||
| 774 | else | ||
| 775 | dev_info_once(adev->dev, | ||
| 776 | "MES FW version must be >= 0x82 to enable LR compute workaround.\n"); | ||
| 772 | 777 | ||
| 773 | /* | 778 | /* |
| 774 | * Keep oversubscribe timer for sdma . When we have unmapped doorbell | 779 | * Keep oversubscribe timer for sdma . When we have unmapped doorbell |
| @@ -113,6 +113,25 @@ static int vcn_v5_0_1_early_init(struct amdgpu_ip_block *ip_block) · 112 unmodified lines | |||
| 113 | return 0; | 113 | return 0; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static int vcn_v5_0_1_late_init(struct amdgpu_ip_block *ip_block) | ||
| 117 | { | ||
| 118 | struct amdgpu_device *adev = ip_block->adev; | ||
| 119 | |||
| 120 | adev->vcn.supported_reset = | ||
| 121 | amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]); | ||
| 122 | |||
| 123 | switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) { | ||
| 124 | case IP_VERSION(13, 0, 12): | ||
| 125 | if ((adev->psp.sos.fw_version >= 0x00450025) && amdgpu_dpm_reset_vcn_is_supported(adev)) | ||
| 126 | adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE; | ||
| 127 | break; | ||
| 128 | default: | ||
| 129 | break; | ||
| 130 | } | ||
| 131 | |||
| 132 | return 0; | ||
| 133 | } | ||
| 134 | |||
| 116 | static void vcn_v5_0_1_fw_shared_init(struct amdgpu_device *adev, int inst_idx) | 135 | static void vcn_v5_0_1_fw_shared_init(struct amdgpu_device *adev, int inst_idx) |
| 117 | { | 136 | { |
| 118 | struct amdgpu_vcn5_fw_shared *fw_shared; | 137 | struct amdgpu_vcn5_fw_shared *fw_shared; |
| @@ -187,10 +206,6 @@ static int vcn_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block) · 68 unmodified lines | |||
| 187 | vcn_v5_0_1_fw_shared_init(adev, i); | 206 | vcn_v5_0_1_fw_shared_init(adev, i); |
| 188 | } | 207 | } |
| 189 | 208 | ||
| 190 | /* TODO: Add queue reset mask when FW fully supports it */ | ||
| 191 | adev->vcn.supported_reset = | ||
| 192 | amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]); | ||
| 193 | |||
| 194 | if (amdgpu_sriov_vf(adev)) { | 209 | if (amdgpu_sriov_vf(adev)) { |
| 195 | r = amdgpu_virt_alloc_mm_table(adev); | 210 | r = amdgpu_virt_alloc_mm_table(adev); |
| 196 | if (r) | 211 | if (r) |
| @@ -253,6 +268,23 @@ static int vcn_v5_0_1_sw_fini(struct amdgpu_ip_block *ip_block) · 56 unmodified lines | |||
| 253 | return 0; | 268 | return 0; |
| 254 | } | 269 | } |
| 255 | 270 | ||
| 271 | static int vcn_v5_0_1_hw_init_inst(struct amdgpu_device *adev, int i) | ||
| 272 | { | ||
| 273 | struct amdgpu_ring *ring; | ||
| 274 | int vcn_inst; | ||
| 275 | |||
| 276 | vcn_inst = GET_INST(VCN, i); | ||
| 277 | ring = &adev->vcn.inst[i].ring_enc[0]; | ||
| 278 | |||
| 279 | if (ring->use_doorbell) | ||
| 280 | adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell, | ||
| 281 | ((adev->doorbell_index.vcn.vcn_ring0_1 << 1) + | ||
| 282 | 11 * vcn_inst), | ||
| 283 | adev->vcn.inst[i].aid_id); | ||
| 284 | |||
| 285 | return 0; | ||
| 286 | } | ||
| 287 | |||
| 256 | /** | 288 | /** |
| 257 | * vcn_v5_0_1_hw_init - start and test VCN block | 289 | * vcn_v5_0_1_hw_init - start and test VCN block |
| 258 | * | 290 | * |
| @@ -264,7 +296,7 @@ static int vcn_v5_0_1_hw_init(struct amdgpu_ip_block *ip_block) · 5 unmodified lines | |||
| 264 | { | 296 | { |
| 265 | struct amdgpu_device *adev = ip_block->adev; | 297 | struct amdgpu_device *adev = ip_block->adev; |
| 266 | struct amdgpu_ring *ring; | 298 | struct amdgpu_ring *ring; |
| 267 | int i, r, vcn_inst; | 299 | int i, r; |
| 268 | 300 | ||
| 269 | if (amdgpu_sriov_vf(adev)) { | 301 | if (amdgpu_sriov_vf(adev)) { |
| 270 | r = vcn_v5_0_1_start_sriov(adev); | 302 | r = vcn_v5_0_1_start_sriov(adev); |
| @@ -282,14 +314,8 @@ static int vcn_v5_0_1_hw_init(struct amdgpu_ip_block *ip_block) · 11 unmodified lines | |||
| 282 | if (RREG32_SOC15(VCN, GET_INST(VCN, 0), regVCN_RRMT_CNTL) & 0x100) | 314 | if (RREG32_SOC15(VCN, GET_INST(VCN, 0), regVCN_RRMT_CNTL) & 0x100) |
| 283 | adev->vcn.caps |= AMDGPU_VCN_CAPS(RRMT_ENABLED); | 315 | adev->vcn.caps |= AMDGPU_VCN_CAPS(RRMT_ENABLED); |
| 284 | for (i = 0; i < adev->vcn.num_vcn_inst; ++i) { | 316 | for (i = 0; i < adev->vcn.num_vcn_inst; ++i) { |
| 285 | vcn_inst = GET_INST(VCN, i); | ||
| 286 | ring = &adev->vcn.inst[i].ring_enc[0]; | 317 | ring = &adev->vcn.inst[i].ring_enc[0]; |
| 287 | 318 | vcn_v5_0_1_hw_init_inst(adev, i); | |
| 288 | if (ring->use_doorbell) | ||
| 289 | adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell, | ||
| 290 | ((adev->doorbell_index.vcn.vcn_ring0_1 << 1) + | ||
| 291 | 11 * vcn_inst), | ||
| 292 | adev->vcn.inst[i].aid_id); | ||
| 293 | 319 | ||
| 294 | /* Re-init fw_shared, if required */ | 320 | /* Re-init fw_shared, if required */ |
| 295 | vcn_v5_0_1_fw_shared_init(adev, i); | 321 | vcn_v5_0_1_fw_shared_init(adev, i); |
| @@ -1273,6 +1299,31 @@ static void vcn_v5_0_1_unified_ring_set_wptr(struct amdgpu_ring *ring) · 977 unmodified lines | |||
| 1273 | } | 1299 | } |
| 1274 | } | 1300 | } |
| 1275 | 1301 | ||
| 1302 | static int vcn_v5_0_1_ring_reset(struct amdgpu_ring *ring, | ||
| 1303 | unsigned int vmid, | ||
| 1304 | struct amdgpu_fence *timedout_fence) | ||
| 1305 | { | ||
| 1306 | int r = 0; | ||
| 1307 | int vcn_inst; | ||
| 1308 | struct amdgpu_device *adev = ring->adev; | ||
| 1309 | struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me]; | ||
| 1310 | |||
| 1311 | amdgpu_ring_reset_helper_begin(ring, timedout_fence); | ||
| 1312 | |||
| 1313 | vcn_inst = GET_INST(VCN, ring->me); | ||
| 1314 | r = amdgpu_dpm_reset_vcn(adev, 1 << vcn_inst); | ||
| 1315 | |||
| 1316 | if (r) { | ||
| 1317 | DRM_DEV_ERROR(adev->dev, "VCN reset fail : %d\n", r); | ||
| 1318 | return r; | ||
| 1319 | } | ||
| 1320 | |||
| 1321 | vcn_v5_0_1_hw_init_inst(adev, ring->me); | ||
| 1322 | vcn_v5_0_1_start_dpg_mode(vinst, vinst->indirect_sram); | ||
| 1323 | |||
| 1324 | return amdgpu_ring_reset_helper_end(ring, timedout_fence); | ||
| 1325 | } | ||
| 1326 | |||
| 1276 | static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = { | 1327 | static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = { |
| 1277 | .type = AMDGPU_RING_TYPE_VCN_ENC, | 1328 | .type = AMDGPU_RING_TYPE_VCN_ENC, |
| 1278 | .align_mask = 0x3f, | 1329 | .align_mask = 0x3f, |
| @@ -1301,6 +1352,7 @@ static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = { · 22 unmodified lines | |||
| 1301 | .emit_wreg = vcn_v4_0_3_enc_ring_emit_wreg, | 1352 | .emit_wreg = vcn_v4_0_3_enc_ring_emit_wreg, |
| 1302 | .emit_reg_wait = vcn_v4_0_3_enc_ring_emit_reg_wait, | 1353 | .emit_reg_wait = vcn_v4_0_3_enc_ring_emit_reg_wait, |
| 1303 | .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, | 1354 | .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, |
| 1355 | .reset = vcn_v5_0_1_ring_reset, | ||
| 1304 | }; | 1356 | }; |
| 1305 | 1357 | ||
| 1306 | /** | 1358 | /** |
| @@ -1504,7 +1556,7 @@ static void vcn_v5_0_1_set_irq_funcs(struct amdgpu_device *adev) · 197 unmodified lines | |||
| 1504 | static const struct amd_ip_funcs vcn_v5_0_1_ip_funcs = { | 1556 | static const struct amd_ip_funcs vcn_v5_0_1_ip_funcs = { |
| 1505 | .name = "vcn_v5_0_1", | 1557 | .name = "vcn_v5_0_1", |
| 1506 | .early_init = vcn_v5_0_1_early_init, | 1558 | .early_init = vcn_v5_0_1_early_init, |
| 1507 | .late_init = NULL, | 1559 | .late_init = vcn_v5_0_1_late_init, |
| 1508 | .sw_init = vcn_v5_0_1_sw_init, | 1560 | .sw_init = vcn_v5_0_1_sw_init, |
| 1509 | .sw_fini = vcn_v5_0_1_sw_fini, | 1561 | .sw_fini = vcn_v5_0_1_sw_fini, |
| 1510 | .hw_init = vcn_v5_0_1_hw_init, | 1562 | .hw_init = vcn_v5_0_1_hw_init, |
| @@ -495,6 +495,7 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf) · 494 unmodified lines | |||
| 495 | mutex_init(&kfd->doorbell_mutex); | 495 | mutex_init(&kfd->doorbell_mutex); |
| 496 | 496 | ||
| 497 | ida_init(&kfd->doorbell_ida); | 497 | ida_init(&kfd->doorbell_ida); |
| 498 | atomic_set(&kfd->kfd_processes_count, 0); | ||
| 498 | 499 | ||
| 499 | return kfd; | 500 | return kfd; |
| 500 | } | 501 | } |
| @@ -1133,7 +1134,15 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) · 632 unmodified lines | |||
| 1133 | } | 1134 | } |
| 1134 | 1135 | ||
| 1135 | for (i = 0; i < kfd->num_nodes; i++) { | 1136 | for (i = 0; i < kfd->num_nodes; i++) { |
| 1136 | node = kfd->nodes[i]; | 1137 | /* Race if another thread in b/w |
| 1138 | * kfd_cleanup_nodes and kfree(kfd), | ||
| 1139 | * when kfd->nodes[i] = NULL | ||
| 1140 | */ | ||
| 1141 | if (kfd->nodes[i]) | ||
| 1142 | node = kfd->nodes[i]; | ||
| 1143 | else | ||
| 1144 | return; | ||
| 1145 | |||
| 1137 | spin_lock_irqsave(&node->interrupt_lock, flags); | 1146 | spin_lock_irqsave(&node->interrupt_lock, flags); |
| 1138 | 1147 | ||
| 1139 | if (node->interrupts_active | 1148 | if (node->interrupts_active |
| @@ -1485,6 +1494,15 @@ int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd) · 345 unmodified lines | |||
| 1485 | 1494 | ||
| 1486 | mutex_lock(&kfd_processes_mutex); | 1495 | mutex_lock(&kfd_processes_mutex); |
| 1487 | 1496 | ||
| 1497 | /* kfd_processes_count is per kfd_dev, return -EBUSY without | ||
| 1498 | * further check | ||
| 1499 | */ | ||
| 1500 | if (!!atomic_read(&kfd->kfd_processes_count)) { | ||
| 1501 | pr_debug("process_wq_release not finished\n"); | ||
| 1502 | r = -EBUSY; | ||
| 1503 | goto out; | ||
| 1504 | } | ||
| 1505 | |||
| 1488 | if (hash_empty(kfd_processes_table) && !kfd_is_locked(kfd)) | 1506 | if (hash_empty(kfd_processes_table) && !kfd_is_locked(kfd)) |
| 1489 | goto out; | 1507 | goto out; |
| 1490 | 1508 | ||
| @@ -382,6 +382,8 @@ struct kfd_dev { · 381 unmodified lines | |||
| 382 | 382 | ||
| 383 | /* for dynamic partitioning */ | 383 | /* for dynamic partitioning */ |
| 384 | int kfd_dev_lock; | 384 | int kfd_dev_lock; |
| 385 | |||
| 386 | atomic_t kfd_processes_count; | ||
| 385 | }; | 387 | }; |
| 386 | 388 | ||
| 387 | enum kfd_mempool { | 389 | enum kfd_mempool { |
| @@ -1088,6 +1088,8 @@ static void kfd_process_destroy_pdds(struct kfd_process *p) · 1087 unmodified lines | |||
| 1088 | pdd->runtime_inuse = false; | 1088 | pdd->runtime_inuse = false; |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | atomic_dec(&pdd->dev->kfd->kfd_processes_count); | ||
| 1092 | |||
| 1091 | kfree(pdd); | 1093 | kfree(pdd); |
| 1092 | p->pdds[i] = NULL; | 1094 | p->pdds[i] = NULL; |
| 1093 | } | 1095 | } |
| @@ -1649,6 +1651,8 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_node *dev, · 555 unmodified lines | |||
| 1649 | /* Init idr used for memory handle translation */ | 1651 | /* Init idr used for memory handle translation */ |
| 1650 | idr_init(&pdd->alloc_idr); | 1652 | idr_init(&pdd->alloc_idr); |
| 1651 | 1653 | ||
| 1654 | atomic_inc(&dev->kfd->kfd_processes_count); | ||
| 1655 | |||
| 1652 | return pdd; | 1656 | return pdd; |
| 1653 | } | 1657 | } |
| 1654 | 1658 | ||
| @@ -1738,7 +1738,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm, · 1737 unmodified lines | |||
| 1738 | 1738 | ||
| 1739 | WRITE_ONCE(p->svms.faulting_task, current); | 1739 | WRITE_ONCE(p->svms.faulting_task, current); |
| 1740 | r = amdgpu_hmm_range_get_pages(&prange->notifier, addr, npages, | 1740 | r = amdgpu_hmm_range_get_pages(&prange->notifier, addr, npages, |
| 1741 | readonly, owner, NULL, | 1741 | readonly, owner, |
| 1742 | &hmm_range); | 1742 | &hmm_range); |
| 1743 | WRITE_ONCE(p->svms.faulting_task, NULL); | 1743 | WRITE_ONCE(p->svms.faulting_task, NULL); |
| 1744 | if (r) | 1744 | if (r) |
| @@ -233,6 +233,7 @@ static int amdgpu_dm_encoder_init(struct drm_device *dev, · 232 unmodified lines | |||
| 233 | 233 | ||
| 234 | static int amdgpu_dm_connector_get_modes(struct drm_connector *connector); | 234 | static int amdgpu_dm_connector_get_modes(struct drm_connector *connector); |
| 235 | 235 | ||
| 236 | static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state); | ||
| 236 | static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state); | 237 | static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state); |
| 237 | 238 | ||
| 238 | static int amdgpu_dm_atomic_check(struct drm_device *dev, | 239 | static int amdgpu_dm_atomic_check(struct drm_device *dev, |
| @@ -417,8 +418,7 @@ static inline bool update_planes_and_stream_adapter(struct dc *dc, · 178 unmodified lines | |||
| 417 | /* | 418 | /* |
| 418 | * Previous frame finished and HW is ready for optimization. | 419 | * Previous frame finished and HW is ready for optimization. |
| 419 | */ | 420 | */ |
| 420 | if (update_type == UPDATE_TYPE_FAST) | 421 | dc_post_update_surfaces_to_stream(dc); |
| 421 | dc_post_update_surfaces_to_stream(dc); | ||
| 422 | 422 | ||
| 423 | return dc_update_planes_and_stream(dc, | 423 | return dc_update_planes_and_stream(dc, |
| 424 | array_of_surface_update, | 424 | array_of_surface_update, |
| @@ -3637,7 +3637,7 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { · 3212 unmodified lines | |||
| 3637 | 3637 | ||
| 3638 | static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { | 3638 | static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { |
| 3639 | .atomic_commit_tail = amdgpu_dm_atomic_commit_tail, | 3639 | .atomic_commit_tail = amdgpu_dm_atomic_commit_tail, |
| 3640 | .atomic_commit_setup = drm_dp_mst_atomic_setup_commit, | 3640 | .atomic_commit_setup = amdgpu_dm_atomic_setup_commit, |
| 3641 | }; | 3641 | }; |
| 3642 | 3642 | ||
| 3643 | static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) | 3643 | static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) |
| @@ -4829,6 +4829,16 @@ static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *cap · 1185 unmodified lines | |||
| 4829 | if (!caps->data_points) | 4829 | if (!caps->data_points) |
| 4830 | return; | 4830 | return; |
| 4831 | 4831 | ||
| 4832 | /* | ||
| 4833 | * Handle the case where brightness is below the first data point | ||
| 4834 | * Interpolate between (0,0) and (first_signal, first_lum) | ||
| 4835 | */ | ||
| 4836 | if (brightness < caps->luminance_data[0].input_signal) { | ||
| 4837 | lum = DIV_ROUND_CLOSEST(caps->luminance_data[0].luminance * brightness, | ||
| 4838 | caps->luminance_data[0].input_signal); | ||
| 4839 | goto scale; | ||
| 4840 | } | ||
| 4841 | |||
| 4832 | left = 0; | 4842 | left = 0; |
| 4833 | right = caps->data_points - 1; | 4843 | right = caps->data_points - 1; |
| 4834 | while (left <= right) { | 4844 | while (left <= right) { |
| @@ -8261,6 +8271,10 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, · 3426 unmodified lines | |||
| 8261 | {"1920x1200", 1920, 1200} | 8271 | {"1920x1200", 1920, 1200} |
| 8262 | }; | 8272 | }; |
| 8263 | 8273 | ||
| 8274 | if ((connector->connector_type != DRM_MODE_CONNECTOR_eDP) && | ||
| 8275 | (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)) | ||
| 8276 | return; | ||
| 8277 | |||
| 8264 | n = ARRAY_SIZE(common_modes); | 8278 | n = ARRAY_SIZE(common_modes); |
| 8265 | 8279 | ||
| 8266 | for (i = 0; i < n; i++) { | 8280 | for (i = 0; i < n; i++) { |
| @@ -10353,6 +10367,39 @@ static void amdgpu_dm_update_hdcp(struct drm_atomic_state *state) · 2086 unmodified lines | |||
| 10353 | } | 10367 | } |
| 10354 | } | 10368 | } |
| 10355 | 10369 | ||
| 10370 | static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state) | ||
| 10371 | { | ||
| 10372 | struct drm_crtc *crtc; | ||
| 10373 | struct drm_crtc_state *old_crtc_state, *new_crtc_state; | ||
| 10374 | struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state; | ||
| 10375 | int i, ret; | ||
| 10376 | |||
| 10377 | ret = drm_dp_mst_atomic_setup_commit(state); | ||
| 10378 | if (ret) | ||
| 10379 | return ret; | ||
| 10380 | |||
| 10381 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { | ||
| 10382 | dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); | ||
| 10383 | dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); | ||
| 10384 | /* | ||
| 10385 | * Color management settings. We also update color properties | ||
| 10386 | * when a modeset is needed, to ensure it gets reprogrammed. | ||
| 10387 | */ | ||
| 10388 | if (dm_new_crtc_state->base.active && dm_new_crtc_state->stream && | ||
| 10389 | (dm_new_crtc_state->base.color_mgmt_changed || | ||
| 10390 | dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf || | ||
| 10391 | drm_atomic_crtc_needs_modeset(new_crtc_state))) { | ||
| 10392 | ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state); | ||
| 10393 | if (ret) { | ||
| 10394 | drm_dbg_atomic(state->dev, "Failed to update color state\n"); | ||
| 10395 | return ret; | ||
| 10396 | } | ||
| 10397 | } | ||
| 10398 | } | ||
| 10399 | |||
| 10400 | return 0; | ||
| 10401 | } | ||
| 10402 | |||
| 10356 | /** | 10403 | /** |
| 10357 | * amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation. | 10404 | * amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation. |
| 10358 | * @state: The atomic state to commit | 10405 | * @state: The atomic state to commit |
| @@ -11167,7 +11214,7 @@ skip_modeset: · 808 unmodified lines | |||
| 11167 | if (dm_new_crtc_state->base.color_mgmt_changed || | 11214 | if (dm_new_crtc_state->base.color_mgmt_changed || |
| 11168 | dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf || | 11215 | dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf || |
| 11169 | drm_atomic_crtc_needs_modeset(new_crtc_state)) { | 11216 | drm_atomic_crtc_needs_modeset(new_crtc_state)) { |
| 11170 | ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state); | 11217 | ret = amdgpu_dm_check_crtc_color_mgmt(dm_new_crtc_state, true); |
| 11171 | if (ret) | 11218 | if (ret) |
| 11172 | goto fail; | 11219 | goto fail; |
| 11173 | } | 11220 | } |
| @@ -1054,6 +1054,8 @@ void amdgpu_dm_init_color_mod(void); · 1053 unmodified lines | |||
| 1054 | int amdgpu_dm_create_color_properties(struct amdgpu_device *adev); | 1054 | int amdgpu_dm_create_color_properties(struct amdgpu_device *adev); |
| 1055 | int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state); | 1055 | int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state); |
| 1056 | int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc); | 1056 | int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc); |
| 1057 | int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc, | ||
| 1058 | bool check_only); | ||
| 1057 | int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, | 1059 | int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, |
| 1058 | struct drm_plane_state *plane_state, | 1060 | struct drm_plane_state *plane_state, |
| 1059 | struct dc_plane_state *dc_plane_state); | 1061 | struct dc_plane_state *dc_plane_state); |
| @@ -566,12 +566,11 @@ static int __set_output_tf(struct dc_transfer_func *func, · 565 unmodified lines | |||
| 566 | return res ? 0 : -ENOMEM; | 566 | return res ? 0 : -ENOMEM; |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | static int amdgpu_dm_set_atomic_regamma(struct dc_stream_state *stream, | 569 | static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf, |
| 570 | const struct drm_color_lut *regamma_lut, | 570 | const struct drm_color_lut *regamma_lut, |
| 571 | uint32_t regamma_size, bool has_rom, | 571 | uint32_t regamma_size, bool has_rom, |
| 572 | enum dc_transfer_func_predefined tf) | 572 | enum dc_transfer_func_predefined tf) |
| 573 | { | 573 | { |
| 574 | struct dc_transfer_func *out_tf = &stream->out_transfer_func; | ||
| 575 | int ret = 0; | 574 | int ret = 0; |
| 576 | 575 | ||
| 577 | if (regamma_size || tf != TRANSFER_FUNCTION_LINEAR) { | 576 | if (regamma_size || tf != TRANSFER_FUNCTION_LINEAR) { |
| @@ -821,7 +820,7 @@ int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev, · 243 unmodified lines | |||
| 821 | struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane_state); | 820 | struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane_state); |
| 822 | const struct drm_color_lut *shaper = NULL, *lut3d = NULL; | 821 | const struct drm_color_lut *shaper = NULL, *lut3d = NULL; |
| 823 | uint32_t exp_size, size, dim_size = MAX_COLOR_3DLUT_SIZE; | 822 | uint32_t exp_size, size, dim_size = MAX_COLOR_3DLUT_SIZE; |
| 824 | bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut; | 823 | bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend; |
| 825 | 824 | ||
| 826 | /* shaper LUT is only available if 3D LUT color caps */ | 825 | /* shaper LUT is only available if 3D LUT color caps */ |
| 827 | exp_size = has_3dlut ? MAX_COLOR_LUT_ENTRIES : 0; | 826 | exp_size = has_3dlut ? MAX_COLOR_LUT_ENTRIES : 0; |
| @@ -885,33 +884,33 @@ int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state) · 57 unmodified lines | |||
| 885 | } | 884 | } |
| 886 | 885 | ||
| 887 | /** | 886 | /** |
| 888 | * amdgpu_dm_update_crtc_color_mgmt: Maps DRM color management to DC stream. | 887 | * amdgpu_dm_check_crtc_color_mgmt: Check if DRM color props are programmable by DC. |
| 889 | * @crtc: amdgpu_dm crtc state | 888 | * @crtc: amdgpu_dm crtc state |
| 889 | * @check_only: only check color state without update dc stream | ||
| 890 | * | 890 | * |
| 891 | * With no plane level color management properties we're free to use any | 891 | * This function just verifies CRTC LUT sizes, if there is enough space for |
| 892 | * of the HW blocks as long as the CRTC CTM always comes before the | 892 | * output transfer function and if its parameters can be calculated by AMD |
| 893 | * CRTC RGM and after the CRTC DGM. | 893 | * color module. It also adjusts some settings for programming CRTC degamma at |
| 894 | * | 894 | * plane stage, using plane DGM block. |
| 895 | * - The CRTC RGM block will be placed in the RGM LUT block if it is non-linear. | ||
| 896 | * - The CRTC DGM block will be placed in the DGM LUT block if it is non-linear. | ||
| 897 | * - The CRTC CTM will be placed in the gamut remap block if it is non-linear. | ||
| 898 | * | 895 | * |
| 899 | * The RGM block is typically more fully featured and accurate across | 896 | * The RGM block is typically more fully featured and accurate across |
| 900 | * all ASICs - DCE can't support a custom non-linear CRTC DGM. | 897 | * all ASICs - DCE can't support a custom non-linear CRTC DGM. |
| 901 | * | 898 | * |
| 902 | * For supporting both plane level color management and CRTC level color | 899 | * For supporting both plane level color management and CRTC level color |
| 903 | * management at once we have to either restrict the usage of CRTC properties | 900 | * management at once we have to either restrict the usage of some CRTC |
| 904 | * or blend adjustments together. | 901 | * properties or blend adjustments together. |
| 905 | * | 902 | * |
| 906 | * Returns: | 903 | * Returns: |
| 907 | * 0 on success. Error code if setup fails. | 904 | * 0 on success. Error code if validation fails. |
| 908 | */ | 905 | */ |
| 909 | int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) | 906 | |
| 907 | int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc, | ||
| 908 | bool check_only) | ||
| 910 | { | 909 | { |
| 911 | struct dc_stream_state *stream = crtc->stream; | 910 | struct dc_stream_state *stream = crtc->stream; |
| 912 | struct amdgpu_device *adev = drm_to_adev(crtc->base.state->dev); | 911 | struct amdgpu_device *adev = drm_to_adev(crtc->base.state->dev); |
| 913 | bool has_rom = adev->asic_type <= CHIP_RAVEN; | 912 | bool has_rom = adev->asic_type <= CHIP_RAVEN; |
| 914 | struct drm_color_ctm *ctm = NULL; | 913 | struct dc_transfer_func *out_tf; |
| 915 | const struct drm_color_lut *degamma_lut, *regamma_lut; | 914 | const struct drm_color_lut *degamma_lut, *regamma_lut; |
| 916 | uint32_t degamma_size, regamma_size; | 915 | uint32_t degamma_size, regamma_size; |
| 917 | bool has_regamma, has_degamma; | 916 | bool has_regamma, has_degamma; |
| @@ -940,6 +939,14 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 22 unmodified lines | |||
| 940 | crtc->cm_has_degamma = false; | 939 | crtc->cm_has_degamma = false; |
| 941 | crtc->cm_is_degamma_srgb = false; | 940 | crtc->cm_is_degamma_srgb = false; |
| 942 | 941 | ||
| 942 | if (check_only) { | ||
| 943 | out_tf = kvzalloc(sizeof(*out_tf), GFP_KERNEL); | ||
| 944 | if (!out_tf) | ||
| 945 | return -ENOMEM; | ||
| 946 | } else { | ||
| 947 | out_tf = &stream->out_transfer_func; | ||
| 948 | } | ||
| 949 | |||
| 943 | /* Setup regamma and degamma. */ | 950 | /* Setup regamma and degamma. */ |
| 944 | if (is_legacy) { | 951 | if (is_legacy) { |
| 945 | /* | 952 | /* |
| @@ -954,8 +961,8 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 8 unmodified lines | |||
| 954 | * inverse color ramp in legacy userspace. | 961 | * inverse color ramp in legacy userspace. |
| 955 | */ | 962 | */ |
| 956 | crtc->cm_is_degamma_srgb = true; | 963 | crtc->cm_is_degamma_srgb = true; |
| 957 | stream->out_transfer_func.type = TF_TYPE_DISTRIBUTED_POINTS; | 964 | out_tf->type = TF_TYPE_DISTRIBUTED_POINTS; |
| 958 | stream->out_transfer_func.tf = TRANSFER_FUNCTION_SRGB; | 965 | out_tf->tf = TRANSFER_FUNCTION_SRGB; |
| 959 | /* | 966 | /* |
| 960 | * Note: although we pass has_rom as parameter here, we never | 967 | * Note: although we pass has_rom as parameter here, we never |
| 961 | * actually use ROM because the color module only takes the ROM | 968 | * actually use ROM because the color module only takes the ROM |
| @@ -963,16 +970,12 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 1 unmodified line | |||
| 963 | * | 970 | * |
| 964 | * See more in mod_color_calculate_regamma_params() | 971 | * See more in mod_color_calculate_regamma_params() |
| 965 | */ | 972 | */ |
| 966 | r = __set_legacy_tf(&stream->out_transfer_func, regamma_lut, | 973 | r = __set_legacy_tf(out_tf, regamma_lut, |
| 967 | regamma_size, has_rom); | 974 | regamma_size, has_rom); |
| 968 | if (r) | ||
| 969 | return r; | ||
| 970 | } else { | 975 | } else { |
| 971 | regamma_size = has_regamma ? regamma_size : 0; | 976 | regamma_size = has_regamma ? regamma_size : 0; |
| 972 | r = amdgpu_dm_set_atomic_regamma(stream, regamma_lut, | 977 | r = amdgpu_dm_set_atomic_regamma(out_tf, regamma_lut, |
| 973 | regamma_size, has_rom, tf); | 978 | regamma_size, has_rom, tf); |
| 974 | if (r) | ||
| 975 | return r; | ||
| 976 | } | 979 | } |
| 977 | 980 | ||
| 978 | /* | 981 | /* |
| @@ -981,6 +984,43 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 2 unmodified lines | |||
| 981 | * have to place the CTM in the OCSC in that case. | 984 | * have to place the CTM in the OCSC in that case. |
| 982 | */ | 985 | */ |
| 983 | crtc->cm_has_degamma = has_degamma; | 986 | crtc->cm_has_degamma = has_degamma; |
| 987 | if (check_only) | ||
| 988 | kvfree(out_tf); | ||
| 989 | |||
| 990 | return r; | ||
| 991 | } | ||
| 992 | |||
| 993 | /** | ||
| 994 | * amdgpu_dm_update_crtc_color_mgmt: Maps DRM color management to DC stream. | ||
| 995 | * @crtc: amdgpu_dm crtc state | ||
| 996 | * | ||
| 997 | * With no plane level color management properties we're free to use any | ||
| 998 | * of the HW blocks as long as the CRTC CTM always comes before the | ||
| 999 | * CRTC RGM and after the CRTC DGM. | ||
| 1000 | * | ||
| 1001 | * - The CRTC RGM block will be placed in the RGM LUT block if it is non-linear. | ||
| 1002 | * - The CRTC DGM block will be placed in the DGM LUT block if it is non-linear. | ||
| 1003 | * - The CRTC CTM will be placed in the gamut remap block if it is non-linear. | ||
| 1004 | * | ||
| 1005 | * The RGM block is typically more fully featured and accurate across | ||
| 1006 | * all ASICs - DCE can't support a custom non-linear CRTC DGM. | ||
| 1007 | * | ||
| 1008 | * For supporting both plane level color management and CRTC level color | ||
| 1009 | * management at once we have to either restrict the usage of CRTC properties | ||
| 1010 | * or blend adjustments together. | ||
| 1011 | * | ||
| 1012 | * Returns: | ||
| 1013 | * 0 on success. Error code if setup fails. | ||
| 1014 | */ | ||
| 1015 | int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) | ||
| 1016 | { | ||
| 1017 | struct dc_stream_state *stream = crtc->stream; | ||
| 1018 | struct drm_color_ctm *ctm = NULL; | ||
| 1019 | int ret; | ||
| 1020 | |||
| 1021 | ret = amdgpu_dm_check_crtc_color_mgmt(crtc, false); | ||
| 1022 | if (ret) | ||
| 1023 | return ret; | ||
| 984 | 1024 | ||
| 985 | /* Setup CRTC CTM. */ | 1025 | /* Setup CRTC CTM. */ |
| 986 | if (crtc->base.ctm) { | 1026 | if (crtc->base.ctm) { |
| @@ -218,8 +218,10 @@ static void amdgpu_dm_idle_worker(struct work_struct *work) · 217 unmodified lines | |||
| 218 | break; | 218 | break; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | if (idle_work->enable) | 221 | if (idle_work->enable) { |
| 222 | dc_post_update_surfaces_to_stream(idle_work->dm->dc); | ||
| 222 | dc_allow_idle_optimizations(idle_work->dm->dc, true); | 223 | dc_allow_idle_optimizations(idle_work->dm->dc, true); |
| 224 | } | ||
| 223 | mutex_unlock(&idle_work->dm->dc_lock); | 225 | mutex_unlock(&idle_work->dm->dc_lock); |
| 224 | } | 226 | } |
| 225 | idle_work->dm->idle_workqueue->running = false; | 227 | idle_work->dm->idle_workqueue->running = false; |
| @@ -273,8 +275,10 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work) · 47 unmodified lines | |||
| 273 | vblank_work->acrtc->dm_irq_params.allow_sr_entry); | 275 | vblank_work->acrtc->dm_irq_params.allow_sr_entry); |
| 274 | } | 276 | } |
| 275 | 277 | ||
| 276 | if (dm->active_vblank_irq_count == 0) | 278 | if (dm->active_vblank_irq_count == 0) { |
| 279 | dc_post_update_surfaces_to_stream(dm->dc); | ||
| 277 | dc_allow_idle_optimizations(dm->dc, true); | 280 | dc_allow_idle_optimizations(dm->dc, true); |
| 281 | } | ||
| 278 | 282 | ||
| 279 | mutex_unlock(&dm->dc_lock); | 283 | mutex_unlock(&dm->dc_lock); |
| 280 | 284 | ||
| @@ -768,14 +768,18 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, · 767 unmodified lines | |||
| 768 | struct mod_hdcp_ddc_funcs *ddc_funcs = &config->ddc.funcs; | 768 | struct mod_hdcp_ddc_funcs *ddc_funcs = &config->ddc.funcs; |
| 769 | 769 | ||
| 770 | config->psp.handle = &adev->psp; | 770 | config->psp.handle = &adev->psp; |
| 771 | if (dc->ctx->dce_version == DCN_VERSION_3_1 || | 771 | if (dc->ctx->dce_version == DCN_VERSION_3_1 || |
| 772 | dc->ctx->dce_version == DCN_VERSION_3_14 || | 772 | dc->ctx->dce_version == DCN_VERSION_3_14 || |
| 773 | dc->ctx->dce_version == DCN_VERSION_3_15 || | 773 | dc->ctx->dce_version == DCN_VERSION_3_15 || |
| 774 | dc->ctx->dce_version == DCN_VERSION_3_5 || | 774 | dc->ctx->dce_version == DCN_VERSION_3_16 || |
| 775 | dc->ctx->dce_version == DCN_VERSION_3_2 || | ||
| 776 | dc->ctx->dce_version == DCN_VERSION_3_21 || | ||
| 777 | dc->ctx->dce_version == DCN_VERSION_3_5 || | ||
| 775 | dc->ctx->dce_version == DCN_VERSION_3_51 || | 778 | dc->ctx->dce_version == DCN_VERSION_3_51 || |
| 776 | dc->ctx->dce_version == DCN_VERSION_3_6 || | 779 | dc->ctx->dce_version == DCN_VERSION_3_6 || |
| 777 | dc->ctx->dce_version == DCN_VERSION_3_16) | 780 | dc->ctx->dce_version == DCN_VERSION_4_01) |
| 778 | config->psp.caps.dtm_v3_supported = 1; | 781 | config->psp.caps.dtm_v3_supported = 1; |
| 782 | |||
| 779 | config->ddc.handle = dc_get_link_at_index(dc, i); | 783 | config->ddc.handle = dc_get_link_at_index(dc, i); |
| 780 | 784 | ||
| 781 | ddc_funcs->write_i2c = lp_write_i2c; | 785 | ddc_funcs->write_i2c = lp_write_i2c; |
| @@ -1633,7 +1633,7 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, · 1632 unmodified lines | |||
| 1633 | drm_object_attach_property(&plane->base, | 1633 | drm_object_attach_property(&plane->base, |
| 1634 | dm->adev->mode_info.plane_ctm_property, 0); | 1634 | dm->adev->mode_info.plane_ctm_property, 0); |
| 1635 | 1635 | ||
| 1636 | if (dpp_color_caps.hw_3d_lut) { | 1636 | if (dpp_color_caps.hw_3d_lut || dm->dc->caps.color.mpc.preblend) { |
| 1637 | drm_object_attach_property(&plane->base, | 1637 | drm_object_attach_property(&plane->base, |
| 1638 | mode_info.plane_shaper_lut_property, 0); | 1638 | mode_info.plane_shaper_lut_property, 0); |
| 1639 | drm_object_attach_property(&plane->base, | 1639 | drm_object_attach_property(&plane->base, |
| @@ -53,11 +53,11 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc · 52 unmodified lines | |||
| 53 | func_name, line); | 53 | func_name, line); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx) | 56 | void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx) |
| 57 | { | 57 | { |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx) | 60 | void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx) |
| 61 | { | 61 | { |
| 62 | } | 62 | } |
| 63 | 63 | ||
| @@ -463,6 +463,9 @@ void dce_clk_mgr_construct( · 462 unmodified lines | |||
| 463 | clk_mgr->max_clks_state = DM_PP_CLOCKS_STATE_NOMINAL; | 463 | clk_mgr->max_clks_state = DM_PP_CLOCKS_STATE_NOMINAL; |
| 464 | clk_mgr->cur_min_clks_state = DM_PP_CLOCKS_STATE_INVALID; | 464 | clk_mgr->cur_min_clks_state = DM_PP_CLOCKS_STATE_INVALID; |
| 465 | 465 | ||
| 466 | base->clks.max_supported_dispclk_khz = | ||
| 467 | clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz; | ||
| 468 | |||
| 466 | dce_clock_read_integrated_info(clk_mgr); | 469 | dce_clock_read_integrated_info(clk_mgr); |
| 467 | dce_clock_read_ss_info(clk_mgr); | 470 | dce_clock_read_ss_info(clk_mgr); |
| 468 | } | 471 | } |
| @@ -147,6 +147,8 @@ void dce60_clk_mgr_construct( · 146 unmodified lines | |||
| 147 | struct dc_context *ctx, | 147 | struct dc_context *ctx, |
| 148 | struct clk_mgr_internal *clk_mgr) | 148 | struct clk_mgr_internal *clk_mgr) |
| 149 | { | 149 | { |
| 150 | struct clk_mgr *base = &clk_mgr->base; | ||
| 151 | |||
| 150 | dce_clk_mgr_construct(ctx, clk_mgr); | 152 | dce_clk_mgr_construct(ctx, clk_mgr); |
| 151 | 153 | ||
| 152 | memcpy(clk_mgr->max_clks_by_state, | 154 | memcpy(clk_mgr->max_clks_by_state, |
| @@ -157,5 +159,8 @@ void dce60_clk_mgr_construct( · 4 unmodified lines | |||
| 157 | clk_mgr->clk_mgr_shift = &disp_clk_shift; | 159 | clk_mgr->clk_mgr_shift = &disp_clk_shift; |
| 158 | clk_mgr->clk_mgr_mask = &disp_clk_mask; | 160 | clk_mgr->clk_mgr_mask = &disp_clk_mask; |
| 159 | clk_mgr->base.funcs = &dce60_funcs; | 161 | clk_mgr->base.funcs = &dce60_funcs; |
| 162 | |||
| 163 | base->clks.max_supported_dispclk_khz = | ||
| 164 | clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz; | ||
| 160 | } | 165 | } |
| 161 | 166 | ||
| @@ -69,7 +69,7 @@ static uint32_t dcn30_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un · 68 unmodified lines | |||
| 69 | 69 | ||
| 70 | /* handle DALSMC_Result_CmdRejectedBusy? */ | 70 | /* handle DALSMC_Result_CmdRejectedBusy? */ |
| 71 | 71 | ||
| 72 | TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); | 72 | TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); |
| 73 | 73 | ||
| 74 | return reg; | 74 | return reg; |
| 75 | } | 75 | } |
| @@ -77,6 +77,7 @@ static const struct IP_BASE CLK_BASE = { { { { 0x00016C00, 0x02401800, 0, 0, 0, · 76 unmodified lines | |||
| 77 | #undef DC_LOGGER | 77 | #undef DC_LOGGER |
| 78 | #define DC_LOGGER \ | 78 | #define DC_LOGGER \ |
| 79 | clk_mgr->base.base.ctx->logger | 79 | clk_mgr->base.base.ctx->logger |
| 80 | |||
| 80 | #define regCLK1_CLK_PLL_REQ 0x0237 | 81 | #define regCLK1_CLK_PLL_REQ 0x0237 |
| 81 | #define regCLK1_CLK_PLL_REQ_BASE_IDX 0 | 82 | #define regCLK1_CLK_PLL_REQ_BASE_IDX 0 |
| 82 | 83 | ||
| @@ -87,8 +88,70 @@ static const struct IP_BASE CLK_BASE = { { { { 0x00016C00, 0x02401800, 0, 0, 0, · 4 unmodified lines | |||
| 87 | #define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L | 88 | #define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L |
| 88 | #define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L | 89 | #define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L |
| 89 | 90 | ||
| 91 | #define regCLK1_CLK0_DFS_CNTL 0x0269 | ||
| 92 | #define regCLK1_CLK0_DFS_CNTL_BASE_IDX 0 | ||
| 93 | #define regCLK1_CLK1_DFS_CNTL 0x026c | ||
| 94 | #define regCLK1_CLK1_DFS_CNTL_BASE_IDX 0 | ||
| 95 | #define regCLK1_CLK2_DFS_CNTL 0x026f | ||
| 96 | #define regCLK1_CLK2_DFS_CNTL_BASE_IDX 0 | ||
| 97 | #define regCLK1_CLK3_DFS_CNTL 0x0272 | ||
| 98 | #define regCLK1_CLK3_DFS_CNTL_BASE_IDX 0 | ||
| 99 | #define regCLK1_CLK4_DFS_CNTL 0x0275 | ||
| 100 | #define regCLK1_CLK4_DFS_CNTL_BASE_IDX 0 | ||
| 101 | #define regCLK1_CLK5_DFS_CNTL 0x0278 | ||
| 102 | #define regCLK1_CLK5_DFS_CNTL_BASE_IDX 0 | ||
| 103 | |||
| 104 | #define regCLK1_CLK0_CURRENT_CNT 0x02fb | ||
| 105 | #define regCLK1_CLK0_CURRENT_CNT_BASE_IDX 0 | ||
| 106 | #define regCLK1_CLK1_CURRENT_CNT 0x02fc | ||
| 107 | #define regCLK1_CLK1_CURRENT_CNT_BASE_IDX 0 | ||
| 108 | #define regCLK1_CLK2_CURRENT_CNT 0x02fd | ||
| 109 | #define regCLK1_CLK2_CURRENT_CNT_BASE_IDX 0 | ||
| 110 | #define regCLK1_CLK3_CURRENT_CNT 0x02fe | ||
| 111 | #define regCLK1_CLK3_CURRENT_CNT_BASE_IDX 0 | ||
| 112 | #define regCLK1_CLK4_CURRENT_CNT 0x02ff | ||
| 113 | #define regCLK1_CLK4_CURRENT_CNT_BASE_IDX 0 | ||
| 114 | #define regCLK1_CLK5_CURRENT_CNT 0x0300 | ||
| 115 | #define regCLK1_CLK5_CURRENT_CNT_BASE_IDX 0 | ||
| 116 | |||
| 117 | #define regCLK1_CLK0_BYPASS_CNTL 0x028a | ||
| 118 | #define regCLK1_CLK0_BYPASS_CNTL_BASE_IDX 0 | ||
| 119 | #define regCLK1_CLK1_BYPASS_CNTL 0x0293 | ||
| 120 | #define regCLK1_CLK1_BYPASS_CNTL_BASE_IDX 0 | ||
| 90 | #define regCLK1_CLK2_BYPASS_CNTL 0x029c | 121 | #define regCLK1_CLK2_BYPASS_CNTL 0x029c |
| 91 | #define regCLK1_CLK2_BYPASS_CNTL_BASE_IDX 0 | 122 | #define regCLK1_CLK2_BYPASS_CNTL_BASE_IDX 0 |
| 123 | #define regCLK1_CLK3_BYPASS_CNTL 0x02a5 | ||
| 124 | #define regCLK1_CLK3_BYPASS_CNTL_BASE_IDX 0 | ||
| 125 | #define regCLK1_CLK4_BYPASS_CNTL 0x02ae | ||
| 126 | #define regCLK1_CLK4_BYPASS_CNTL_BASE_IDX 0 | ||
| 127 | #define regCLK1_CLK5_BYPASS_CNTL 0x02b7 | ||
| 128 | #define regCLK1_CLK5_BYPASS_CNTL_BASE_IDX 0 | ||
| 129 | |||
| 130 | #define regCLK1_CLK0_DS_CNTL 0x0283 | ||
| 131 | #define regCLK1_CLK0_DS_CNTL_BASE_IDX 0 | ||
| 132 | #define regCLK1_CLK1_DS_CNTL 0x028c | ||
| 133 | #define regCLK1_CLK1_DS_CNTL_BASE_IDX 0 | ||
| 134 | #define regCLK1_CLK2_DS_CNTL 0x0295 | ||
| 135 | #define regCLK1_CLK2_DS_CNTL_BASE_IDX 0 | ||
| 136 | #define regCLK1_CLK3_DS_CNTL 0x029e | ||
| 137 | #define regCLK1_CLK3_DS_CNTL_BASE_IDX 0 | ||
| 138 | #define regCLK1_CLK4_DS_CNTL 0x02a7 | ||
| 139 | #define regCLK1_CLK4_DS_CNTL_BASE_IDX 0 | ||
| 140 | #define regCLK1_CLK5_DS_CNTL 0x02b0 | ||
| 141 | #define regCLK1_CLK5_DS_CNTL_BASE_IDX 0 | ||
| 142 | |||
| 143 | #define regCLK1_CLK0_ALLOW_DS 0x0284 | ||
| 144 | #define regCLK1_CLK0_ALLOW_DS_BASE_IDX 0 | ||
| 145 | #define regCLK1_CLK1_ALLOW_DS 0x028d | ||
| 146 | #define regCLK1_CLK1_ALLOW_DS_BASE_IDX 0 | ||
| 147 | #define regCLK1_CLK2_ALLOW_DS 0x0296 | ||
| 148 | #define regCLK1_CLK2_ALLOW_DS_BASE_IDX 0 | ||
| 149 | #define regCLK1_CLK3_ALLOW_DS 0x029f | ||
| 150 | #define regCLK1_CLK3_ALLOW_DS_BASE_IDX 0 | ||
| 151 | #define regCLK1_CLK4_ALLOW_DS 0x02a8 | ||
| 152 | #define regCLK1_CLK4_ALLOW_DS_BASE_IDX 0 | ||
| 153 | #define regCLK1_CLK5_ALLOW_DS 0x02b1 | ||
| 154 | #define regCLK1_CLK5_ALLOW_DS_BASE_IDX 0 | ||
| 92 | 155 | ||
| 93 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL__SHIFT 0x0 | 156 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL__SHIFT 0x0 |
| 94 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV__SHIFT 0x10 | 157 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV__SHIFT 0x10 |
| @@ -185,6 +248,8 @@ void dcn314_init_clocks(struct clk_mgr *clk_mgr) · 90 unmodified lines | |||
| 185 | { | 248 | { |
| 186 | struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); | 249 | struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); |
| 187 | uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz; | 250 | uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz; |
| 251 | struct clk_mgr_dcn314 *clk_mgr_dcn314 = TO_CLK_MGR_DCN314(clk_mgr_int); | ||
| 252 | struct clk_log_info log_info = {0}; | ||
| 188 | 253 | ||
| 189 | memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks)); | 254 | memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks)); |
| 190 | // Assumption is that boot state always supports pstate | 255 | // Assumption is that boot state always supports pstate |
| @@ -200,6 +265,9 @@ void dcn314_init_clocks(struct clk_mgr *clk_mgr) · 9 unmodified lines | |||
| 200 | dce_adjust_dp_ref_freq_for_ss(clk_mgr_int, clk_mgr->dprefclk_khz); | 265 | dce_adjust_dp_ref_freq_for_ss(clk_mgr_int, clk_mgr->dprefclk_khz); |
| 201 | else | 266 | else |
| 202 | clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz; | 267 | clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz; |
| 268 | |||
| 269 | dcn314_dump_clk_registers(&clk_mgr->boot_snapshot, &clk_mgr_dcn314->base.base, &log_info); | ||
| 270 | clk_mgr->clks.dispclk_khz = clk_mgr->boot_snapshot.dispclk * 1000; | ||
| 203 | } | 271 | } |
| 204 | 272 | ||
| 205 | void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, | 273 | void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, |
| @@ -218,6 +286,8 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 12 unmodified lines | |||
| 218 | if (dc->work_arounds.skip_clock_update) | 286 | if (dc->work_arounds.skip_clock_update) |
| 219 | return; | 287 | return; |
| 220 | 288 | ||
| 289 | display_count = dcn314_get_active_display_cnt_wa(dc, context); | ||
| 290 | |||
| 221 | /* | 291 | /* |
| 222 | * if it is safe to lower, but we are already in the lower state, we don't have to do anything | 292 | * if it is safe to lower, but we are already in the lower state, we don't have to do anything |
| 223 | * also if safe to lower is false, we just go in the higher state | 293 | * also if safe to lower is false, we just go in the higher state |
| @@ -236,7 +306,6 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 12 unmodified lines | |||
| 236 | } | 306 | } |
| 237 | /* check that we're not already in lower */ | 307 | /* check that we're not already in lower */ |
| 238 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) { | 308 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) { |
| 239 | display_count = dcn314_get_active_display_cnt_wa(dc, context); | ||
| 240 | /* if we can go lower, go lower */ | 309 | /* if we can go lower, go lower */ |
| 241 | if (display_count == 0) { | 310 | if (display_count == 0) { |
| 242 | union display_idle_optimization_u idle_info = { 0 }; | 311 | union display_idle_optimization_u idle_info = { 0 }; |
| @@ -293,11 +362,19 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 50 unmodified lines | |||
| 293 | update_dppclk = true; | 362 | update_dppclk = true; |
| 294 | } | 363 | } |
| 295 | 364 | ||
| 296 | if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { | 365 | if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz) && |
| 366 | (new_clocks->dispclk_khz > 0 || (safe_to_lower && display_count == 0))) { | ||
| 367 | int requested_dispclk_khz = new_clocks->dispclk_khz; | ||
| 368 | |||
| 297 | dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true); | 369 | dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true); |
| 298 | 370 | ||
| 371 | /* Clamp the requested clock to PMFW based on their limit. */ | ||
| 372 | if (dc->debug.min_disp_clk_khz > 0 && requested_dispclk_khz < dc->debug.min_disp_clk_khz) | ||
| 373 | requested_dispclk_khz = dc->debug.min_disp_clk_khz; | ||
| 374 | |||
| 375 | dcn314_smu_set_dispclk(clk_mgr, requested_dispclk_khz); | ||
| 299 | clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; | 376 | clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; |
| 300 | dcn314_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); | 377 | |
| 301 | dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false); | 378 | dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false); |
| 302 | 379 | ||
| 303 | update_dispclk = true; | 380 | update_dispclk = true; |
| @@ -385,10 +462,65 @@ bool dcn314_are_clock_states_equal(struct dc_clocks *a, · 81 unmodified lines | |||
| 385 | return true; | 462 | return true; |
| 386 | } | 463 | } |
| 387 | 464 | ||
| 388 | static void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass, | 465 | |
| 466 | static void dcn314_dump_clk_registers_internal(struct dcn35_clk_internal *internal, struct clk_mgr *clk_mgr_base) | ||
| 467 | { | ||
| 468 | struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base); | ||
| 469 | |||
| 470 | // read dtbclk | ||
| 471 | internal->CLK1_CLK4_CURRENT_CNT = REG_READ(CLK1_CLK4_CURRENT_CNT); | ||
| 472 | internal->CLK1_CLK4_BYPASS_CNTL = REG_READ(CLK1_CLK4_BYPASS_CNTL); | ||
| 473 | |||
| 474 | // read dcfclk | ||
| 475 | internal->CLK1_CLK3_CURRENT_CNT = REG_READ(CLK1_CLK3_CURRENT_CNT); | ||
| 476 | internal->CLK1_CLK3_BYPASS_CNTL = REG_READ(CLK1_CLK3_BYPASS_CNTL); | ||
| 477 | |||
| 478 | // read dcf deep sleep divider | ||
| 479 | internal->CLK1_CLK3_DS_CNTL = REG_READ(CLK1_CLK3_DS_CNTL); | ||
| 480 | internal->CLK1_CLK3_ALLOW_DS = REG_READ(CLK1_CLK3_ALLOW_DS); | ||
| 481 | |||
| 482 | // read dppclk | ||
| 483 | internal->CLK1_CLK1_CURRENT_CNT = REG_READ(CLK1_CLK1_CURRENT_CNT); | ||
| 484 | internal->CLK1_CLK1_BYPASS_CNTL = REG_READ(CLK1_CLK1_BYPASS_CNTL); | ||
| 485 | |||
| 486 | // read dprefclk | ||
| 487 | internal->CLK1_CLK2_CURRENT_CNT = REG_READ(CLK1_CLK2_CURRENT_CNT); | ||
| 488 | internal->CLK1_CLK2_BYPASS_CNTL = REG_READ(CLK1_CLK2_BYPASS_CNTL); | ||
| 489 | |||
| 490 | // read dispclk | ||
| 491 | internal->CLK1_CLK0_CURRENT_CNT = REG_READ(CLK1_CLK0_CURRENT_CNT); | ||
| 492 | internal->CLK1_CLK0_BYPASS_CNTL = REG_READ(CLK1_CLK0_BYPASS_CNTL); | ||
| 493 | } | ||
| 494 | |||
| 495 | void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass, | ||
| 389 | struct clk_mgr *clk_mgr_base, struct clk_log_info *log_info) | 496 | struct clk_mgr *clk_mgr_base, struct clk_log_info *log_info) |
| 390 | { | 497 | { |
| 391 | return; | 498 | |
| 499 | struct dcn35_clk_internal internal = {0}; | ||
| 500 | |||
| 501 | dcn314_dump_clk_registers_internal(&internal, clk_mgr_base); | ||
| 502 | |||
| 503 | regs_and_bypass->dcfclk = internal.CLK1_CLK3_CURRENT_CNT / 10; | ||
| 504 | regs_and_bypass->dcf_deep_sleep_divider = internal.CLK1_CLK3_DS_CNTL / 10; | ||
| 505 | regs_and_bypass->dcf_deep_sleep_allow = internal.CLK1_CLK3_ALLOW_DS; | ||
| 506 | regs_and_bypass->dprefclk = internal.CLK1_CLK2_CURRENT_CNT / 10; | ||
| 507 | regs_and_bypass->dispclk = internal.CLK1_CLK0_CURRENT_CNT / 10; | ||
| 508 | regs_and_bypass->dppclk = internal.CLK1_CLK1_CURRENT_CNT / 10; | ||
| 509 | regs_and_bypass->dtbclk = internal.CLK1_CLK4_CURRENT_CNT / 10; | ||
| 510 | |||
| 511 | regs_and_bypass->dppclk_bypass = internal.CLK1_CLK1_BYPASS_CNTL & 0x0007; | ||
| 512 | if (regs_and_bypass->dppclk_bypass < 0 || regs_and_bypass->dppclk_bypass > 4) | ||
| 513 | regs_and_bypass->dppclk_bypass = 0; | ||
| 514 | regs_and_bypass->dcfclk_bypass = internal.CLK1_CLK3_BYPASS_CNTL & 0x0007; | ||
| 515 | if (regs_and_bypass->dcfclk_bypass < 0 || regs_and_bypass->dcfclk_bypass > 4) | ||
| 516 | regs_and_bypass->dcfclk_bypass = 0; | ||
| 517 | regs_and_bypass->dispclk_bypass = internal.CLK1_CLK0_BYPASS_CNTL & 0x0007; | ||
| 518 | if (regs_and_bypass->dispclk_bypass < 0 || regs_and_bypass->dispclk_bypass > 4) | ||
| 519 | regs_and_bypass->dispclk_bypass = 0; | ||
| 520 | regs_and_bypass->dprefclk_bypass = internal.CLK1_CLK2_BYPASS_CNTL & 0x0007; | ||
| 521 | if (regs_and_bypass->dprefclk_bypass < 0 || regs_and_bypass->dprefclk_bypass > 4) | ||
| 522 | regs_and_bypass->dprefclk_bypass = 0; | ||
| 523 | |||
| 392 | } | 524 | } |
| 393 | 525 | ||
| 394 | static struct clk_bw_params dcn314_bw_params = { | 526 | static struct clk_bw_params dcn314_bw_params = { |
| @@ -65,4 +65,9 @@ void dcn314_clk_mgr_construct(struct dc_context *ctx, · 64 unmodified lines | |||
| 65 | 65 | ||
| 66 | void dcn314_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr_int); | 66 | void dcn314_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr_int); |
| 67 | 67 | ||
| 68 | |||
| 69 | void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass, | ||
| 70 | struct clk_mgr *clk_mgr_base, struct clk_log_info *log_info); | ||
| 71 | |||
| 72 | |||
| 68 | #endif //__DCN314_CLK_MGR_H__ | 73 | #endif //__DCN314_CLK_MGR_H__ |
| @@ -63,7 +63,8 @@ static uint32_t dcn32_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un · 62 unmodified lines | |||
| 63 | udelay(delay_us); | 63 | udelay(delay_us); |
| 64 | } while (max_retries--); | 64 | } while (max_retries--); |
| 65 | 65 | ||
| 66 | TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); | 66 | TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); |
| 67 | |||
| 67 | 68 | ||
| 68 | return reg; | 69 | return reg; |
| 69 | } | 70 | } |
| @@ -120,7 +121,7 @@ static uint32_t dcn32_smu_wait_for_response_delay(struct clk_mgr_internal *clk_m · 50 unmodified lines | |||
| 120 | *total_delay_us += delay_us; | 121 | *total_delay_us += delay_us; |
| 121 | } while (max_retries--); | 122 | } while (max_retries--); |
| 122 | 123 | ||
| 123 | TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx); | 124 | TRACE_SMU_MSG_DELAY(0, 0, *total_delay_us, clk_mgr->base.ctx); |
| 124 | 125 | ||
| 125 | return reg; | 126 | return reg; |
| 126 | } | 127 | } |
| @@ -587,9 +587,118 @@ bool dcn35_are_clock_states_equal(struct dc_clocks *a, · 586 unmodified lines | |||
| 587 | return true; | 587 | return true; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | static void dcn35_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass, | 590 | static void dcn35_save_clk_registers_internal(struct dcn35_clk_internal *internal, struct clk_mgr *clk_mgr_base) |
| 591 | { | ||
| 592 | struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base); | ||
| 593 | |||
| 594 | // read dtbclk | ||
| 595 | internal->CLK1_CLK4_CURRENT_CNT = REG_READ(CLK1_CLK4_CURRENT_CNT); | ||
| 596 | internal->CLK1_CLK4_BYPASS_CNTL = REG_READ(CLK1_CLK4_BYPASS_CNTL); | ||
| 597 | |||
| 598 | // read dcfclk | ||
| 599 | internal->CLK1_CLK3_CURRENT_CNT = REG_READ(CLK1_CLK3_CURRENT_CNT); | ||
| 600 | internal->CLK1_CLK3_BYPASS_CNTL = REG_READ(CLK1_CLK3_BYPASS_CNTL); | ||
| 601 | |||
| 602 | // read dcf deep sleep divider | ||
| 603 | internal->CLK1_CLK3_DS_CNTL = REG_READ(CLK1_CLK3_DS_CNTL); | ||
| 604 | internal->CLK1_CLK3_ALLOW_DS = REG_READ(CLK1_CLK3_ALLOW_DS); | ||
| 605 | |||
| 606 | // read dppclk | ||
| 607 | internal->CLK1_CLK1_CURRENT_CNT = REG_READ(CLK1_CLK1_CURRENT_CNT); | ||
| 608 | internal->CLK1_CLK1_BYPASS_CNTL = REG_READ(CLK1_CLK1_BYPASS_CNTL); | ||
| 609 | |||
| 610 | // read dprefclk | ||
| 611 | internal->CLK1_CLK2_CURRENT_CNT = REG_READ(CLK1_CLK2_CURRENT_CNT); | ||
| 612 | internal->CLK1_CLK2_BYPASS_CNTL = REG_READ(CLK1_CLK2_BYPASS_CNTL); | ||
| 613 | |||
| 614 | // read dispclk | ||
| 615 | internal->CLK1_CLK0_CURRENT_CNT = REG_READ(CLK1_CLK0_CURRENT_CNT); | ||
| 616 | internal->CLK1_CLK0_BYPASS_CNTL = REG_READ(CLK1_CLK0_BYPASS_CNTL); | ||
| 617 | } | ||
| 618 | |||
| 619 | static void dcn35_save_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass, | ||
| 591 | struct clk_mgr_dcn35 *clk_mgr) | 620 | struct clk_mgr_dcn35 *clk_mgr) |
| 592 | { | 621 | { |
| 622 | struct dcn35_clk_internal internal = {0}; | ||
| 623 | char *bypass_clks[5] = {"0x0 DFS", "0x1 REFCLK", "0x2 ERROR", "0x3 400 FCH", "0x4 600 FCH"}; | ||
| 624 | |||
| 625 | dcn35_save_clk_registers_internal(&internal, &clk_mgr->base.base); | ||
| 626 | |||
| 627 | regs_and_bypass->dcfclk = internal.CLK1_CLK3_CURRENT_CNT / 10; | ||
| 628 | regs_and_bypass->dcf_deep_sleep_divider = internal.CLK1_CLK3_DS_CNTL / 10; | ||
| 629 | regs_and_bypass->dcf_deep_sleep_allow = internal.CLK1_CLK3_ALLOW_DS; | ||
| 630 | regs_and_bypass->dprefclk = internal.CLK1_CLK2_CURRENT_CNT / 10; | ||
| 631 | regs_and_bypass->dispclk = internal.CLK1_CLK0_CURRENT_CNT / 10; | ||
| 632 | regs_and_bypass->dppclk = internal.CLK1_CLK1_CURRENT_CNT / 10; | ||
| 633 | regs_and_bypass->dtbclk = internal.CLK1_CLK4_CURRENT_CNT / 10; | ||
| 634 | |||
| 635 | regs_and_bypass->dppclk_bypass = internal.CLK1_CLK1_BYPASS_CNTL & 0x0007; | ||
| 636 | if (regs_and_bypass->dppclk_bypass < 0 || regs_and_bypass->dppclk_bypass > 4) | ||
| 637 | regs_and_bypass->dppclk_bypass = 0; | ||
| 638 | regs_and_bypass->dcfclk_bypass = internal.CLK1_CLK3_BYPASS_CNTL & 0x0007; | ||
| 639 | if (regs_and_bypass->dcfclk_bypass < 0 || regs_and_bypass->dcfclk_bypass > 4) | ||
| 640 | regs_and_bypass->dcfclk_bypass = 0; | ||
| 641 | regs_and_bypass->dispclk_bypass = internal.CLK1_CLK0_BYPASS_CNTL & 0x0007; | ||
| 642 | if (regs_and_bypass->dispclk_bypass < 0 || regs_and_bypass->dispclk_bypass > 4) | ||
| 643 | regs_and_bypass->dispclk_bypass = 0; | ||
| 644 | regs_and_bypass->dprefclk_bypass = internal.CLK1_CLK2_BYPASS_CNTL & 0x0007; | ||
| 645 | if (regs_and_bypass->dprefclk_bypass < 0 || regs_and_bypass->dprefclk_bypass > 4) | ||
| 646 | regs_and_bypass->dprefclk_bypass = 0; | ||
| 647 | |||
| 648 | if (clk_mgr->base.base.ctx->dc->debug.pstate_enabled) { | ||
| 649 | DC_LOG_SMU("clk_type,clk_value,deepsleep_cntl,deepsleep_allow,bypass\n"); | ||
| 650 | |||
| 651 | DC_LOG_SMU("dcfclk,%d,%d,%d,%s\n", | ||
| 652 | regs_and_bypass->dcfclk, | ||
| 653 | regs_and_bypass->dcf_deep_sleep_divider, | ||
| 654 | regs_and_bypass->dcf_deep_sleep_allow, | ||
| 655 | bypass_clks[(int) regs_and_bypass->dcfclk_bypass]); | ||
| 656 | |||
| 657 | DC_LOG_SMU("dprefclk,%d,N/A,N/A,%s\n", | ||
| 658 | regs_and_bypass->dprefclk, | ||
| 659 | bypass_clks[(int) regs_and_bypass->dprefclk_bypass]); | ||
| 660 | |||
| 661 | DC_LOG_SMU("dispclk,%d,N/A,N/A,%s\n", | ||
| 662 | regs_and_bypass->dispclk, | ||
| 663 | bypass_clks[(int) regs_and_bypass->dispclk_bypass]); | ||
| 664 | |||
| 665 | // REGISTER VALUES | ||
| 666 | DC_LOG_SMU("reg_name,value,clk_type"); | ||
| 667 | |||
| 668 | DC_LOG_SMU("CLK1_CLK3_CURRENT_CNT,%d,dcfclk", | ||
| 669 | internal.CLK1_CLK3_CURRENT_CNT); | ||
| 670 | |||
| 671 | DC_LOG_SMU("CLK1_CLK4_CURRENT_CNT,%d,dtbclk", | ||
| 672 | internal.CLK1_CLK4_CURRENT_CNT); | ||
| 673 | |||
| 674 | DC_LOG_SMU("CLK1_CLK3_DS_CNTL,%d,dcf_deep_sleep_divider", | ||
| 675 | internal.CLK1_CLK3_DS_CNTL); | ||
| 676 | |||
| 677 | DC_LOG_SMU("CLK1_CLK3_ALLOW_DS,%d,dcf_deep_sleep_allow", | ||
| 678 | internal.CLK1_CLK3_ALLOW_DS); | ||
| 679 | |||
| 680 | DC_LOG_SMU("CLK1_CLK2_CURRENT_CNT,%d,dprefclk", | ||
| 681 | internal.CLK1_CLK2_CURRENT_CNT); | ||
| 682 | |||
| 683 | DC_LOG_SMU("CLK1_CLK0_CURRENT_CNT,%d,dispclk", | ||
| 684 | internal.CLK1_CLK0_CURRENT_CNT); | ||
| 685 | |||
| 686 | DC_LOG_SMU("CLK1_CLK1_CURRENT_CNT,%d,dppclk", | ||
| 687 | internal.CLK1_CLK1_CURRENT_CNT); | ||
| 688 | |||
| 689 | DC_LOG_SMU("CLK1_CLK3_BYPASS_CNTL,%d,dcfclk_bypass", | ||
| 690 | internal.CLK1_CLK3_BYPASS_CNTL); | ||
| 691 | |||
| 692 | DC_LOG_SMU("CLK1_CLK2_BYPASS_CNTL,%d,dprefclk_bypass", | ||
| 693 | internal.CLK1_CLK2_BYPASS_CNTL); | ||
| 694 | |||
| 695 | DC_LOG_SMU("CLK1_CLK0_BYPASS_CNTL,%d,dispclk_bypass", | ||
| 696 | internal.CLK1_CLK0_BYPASS_CNTL); | ||
| 697 | |||
| 698 | DC_LOG_SMU("CLK1_CLK1_BYPASS_CNTL,%d,dppclk_bypass", | ||
| 699 | internal.CLK1_CLK1_BYPASS_CNTL); | ||
| 700 | |||
| 701 | } | ||
| 593 | } | 702 | } |
| 594 | 703 | ||
| 595 | static bool dcn35_is_spll_ssc_enabled(struct clk_mgr *clk_mgr_base) | 704 | static bool dcn35_is_spll_ssc_enabled(struct clk_mgr *clk_mgr_base) |
| @@ -623,6 +732,7 @@ static void init_clk_states(struct clk_mgr *clk_mgr) · 27 unmodified lines | |||
| 623 | void dcn35_init_clocks(struct clk_mgr *clk_mgr) | 732 | void dcn35_init_clocks(struct clk_mgr *clk_mgr) |
| 624 | { | 733 | { |
| 625 | struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); | 734 | struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); |
| 735 | struct clk_mgr_dcn35 *clk_mgr_dcn35 = TO_CLK_MGR_DCN35(clk_mgr_int); | ||
| 626 | 736 | ||
| 627 | init_clk_states(clk_mgr); | 737 | init_clk_states(clk_mgr); |
| 628 | 738 | ||
| @@ -633,6 +743,13 @@ void dcn35_init_clocks(struct clk_mgr *clk_mgr) · 4 unmodified lines | |||
| 633 | else | 743 | else |
| 634 | clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz; | 744 | clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz; |
| 635 | 745 | ||
| 746 | dcn35_save_clk_registers(&clk_mgr->boot_snapshot, clk_mgr_dcn35); | ||
| 747 | |||
| 748 | clk_mgr->clks.ref_dtbclk_khz = clk_mgr->boot_snapshot.dtbclk * 10; | ||
| 749 | if (clk_mgr->boot_snapshot.dtbclk > 59000) { | ||
| 750 | /*dtbclk enabled based on */ | ||
| 751 | clk_mgr->clks.dtbclk_en = true; | ||
| 752 | } | ||
| 636 | } | 753 | } |
| 637 | static struct clk_bw_params dcn35_bw_params = { | 754 | static struct clk_bw_params dcn35_bw_params = { |
| 638 | .vram_type = Ddr4MemType, | 755 | .vram_type = Ddr4MemType, |
| @@ -1323,7 +1440,7 @@ void dcn35_clk_mgr_construct( · 684 unmodified lines | |||
| 1323 | dcn35_bw_params.wm_table = ddr5_wm_table; | 1440 | dcn35_bw_params.wm_table = ddr5_wm_table; |
| 1324 | } | 1441 | } |
| 1325 | /* Saved clocks configured at boot for debug purposes */ | 1442 | /* Saved clocks configured at boot for debug purposes */ |
| 1326 | dcn35_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, clk_mgr); | 1443 | dcn35_save_clk_registers(&clk_mgr->base.base.boot_snapshot, clk_mgr); |
| 1327 | 1444 | ||
| 1328 | clk_mgr->base.base.dprefclk_khz = dcn35_smu_get_dprefclk(&clk_mgr->base); | 1445 | clk_mgr->base.base.dprefclk_khz = dcn35_smu_get_dprefclk(&clk_mgr->base); |
| 1329 | clk_mgr->base.base.clks.ref_dtbclk_khz = 600000; | 1446 | clk_mgr->base.base.clks.ref_dtbclk_khz = 600000; |
| @@ -162,7 +162,7 @@ static void dcn401_init_single_clock(struct clk_mgr_internal *clk_mgr, PPCLK_e c · 161 unmodified lines | |||
| 162 | unsigned int i; | 162 | unsigned int i; |
| 163 | char *entry_i = (char *)entry_0; | 163 | char *entry_i = (char *)entry_0; |
| 164 | 164 | ||
| 165 | uint32_t ret = dcn30_smu_get_dpm_freq_by_index(clk_mgr, clk, 0xFF); | 165 | uint32_t ret = dcn401_smu_get_dpm_freq_by_index(clk_mgr, clk, 0xFF); |
| 166 | 166 | ||
| 167 | if (ret & (1 << 31)) | 167 | if (ret & (1 << 31)) |
| 168 | /* fine-grained, only min and max */ | 168 | /* fine-grained, only min and max */ |
| @@ -174,7 +174,7 @@ static void dcn401_init_single_clock(struct clk_mgr_internal *clk_mgr, PPCLK_e c · 5 unmodified lines | |||
| 174 | 174 | ||
| 175 | /* if the initial message failed, num_levels will be 0 */ | 175 | /* if the initial message failed, num_levels will be 0 */ |
| 176 | for (i = 0; i < *num_levels && i < ARRAY_SIZE(clk_mgr->base.bw_params->clk_table.entries); i++) { | 176 | for (i = 0; i < *num_levels && i < ARRAY_SIZE(clk_mgr->base.bw_params->clk_table.entries); i++) { |
| 177 | *((unsigned int *)entry_i) = (dcn30_smu_get_dpm_freq_by_index(clk_mgr, clk, i) & 0xFFFF); | 177 | *((unsigned int *)entry_i) = (dcn401_smu_get_dpm_freq_by_index(clk_mgr, clk, i) & 0xFFFF); |
| 178 | entry_i += sizeof(clk_mgr->base.bw_params->clk_table.entries[0]); | 178 | entry_i += sizeof(clk_mgr->base.bw_params->clk_table.entries[0]); |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| @@ -231,20 +231,20 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 50 unmodified lines | |||
| 231 | clk_mgr->smu_present = false; | 231 | clk_mgr->smu_present = false; |
| 232 | clk_mgr->dpm_present = false; | 232 | clk_mgr->dpm_present = false; |
| 233 | 233 | ||
| 234 | if (!clk_mgr_base->force_smu_not_present && dcn30_smu_get_smu_version(clk_mgr, &clk_mgr->smu_ver)) | 234 | if (!clk_mgr_base->force_smu_not_present && dcn401_smu_get_smu_version(clk_mgr, &clk_mgr->smu_ver)) |
| 235 | clk_mgr->smu_present = true; | 235 | clk_mgr->smu_present = true; |
| 236 | 236 | ||
| 237 | if (!clk_mgr->smu_present) | 237 | if (!clk_mgr->smu_present) |
| 238 | return; | 238 | return; |
| 239 | 239 | ||
| 240 | dcn30_smu_check_driver_if_version(clk_mgr); | 240 | dcn401_smu_check_driver_if_version(clk_mgr); |
| 241 | dcn30_smu_check_msg_header_version(clk_mgr); | 241 | dcn401_smu_check_msg_header_version(clk_mgr); |
| 242 | 242 | ||
| 243 | /* DCFCLK */ | 243 | /* DCFCLK */ |
| 244 | dcn401_init_single_clock(clk_mgr, PPCLK_DCFCLK, | 244 | dcn401_init_single_clock(clk_mgr, PPCLK_DCFCLK, |
| 245 | &clk_mgr_base->bw_params->clk_table.entries[0].dcfclk_mhz, | 245 | &clk_mgr_base->bw_params->clk_table.entries[0].dcfclk_mhz, |
| 246 | &num_entries_per_clk->num_dcfclk_levels); | 246 | &num_entries_per_clk->num_dcfclk_levels); |
| 247 | clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DCFCLK); | 247 | clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DCFCLK); |
| 248 | if (num_entries_per_clk->num_dcfclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz == | 248 | if (num_entries_per_clk->num_dcfclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz == |
| 249 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dcfclk_levels - 1].dcfclk_mhz) | 249 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dcfclk_levels - 1].dcfclk_mhz) |
| 250 | clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = 0; | 250 | clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = 0; |
| @@ -253,7 +253,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 2 unmodified lines | |||
| 253 | dcn401_init_single_clock(clk_mgr, PPCLK_SOCCLK, | 253 | dcn401_init_single_clock(clk_mgr, PPCLK_SOCCLK, |
| 254 | &clk_mgr_base->bw_params->clk_table.entries[0].socclk_mhz, | 254 | &clk_mgr_base->bw_params->clk_table.entries[0].socclk_mhz, |
| 255 | &num_entries_per_clk->num_socclk_levels); | 255 | &num_entries_per_clk->num_socclk_levels); |
| 256 | clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_SOCCLK); | 256 | clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_SOCCLK); |
| 257 | if (num_entries_per_clk->num_socclk_levels && clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz == | 257 | if (num_entries_per_clk->num_socclk_levels && clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz == |
| 258 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_socclk_levels - 1].socclk_mhz) | 258 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_socclk_levels - 1].socclk_mhz) |
| 259 | clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = 0; | 259 | clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = 0; |
| @@ -263,7 +263,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 3 unmodified lines | |||
| 263 | dcn401_init_single_clock(clk_mgr, PPCLK_DTBCLK, | 263 | dcn401_init_single_clock(clk_mgr, PPCLK_DTBCLK, |
| 264 | &clk_mgr_base->bw_params->clk_table.entries[0].dtbclk_mhz, | 264 | &clk_mgr_base->bw_params->clk_table.entries[0].dtbclk_mhz, |
| 265 | &num_entries_per_clk->num_dtbclk_levels); | 265 | &num_entries_per_clk->num_dtbclk_levels); |
| 266 | clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DTBCLK); | 266 | clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DTBCLK); |
| 267 | if (num_entries_per_clk->num_dtbclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz == | 267 | if (num_entries_per_clk->num_dtbclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz == |
| 268 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dtbclk_levels - 1].dtbclk_mhz) | 268 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dtbclk_levels - 1].dtbclk_mhz) |
| 269 | clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = 0; | 269 | clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = 0; |
| @@ -273,7 +273,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 3 unmodified lines | |||
| 273 | dcn401_init_single_clock(clk_mgr, PPCLK_DISPCLK, | 273 | dcn401_init_single_clock(clk_mgr, PPCLK_DISPCLK, |
| 274 | &clk_mgr_base->bw_params->clk_table.entries[0].dispclk_mhz, | 274 | &clk_mgr_base->bw_params->clk_table.entries[0].dispclk_mhz, |
| 275 | &num_entries_per_clk->num_dispclk_levels); | 275 | &num_entries_per_clk->num_dispclk_levels); |
| 276 | clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DISPCLK); | 276 | clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DISPCLK); |
| 277 | if (num_entries_per_clk->num_dispclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz == | 277 | if (num_entries_per_clk->num_dispclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz == |
| 278 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dispclk_levels - 1].dispclk_mhz) | 278 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dispclk_levels - 1].dispclk_mhz) |
| 279 | clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = 0; | 279 | clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = 0; |
| @@ -1318,8 +1318,8 @@ static void dcn401_notify_wm_ranges(struct clk_mgr *clk_mgr_base) · 1038 unmodified lines | |||
| 1318 | table->Watermarks.WatermarkRow[i].WmSetting = i; | 1318 | table->Watermarks.WatermarkRow[i].WmSetting = i; |
| 1319 | table->Watermarks.WatermarkRow[i].Flags = clk_mgr->base.bw_params->wm_table.nv_entries[i].pmfw_breakdown.wm_type; | 1319 | table->Watermarks.WatermarkRow[i].Flags = clk_mgr->base.bw_params->wm_table.nv_entries[i].pmfw_breakdown.wm_type; |
| 1320 | } | 1320 | } |
| 1321 | dcn30_smu_set_dram_addr_high(clk_mgr, clk_mgr->wm_range_table_addr >> 32); | 1321 | dcn401_smu_set_dram_addr_high(clk_mgr, clk_mgr->wm_range_table_addr >> 32); |
| 1322 | dcn30_smu_set_dram_addr_low(clk_mgr, clk_mgr->wm_range_table_addr & 0xFFFFFFFF); | 1322 | dcn401_smu_set_dram_addr_low(clk_mgr, clk_mgr->wm_range_table_addr & 0xFFFFFFFF); |
| 1323 | dcn401_smu_transfer_wm_table_dram_2_smu(clk_mgr); | 1323 | dcn401_smu_transfer_wm_table_dram_2_smu(clk_mgr); |
| 1324 | } | 1324 | } |
| 1325 | 1325 | ||
| @@ -1390,7 +1390,7 @@ static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 64 unmodified lines | |||
| 1390 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz; | 1390 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz; |
| 1391 | } | 1391 | } |
| 1392 | 1392 | ||
| 1393 | clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK); | 1393 | clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK); |
| 1394 | if (num_entries_per_clk->num_memclk_levels && clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz == | 1394 | if (num_entries_per_clk->num_memclk_levels && clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz == |
| 1395 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz) | 1395 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz) |
| 1396 | clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = 0; | 1396 | clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = 0; |
| @@ -1399,7 +1399,7 @@ static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 2 unmodified lines | |||
| 1399 | dcn401_init_single_clock(clk_mgr, PPCLK_FCLK, | 1399 | dcn401_init_single_clock(clk_mgr, PPCLK_FCLK, |
| 1400 | &clk_mgr_base->bw_params->clk_table.entries[0].fclk_mhz, | 1400 | &clk_mgr_base->bw_params->clk_table.entries[0].fclk_mhz, |
| 1401 | &num_entries_per_clk->num_fclk_levels); | 1401 | &num_entries_per_clk->num_fclk_levels); |
| 1402 | clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_FCLK); | 1402 | clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_FCLK); |
| 1403 | if (num_entries_per_clk->num_fclk_levels && clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz == | 1403 | if (num_entries_per_clk->num_fclk_levels && clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz == |
| 1404 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_fclk_levels - 1].fclk_mhz) | 1404 | clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_fclk_levels - 1].fclk_mhz) |
| 1405 | clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = 0; | 1405 | clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = 0; |
| @@ -57,6 +57,8 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin · 56 unmodified lines | |||
| 57 | /* Wait for response register to be ready */ | 57 | /* Wait for response register to be ready */ |
| 58 | dcn401_smu_wait_for_response(clk_mgr, 10, 200000); | 58 | dcn401_smu_wait_for_response(clk_mgr, 10, 200000); |
| 59 | 59 | ||
| 60 | TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx); | ||
| 61 | |||
| 60 | /* Clear response register */ | 62 | /* Clear response register */ |
| 61 | REG_WRITE(DAL_RESP_REG, 0); | 63 | REG_WRITE(DAL_RESP_REG, 0); |
| 62 | 64 | ||
| @@ -71,9 +73,11 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin · 8 unmodified lines | |||
| 71 | if (param_out) | 73 | if (param_out) |
| 72 | *param_out = REG_READ(DAL_ARG_REG); | 74 | *param_out = REG_READ(DAL_ARG_REG); |
| 73 | 75 | ||
| 76 | TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx); | ||
| 74 | return true; | 77 | return true; |
| 75 | } | 78 | } |
| 76 | 79 | ||
| 80 | TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx); | ||
| 77 | return false; | 81 | return false; |
| 78 | } | 82 | } |
| 79 | 83 | ||
| @@ -102,8 +106,6 @@ static uint32_t dcn401_smu_wait_for_response_delay(struct clk_mgr_internal *clk_ · 22 unmodified lines | |||
| 102 | *total_delay_us += delay_us; | 106 | *total_delay_us += delay_us; |
| 103 | } while (max_retries--); | 107 | } while (max_retries--); |
| 104 | 108 | ||
| 105 | TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx); | ||
| 106 | |||
| 107 | return reg; | 109 | return reg; |
| 108 | } | 110 | } |
| 109 | 111 | ||
| @@ -115,6 +117,8 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg · 5 unmodified lines | |||
| 115 | /* Wait for response register to be ready */ | 117 | /* Wait for response register to be ready */ |
| 116 | dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay1_us); | 118 | dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay1_us); |
| 117 | 119 | ||
| 120 | TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx); | ||
| 121 | |||
| 118 | /* Clear response register */ | 122 | /* Clear response register */ |
| 119 | REG_WRITE(DAL_RESP_REG, 0); | 123 | REG_WRITE(DAL_RESP_REG, 0); |
| 120 | 124 | ||
| @@ -124,18 +128,71 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg · 3 unmodified lines | |||
| 124 | /* Trigger the message transaction by writing the message ID */ | 128 | /* Trigger the message transaction by writing the message ID */ |
| 125 | REG_WRITE(DAL_MSG_REG, msg_id); | 129 | REG_WRITE(DAL_MSG_REG, msg_id); |
| 126 | 130 | ||
| 127 | TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx); | ||
| 128 | |||
| 129 | /* Wait for response */ | 131 | /* Wait for response */ |
| 130 | if (dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay2_us) == DALSMC_Result_OK) { | 132 | if (dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay2_us) == DALSMC_Result_OK) { |
| 131 | if (param_out) | 133 | if (param_out) |
| 132 | *param_out = REG_READ(DAL_ARG_REG); | 134 | *param_out = REG_READ(DAL_ARG_REG); |
| 133 | 135 | ||
| 134 | *total_delay_us = delay1_us + delay2_us; | 136 | *total_delay_us = delay1_us + delay2_us; |
| 137 | TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx); | ||
| 135 | return true; | 138 | return true; |
| 136 | } | 139 | } |
| 137 | 140 | ||
| 138 | *total_delay_us = delay1_us + 2000000; | 141 | *total_delay_us = delay1_us + 2000000; |
| 142 | TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx); | ||
| 143 | return false; | ||
| 144 | } | ||
| 145 | |||
| 146 | bool dcn401_smu_get_smu_version(struct clk_mgr_internal *clk_mgr, unsigned int *version) | ||
| 147 | { | ||
| 148 | smu_print("SMU Get SMU version\n"); | ||
| 149 | |||
| 150 | if (dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 151 | DALSMC_MSG_GetSmuVersion, 0, version)) { | ||
| 152 | |||
| 153 | smu_print("SMU version: %d\n", *version); | ||
| 154 | |||
| 155 | return true; | ||
| 156 | } | ||
| 157 | |||
| 158 | return false; | ||
| 159 | } | ||
| 160 | |||
| 161 | /* Message output should match SMU11_DRIVER_IF_VERSION in smu11_driver_if.h */ | ||
| 162 | bool dcn401_smu_check_driver_if_version(struct clk_mgr_internal *clk_mgr) | ||
| 163 | { | ||
| 164 | uint32_t response = 0; | ||
| 165 | |||
| 166 | smu_print("SMU Check driver if version\n"); | ||
| 167 | |||
| 168 | if (dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 169 | DALSMC_MSG_GetDriverIfVersion, 0, &response)) { | ||
| 170 | |||
| 171 | smu_print("SMU driver if version: %d\n", response); | ||
| 172 | |||
| 173 | if (response == SMU14_DRIVER_IF_VERSION) | ||
| 174 | return true; | ||
| 175 | } | ||
| 176 | |||
| 177 | return false; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* Message output should match DALSMC_VERSION in dalsmc.h */ | ||
| 181 | bool dcn401_smu_check_msg_header_version(struct clk_mgr_internal *clk_mgr) | ||
| 182 | { | ||
| 183 | uint32_t response = 0; | ||
| 184 | |||
| 185 | smu_print("SMU Check msg header version\n"); | ||
| 186 | |||
| 187 | if (dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 188 | DALSMC_MSG_GetMsgHeaderVersion, 0, &response)) { | ||
| 189 | |||
| 190 | smu_print("SMU msg header version: %d\n", response); | ||
| 191 | |||
| 192 | if (response == DALSMC_VERSION) | ||
| 193 | return true; | ||
| 194 | } | ||
| 195 | |||
| 139 | return false; | 196 | return false; |
| 140 | } | 197 | } |
| 141 | 198 | ||
| @@ -163,6 +220,22 @@ void dcn401_smu_send_cab_for_uclk_message(struct clk_mgr_internal *clk_mgr, unsi · 21 unmodified lines | |||
| 163 | smu_print("Numways for SubVP : %d\n", num_ways); | 220 | smu_print("Numways for SubVP : %d\n", num_ways); |
| 164 | } | 221 | } |
| 165 | 222 | ||
| 223 | void dcn401_smu_set_dram_addr_high(struct clk_mgr_internal *clk_mgr, uint32_t addr_high) | ||
| 224 | { | ||
| 225 | smu_print("SMU Set DRAM addr high: %d\n", addr_high); | ||
| 226 | |||
| 227 | dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 228 | DALSMC_MSG_SetDalDramAddrHigh, addr_high, NULL); | ||
| 229 | } | ||
| 230 | |||
| 231 | void dcn401_smu_set_dram_addr_low(struct clk_mgr_internal *clk_mgr, uint32_t addr_low) | ||
| 232 | { | ||
| 233 | smu_print("SMU Set DRAM addr low: %d\n", addr_low); | ||
| 234 | |||
| 235 | dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 236 | DALSMC_MSG_SetDalDramAddrLow, addr_low, NULL); | ||
| 237 | } | ||
| 238 | |||
| 166 | void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr) | 239 | void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr) |
| 167 | { | 240 | { |
| 168 | smu_print("SMU Transfer WM table DRAM 2 SMU\n"); | 241 | smu_print("SMU Transfer WM table DRAM 2 SMU\n"); |
| @@ -348,3 +421,52 @@ unsigned int dcn401_smu_get_num_of_umc_channels(struct clk_mgr_internal *clk_mgr · 179 unmodified lines | |||
| 348 | 421 | ||
| 349 | return response; | 422 | return response; |
| 350 | } | 423 | } |
| 424 | |||
| 425 | /* | ||
| 426 | * Frequency in MHz returned in lower 16 bits for valid DPM level | ||
| 427 | * | ||
| 428 | * Call with dpm_level = 0xFF to query features, return value will be: | ||
| 429 | * Bits 7:0 - number of DPM levels | ||
| 430 | * Bit 28 - 1 = auto DPM on | ||
| 431 | * Bit 29 - 1 = sweep DPM on | ||
| 432 | * Bit 30 - 1 = forced DPM on | ||
| 433 | * Bit 31 - 0 = discrete, 1 = fine-grained | ||
| 434 | * | ||
| 435 | * With fine-grained DPM, only min and max frequencies will be reported | ||
| 436 | * | ||
| 437 | * Returns 0 on failure | ||
| 438 | */ | ||
| 439 | unsigned int dcn401_smu_get_dpm_freq_by_index(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint8_t dpm_level) | ||
| 440 | { | ||
| 441 | uint32_t response = 0; | ||
| 442 | |||
| 443 | /* bits 23:16 for clock type, lower 8 bits for DPM level */ | ||
| 444 | uint32_t param = (clk << 16) | dpm_level; | ||
| 445 | |||
| 446 | smu_print("SMU Get dpm freq by index: clk = %d, dpm_level = %d\n", clk, dpm_level); | ||
| 447 | |||
| 448 | dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 449 | DALSMC_MSG_GetDpmFreqByIndex, param, &response); | ||
| 450 | |||
| 451 | smu_print("SMU dpm freq: %d MHz\n", response); | ||
| 452 | |||
| 453 | return response; | ||
| 454 | } | ||
| 455 | |||
| 456 | /* Returns the max DPM frequency in DC mode in MHz, 0 on failure */ | ||
| 457 | unsigned int dcn401_smu_get_dc_mode_max_dpm_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk) | ||
| 458 | { | ||
| 459 | uint32_t response = 0; | ||
| 460 | |||
| 461 | /* bits 23:16 for clock type */ | ||
| 462 | uint32_t param = clk << 16; | ||
| 463 | |||
| 464 | smu_print("SMU Get DC mode max DPM freq: clk = %d\n", clk); | ||
| 465 | |||
| 466 | dcn401_smu_send_msg_with_param(clk_mgr, | ||
| 467 | DALSMC_MSG_GetDcModeMaxDpmFreq, param, &response); | ||
| 468 | |||
| 469 | smu_print("SMU DC mode max DMP freq: %d MHz\n", response); | ||
| 470 | |||
| 471 | return response; | ||
| 472 | } | ||
| @@ -7,11 +7,17 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include "os_types.h" | 8 | #include "os_types.h" |
| 9 | #include "core_types.h" | 9 | #include "core_types.h" |
| 10 | #include "dcn32/dcn32_clk_mgr_smu_msg.h" | ||
| 11 | 10 | ||
| 11 | struct clk_mgr_internal; | ||
| 12 | |||
| 13 | bool dcn401_smu_get_smu_version(struct clk_mgr_internal *clk_mgr, unsigned int *version); | ||
| 14 | bool dcn401_smu_check_driver_if_version(struct clk_mgr_internal *clk_mgr); | ||
| 15 | bool dcn401_smu_check_msg_header_version(struct clk_mgr_internal *clk_mgr); | ||
| 12 | void dcn401_smu_send_fclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support); | 16 | void dcn401_smu_send_fclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support); |
| 13 | void dcn401_smu_send_uclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support); | 17 | void dcn401_smu_send_uclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support); |
| 14 | void dcn401_smu_send_cab_for_uclk_message(struct clk_mgr_internal *clk_mgr, unsigned int num_ways); | 18 | void dcn401_smu_send_cab_for_uclk_message(struct clk_mgr_internal *clk_mgr, unsigned int num_ways); |
| 19 | void dcn401_smu_set_dram_addr_high(struct clk_mgr_internal *clk_mgr, uint32_t addr_high); | ||
| 20 | void dcn401_smu_set_dram_addr_low(struct clk_mgr_internal *clk_mgr, uint32_t addr_low); | ||
| 15 | void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr); | 21 | void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr); |
| 16 | void dcn401_smu_set_pme_workaround(struct clk_mgr_internal *clk_mgr); | 22 | void dcn401_smu_set_pme_workaround(struct clk_mgr_internal *clk_mgr); |
| 17 | unsigned int dcn401_smu_set_hard_min_by_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint16_t freq_mhz); | 23 | unsigned int dcn401_smu_set_hard_min_by_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint16_t freq_mhz); |
| @@ -29,5 +35,7 @@ bool dcn401_smu_set_subvp_uclk_fclk_hardmin(struct clk_mgr_internal *clk_mgr, · 11 unmodified lines | |||
| 29 | void dcn401_smu_set_min_deep_sleep_dcef_clk(struct clk_mgr_internal *clk_mgr, uint32_t freq_mhz); | 35 | void dcn401_smu_set_min_deep_sleep_dcef_clk(struct clk_mgr_internal *clk_mgr, uint32_t freq_mhz); |
| 30 | void dcn401_smu_set_num_of_displays(struct clk_mgr_internal *clk_mgr, uint32_t num_displays); | 36 | void dcn401_smu_set_num_of_displays(struct clk_mgr_internal *clk_mgr, uint32_t num_displays); |
| 31 | unsigned int dcn401_smu_get_num_of_umc_channels(struct clk_mgr_internal *clk_mgr); | 37 | unsigned int dcn401_smu_get_num_of_umc_channels(struct clk_mgr_internal *clk_mgr); |
| 38 | unsigned int dcn401_smu_get_dc_mode_max_dpm_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk); | ||
| 39 | unsigned int dcn401_smu_get_dpm_freq_by_index(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint8_t dpm_level); | ||
| 32 | 40 | ||
| 33 | #endif /* __DCN401_CLK_MGR_SMU_MSG_H_ */ | 41 | #endif /* __DCN401_CLK_MGR_SMU_MSG_H_ */ |
| @@ -460,7 +460,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc, · 459 unmodified lines | |||
| 460 | * avoid conflicting with firmware updates. | 460 | * avoid conflicting with firmware updates. |
| 461 | */ | 461 | */ |
| 462 | if (dc->ctx->dce_version > DCE_VERSION_MAX) { | 462 | if (dc->ctx->dce_version > DCE_VERSION_MAX) { |
| 463 | if ((dc->optimized_required || dc->wm_optimized_required) && | 463 | if (dc->optimized_required && |
| 464 | (stream->adjust.v_total_max != adjust->v_total_max || | 464 | (stream->adjust.v_total_max != adjust->v_total_max || |
| 465 | stream->adjust.v_total_min != adjust->v_total_min)) { | 465 | stream->adjust.v_total_min != adjust->v_total_min)) { |
| 466 | stream->adjust.timing_adjust_pending = true; | 466 | stream->adjust.timing_adjust_pending = true; |
| @@ -2577,7 +2577,6 @@ void dc_post_update_surfaces_to_stream(struct dc *dc) · 2110 unmodified lines | |||
| 2577 | } | 2577 | } |
| 2578 | 2578 | ||
| 2579 | dc->optimized_required = false; | 2579 | dc->optimized_required = false; |
| 2580 | dc->wm_optimized_required = false; | ||
| 2581 | } | 2580 | } |
| 2582 | 2581 | ||
| 2583 | bool dc_set_generic_gpio_for_stereo(bool enable, | 2582 | bool dc_set_generic_gpio_for_stereo(bool enable, |
| @@ -3056,8 +3055,6 @@ enum surface_update_type dc_check_update_surfaces_for_stream( · 472 unmodified lines | |||
| 3056 | } else if (memcmp(&dc->current_state->bw_ctx.bw.dcn.clk, &dc->clk_mgr->clks, offsetof(struct dc_clocks, prev_p_state_change_support)) != 0) { | 3055 | } else if (memcmp(&dc->current_state->bw_ctx.bw.dcn.clk, &dc->clk_mgr->clks, offsetof(struct dc_clocks, prev_p_state_change_support)) != 0) { |
| 3057 | dc->optimized_required = true; | 3056 | dc->optimized_required = true; |
| 3058 | } | 3057 | } |
| 3059 | |||
| 3060 | dc->optimized_required |= dc->wm_optimized_required; | ||
| 3061 | } | 3058 | } |
| 3062 | 3059 | ||
| 3063 | return type; | 3060 | return type; |
| @@ -3313,6 +3310,9 @@ static void copy_stream_update_to_stream(struct dc *dc, · 249 unmodified lines | |||
| 3313 | if (update->adaptive_sync_infopacket) | 3310 | if (update->adaptive_sync_infopacket) |
| 3314 | stream->adaptive_sync_infopacket = *update->adaptive_sync_infopacket; | 3311 | stream->adaptive_sync_infopacket = *update->adaptive_sync_infopacket; |
| 3315 | 3312 | ||
| 3313 | if (update->avi_infopacket) | ||
| 3314 | stream->avi_infopacket = *update->avi_infopacket; | ||
| 3315 | |||
| 3316 | if (update->dither_option) | 3316 | if (update->dither_option) |
| 3317 | stream->dither_option = *update->dither_option; | 3317 | stream->dither_option = *update->dither_option; |
| 3318 | 3318 | ||
| @@ -3607,7 +3607,8 @@ static void commit_planes_do_stream_update(struct dc *dc, · 288 unmodified lines | |||
| 3607 | stream_update->vsp_infopacket || | 3607 | stream_update->vsp_infopacket || |
| 3608 | stream_update->hfvsif_infopacket || | 3608 | stream_update->hfvsif_infopacket || |
| 3609 | stream_update->adaptive_sync_infopacket || | 3609 | stream_update->adaptive_sync_infopacket || |
| 3610 | stream_update->vtem_infopacket) { | 3610 | stream_update->vtem_infopacket || |
| 3611 | stream_update->avi_infopacket) { | ||
| 3611 | resource_build_info_frame(pipe_ctx); | 3612 | resource_build_info_frame(pipe_ctx); |
| 3612 | dc->hwss.update_info_frame(pipe_ctx); | 3613 | dc->hwss.update_info_frame(pipe_ctx); |
| 3613 | 3614 | ||
| @@ -5079,6 +5080,7 @@ static bool full_update_required(struct dc *dc, · 1465 unmodified lines | |||
| 5079 | stream_update->hfvsif_infopacket || | 5080 | stream_update->hfvsif_infopacket || |
| 5080 | stream_update->vtem_infopacket || | 5081 | stream_update->vtem_infopacket || |
| 5081 | stream_update->adaptive_sync_infopacket || | 5082 | stream_update->adaptive_sync_infopacket || |
| 5083 | stream_update->avi_infopacket || | ||
| 5082 | stream_update->dpms_off || | 5084 | stream_update->dpms_off || |
| 5083 | stream_update->allow_freesync || | 5085 | stream_update->allow_freesync || |
| 5084 | stream_update->vrr_active_variable || | 5086 | stream_update->vrr_active_variable || |
| @@ -4410,8 +4410,14 @@ static void set_avi_info_frame( · 4409 unmodified lines | |||
| 4410 | unsigned int fr_ind = pipe_ctx->stream->timing.fr_index; | 4410 | unsigned int fr_ind = pipe_ctx->stream->timing.fr_index; |
| 4411 | enum dc_timing_3d_format format; | 4411 | enum dc_timing_3d_format format; |
| 4412 | 4412 | ||
| 4413 | if (stream->avi_infopacket.valid) { | ||
| 4414 | *info_packet = stream->avi_infopacket; | ||
| 4415 | return; | ||
| 4416 | } | ||
| 4417 | |||
| 4413 | memset(&hdmi_info, 0, sizeof(union hdmi_info_packet)); | 4418 | memset(&hdmi_info, 0, sizeof(union hdmi_info_packet)); |
| 4414 | 4419 | ||
| 4420 | |||
| 4415 | color_space = pipe_ctx->stream->output_color_space; | 4421 | color_space = pipe_ctx->stream->output_color_space; |
| 4416 | if (color_space == COLOR_SPACE_UNKNOWN) | 4422 | if (color_space == COLOR_SPACE_UNKNOWN) |
| 4417 | color_space = (stream->timing.pixel_encoding == PIXEL_ENCODING_RGB) ? | 4423 | color_space = (stream->timing.pixel_encoding == PIXEL_ENCODING_RGB) ? |
| @@ -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.350" | 58 | #define DC_VER "3.2.351" |
| 59 | 59 | ||
| 60 | /** | 60 | /** |
| 61 | * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC | 61 | * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC |
| @@ -1163,6 +1163,7 @@ struct dc_debug_options { · 1101 unmodified lines | |||
| 1163 | unsigned int auxless_alpm_lfps_silence_ns; | 1163 | unsigned int auxless_alpm_lfps_silence_ns; |
| 1164 | unsigned int auxless_alpm_lfps_t1t2_us; | 1164 | unsigned int auxless_alpm_lfps_t1t2_us; |
| 1165 | short auxless_alpm_lfps_t1t2_offset_us; | 1165 | short auxless_alpm_lfps_t1t2_offset_us; |
| 1166 | bool disable_stutter_for_wm_program; | ||
| 1166 | }; | 1167 | }; |
| 1167 | 1168 | ||
| 1168 | 1169 | ||
| @@ -1391,7 +1392,6 @@ union surface_update_flags { · 222 unmodified lines | |||
| 1391 | uint32_t in_transfer_func_change:1; | 1392 | uint32_t in_transfer_func_change:1; |
| 1392 | uint32_t input_csc_change:1; | 1393 | uint32_t input_csc_change:1; |
| 1393 | uint32_t coeff_reduction_change:1; | 1394 | uint32_t coeff_reduction_change:1; |
| 1394 | uint32_t output_tf_change:1; | ||
| 1395 | uint32_t pixel_format_change:1; | 1395 | uint32_t pixel_format_change:1; |
| 1396 | uint32_t plane_size_change:1; | 1396 | uint32_t plane_size_change:1; |
| 1397 | uint32_t gamut_remap_change:1; | 1397 | uint32_t gamut_remap_change:1; |
| @@ -1735,7 +1735,6 @@ struct dc { · 337 unmodified lines | |||
| 1735 | 1735 | ||
| 1736 | /* Require to optimize clocks and bandwidth for added/removed planes */ | 1736 | /* Require to optimize clocks and bandwidth for added/removed planes */ |
| 1737 | bool optimized_required; | 1737 | bool optimized_required; |
| 1738 | bool wm_optimized_required; | ||
| 1739 | bool idle_optimizations_allowed; | 1738 | bool idle_optimizations_allowed; |
| 1740 | bool enable_c20_dtm_b0; | 1739 | bool enable_c20_dtm_b0; |
| 1741 | 1740 | ||
| @@ -203,6 +203,7 @@ struct dc_stream_state { · 202 unmodified lines | |||
| 203 | struct dc_info_packet hfvsif_infopacket; | 203 | struct dc_info_packet hfvsif_infopacket; |
| 204 | struct dc_info_packet vtem_infopacket; | 204 | struct dc_info_packet vtem_infopacket; |
| 205 | struct dc_info_packet adaptive_sync_infopacket; | 205 | struct dc_info_packet adaptive_sync_infopacket; |
| 206 | struct dc_info_packet avi_infopacket; | ||
| 206 | uint8_t dsc_packed_pps[128]; | 207 | uint8_t dsc_packed_pps[128]; |
| 207 | struct rect src; /* composition area */ | 208 | struct rect src; /* composition area */ |
| 208 | struct rect dst; /* stream addressable area */ | 209 | struct rect dst; /* stream addressable area */ |
| @@ -335,6 +336,8 @@ struct dc_stream_update { · 126 unmodified lines | |||
| 335 | struct dc_info_packet *hfvsif_infopacket; | 336 | struct dc_info_packet *hfvsif_infopacket; |
| 336 | struct dc_info_packet *vtem_infopacket; | 337 | struct dc_info_packet *vtem_infopacket; |
| 337 | struct dc_info_packet *adaptive_sync_infopacket; | 338 | struct dc_info_packet *adaptive_sync_infopacket; |
| 339 | struct dc_info_packet *avi_infopacket; | ||
| 340 | |||
| 338 | bool *dpms_off; | 341 | bool *dpms_off; |
| 339 | bool integer_scaling_update; | 342 | bool integer_scaling_update; |
| 340 | bool *allow_freesync; | 343 | bool *allow_freesync; |
| @@ -1217,6 +1217,7 @@ struct dc_panel_config { · 1216 unmodified lines | |||
| 1217 | bool rc_disable; | 1217 | bool rc_disable; |
| 1218 | bool rc_allow_static_screen; | 1218 | bool rc_allow_static_screen; |
| 1219 | bool rc_allow_fullscreen_VPB; | 1219 | bool rc_allow_fullscreen_VPB; |
| 1220 | bool read_psrcap_again; | ||
| 1220 | unsigned int replay_enable_option; | 1221 | unsigned int replay_enable_option; |
| 1221 | } psr; | 1222 | } psr; |
| 1222 | /* ABM */ | 1223 | /* ABM */ |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | |||
| 39 | 39 | ||
| 40 | #define CTX \ | 40 | #define CTX \ |
| 41 | dccg_dcn->base.ctx | 41 | dccg_dcn->base.ctx |
| 42 | #include "logger_types.h" | ||
| 42 | #define DC_LOGGER \ | 43 | #define DC_LOGGER \ |
| 43 | dccg->ctx->logger | 44 | dccg->ctx->logger |
| 44 | 45 | ||
| @@ -1136,7 +1137,7 @@ static void dcn35_set_dppclk_enable(struct dccg *dccg, · 1091 unmodified lines | |||
| 1136 | default: | 1137 | default: |
| 1137 | break; | 1138 | break; |
| 1138 | } | 1139 | } |
| 1139 | //DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable); | 1140 | DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable); |
| 1140 | 1141 | ||
| 1141 | } | 1142 | } |
| 1142 | 1143 | ||
| @@ -1406,6 +1407,10 @@ static void dccg35_set_dtbclk_dto( · 263 unmodified lines | |||
| 1406 | * PIPEx_DTO_SRC_SEL should not be programmed during DTBCLK update since OTG may still be on, and the | 1407 | * PIPEx_DTO_SRC_SEL should not be programmed during DTBCLK update since OTG may still be on, and the |
| 1407 | * programming is handled in program_pix_clk() regardless, so it can be removed from here. | 1408 | * programming is handled in program_pix_clk() regardless, so it can be removed from here. |
| 1408 | */ | 1409 | */ |
| 1410 | DC_LOG_DEBUG("%s: OTG%d DTBCLK DTO enabled: pixclk_khz=%d, ref_dtbclk_khz=%d, req_dtbclk_khz=%d, phase=%d, modulo=%d\n", | ||
| 1411 | __func__, params->otg_inst, params->pixclk_khz, | ||
| 1412 | params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo); | ||
| 1413 | |||
| 1409 | } else { | 1414 | } else { |
| 1410 | switch (params->otg_inst) { | 1415 | switch (params->otg_inst) { |
| 1411 | case 0: | 1416 | case 0: |
| @@ -1431,6 +1436,8 @@ static void dccg35_set_dtbclk_dto( · 19 unmodified lines | |||
| 1431 | 1436 | ||
| 1432 | REG_WRITE(DTBCLK_DTO_MODULO[params->otg_inst], 0); | 1437 | REG_WRITE(DTBCLK_DTO_MODULO[params->otg_inst], 0); |
| 1433 | REG_WRITE(DTBCLK_DTO_PHASE[params->otg_inst], 0); | 1438 | REG_WRITE(DTBCLK_DTO_PHASE[params->otg_inst], 0); |
| 1439 | |||
| 1440 | DC_LOG_DEBUG("%s: OTG%d DTBCLK DTO disabled\n", __func__, params->otg_inst); | ||
| 1434 | } | 1441 | } |
| 1435 | } | 1442 | } |
| 1436 | 1443 | ||
| @@ -1475,6 +1482,8 @@ static void dccg35_set_dpstreamclk( · 38 unmodified lines | |||
| 1475 | BREAK_TO_DEBUGGER(); | 1482 | BREAK_TO_DEBUGGER(); |
| 1476 | return; | 1483 | return; |
| 1477 | } | 1484 | } |
| 1485 | DC_LOG_DEBUG("%s: dp_hpo_inst(%d) DPSTREAMCLK_EN = %d, DPSTREAMCLK_SRC_SEL = %d\n", | ||
| 1486 | __func__, dp_hpo_inst, (src == REFCLK) ? 0 : 1, otg_inst); | ||
| 1478 | } | 1487 | } |
| 1479 | 1488 | ||
| 1480 | 1489 | ||
| @@ -1514,6 +1523,8 @@ static void dccg35_set_dpstreamclk_root_clock_gating( · 33 unmodified lines | |||
| 1514 | BREAK_TO_DEBUGGER(); | 1523 | BREAK_TO_DEBUGGER(); |
| 1515 | return; | 1524 | return; |
| 1516 | } | 1525 | } |
| 1526 | DC_LOG_DEBUG("%s: dp_hpo_inst(%d) DPSTREAMCLK_ROOT_GATE_DISABLE = %d\n", | ||
| 1527 | __func__, dp_hpo_inst, enable ? 1 : 0); | ||
| 1517 | } | 1528 | } |
| 1518 | 1529 | ||
| 1519 | 1530 | ||
| @@ -1553,7 +1564,7 @@ static void dccg35_set_physymclk_root_clock_gating( · 33 unmodified lines | |||
| 1553 | BREAK_TO_DEBUGGER(); | 1564 | BREAK_TO_DEBUGGER(); |
| 1554 | return; | 1565 | return; |
| 1555 | } | 1566 | } |
| 1556 | //DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE:\n", __func__, phy_inst, enable ? 0 : 1); | 1567 | DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE: %d\n", __func__, phy_inst, enable ? 0 : 1); |
| 1557 | 1568 | ||
| 1558 | } | 1569 | } |
| 1559 | 1570 | ||
| @@ -1626,6 +1637,8 @@ static void dccg35_set_physymclk( · 66 unmodified lines | |||
| 1626 | BREAK_TO_DEBUGGER(); | 1637 | BREAK_TO_DEBUGGER(); |
| 1627 | return; | 1638 | return; |
| 1628 | } | 1639 | } |
| 1640 | DC_LOG_DEBUG("%s: phy_inst(%d) PHYxSYMCLK_EN = %d, PHYxSYMCLK_SRC_SEL = %d\n", | ||
| 1641 | __func__, phy_inst, force_enable ? 1 : 0, clk_src); | ||
| 1629 | } | 1642 | } |
| 1630 | 1643 | ||
| 1631 | static void dccg35_set_valid_pixel_rate( | 1644 | static void dccg35_set_valid_pixel_rate( |
| @@ -1673,6 +1686,7 @@ static void dccg35_dpp_root_clock_control( · 41 unmodified lines | |||
| 1673 | } | 1686 | } |
| 1674 | 1687 | ||
| 1675 | dccg->dpp_clock_gated[dpp_inst] = !clock_on; | 1688 | dccg->dpp_clock_gated[dpp_inst] = !clock_on; |
| 1689 | DC_LOG_DEBUG("%s: dpp_inst(%d) clock_on = %d\n", __func__, dpp_inst, clock_on); | ||
| 1676 | } | 1690 | } |
| 1677 | 1691 | ||
| 1678 | static void dccg35_disable_symclk32_se( | 1692 | static void dccg35_disable_symclk32_se( |
| @@ -1731,6 +1745,7 @@ static void dccg35_disable_symclk32_se( · 52 unmodified lines | |||
| 1731 | BREAK_TO_DEBUGGER(); | 1745 | BREAK_TO_DEBUGGER(); |
| 1732 | return; | 1746 | return; |
| 1733 | } | 1747 | } |
| 1748 | |||
| 1734 | } | 1749 | } |
| 1735 | 1750 | ||
| 1736 | static void dccg35_init_cb(struct dccg *dccg) | 1751 | static void dccg35_init_cb(struct dccg *dccg) |
| @@ -1738,7 +1753,6 @@ static void dccg35_init_cb(struct dccg *dccg) · 1 unmodified line | |||
| 1738 | (void)dccg; | 1753 | (void)dccg; |
| 1739 | /* Any RCG should be done when driver enter low power mode*/ | 1754 | /* Any RCG should be done when driver enter low power mode*/ |
| 1740 | } | 1755 | } |
| 1741 | |||
| 1742 | void dccg35_init(struct dccg *dccg) | 1756 | void dccg35_init(struct dccg *dccg) |
| 1743 | { | 1757 | { |
| 1744 | int otg_inst; | 1758 | int otg_inst; |
| @@ -1753,6 +1767,8 @@ void dccg35_init(struct dccg *dccg) · 8 unmodified lines | |||
| 1753 | for (otg_inst = 0; otg_inst < 2; otg_inst++) { | 1767 | for (otg_inst = 0; otg_inst < 2; otg_inst++) { |
| 1754 | dccg31_disable_symclk32_le(dccg, otg_inst); | 1768 | dccg31_disable_symclk32_le(dccg, otg_inst); |
| 1755 | dccg31_set_symclk32_le_root_clock_gating(dccg, otg_inst, false); | 1769 | dccg31_set_symclk32_le_root_clock_gating(dccg, otg_inst, false); |
| 1770 | DC_LOG_DEBUG("%s: OTG%d SYMCLK32_LE disabled and root clock gating disabled\n", | ||
| 1771 | __func__, otg_inst); | ||
| 1756 | } | 1772 | } |
| 1757 | 1773 | ||
| 1758 | // if (dccg->ctx->dc->debug.root_clock_optimization.bits.symclk32_se) | 1774 | // if (dccg->ctx->dc->debug.root_clock_optimization.bits.symclk32_se) |
| @@ -1765,6 +1781,8 @@ void dccg35_init(struct dccg *dccg) · 6 unmodified lines | |||
| 1765 | dccg35_set_dpstreamclk(dccg, REFCLK, otg_inst, | 1781 | dccg35_set_dpstreamclk(dccg, REFCLK, otg_inst, |
| 1766 | otg_inst); | 1782 | otg_inst); |
| 1767 | dccg35_set_dpstreamclk_root_clock_gating(dccg, otg_inst, false); | 1783 | dccg35_set_dpstreamclk_root_clock_gating(dccg, otg_inst, false); |
| 1784 | DC_LOG_DEBUG("%s: OTG%d DPSTREAMCLK disabled and root clock gating disabled\n", | ||
| 1785 | __func__, otg_inst); | ||
| 1768 | } | 1786 | } |
| 1769 | 1787 | ||
| 1770 | /* | 1788 | /* |
| @@ -169,6 +169,7 @@ static bool dmub_replay_copy_settings(struct dmub_replay *dmub, · 168 unmodified lines | |||
| 169 | copy_settings_data->max_deviation_line = link->dpcd_caps.pr_info.max_deviation_line; | 169 | copy_settings_data->max_deviation_line = link->dpcd_caps.pr_info.max_deviation_line; |
| 170 | copy_settings_data->smu_optimizations_en = link->replay_settings.replay_smu_opt_enable; | 170 | copy_settings_data->smu_optimizations_en = link->replay_settings.replay_smu_opt_enable; |
| 171 | copy_settings_data->replay_timing_sync_supported = link->replay_settings.config.replay_timing_sync_supported; | 171 | copy_settings_data->replay_timing_sync_supported = link->replay_settings.config.replay_timing_sync_supported; |
| 172 | copy_settings_data->replay_support_fast_resync_in_ultra_sleep_mode = link->replay_settings.config.replay_support_fast_resync_in_ultra_sleep_mode; | ||
| 172 | 173 | ||
| 173 | copy_settings_data->debug.bitfields.enable_ips_visual_confirm = dc->dc->debug.enable_ips_visual_confirm; | 174 | copy_settings_data->debug.bitfields.enable_ips_visual_confirm = dc->dc->debug.enable_ips_visual_confirm; |
| 174 | 175 | ||
| @@ -277,12 +277,13 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc · 276 unmodified lines | |||
| 277 | /* | 277 | /* |
| 278 | * SMU message tracing | 278 | * SMU message tracing |
| 279 | */ | 279 | */ |
| 280 | void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx); | 280 | void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx); |
| 281 | void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx); | 281 | void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx); |
| 282 | |||
| 283 | #define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_msg(msg_id, param_in, ctx) | ||
| 284 | #define TRACE_SMU_DELAY(response_delay, ctx) dm_trace_smu_delay(response_delay, ctx) | ||
| 285 | 282 | ||
| 283 | #define TRACE_SMU_MSG_DELAY(msg_id, param_in, delay, ctx) dm_trace_smu_enter(msg_id, param_in, delay, ctx) | ||
| 284 | #define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx) | ||
| 285 | #define TRACE_SMU_MSG_ENTER(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx) | ||
| 286 | #define TRACE_SMU_MSG_EXIT(success, response, ctx) dm_trace_smu_exit(success, response, ctx) | ||
| 286 | 287 | ||
| 287 | /* | 288 | /* |
| 288 | * DMUB Interfaces | 289 | * DMUB Interfaces |
| @@ -48,18 +48,19 @@ static void set_reserved_time_on_all_planes_with_stream_index(struct display_con · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | static void remove_duplicates(double *list_a, int *list_a_size) | 49 | static void remove_duplicates(double *list_a, int *list_a_size) |
| 50 | { | 50 | { |
| 51 | int cur_element = 0; | 51 | int j = 0; |
| 52 | // For all elements b[i] in list_b[] | 52 | |
| 53 | while (cur_element < *list_a_size - 1) { | 53 | if (*list_a_size == 0) |
| 54 | if (list_a[cur_element] == list_a[cur_element + 1]) { | 54 | return; |
| 55 | for (int j = cur_element + 1; j < *list_a_size - 1; j++) { | 55 | |
| 56 | list_a[j] = list_a[j + 1]; | 56 | for (int i = 1; i < *list_a_size; i++) { |
| 57 | } | 57 | if (list_a[j] != list_a[i]) { |
| 58 | *list_a_size = *list_a_size - 1; | 58 | j++; |
| 59 | } else { | 59 | list_a[j] = list_a[i]; |
| 60 | cur_element++; | ||
| 61 | } | 60 | } |
| 62 | } | 61 | } |
| 62 | |||
| 63 | *list_a_size = j + 1; | ||
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | static bool increase_mpc_combine_factor(unsigned int *mpc_combine_factor, unsigned int limit) | 66 | static bool increase_mpc_combine_factor(unsigned int *mpc_combine_factor, unsigned int limit) |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "dcn32_hubbub.h" | 28 | #include "dcn32_hubbub.h" |
| 29 | #include "dm_services.h" | 29 | #include "dm_services.h" |
| 30 | #include "reg_helper.h" | 30 | #include "reg_helper.h" |
| 31 | #include "dal_asic_id.h" | ||
| 31 | 32 | ||
| 32 | 33 | ||
| 33 | #define CTX \ | 34 | #define CTX \ |
| @@ -72,6 +73,14 @@ static void dcn32_init_crb(struct hubbub *hubbub) · 38 unmodified lines | |||
| 72 | REG_UPDATE(DCHUBBUB_DEBUG_CTRL_0, DET_DEPTH, 0x47F); | 73 | REG_UPDATE(DCHUBBUB_DEBUG_CTRL_0, DET_DEPTH, 0x47F); |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 76 | static void hubbub32_set_sdp_control(struct hubbub *hubbub, bool dc_control) | ||
| 77 | { | ||
| 78 | struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub); | ||
| 79 | |||
| 80 | REG_UPDATE(DCHUBBUB_SDPIF_CFG0, | ||
| 81 | SDPIF_PORT_CONTROL, dc_control); | ||
| 82 | } | ||
| 83 | |||
| 75 | void hubbub32_set_request_limit(struct hubbub *hubbub, int memory_channel_count, int words_per_channel) | 84 | void hubbub32_set_request_limit(struct hubbub *hubbub, int memory_channel_count, int words_per_channel) |
| 76 | { | 85 | { |
| 77 | struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub); | 86 | struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub); |
| @@ -754,8 +763,18 @@ static bool hubbub32_program_watermarks( · 676 unmodified lines | |||
| 754 | unsigned int refclk_mhz, | 763 | unsigned int refclk_mhz, |
| 755 | bool safe_to_lower) | 764 | bool safe_to_lower) |
| 756 | { | 765 | { |
| 766 | struct dc *dc = hubbub->ctx->dc; | ||
| 757 | bool wm_pending = false; | 767 | bool wm_pending = false; |
| 758 | 768 | ||
| 769 | if (!safe_to_lower && dc->debug.disable_stutter_for_wm_program && | ||
| 770 | (ASICREV_IS_GC_11_0_0(dc->ctx->asic_id.hw_internal_rev) || | ||
| 771 | ASICREV_IS_GC_11_0_3(dc->ctx->asic_id.hw_internal_rev))) { | ||
| 772 | /* before raising watermarks, SDP control give to DF, stutter must be disabled */ | ||
| 773 | wm_pending = true; | ||
| 774 | hubbub32_set_sdp_control(hubbub, false); | ||
| 775 | hubbub1_allow_self_refresh_control(hubbub, false); | ||
| 776 | } | ||
| 777 | |||
| 759 | if (hubbub32_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower)) | 778 | if (hubbub32_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower)) |
| 760 | wm_pending = true; | 779 | wm_pending = true; |
| 761 | 780 | ||
| @@ -786,10 +805,20 @@ static bool hubbub32_program_watermarks( · 24 unmodified lines | |||
| 786 | REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND, | 805 | REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND, |
| 787 | DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/ | 806 | DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/ |
| 788 | 807 | ||
| 789 | if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter) | 808 | if (safe_to_lower) { |
| 790 | hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter); | 809 | /* after lowering watermarks, stutter setting is restored, SDP control given to DC */ |
| 810 | hubbub1_allow_self_refresh_control(hubbub, !dc->debug.disable_stutter); | ||
| 811 | |||
| 812 | if (dc->debug.disable_stutter_for_wm_program && | ||
| 813 | (ASICREV_IS_GC_11_0_0(dc->ctx->asic_id.hw_internal_rev) || | ||
| 814 | ASICREV_IS_GC_11_0_3(dc->ctx->asic_id.hw_internal_rev))) { | ||
| 815 | hubbub32_set_sdp_control(hubbub, true); | ||
| 816 | } | ||
| 817 | } else if (dc->debug.disable_stutter) { | ||
| 818 | hubbub1_allow_self_refresh_control(hubbub, !dc->debug.disable_stutter); | ||
| 819 | } | ||
| 791 | 820 | ||
| 792 | hubbub32_force_usr_retraining_allow(hubbub, hubbub->ctx->dc->debug.force_usr_allow); | 821 | hubbub32_force_usr_retraining_allow(hubbub, dc->debug.force_usr_allow); |
| 793 | 822 | ||
| 794 | return wm_pending; | 823 | return wm_pending; |
| 795 | } | 824 | } |
| @@ -974,8 +1003,7 @@ void hubbub32_init(struct hubbub *hubbub) · 178 unmodified lines | |||
| 974 | ignore the "df_pre_cstate_req" from the SDP port control. | 1003 | ignore the "df_pre_cstate_req" from the SDP port control. |
| 975 | only the DCN will determine when to connect the SDP port | 1004 | only the DCN will determine when to connect the SDP port |
| 976 | */ | 1005 | */ |
| 977 | REG_UPDATE(DCHUBBUB_SDPIF_CFG0, | 1006 | hubbub32_set_sdp_control(hubbub, true); |
| 978 | SDPIF_PORT_CONTROL, 1); | ||
| 979 | /*Set SDP's max outstanding request to 512 | 1007 | /*Set SDP's max outstanding request to 512 |
| 980 | must set the register back to 0 (max outstanding = 256) in zero frame buffer mode*/ | 1008 | must set the register back to 0 (max outstanding = 256) in zero frame buffer mode*/ |
| 981 | REG_UPDATE(DCHUBBUB_SDPIF_CFG1, | 1009 | REG_UPDATE(DCHUBBUB_SDPIF_CFG1, |
| @@ -3347,7 +3347,7 @@ void dcn10_prepare_bandwidth( · 3346 unmodified lines | |||
| 3347 | context, | 3347 | context, |
| 3348 | false); | 3348 | false); |
| 3349 | 3349 | ||
| 3350 | dc->wm_optimized_required = hubbub->funcs->program_watermarks(hubbub, | 3350 | dc->optimized_required = hubbub->funcs->program_watermarks(hubbub, |
| 3351 | &context->bw_ctx.bw.dcn.watermarks, | 3351 | &context->bw_ctx.bw.dcn.watermarks, |
| 3352 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, | 3352 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, |
| 3353 | true); | 3353 | true); |
| @@ -1982,10 +1982,8 @@ static void dcn20_program_pipe( · 1981 unmodified lines | |||
| 1982 | * updating on slave planes | 1982 | * updating on slave planes |
| 1983 | */ | 1983 | */ |
| 1984 | if (pipe_ctx->update_flags.bits.enable || | 1984 | if (pipe_ctx->update_flags.bits.enable || |
| 1985 | pipe_ctx->update_flags.bits.plane_changed || | 1985 | pipe_ctx->update_flags.bits.plane_changed || |
| 1986 | pipe_ctx->stream->update_flags.bits.out_tf || | 1986 | pipe_ctx->stream->update_flags.bits.out_tf) |
| 1987 | (pipe_ctx->plane_state && | ||
| 1988 | pipe_ctx->plane_state->update_flags.bits.output_tf_change)) | ||
| 1989 | hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream); | 1987 | hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream); |
| 1990 | 1988 | ||
| 1991 | /* If the pipe has been enabled or has a different opp, we | 1989 | /* If the pipe has been enabled or has a different opp, we |
| @@ -2390,10 +2388,10 @@ void dcn20_prepare_bandwidth( · 398 unmodified lines | |||
| 2390 | } | 2388 | } |
| 2391 | 2389 | ||
| 2392 | /* program dchubbub watermarks: | 2390 | /* program dchubbub watermarks: |
| 2393 | * For assigning wm_optimized_required, use |= operator since we don't want | 2391 | * For assigning optimized_required, use |= operator since we don't want |
| 2394 | * to clear the value if the optimize has not happened yet | 2392 | * to clear the value if the optimize has not happened yet |
| 2395 | */ | 2393 | */ |
| 2396 | dc->wm_optimized_required |= hubbub->funcs->program_watermarks(hubbub, | 2394 | dc->optimized_required |= hubbub->funcs->program_watermarks(hubbub, |
| 2397 | &context->bw_ctx.bw.dcn.watermarks, | 2395 | &context->bw_ctx.bw.dcn.watermarks, |
| 2398 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, | 2396 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, |
| 2399 | false); | 2397 | false); |
| @@ -2406,10 +2404,10 @@ void dcn20_prepare_bandwidth( · 6 unmodified lines | |||
| 2406 | if (hubbub->funcs->program_compbuf_size) { | 2404 | if (hubbub->funcs->program_compbuf_size) { |
| 2407 | if (context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes) { | 2405 | if (context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes) { |
| 2408 | compbuf_size_kb = context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes; | 2406 | compbuf_size_kb = context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes; |
| 2409 | dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.dml.ip.min_comp_buffer_size_kbytes); | 2407 | dc->optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.dml.ip.min_comp_buffer_size_kbytes); |
| 2410 | } else { | 2408 | } else { |
| 2411 | compbuf_size_kb = context->bw_ctx.bw.dcn.compbuf_size_kb; | 2409 | compbuf_size_kb = context->bw_ctx.bw.dcn.compbuf_size_kb; |
| 2412 | dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.bw.dcn.compbuf_size_kb); | 2410 | dc->optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.bw.dcn.compbuf_size_kb); |
| 2413 | } | 2411 | } |
| 2414 | 2412 | ||
| 2415 | hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, false); | 2413 | hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, false); |
| @@ -3131,7 +3129,8 @@ void dcn20_fpga_init_hw(struct dc *dc) · 715 unmodified lines | |||
| 3131 | res_pool->dccg->funcs->dccg_init(res_pool->dccg); | 3129 | res_pool->dccg->funcs->dccg_init(res_pool->dccg); |
| 3132 | 3130 | ||
| 3133 | //Enable ability to power gate / don't force power on permanently | 3131 | //Enable ability to power gate / don't force power on permanently |
| 3134 | hws->funcs.enable_power_gating_plane(hws, true); | 3132 | if (hws->funcs.enable_power_gating_plane) |
| 3133 | hws->funcs.enable_power_gating_plane(hws, true); | ||
| 3135 | 3134 | ||
| 3136 | // Specific to FPGA dccg and registers | 3135 | // Specific to FPGA dccg and registers |
| 3137 | REG_WRITE(RBBMIF_TIMEOUT_DIS, 0xFFFFFFFF); | 3136 | REG_WRITE(RBBMIF_TIMEOUT_DIS, 0xFFFFFFFF); |
| @@ -1383,22 +1383,22 @@ void dcn401_prepare_bandwidth(struct dc *dc, · 1382 unmodified lines | |||
| 1383 | false); | 1383 | false); |
| 1384 | 1384 | ||
| 1385 | /* program dchubbub watermarks: | 1385 | /* program dchubbub watermarks: |
| 1386 | * For assigning wm_optimized_required, use |= operator since we don't want | 1386 | * For assigning optimized_required, use |= operator since we don't want |
| 1387 | * to clear the value if the optimize has not happened yet | 1387 | * to clear the value if the optimize has not happened yet |
| 1388 | */ | 1388 | */ |
| 1389 | dc->wm_optimized_required |= hubbub->funcs->program_watermarks(hubbub, | 1389 | dc->optimized_required |= hubbub->funcs->program_watermarks(hubbub, |
| 1390 | &context->bw_ctx.bw.dcn.watermarks, | 1390 | &context->bw_ctx.bw.dcn.watermarks, |
| 1391 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, | 1391 | dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, |
| 1392 | false); | 1392 | false); |
| 1393 | /* update timeout thresholds */ | 1393 | /* update timeout thresholds */ |
| 1394 | if (hubbub->funcs->program_arbiter) { | 1394 | if (hubbub->funcs->program_arbiter) { |
| 1395 | dc->wm_optimized_required |= hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, false); | 1395 | dc->optimized_required |= hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, false); |
| 1396 | } | 1396 | } |
| 1397 | 1397 | ||
| 1398 | /* decrease compbuf size */ | 1398 | /* decrease compbuf size */ |
| 1399 | if (hubbub->funcs->program_compbuf_segments) { | 1399 | if (hubbub->funcs->program_compbuf_segments) { |
| 1400 | compbuf_size = context->bw_ctx.bw.dcn.arb_regs.compbuf_size; | 1400 | compbuf_size = context->bw_ctx.bw.dcn.arb_regs.compbuf_size; |
| 1401 | dc->wm_optimized_required |= (compbuf_size != dc->current_state->bw_ctx.bw.dcn.arb_regs.compbuf_size); | 1401 | dc->optimized_required |= (compbuf_size != dc->current_state->bw_ctx.bw.dcn.arb_regs.compbuf_size); |
| 1402 | 1402 | ||
| 1403 | hubbub->funcs->program_compbuf_segments(hubbub, compbuf_size, false); | 1403 | hubbub->funcs->program_compbuf_segments(hubbub, compbuf_size, false); |
| 1404 | } | 1404 | } |
| @@ -2032,10 +2032,8 @@ void dcn401_program_pipe( · 627 unmodified lines | |||
| 2032 | * updating on slave planes | 2032 | * updating on slave planes |
| 2033 | */ | 2033 | */ |
| 2034 | if (pipe_ctx->update_flags.bits.enable || | 2034 | if (pipe_ctx->update_flags.bits.enable || |
| 2035 | pipe_ctx->update_flags.bits.plane_changed || | 2035 | pipe_ctx->update_flags.bits.plane_changed || |
| 2036 | pipe_ctx->stream->update_flags.bits.out_tf || | 2036 | pipe_ctx->stream->update_flags.bits.out_tf) |
| 2037 | (pipe_ctx->plane_state && | ||
| 2038 | pipe_ctx->plane_state->update_flags.bits.output_tf_change)) | ||
| 2039 | hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream); | 2037 | hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream); |
| 2040 | 2038 | ||
| 2041 | /* If the pipe has been enabled or has a different opp, we | 2039 | /* If the pipe has been enabled or has a different opp, we |
| @@ -703,6 +703,20 @@ bool edp_setup_psr(struct dc_link *link, · 702 unmodified lines | |||
| 703 | if (!link) | 703 | if (!link) |
| 704 | return false; | 704 | return false; |
| 705 | 705 | ||
| 706 | /* This is a workaround: some vendors require the source to | ||
| 707 | * read the PSR cap; otherwise, the vendor's PSR feature will | ||
| 708 | * fall back to its default behavior, causing a misconfiguration | ||
| 709 | * of this feature. | ||
| 710 | */ | ||
| 711 | if (link->panel_config.psr.read_psrcap_again) { | ||
| 712 | dm_helpers_dp_read_dpcd( | ||
| 713 | link->ctx, | ||
| 714 | link, | ||
| 715 | DP_PSR_SUPPORT, | ||
| 716 | &link->dpcd_caps.psr_info.psr_version, | ||
| 717 | sizeof(link->dpcd_caps.psr_info.psr_version)); | ||
| 718 | } | ||
| 719 | |||
| 706 | //Clear PSR cfg | 720 | //Clear PSR cfg |
| 707 | memset(&psr_configuration, 0, sizeof(psr_configuration)); | 721 | memset(&psr_configuration, 0, sizeof(psr_configuration)); |
| 708 | dm_helpers_dp_write_dpcd( | 722 | dm_helpers_dp_write_dpcd( |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "stream_encoder.h" | 29 | #include "stream_encoder.h" |
| 30 | 30 | ||
| 31 | #include "resource.h" | 31 | #include "resource.h" |
| 32 | #include "clk_mgr.h" | ||
| 32 | #include "include/irq_service_interface.h" | 33 | #include "include/irq_service_interface.h" |
| 33 | #include "virtual/virtual_stream_encoder.h" | 34 | #include "virtual/virtual_stream_encoder.h" |
| 34 | #include "dce110/dce110_resource.h" | 35 | #include "dce110/dce110_resource.h" |
| @@ -836,17 +837,24 @@ static enum dc_status build_mapped_resource( · 801 unmodified lines | |||
| 836 | return DC_OK; | 837 | return DC_OK; |
| 837 | } | 838 | } |
| 838 | 839 | ||
| 839 | static enum dc_status dce100_validate_bandwidth( | 840 | enum dc_status dce100_validate_bandwidth( |
| 840 | struct dc *dc, | 841 | struct dc *dc, |
| 841 | struct dc_state *context, | 842 | struct dc_state *context, |
| 842 | enum dc_validate_mode validate_mode) | 843 | enum dc_validate_mode validate_mode) |
| 843 | { | 844 | { |
| 844 | int i; | 845 | int i; |
| 845 | bool at_least_one_pipe = false; | 846 | bool at_least_one_pipe = false; |
| 847 | struct dc_stream_state *stream = NULL; | ||
| 848 | const uint32_t max_pix_clk_khz = max(dc->clk_mgr->clks.max_supported_dispclk_khz, 400000); | ||
| 846 | 849 | ||
| 847 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | 850 | for (i = 0; i < dc->res_pool->pipe_count; i++) { |
| 848 | if (context->res_ctx.pipe_ctx[i].stream) | 851 | stream = context->res_ctx.pipe_ctx[i].stream; |
| 852 | if (stream) { | ||
| 849 | at_least_one_pipe = true; | 853 | at_least_one_pipe = true; |
| 854 | |||
| 855 | if (stream->timing.pix_clk_100hz >= max_pix_clk_khz * 10) | ||
| 856 | return DC_FAIL_BANDWIDTH_VALIDATE; | ||
| 857 | } | ||
| 850 | } | 858 | } |
| 851 | 859 | ||
| 852 | if (at_least_one_pipe) { | 860 | if (at_least_one_pipe) { |
| @@ -854,7 +862,16 @@ static enum dc_status dce100_validate_bandwidth( · 1 unmodified line | |||
| 854 | context->bw_ctx.bw.dce.dispclk_khz = 681000; | 862 | context->bw_ctx.bw.dce.dispclk_khz = 681000; |
| 855 | context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; | 863 | context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; |
| 856 | } else { | 864 | } else { |
| 857 | context->bw_ctx.bw.dce.dispclk_khz = 0; | 865 | /* On DCE 6.0 and 6.4 the PLL0 is both the display engine clock and |
| 866 | * the DP clock, and shouldn't be turned off. Just select the display | ||
| 867 | * clock value from its low power mode. | ||
| 868 | */ | ||
| 869 | if (dc->ctx->dce_version == DCE_VERSION_6_0 || | ||
| 870 | dc->ctx->dce_version == DCE_VERSION_6_4) | ||
| 871 | context->bw_ctx.bw.dce.dispclk_khz = 352000; | ||
| 872 | else | ||
| 873 | context->bw_ctx.bw.dce.dispclk_khz = 0; | ||
| 874 | |||
| 858 | context->bw_ctx.bw.dce.yclk_khz = 0; | 875 | context->bw_ctx.bw.dce.yclk_khz = 0; |
| 859 | } | 876 | } |
| 860 | 877 | ||
| @@ -881,7 +898,7 @@ static bool dce100_validate_surface_sets( · 20 unmodified lines | |||
| 881 | return true; | 898 | return true; |
| 882 | } | 899 | } |
| 883 | 900 | ||
| 884 | static enum dc_status dce100_validate_global( | 901 | enum dc_status dce100_validate_global( |
| 885 | struct dc *dc, | 902 | struct dc *dc, |
| 886 | struct dc_state *context) | 903 | struct dc_state *context) |
| 887 | { | 904 | { |
| @@ -41,6 +41,15 @@ struct resource_pool *dce100_create_resource_pool( · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps); | 42 | enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps); |
| 43 | 43 | ||
| 44 | enum dc_status dce100_validate_global( | ||
| 45 | struct dc *dc, | ||
| 46 | struct dc_state *context); | ||
| 47 | |||
| 48 | enum dc_status dce100_validate_bandwidth( | ||
| 49 | struct dc *dc, | ||
| 50 | struct dc_state *context, | ||
| 51 | enum dc_validate_mode validate_mode); | ||
| 52 | |||
| 44 | enum dc_status dce100_add_stream_to_ctx( | 53 | enum dc_status dce100_add_stream_to_ctx( |
| 45 | struct dc *dc, | 54 | struct dc *dc, |
| 46 | struct dc_state *new_ctx, | 55 | struct dc_state *new_ctx, |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include "stream_encoder.h" | 34 | #include "stream_encoder.h" |
| 35 | 35 | ||
| 36 | #include "resource.h" | 36 | #include "resource.h" |
| 37 | #include "clk_mgr.h" | ||
| 37 | #include "include/irq_service_interface.h" | 38 | #include "include/irq_service_interface.h" |
| 38 | #include "irq/dce60/irq_service_dce60.h" | 39 | #include "irq/dce60/irq_service_dce60.h" |
| 39 | #include "dce110/dce110_timing_generator.h" | 40 | #include "dce110/dce110_timing_generator.h" |
| @@ -863,70 +864,6 @@ static void dce60_resource_destruct(struct dce110_resource_pool *pool) · 823 unmodified lines | |||
| 863 | } | 864 | } |
| 864 | } | 865 | } |
| 865 | 866 | ||
| 866 | static enum dc_status dce60_validate_bandwidth( | ||
| 867 | struct dc *dc, | ||
| 868 | struct dc_state *context, | ||
| 869 | enum dc_validate_mode validate_mode) | ||
| 870 | { | ||
| 871 | int i; | ||
| 872 | bool at_least_one_pipe = false; | ||
| 873 | |||
| 874 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 875 | if (context->res_ctx.pipe_ctx[i].stream) | ||
| 876 | at_least_one_pipe = true; | ||
| 877 | } | ||
| 878 | |||
| 879 | if (at_least_one_pipe) { | ||
| 880 | /* TODO implement when needed but for now hardcode max value*/ | ||
| 881 | context->bw_ctx.bw.dce.dispclk_khz = 681000; | ||
| 882 | context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; | ||
| 883 | } else { | ||
| 884 | /* On DCE 6.0 and 6.4 the PLL0 is both the display engine clock and | ||
| 885 | * the DP clock, and shouldn't be turned off. Just select the display | ||
| 886 | * clock value from its low power mode. | ||
| 887 | */ | ||
| 888 | if (dc->ctx->dce_version == DCE_VERSION_6_0 || | ||
| 889 | dc->ctx->dce_version == DCE_VERSION_6_4) | ||
| 890 | context->bw_ctx.bw.dce.dispclk_khz = 352000; | ||
| 891 | else | ||
| 892 | context->bw_ctx.bw.dce.dispclk_khz = 0; | ||
| 893 | |||
| 894 | context->bw_ctx.bw.dce.yclk_khz = 0; | ||
| 895 | } | ||
| 896 | |||
| 897 | return DC_OK; | ||
| 898 | } | ||
| 899 | |||
| 900 | static bool dce60_validate_surface_sets( | ||
| 901 | struct dc_state *context) | ||
| 902 | { | ||
| 903 | int i; | ||
| 904 | |||
| 905 | for (i = 0; i < context->stream_count; i++) { | ||
| 906 | if (context->stream_status[i].plane_count == 0) | ||
| 907 | continue; | ||
| 908 | |||
| 909 | if (context->stream_status[i].plane_count > 1) | ||
| 910 | return false; | ||
| 911 | |||
| 912 | if (context->stream_status[i].plane_states[0]->format | ||
| 913 | >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) | ||
| 914 | return false; | ||
| 915 | } | ||
| 916 | |||
| 917 | return true; | ||
| 918 | } | ||
| 919 | |||
| 920 | static enum dc_status dce60_validate_global( | ||
| 921 | struct dc *dc, | ||
| 922 | struct dc_state *context) | ||
| 923 | { | ||
| 924 | if (!dce60_validate_surface_sets(context)) | ||
| 925 | return DC_FAIL_SURFACE_VALIDATE; | ||
| 926 | |||
| 927 | return DC_OK; | ||
| 928 | } | ||
| 929 | |||
| 930 | static void dce60_destroy_resource_pool(struct resource_pool **pool) | 867 | static void dce60_destroy_resource_pool(struct resource_pool **pool) |
| 931 | { | 868 | { |
| 932 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); | 869 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
| @@ -940,10 +877,10 @@ static const struct resource_funcs dce60_res_pool_funcs = { · 7 unmodified lines | |||
| 940 | .destroy = dce60_destroy_resource_pool, | 877 | .destroy = dce60_destroy_resource_pool, |
| 941 | .link_enc_create = dce60_link_encoder_create, | 878 | .link_enc_create = dce60_link_encoder_create, |
| 942 | .panel_cntl_create = dce60_panel_cntl_create, | 879 | .panel_cntl_create = dce60_panel_cntl_create, |
| 943 | .validate_bandwidth = dce60_validate_bandwidth, | 880 | .validate_bandwidth = dce100_validate_bandwidth, |
| 944 | .validate_plane = dce100_validate_plane, | 881 | .validate_plane = dce100_validate_plane, |
| 945 | .add_stream_to_ctx = dce100_add_stream_to_ctx, | 882 | .add_stream_to_ctx = dce100_add_stream_to_ctx, |
| 946 | .validate_global = dce60_validate_global, | 883 | .validate_global = dce100_validate_global, |
| 947 | .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link | 884 | .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link |
| 948 | }; | 885 | }; |
| 949 | 886 | ||
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include "stream_encoder.h" | 32 | #include "stream_encoder.h" |
| 33 | 33 | ||
| 34 | #include "resource.h" | 34 | #include "resource.h" |
| 35 | #include "clk_mgr.h" | ||
| 35 | #include "include/irq_service_interface.h" | 36 | #include "include/irq_service_interface.h" |
| 36 | #include "irq/dce80/irq_service_dce80.h" | 37 | #include "irq/dce80/irq_service_dce80.h" |
| 37 | #include "dce110/dce110_timing_generator.h" | 38 | #include "dce110/dce110_timing_generator.h" |
| @@ -869,61 +870,6 @@ static void dce80_resource_destruct(struct dce110_resource_pool *pool) · 831 unmodified lines | |||
| 869 | } | 870 | } |
| 870 | } | 871 | } |
| 871 | 872 | ||
| 872 | static enum dc_status dce80_validate_bandwidth( | ||
| 873 | struct dc *dc, | ||
| 874 | struct dc_state *context, | ||
| 875 | enum dc_validate_mode validate_mode) | ||
| 876 | { | ||
| 877 | int i; | ||
| 878 | bool at_least_one_pipe = false; | ||
| 879 | |||
| 880 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 881 | if (context->res_ctx.pipe_ctx[i].stream) | ||
| 882 | at_least_one_pipe = true; | ||
| 883 | } | ||
| 884 | |||
| 885 | if (at_least_one_pipe) { | ||
| 886 | /* TODO implement when needed but for now hardcode max value*/ | ||
| 887 | context->bw_ctx.bw.dce.dispclk_khz = 681000; | ||
| 888 | context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; | ||
| 889 | } else { | ||
| 890 | context->bw_ctx.bw.dce.dispclk_khz = 0; | ||
| 891 | context->bw_ctx.bw.dce.yclk_khz = 0; | ||
| 892 | } | ||
| 893 | |||
| 894 | return DC_OK; | ||
| 895 | } | ||
| 896 | |||
| 897 | static bool dce80_validate_surface_sets( | ||
| 898 | struct dc_state *context) | ||
| 899 | { | ||
| 900 | int i; | ||
| 901 | |||
| 902 | for (i = 0; i < context->stream_count; i++) { | ||
| 903 | if (context->stream_status[i].plane_count == 0) | ||
| 904 | continue; | ||
| 905 | |||
| 906 | if (context->stream_status[i].plane_count > 1) | ||
| 907 | return false; | ||
| 908 | |||
| 909 | if (context->stream_status[i].plane_states[0]->format | ||
| 910 | >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) | ||
| 911 | return false; | ||
| 912 | } | ||
| 913 | |||
| 914 | return true; | ||
| 915 | } | ||
| 916 | |||
| 917 | static enum dc_status dce80_validate_global( | ||
| 918 | struct dc *dc, | ||
| 919 | struct dc_state *context) | ||
| 920 | { | ||
| 921 | if (!dce80_validate_surface_sets(context)) | ||
| 922 | return DC_FAIL_SURFACE_VALIDATE; | ||
| 923 | |||
| 924 | return DC_OK; | ||
| 925 | } | ||
| 926 | |||
| 927 | static void dce80_destroy_resource_pool(struct resource_pool **pool) | 873 | static void dce80_destroy_resource_pool(struct resource_pool **pool) |
| 928 | { | 874 | { |
| 929 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); | 875 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
| @@ -937,10 +883,10 @@ static const struct resource_funcs dce80_res_pool_funcs = { · 7 unmodified lines | |||
| 937 | .destroy = dce80_destroy_resource_pool, | 883 | .destroy = dce80_destroy_resource_pool, |
| 938 | .link_enc_create = dce80_link_encoder_create, | 884 | .link_enc_create = dce80_link_encoder_create, |
| 939 | .panel_cntl_create = dce80_panel_cntl_create, | 885 | .panel_cntl_create = dce80_panel_cntl_create, |
| 940 | .validate_bandwidth = dce80_validate_bandwidth, | 886 | .validate_bandwidth = dce100_validate_bandwidth, |
| 941 | .validate_plane = dce100_validate_plane, | 887 | .validate_plane = dce100_validate_plane, |
| 942 | .add_stream_to_ctx = dce100_add_stream_to_ctx, | 888 | .add_stream_to_ctx = dce100_add_stream_to_ctx, |
| 943 | .validate_global = dce80_validate_global, | 889 | .validate_global = dce100_validate_global, |
| 944 | .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link | 890 | .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link |
| 945 | }; | 891 | }; |
| 946 | 892 | ||
| @@ -927,6 +927,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 926 unmodified lines | |||
| 927 | .enable_legacy_fast_update = true, | 927 | .enable_legacy_fast_update = true, |
| 928 | .using_dml2 = false, | 928 | .using_dml2 = false, |
| 929 | .disable_dsc_power_gate = true, | 929 | .disable_dsc_power_gate = true, |
| 930 | .min_disp_clk_khz = 100000, | ||
| 930 | }; | 931 | }; |
| 931 | 932 | ||
| 932 | static const struct dc_panel_config panel_config_defaults = { | 933 | static const struct dc_panel_config panel_config_defaults = { |
| @@ -739,6 +739,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 738 unmodified lines | |||
| 739 | .fpo_vactive_min_active_margin_us = 200, | 739 | .fpo_vactive_min_active_margin_us = 200, |
| 740 | .fpo_vactive_max_blank_us = 1000, | 740 | .fpo_vactive_max_blank_us = 1000, |
| 741 | .enable_legacy_fast_update = false, | 741 | .enable_legacy_fast_update = false, |
| 742 | .disable_stutter_for_wm_program = true | ||
| 742 | }; | 743 | }; |
| 743 | 744 | ||
| 744 | static struct dce_aux *dcn32_aux_engine_create( | 745 | static struct dce_aux *dcn32_aux_engine_create( |
| @@ -1230,7 +1230,8 @@ unsigned int dcn32_get_max_hw_cursor_size(const struct dc *dc, · 1229 unmodified lines | |||
| 1230 | SR(DCHUBBUB_ARB_MALL_CNTL), \ | 1230 | SR(DCHUBBUB_ARB_MALL_CNTL), \ |
| 1231 | SR(DCN_VM_FAULT_ADDR_MSB), SR(DCN_VM_FAULT_ADDR_LSB), \ | 1231 | SR(DCN_VM_FAULT_ADDR_MSB), SR(DCN_VM_FAULT_ADDR_LSB), \ |
| 1232 | SR(DCN_VM_FAULT_CNTL), SR(DCN_VM_FAULT_STATUS), \ | 1232 | SR(DCN_VM_FAULT_CNTL), SR(DCN_VM_FAULT_STATUS), \ |
| 1233 | SR(SDPIF_REQUEST_RATE_LIMIT) | 1233 | SR(SDPIF_REQUEST_RATE_LIMIT), \ |
| 1234 | SR(DCHUBBUB_SDPIF_CFG0) | ||
| 1234 | 1235 | ||
| 1235 | /* DCCG */ | 1236 | /* DCCG */ |
| 1236 | 1237 | ||
| @@ -4142,10 +4142,14 @@ struct dmub_cmd_replay_copy_settings_data { · 4141 unmodified lines | |||
| 4142 | * @hpo_link_enc_inst: HPO link encoder instance | 4142 | * @hpo_link_enc_inst: HPO link encoder instance |
| 4143 | */ | 4143 | */ |
| 4144 | uint8_t hpo_link_enc_inst; | 4144 | uint8_t hpo_link_enc_inst; |
| 4145 | /** | ||
| 4146 | * Determines if fast resync in ultra sleep mode is enabled/disabled. | ||
| 4147 | */ | ||
| 4148 | uint8_t replay_support_fast_resync_in_ultra_sleep_mode; | ||
| 4145 | /** | 4149 | /** |
| 4146 | * @pad: Align structure to 4 byte boundary. | 4150 | * @pad: Align structure to 4 byte boundary. |
| 4147 | */ | 4151 | */ |
| 4148 | uint8_t pad[2]; | 4152 | uint8_t pad[1]; |
| 4149 | }; | 4153 | }; |
| 4150 | 4154 | ||
| 4151 | 4155 | ||
| @@ -238,7 +238,8 @@ union MESAPI_SET_HW_RESOURCES { · 237 unmodified lines | |||
| 238 | uint32_t enable_mes_sch_stb_log : 1; | 238 | uint32_t enable_mes_sch_stb_log : 1; |
| 239 | uint32_t limit_single_process : 1; | 239 | uint32_t limit_single_process : 1; |
| 240 | uint32_t is_strix_tmz_wa_enabled :1; | 240 | uint32_t is_strix_tmz_wa_enabled :1; |
| 241 | uint32_t reserved : 13; | 241 | uint32_t enable_lr_compute_wa : 1; |
| 242 | uint32_t reserved : 12; | ||
| 242 | }; | 243 | }; |
| 243 | uint32_t uint32_t_all; | 244 | uint32_t uint32_t_all; |
| 244 | }; | 245 | }; |
| @@ -287,7 +287,8 @@ union MESAPI_SET_HW_RESOURCES { · 286 unmodified lines | |||
| 287 | uint32_t limit_single_process : 1; | 287 | uint32_t limit_single_process : 1; |
| 288 | uint32_t unmapped_doorbell_handling: 2; | 288 | uint32_t unmapped_doorbell_handling: 2; |
| 289 | uint32_t enable_mes_fence_int: 1; | 289 | uint32_t enable_mes_fence_int: 1; |
| 290 | uint32_t reserved : 10; | 290 | uint32_t enable_lr_compute_wa : 1; |
| 291 | uint32_t reserved : 9; | ||
| 291 | }; | 292 | }; |
| 292 | uint32_t uint32_all; | 293 | uint32_t uint32_all; |
| 293 | }; | 294 | }; |
| @@ -120,7 +120,8 @@ · 119 unmodified lines | |||
| 120 | #define PPSMC_MSG_GetBadPageSeverity 0x5B | 120 | #define PPSMC_MSG_GetBadPageSeverity 0x5B |
| 121 | #define PPSMC_MSG_GetSystemMetricsTable 0x5C | 121 | #define PPSMC_MSG_GetSystemMetricsTable 0x5C |
| 122 | #define PPSMC_MSG_GetSystemMetricsVersion 0x5D | 122 | #define PPSMC_MSG_GetSystemMetricsVersion 0x5D |
| 123 | #define PPSMC_Message_Count 0x5E | 123 | #define PPSMC_MSG_ResetVCN 0x5E |
| 124 | #define PPSMC_Message_Count 0x5F | ||
| 124 | 125 | ||
| 125 | //PPSMC Reset Types for driver msg argument | 126 | //PPSMC Reset Types for driver msg argument |
| 126 | #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET 0x1 | 127 | #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET 0x1 |
File renamed without changes.
| @@ -136,6 +136,7 @@ const struct cmn2asic_msg_mapping smu_v13_0_12_message_map[SMU_MSG_MAX_COUNT] = · 135 unmodified lines | |||
| 136 | MSG_MAP(RmaDueToBadPageThreshold, PPSMC_MSG_RmaDueToBadPageThreshold, 0), | 136 | MSG_MAP(RmaDueToBadPageThreshold, PPSMC_MSG_RmaDueToBadPageThreshold, 0), |
| 137 | MSG_MAP(SetThrottlingPolicy, PPSMC_MSG_SetThrottlingPolicy, 0), | 137 | MSG_MAP(SetThrottlingPolicy, PPSMC_MSG_SetThrottlingPolicy, 0), |
| 138 | MSG_MAP(ResetSDMA, PPSMC_MSG_ResetSDMA, 0), | 138 | MSG_MAP(ResetSDMA, PPSMC_MSG_ResetSDMA, 0), |
| 139 | MSG_MAP(ResetVCN, PPSMC_MSG_ResetVCN, 0), | ||
| 139 | MSG_MAP(GetStaticMetricsTable, PPSMC_MSG_GetStaticMetricsTable, 1), | 140 | MSG_MAP(GetStaticMetricsTable, PPSMC_MSG_GetStaticMetricsTable, 1), |
| 140 | MSG_MAP(GetSystemMetricsTable, PPSMC_MSG_GetSystemMetricsTable, 1), | 141 | MSG_MAP(GetSystemMetricsTable, PPSMC_MSG_GetSystemMetricsTable, 1), |
| 141 | }; | 142 | }; |
| @@ -353,6 +353,9 @@ static void smu_v13_0_12_init_caps(struct smu_context *smu) · 352 unmodified lines | |||
| 353 | smu_v13_0_6_cap_set(smu, SMU_CAP(PLDM_VERSION)); | 353 | smu_v13_0_6_cap_set(smu, SMU_CAP(PLDM_VERSION)); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | if (fw_ver > 0x04560900) | ||
| 357 | smu_v13_0_6_cap_set(smu, SMU_CAP(VCN_RESET)); | ||
| 358 | |||
| 356 | if (fw_ver >= 0x04560700) { | 359 | if (fw_ver >= 0x04560700) { |
| 357 | if (fw_ver >= 0x04560900) { | 360 | if (fw_ver >= 0x04560900) { |
| 358 | smu_v13_0_6_cap_set(smu, SMU_CAP(TEMP_METRICS)); | 361 | smu_v13_0_6_cap_set(smu, SMU_CAP(TEMP_METRICS)); |
Empty file added.
| @@ -0,0 +1,37 @@ | |||
| 1 | /* SPDX-License-Identifier: MIT */ | ||
| 2 | /* | ||
| 3 | * Copyright 2025 Advanced Micro Devices, Inc. | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 6 | * copy of this software and associated documentation files (the "Software"), | ||
| 7 | * to deal in the Software without restriction, including without limitation | ||
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 10 | * Software is furnished to do so, subject to the following conditions: | ||
| 11 | * | ||
| 12 | * The above copyright notice and this permission notice shall be included in | ||
| 13 | * all copies or substantial portions of the Software. | ||
| 14 | * | ||
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 21 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | * | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef __RAS_CORE_STATUS_H__ | ||
| 26 | #define __RAS_CORE_STATUS_H__ | ||
| 27 | |||
| 28 | #define RAS_CORE_OK 0 | ||
| 29 | #define RAS_CORE_NOT_SUPPORTED 248 | ||
| 30 | #define RAS_CORE_FAIL_ERROR_QUERY 249 | ||
| 31 | #define RAS_CORE_FAIL_ERROR_INJECTION 250 | ||
| 32 | #define RAS_CORE_FAIL_FATAL_RECOVERY 251 | ||
| 33 | #define RAS_CORE_FAIL_POISON_CONSUMPTION 252 | ||
| 34 | #define RAS_CORE_FAIL_POISON_CREATION 253 | ||
| 35 | #define RAS_CORE_FAIL_NO_VALID_BANKS 254 | ||
| 36 | #define RAS_CORE_GPU_IN_MODE1_RESET 255 | ||
| 37 | #endif | ||