<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Lang Yu <Lang.Yu@amd.com><br>
<b>Sent:</b> Thursday, March 21, 2024 10:53 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Yu, Lang <Lang.Yu@amd.com>; Gopalakrishnan, Veerabadhran (Veera) <Veerabadhran.Gopalakrishnan@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdgpu: enable UMSCH 4.0.6</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Share same codes with 4.0.5 and enable collaborate mode for VPE.<br>
<br>
Signed-off-by: Lang Yu <Lang.Yu@amd.com><br>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 1 +<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c | 12 ++++++++++--<br>
drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c | 7 +++++--<br>
3 files changed, 16 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c<br>
index 3c407164837b..07c5fca06178 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c<br>
@@ -2247,6 +2247,7 @@ static int amdgpu_discovery_set_umsch_mm_ip_blocks(struct amdgpu_device *adev)<br>
{<br>
switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) {<br>
case IP_VERSION(4, 0, 5):<br>
+ case IP_VERSION(4, 0, 6):<br>
if (amdgpu_umsch_mm & 0x1) {<br>
amdgpu_device_ip_block_add(adev, &umsch_mm_v4_0_ip_block);<br>
adev->enable_umsch_mm = true;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c<br>
index 99210a3b1044..95f80b9131a8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c<br>
@@ -189,10 +189,13 @@ static void setup_vpe_queue(struct amdgpu_device *adev,<br>
mqd->rptr_val = 0;<br>
mqd->unmapped = 1;<br>
<br>
+ if (adev->vpe.collaborate_mode)<br>
+ memcpy(++mqd, test->mqd_data_cpu_addr, sizeof(struct MQD_INFO));<br>
+<br>
qinfo->mqd_addr = test->mqd_data_gpu_addr;<br>
qinfo->csa_addr = test->ctx_data_gpu_addr +<br>
offsetof(struct umsch_mm_test_ctx_data, vpe_ctx_csa);<br>
- qinfo->doorbell_offset_0 = (adev->doorbell_index.vpe_ring + 1) << 1;<br>
+ qinfo->doorbell_offset_0 = 0;<br>
qinfo->doorbell_offset_1 = 0;<br>
}<br>
<br>
@@ -287,7 +290,10 @@ static int submit_vpe_queue(struct amdgpu_device *adev, struct umsch_mm_test *te<br>
ring[5] = 0;<br>
<br>
mqd->wptr_val = (6 << 2);<br>
- // WDOORBELL32(adev->umsch_mm.agdb_index[CONTEXT_PRIORITY_LEVEL_NORMAL], mqd->wptr_val);<br>
+ if (adev->vpe.collaborate_mode)<br>
+ (++mqd)->wptr_val = (6 << 2);<br>
+<br>
+ WDOORBELL32(adev->umsch_mm.agdb_index[CONTEXT_PRIORITY_LEVEL_NORMAL], mqd->wptr_val);<br>
<br>
for (i = 0; i < adev->usec_timeout; i++) {<br>
if (*fence == test_pattern)<br>
@@ -571,6 +577,7 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)<br>
<br>
switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) {<br>
case IP_VERSION(4, 0, 5):<br>
+ case IP_VERSION(4, 0, 6):<br>
fw_name = "amdgpu/umsch_mm_4_0_0.bin";<br>
break;<br>
default:<br>
@@ -750,6 +757,7 @@ static int umsch_mm_early_init(void *handle)<br>
<br>
switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) {<br>
case IP_VERSION(4, 0, 5):<br>
+ case IP_VERSION(4, 0, 6):<br>
umsch_mm_v4_0_set_funcs(&adev->umsch_mm);<br>
break;<br>
default:<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c b/drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c<br>
index 8e7b763cfdb7..84368cf1e175 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c<br>
@@ -60,7 +60,7 @@ static int umsch_mm_v4_0_load_microcode(struct amdgpu_umsch_mm *umsch)<br>
<br>
umsch->cmd_buf_curr_ptr = umsch->cmd_buf_ptr;<br>
<br>
- if (amdgpu_ip_version(adev, VCN_HWIP, 0) == IP_VERSION(4, 0, 5)) {<br>
+ if (amdgpu_ip_version(adev, VCN_HWIP, 0) >= IP_VERSION(4, 0, 5)) {<br>
WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG,<br>
1 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT);<br>
SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS,<br>
@@ -248,7 +248,7 @@ static int umsch_mm_v4_0_ring_stop(struct amdgpu_umsch_mm *umsch)<br>
data = REG_SET_FIELD(data, VCN_UMSCH_RB_DB_CTRL, EN, 0);<br>
WREG32_SOC15(VCN, 0, regVCN_UMSCH_RB_DB_CTRL, data);<br>
<br>
- if (amdgpu_ip_version(adev, VCN_HWIP, 0) == IP_VERSION(4, 0, 5)) {<br>
+ if (amdgpu_ip_version(adev, VCN_HWIP, 0) >= IP_VERSION(4, 0, 5)) {<br>
WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG,<br>
2 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT);<br>
SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS,<br>
@@ -271,6 +271,8 @@ static int umsch_mm_v4_0_set_hw_resources(struct amdgpu_umsch_mm *umsch)<br>
<br>
set_hw_resources.vmid_mask_mm_vcn = umsch->vmid_mask_mm_vcn;<br>
set_hw_resources.vmid_mask_mm_vpe = umsch->vmid_mask_mm_vpe;<br>
+ set_hw_resources.collaboration_mask_vpe =<br>
+ adev->vpe.collaborate_mode ? 0x3 : 0x0;<br>
set_hw_resources.engine_mask = umsch->engine_mask;<br>
<br>
set_hw_resources.vcn0_hqd_mask[0] = umsch->vcn0_hqd_mask;<br>
@@ -346,6 +348,7 @@ static int umsch_mm_v4_0_add_queue(struct amdgpu_umsch_mm *umsch,<br>
add_queue.h_queue = input_ptr->h_queue;<br>
add_queue.vm_context_cntl = input_ptr->vm_context_cntl;<br>
add_queue.is_context_suspended = input_ptr->is_context_suspended;<br>
+ add_queue.collaboration_mode = adev->vpe.collaborate_mode ? 1 : 0;<br>
<br>
add_queue.api_status.api_completion_fence_addr = umsch->ring.fence_drv.gpu_addr;<br>
add_queue.api_status.api_completion_fence_value = ++umsch->ring.fence_drv.sync_seq;<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>