<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:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<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;">Embedding these SRIOV check into the underlying functions is in many places, which is not conducive to subsequent code optimization and maintenance.</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">It took a long time to clean up the SMU code before, but now some new checks have been introduced into the SMU code. </span></div>
<div><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">I think a new method should be adopted to solve this problem unless there's a special reason.</span></div>
<div><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br>
</span></div>
<div><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Best Regards,<br>
Kevin</span></div>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Sent:</b> Tuesday, September 22, 2020 3:25 PM<br>
<b>To:</b> Chen, JingWen <JingWen.Chen2@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Chen, JingWen <JingWen.Chen2@amd.com><br>
<b>Subject:</b> RE: [PATCH 2/2] drm/amd: Skip not used microcode loading in SRIOV</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">[AMD Public Use]<br>
<br>
1. Please do not add the amdgpu_sriov_vf check in every psp fw init_microcode function. psp_init_microcode is the entry point for all kinds of psp fw microcode initialization.<br>
2. I'd like to get a whole picture on all the sequence you want to skip from guest side so that we can have more organized/reasonable approach to exclude those programing sequence for SRIOV, instead of having the amdgpu_sriov_vf patched case by case...<br>
<br>
Regards,<br>
Hawking<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Jingwen Chen<br>
Sent: Tuesday, September 22, 2020 15:09<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Chen, JingWen <JingWen.Chen2@amd.com><br>
Subject: [PATCH 2/2] drm/amd: Skip not used microcode loading in SRIOV<br>
<br>
smc, sdma, sos, ta and asd fw is not used in SRIOV. Skip them to accelerate sw_init for navi12.<br>
<br>
v2: skip above fw in SRIOV for vega10 and sienna_cichlid<br>
Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 9 +++++++++<br>
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++<br>
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 +++<br>
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 3 +++<br>
.../gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c | 12 +++++++-----<br>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 11 +++++++----<br>
6 files changed, 32 insertions(+), 9 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 2c66e20b2ed9..9e2038de6ea7 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
@@ -2385,6 +2385,9 @@ int psp_init_asd_microcode(struct psp_context *psp,<br>
const struct psp_firmware_header_v1_0 *asd_hdr;<br>
int err = 0;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
if (!chip_name) {<br>
dev_err(adev->dev, "invalid chip name for asd microcode\n");<br>
return -EINVAL;<br>
@@ -2424,6 +2427,9 @@ int psp_init_sos_microcode(struct psp_context *psp,<br>
const struct psp_firmware_header_v1_3 *sos_hdr_v1_3;<br>
int err = 0;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
if (!chip_name) {<br>
dev_err(adev->dev, "invalid chip name for sos microcode\n");<br>
return -EINVAL;<br>
@@ -2558,6 +2564,9 @@ int psp_init_ta_microcode(struct psp_context *psp,<br>
int err = 0;<br>
int ta_index = 0;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
if (!chip_name) {<br>
dev_err(adev->dev, "invalid chip name for ta microcode\n");<br>
return -EINVAL;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
index 810635cbf4c1..86fb1eddf5a6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
@@ -592,6 +592,9 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)<br>
struct amdgpu_firmware_info *info = NULL;<br>
const struct common_firmware_header *header = NULL;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
DRM_DEBUG("\n");<br>
<br>
switch (adev->asic_type) {<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
index 48c95a78a173..9c72b95b7463 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
@@ -203,6 +203,9 @@ static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)<br>
const struct common_firmware_header *header = NULL;<br>
const struct sdma_firmware_header_v1_0 *hdr;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
DRM_DEBUG("\n");<br>
<br>
switch (adev->asic_type) {<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
index 34ccf376ee45..9f3952723c63 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
@@ -148,6 +148,9 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)<br>
struct amdgpu_firmware_info *info = NULL;<br>
const struct common_firmware_header *header = NULL;<br>
<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ return 0;<br>
+<br>
DRM_DEBUG("\n");<br>
<br>
switch (adev->asic_type) {<br>
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c<br>
index 1e222c5d91a4..daf122f24f23 100644<br>
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c<br>
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c<br>
@@ -209,11 +209,13 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)<br>
int ret;<br>
struct cgs_firmware_info info = {0};<br>
<br>
- ret = cgs_get_firmware_info(hwmgr->device,<br>
- CGS_UCODE_ID_SMU,<br>
- &info);<br>
- if (ret || !info.kptr)<br>
- return -EINVAL;<br>
+ if (!amdgpu_sriov_vf((struct amdgpu_device *)hwmgr->adev)) {<br>
+ ret = cgs_get_firmware_info(hwmgr->device,<br>
+ CGS_UCODE_ID_SMU,<br>
+ &info);<br>
+ if (ret || !info.kptr)<br>
+ return -EINVAL;<br>
+ }<br>
<br>
priv = kzalloc(sizeof(struct vega10_smumgr), GFP_KERNEL);<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
index 538e6f5e19eb..3010cb31324a 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
@@ -832,10 +832,13 @@ static int smu_sw_init(void *handle)<br>
<br>
smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;<br>
smu->smu_dpm.requested_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;<br>
- ret = smu_init_microcode(smu);<br>
- if (ret) {<br>
- dev_err(adev->dev, "Failed to load smu firmware!\n");<br>
- return ret;<br>
+<br>
+ if (!amdgpu_sriov_vf(adev)) {<br>
+ ret = smu_init_microcode(smu);<br>
+ if (ret) {<br>
+ dev_err(adev->dev, "Failed to load smu firmware!\n");<br>
+ return ret;<br>
+ }<br>
}<br>
<br>
ret = smu_smc_table_sw_init(smu);<br>
--<br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CKevin1.Wang%40amd.com%7C96b1fda73cc94c3ec44408d85ec8f126%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637363564431270216&sdata=szoPYYfIpzZCyRrzYSR%2Fv5DbogjhMuyHMHIzWygj6Lg%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CKevin1.Wang%40amd.com%7C96b1fda73cc94c3ec44408d85ec8f126%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637363564431270216&sdata=szoPYYfIpzZCyRrzYSR%2Fv5DbogjhMuyHMHIzWygj6Lg%3D&reserved=0</a><br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CKevin1.Wang%40amd.com%7C96b1fda73cc94c3ec44408d85ec8f126%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637363564431270216&sdata=szoPYYfIpzZCyRrzYSR%2Fv5DbogjhMuyHMHIzWygj6Lg%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CKevin1.Wang%40amd.com%7C96b1fda73cc94c3ec44408d85ec8f126%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637363564431270216&sdata=szoPYYfIpzZCyRrzYSR%2Fv5DbogjhMuyHMHIzWygj6Lg%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>