<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Reviewed-by: Monk Liu <monk.liu@amd.com></p>
<p><br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>发件人:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Xiangliang Yu <Xiangliang.Yu@amd.com><br>
<b>发送时间:</b> 2017年1月9日 13:05:53<br>
<b>收件人:</b> amd-gfx@lists.freedesktop.org<br>
<b>抄送:</b> Yu, Xiangliang<br>
<b>主题:</b> [V2 1/2] drm/amdgpu/vi: move virtualization detection forward</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Move the detection forward into vi_set_ip_blocks function, then<br>
add ip blocks virtualization need if device is VF.<br>
<br>
V2: add ip blocks according to asic type.<br>
<br>
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/vi.c | 24 +++++++++++++-----------<br>
 1 file changed, 13 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c<br>
index b2ce7da..7350a8f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vi.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c<br>
@@ -857,7 +857,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs =<br>
 {<br>
         .read_disabled_bios = &vi_read_disabled_bios,<br>
         .read_bios_from_rom = &vi_read_bios_from_rom,<br>
-       .detect_hw_virtualization = vi_detect_hw_virtualization,<br>
         .read_register = &vi_read_register,<br>
         .reset = &vi_asic_reset,<br>
         .set_vga_state = &vi_vga_set_state,<br>
@@ -1049,10 +1048,6 @@ static int vi_common_early_init(void *handle)<br>
                 return -EINVAL;<br>
         }<br>
 <br>
-       /* in early init stage, vbios code won't work */<br>
-       if (adev->asic_funcs->detect_hw_virtualization)<br>
-               amdgpu_asic_detect_hw_virtualization(adev);<br>
-<br>
         if (amdgpu_smc_load_fw && smc_enabled)<br>
                 adev->firmware.smu_load = true;<br>
 <br>
@@ -1403,6 +1398,9 @@ static const struct amdgpu_ip_block_version vi_common_ip_block =<br>
 <br>
 int vi_set_ip_blocks(struct amdgpu_device *adev)<br>
 {<br>
+       /* in early init stage, vbios code won't work */<br>
+       vi_detect_hw_virtualization(adev);<br>
+<br>
         switch (adev->asic_type) {<br>
         case CHIP_TOPAZ:<br>
                 /* topaz has no DCE, UVD, VCE */<br>
@@ -1420,7 +1418,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev)<br>
                 amdgpu_ip_block_add(adev, &gmc_v8_5_ip_block);<br>
                 amdgpu_ip_block_add(adev, &tonga_ih_ip_block);<br>
                 amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);<br>
-               if (adev->enable_virtual_display)<br>
+               if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))<br>
                         amdgpu_ip_block_add(adev, &dce_virtual_ip_block);<br>
 #if defined(CONFIG_DRM_AMD_DC)<br>
                 else if (amdgpu_device_has_dc_support(adev))<br>
@@ -1430,15 +1428,17 @@ int vi_set_ip_blocks(struct amdgpu_device *adev)<br>
                         amdgpu_ip_block_add(adev, &dce_v10_1_ip_block);<br>
                 amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);<br>
                 amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);<br>
-               amdgpu_ip_block_add(adev, &uvd_v6_0_ip_block);<br>
-               amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);<br>
+               if (!amdgpu_sriov_vf(adev)) {<br>
+                       amdgpu_ip_block_add(adev, &uvd_v6_0_ip_block);<br>
+                       amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);<br>
+               }<br>
                 break;<br>
         case CHIP_TONGA:<br>
                 amdgpu_ip_block_add(adev, &vi_common_ip_block);<br>
                 amdgpu_ip_block_add(adev, &gmc_v8_0_ip_block);<br>
                 amdgpu_ip_block_add(adev, &tonga_ih_ip_block);<br>
                 amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);<br>
-               if (adev->enable_virtual_display)<br>
+               if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))<br>
                         amdgpu_ip_block_add(adev, &dce_virtual_ip_block);<br>
 #if defined(CONFIG_DRM_AMD_DC)<br>
                 else if (amdgpu_device_has_dc_support(adev))<br>
@@ -1448,8 +1448,10 @@ int vi_set_ip_blocks(struct amdgpu_device *adev)<br>
                         amdgpu_ip_block_add(adev, &dce_v10_0_ip_block);<br>
                 amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);<br>
                 amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);<br>
-               amdgpu_ip_block_add(adev, &uvd_v5_0_ip_block);<br>
-               amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);<br>
+               if (!amdgpu_sriov_vf(adev)) {<br>
+                       amdgpu_ip_block_add(adev, &uvd_v5_0_ip_block);<br>
+                       amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);<br>
+               }<br>
                 break;<br>
         case CHIP_POLARIS11:<br>
         case CHIP_POLARIS10:<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font>
</body>
</html>