<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe WP",
Tahoma, Arial, sans-serif, serif, EmojiFont; font-size:
14.6667px;">PSP engine only allocate space for </span><span
style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal,
"Segoe UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;">firmware. </span>mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW/HIGH
is for firmware TMR address.</span></p>
<p><span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe WP",
Tahoma, Arial, sans-serif, serif, EmojiFont; font-size:
14.6667px;">The other two address are for HEAP/Session.<br>
</span></p>
<p><span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe WP",
Tahoma, Arial, sans-serif, serif, EmojiFont; font-size:
14.6667px;"><br>
</span></p>
<p><span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe WP",
Tahoma, Arial, sans-serif, serif, EmojiFont; font-size:
14.6667px;">Regards!</span></p>
<p><span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe WP",
Tahoma, Arial, sans-serif, serif, EmojiFont; font-size:
14.6667px;">James Zhu<br>
</span></p>
<br>
<div class="moz-cite-prefix">On 2018-08-13 12:16 AM, Quan, Evan
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:SN6PR12MB2656E11594EA2BC12BC5B38DE4390@SN6PR12MB2656.namprd12.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
dir="ltr">
<p style="margin-top:0;margin-bottom:0">Why only the <span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;">mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW/HIGH
use the new <span style="color: rgb(33, 33, 33);
font-family: wf_segoe-ui_normal, "Segoe UI",
"Segoe WP", Tahoma, Arial, sans-serif, serif,
EmojiFont; font-size: 14.6667px;">tmr_mc_addr? And the <span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;">mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW/HIGH
and <span style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;">mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW/HIGH
still use the old <span style="color: rgb(33, 33, 33);
font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;">adev->vcn.gpu_addr?</span></span></span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color:
rgb(33, 33, 33); font-family: wf_segoe-ui_normal,
"Segoe UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><br>
</span></span></span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color:
rgb(33, 33, 33); font-family: wf_segoe-ui_normal,
"Segoe UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;">Regards,</span></span></span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color:
rgb(33, 33, 33); font-family: wf_segoe-ui_normal,
"Segoe UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;"><span
style="color: rgb(33, 33, 33); font-family:
wf_segoe-ui_normal, "Segoe UI", "Segoe
WP", Tahoma, Arial, sans-serif, serif, EmojiFont;
font-size: 14.6667px;"><span style="color: rgb(33, 33,
33); font-family: wf_segoe-ui_normal, "Segoe
UI", "Segoe WP", Tahoma, Arial,
sans-serif, serif, EmojiFont; font-size: 14.6667px;">Evan</span></span></span></span></span></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> on
behalf of James Zhu <a class="moz-txt-link-rfc2396E" href="mailto:jzhums@gmail.com"><jzhums@gmail.com></a><br>
<b>Sent:</b> Friday, August 10, 2018 12:31:42 AM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Cc:</b> Deucher, Alexander; Gao, Likun; Zhu, James; Huang,
Ray<br>
<b>Subject:</b> [PATCH v2 5/5] drm/amdgpu:add VCN booting with
firmware loaded by PSP</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt;">
<div class="PlainText">From: Likun Gao
<a class="moz-txt-link-rfc2396E" href="mailto:Likun.Gao@amd.com"><Likun.Gao@amd.com></a><br>
<br>
Setup psp firmware loading for VCN, and make VCN block<br>
booting from tmr mac address.<br>
<br>
Signed-off-by: James Zhu <a class="moz-txt-link-rfc2396E" href="mailto:James.Zhu@amd.com"><James.Zhu@amd.com></a><br>
Reviewed-by: Alex Deucher
<a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 17
+++++++++------<br>
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 38
++++++++++++++++++++++++++-------<br>
2 files changed, 40 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
index 878f62c..77c192a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
@@ -111,9 +111,10 @@ int amdgpu_vcn_sw_init(struct
amdgpu_device *adev)<br>
version_major, version_minor,
family_id);<br>
}<br>
<br>
- bo_size =
AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes)
+ 8)<br>
- + AMDGPU_VCN_STACK_SIZE +
AMDGPU_VCN_HEAP_SIZE<br>
+ bo_size = AMDGPU_VCN_STACK_SIZE +
AMDGPU_VCN_HEAP_SIZE<br>
+ AMDGPU_VCN_SESSION_SIZE * 40;<br>
+ if (adev->firmware.load_type !=
AMDGPU_FW_LOAD_PSP)<br>
+ bo_size +=
AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes)
+ 8);<br>
r = amdgpu_bo_create_kernel(adev, bo_size,
PAGE_SIZE,<br>
AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.vcpu_bo,<br>
&adev->vcn.gpu_addr, &adev->vcn.cpu_addr);<br>
@@ -189,11 +190,13 @@ int amdgpu_vcn_resume(struct
amdgpu_device *adev)<br>
unsigned offset;<br>
<br>
hdr = (const struct
common_firmware_header *)adev->vcn.fw->data;<br>
- offset =
le32_to_cpu(hdr->ucode_array_offset_bytes);<br>
- memcpy_toio(adev->vcn.cpu_addr,
adev->vcn.fw->data + offset,<br>
-
le32_to_cpu(hdr->ucode_size_bytes));<br>
- size -=
le32_to_cpu(hdr->ucode_size_bytes);<br>
- ptr +=
le32_to_cpu(hdr->ucode_size_bytes);<br>
+ if (adev->firmware.load_type !=
AMDGPU_FW_LOAD_PSP) {<br>
+ offset =
le32_to_cpu(hdr->ucode_array_offset_bytes);<br>
+ memcpy_toio(adev->vcn.cpu_addr,
adev->vcn.fw->data + offset,<br>
+
le32_to_cpu(hdr->ucode_size_bytes));<br>
+ size -=
le32_to_cpu(hdr->ucode_size_bytes);<br>
+ ptr +=
le32_to_cpu(hdr->ucode_size_bytes);<br>
+ }<br>
memset_io(ptr, 0, size);<br>
}<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
index 2ce91a7..74c4ef4 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
@@ -100,6 +100,16 @@ static int vcn_v1_0_sw_init(void
*handle)<br>
if (r)<br>
return r;<br>
<br>
+ if (adev->firmware.load_type ==
AMDGPU_FW_LOAD_PSP) {<br>
+ const struct common_firmware_header *hdr;<br>
+ hdr = (const struct common_firmware_header
*)adev->vcn.fw->data;<br>
+
adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].ucode_id =
AMDGPU_UCODE_ID_VCN;<br>
+
adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw =
adev->vcn.fw;<br>
+ adev->firmware.fw_size +=<br>
+
ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);<br>
+ DRM_INFO("PSP loading VCN firmware\n");<br>
+ }<br>
+<br>
r = amdgpu_vcn_resume(adev);<br>
if (r)<br>
return r;<br>
@@ -265,26 +275,38 @@ static int vcn_v1_0_resume(void
*handle)<br>
static void vcn_v1_0_mc_resume(struct amdgpu_device
*adev)<br>
{<br>
uint32_t size =
AMDGPU_GPU_PAGE_ALIGN(adev->vcn.fw->size + 4);<br>
-<br>
- WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,<br>
+ uint32_t offset;<br>
+<br>
+ if (adev->firmware.load_type ==
AMDGPU_FW_LOAD_PSP) {<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,<br>
+
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_lo));<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,<br>
+
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_hi));<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_VCPU_CACHE_OFFSET0, 0);<br>
+ offset = 0;<br>
+ } else {<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,<br>
lower_32_bits(adev->vcn.gpu_addr));<br>
- WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,<br>
upper_32_bits(adev->vcn.gpu_addr));<br>
- WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0,<br>
+ offset = size;<br>
+ WREG32_SOC15(UVD, 0,
mmUVD_VCPU_CACHE_OFFSET0,<br>
AMDGPU_UVD_FIRMWARE_OFFSET >> 3);<br>
+ }<br>
+<br>
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE0,
size);<br>
<br>
WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW,<br>
-
lower_32_bits(adev->vcn.gpu_addr + size));<br>
+
lower_32_bits(adev->vcn.gpu_addr + offset));<br>
WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_HIGH,<br>
-
upper_32_bits(adev->vcn.gpu_addr + size));<br>
+
upper_32_bits(adev->vcn.gpu_addr + offset));<br>
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET1,
0);<br>
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE1,
AMDGPU_VCN_HEAP_SIZE);<br>
<br>
WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_LOW,<br>
-
lower_32_bits(adev->vcn.gpu_addr + size +
AMDGPU_VCN_HEAP_SIZE));<br>
+
lower_32_bits(adev->vcn.gpu_addr + offset +
AMDGPU_VCN_HEAP_SIZE));<br>
WREG32_SOC15(UVD, 0,
mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_HIGH,<br>
-
upper_32_bits(adev->vcn.gpu_addr + size +
AMDGPU_VCN_HEAP_SIZE));<br>
+
upper_32_bits(adev->vcn.gpu_addr + offset +
AMDGPU_VCN_HEAP_SIZE));<br>
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET2,
0);<br>
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE2,<br>
AMDGPU_VCN_STACK_SIZE +
(AMDGPU_VCN_SESSION_SIZE * 40));<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a
href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</blockquote>
<br>
</body>
</html>