<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
add <a id="OWAAM10677" class="_1OtrSZdhKXVv3UhaivrdJ4 mention ms-bgc-nlr ms-fcl-b" href="mailto:Evan.Quan@amd.com">
@Quan, Evan</a> to support arcturus asic.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">comment inline.</span><br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Zhang, Jack (Jian) <Jack.Zhang1@amd.com><br>
<b>Sent:</b> Monday, December 23, 2019 4:42 PM<br>
<b>To:</b> Feng, Kenneth <Kenneth.Feng@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Tao, Yintian <Yintian.Tao@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deng, Emily <Emily.Deng@amd.com><br>
<b>Cc:</b> Zhang, Jack (Jian) <Jack.Zhang1@amd.com><br>
<b>Subject:</b> RE: [PATCH] amd/amdgpu/sriov enable onevf mode for ARCTURUS VF</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"><br>
<br>
-----Original Message-----<br>
From: Jack Zhang <Jack.Zhang1@amd.com> <br>
Sent: Monday, December 23, 2019 4:40 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhang, Jack (Jian) <Jack.Zhang1@amd.com><br>
Subject: [PATCH] amd/amdgpu/sriov enable onevf mode for ARCTURUS VF<br>
<br>
Before, initialization of smu ip block would be skipped for sriov ASICs. But if there's only one VF being used, guest driver should be able to dump some HW info such as clks, temperature,etc.<br>
<br>
To solve this, now after onevf mode is enabled, host driver will notify guest. If it's onevf mode, guest will do smu hw_init and skip some steps in normal smu hw_init flow because host driver has already done it for smu.<br>
<br>
With this fix, guest app can talk with smu and dump hw information from smu.<br>
<br>
Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +-<br>
drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +-<br>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 49 ++++++++++++++++++------------<br>
3 files changed, 33 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
index 8469834..08130a6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
@@ -1448,7 +1448,8 @@ static int psp_np_fw_load(struct psp_context *psp)<br>
|| ucode->ucode_id == AMDGPU_UCODE_ID_RLC_G<br>
|| ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL<br>
|| ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM<br>
- || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM))<br>
+ || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM<br>
+ || ucode->ucode_id == AMDGPU_UCODE_ID_SMC))<br>
/*skip ucode loading in SRIOV VF */<br>
continue;<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index b53d401..a271496 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -827,8 +827,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)<br>
amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);<br>
amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);<br>
amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);<br>
- if (!amdgpu_sriov_vf(adev))<br>
- amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);<br>
+ amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);<br>
<br>
if (amdgpu_sriov_vf(adev)) {<br>
if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 936c682..c07fb26 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -531,10 +531,14 @@ bool is_support_sw_smu(struct amdgpu_device *adev)<br>
if (adev->asic_type == CHIP_VEGA20)<br>
return (amdgpu_dpm == 2) ? true : false;<br>
else if (adev->asic_type >= CHIP_ARCTURUS) {<br>
- if (amdgpu_sriov_vf(adev))<br>
- return false;<br>
- else<br>
+ if (amdgpu_sriov_vf(adev)) {<br>
+ if(amdgpu_sriov_is_pp_one_vf(adev))<br>
+ return true;<br>
+ else<br>
+ return false;<br>
+ } else {<br>
return true;<br>
+ }<br>
} else<br>
return false;<br>
}<br>
@@ -1062,20 +1066,19 @@ static int smu_smc_table_hw_init(struct smu_context *smu,<br>
}<br>
<br>
/* smu_dump_pptable(smu); */<br>
+ if(amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)){<br>
+ /*<br>
+ * Copy pptable bo in the vram to smc with SMU MSGs such as<br>
+ * SetDriverDramAddr and TransferTableDram2Smu.<br>
+ */</div>
<div class="PlainText">[kevin]: this comment is not neccessary in smu module.</div>
<div class="PlainText"><span>and could you describe the function of pp_one_vf and sriov_vf ?</span></div>
<div class="PlainText"><span>it is useful to help us understand your patch. </span></div>
<div class="PlainText">thanks.</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">+ ret = smu_write_pptable(smu);<br>
+ if (ret)<br>
+ return ret;<br>
<br>
- /*<br>
- * Copy pptable bo in the vram to smc with SMU MSGs such as<br>
- * SetDriverDramAddr and TransferTableDram2Smu.<br>
- */<br>
- ret = smu_write_pptable(smu);<br>
- if (ret)<br>
- return ret;<br>
-<br>
- /* issue Run*Btc msg */<br>
- ret = smu_run_btc(smu);<br>
- if (ret)<br>
- return ret;<br>
-<br>
+ /* issue Run*Btc msg */<br>
+ ret = smu_run_btc(smu);<br>
+ if (ret)<br>
+ return ret;<br>
ret = smu_feature_set_allowed_mask(smu);<br>
if (ret)<br>
return ret;<br>
@@ -1083,7 +1086,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,<br>
ret = smu_system_features_control(smu, true);<br>
if (ret)<br>
return ret;<br>
-<br>
+ }<br>
if (adev->asic_type != CHIP_ARCTURUS) {<br>
ret = smu_notify_display_change(smu);<br>
if (ret)<br>
@@ -1136,8 +1139,9 @@ static int smu_smc_table_hw_init(struct smu_context *smu,<br>
/*<br>
* Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools.<br>
*/<br>
- ret = smu_set_tool_table_location(smu);<br>
-<br>
+ if(amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)){<br>
+ ret = smu_set_tool_table_location(smu);<br>
+ }<br>
if (!smu_is_dpm_running(smu))<br>
pr_info("dpm has been disabled\n");<br>
<br>
@@ -1249,6 +1253,13 @@ static int smu_hw_init(void *handle)<br>
smu_set_gfx_cgpg(&adev->smu, true);<br>
}<br>
<br>
+ if (amdgpu_sriov_vf(adev)) {<br>
+ if(amdgpu_sriov_is_pp_one_vf(adev))<br>
+ smu->pm_enabled = true;<br>
+ else<br>
+ smu->pm_enabled = false;<br>
+ }<br>
+</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">the variable of "smu->pm_enabeld" is initialize in smu_eary_init(), it is only depend on module param amdgpu_dpm.</div>
<div class="PlainText"></div>
<span>after initialized, this variable should not be changed arbitrarily.</span></span></font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt"><span>so i hope you can refine the above code logic.</span></span></font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt"><span><br>
</span></span></font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"> if (!smu->pm_enabled)<br>
return 0;<br>
<br>
--<br>
2.7.4<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>