<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for finding this!  I think the attached patch should fix the issue and it's much less invasive.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</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> Kai-Heng Feng <kai.heng.feng@canonical.com><br>
<b>Sent:</b> Thursday, August 15, 2019 1:11 AM<br>
<b>To:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com><br>
<b>Cc:</b> Huang, Ray <Ray.Huang@amd.com>; anthony.wong@canonical.com <anthony.wong@canonical.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; linux-kernel@vger.kernel.org
 <linux-kernel@vger.kernel.org>; Kai-Heng Feng <kai.heng.feng@canonical.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: Apply flags after amdgpu_device_ip_init()</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">After commit 005440066f92 ("drm/amdgpu: enable gfxoff again on raven<br>
series (v2)"), some Raven Ridge systems start to have rendering<br>
corruption in browser [1].<br>
<br>
Chip specific flags like cg_flags and pg_flags are applied in<br>
amdgpu_device_ip_early_init(). For Raven Ridge, the flags may depend on<br>
pp_feature's PP_GFXOFF_MASK bit, which can be negated in<br>
amdgpu_device_ip_init() based on firmware information. At that time it's<br>
already too late, since cg_flags and pg_flags are already set.<br>
<br>
Apply flags after amdgpu_device_ip_init() and consolidate all flags to<br>
one place, to solve the issue.<br>
<br>
[1] <a href="https://lore.kernel.org/lkml/3EB0E920-31D7-4C91-A360-DBFB4417AC2F@canonical.com/">
https://lore.kernel.org/lkml/3EB0E920-31D7-4C91-A360-DBFB4417AC2F@canonical.com/</a><br>
<br>
Fixes: 005440066f92 ("drm/amdgpu: enable gfxoff again on raven series (v2)")<br>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 589 +++++++++++++++++++++<br>
 drivers/gpu/drm/amd/amdgpu/cik.c           |  87 ---<br>
 drivers/gpu/drm/amd/amdgpu/nv.c            |  50 --<br>
 drivers/gpu/drm/amd/amdgpu/si.c            |  83 ---<br>
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 140 -----<br>
 drivers/gpu/drm/amd/amdgpu/vi.c            | 162 ------<br>
 6 files changed, 589 insertions(+), 522 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 275277364a8a..10ea4899c338 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -1852,6 +1852,591 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)<br>
         return r;<br>
 }<br>
 <br>
+#define CZ_REV_BRISTOL(rev)     \<br>
+       ((rev >= 0xC8 && rev <= 0xCE) || (rev >= 0xE1 && rev <= 0xE6))<br>
+<br>
+static int amdgpu_device_apply_flags(struct amdgpu_device *adev)<br>
+{<br>
+       switch (adev->asic_type) {<br>
+       case CHIP_TAHITI:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_PITCAIRN:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_VERDE:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               //???<br>
+               break;<br>
+       case CHIP_OLAND:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_HAINAN:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_BONAIRE:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_HAWAII:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_KAVERI:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags =<br>
+                       /*AMD_PG_SUPPORT_GFX_PG |<br>
+                         AMD_PG_SUPPORT_GFX_SMG |<br>
+                         AMD_PG_SUPPORT_GFX_DMG |*/<br>
+                       AMD_PG_SUPPORT_UVD |<br>
+                       AMD_PG_SUPPORT_VCE |<br>
+                       /*  AMD_PG_SUPPORT_CP |<br>
+                         AMD_PG_SUPPORT_GDS |<br>
+                         AMD_PG_SUPPORT_RLC_SMU_HS |<br>
+                         AMD_PG_SUPPORT_ACP |<br>
+                         AMD_PG_SUPPORT_SAMU |*/<br>
+                       0;<br>
+               break;<br>
+       case CHIP_KABINI:<br>
+       case CHIP_MULLINS:<br>
+               adev->cg_flags =<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG;<br>
+               adev->pg_flags =<br>
+                       /*AMD_PG_SUPPORT_GFX_PG |<br>
+                         AMD_PG_SUPPORT_GFX_SMG | */<br>
+                       AMD_PG_SUPPORT_UVD |<br>
+                       /*AMD_PG_SUPPORT_VCE |<br>
+                         AMD_PG_SUPPORT_CP |<br>
+                         AMD_PG_SUPPORT_GDS |<br>
+                         AMD_PG_SUPPORT_RLC_SMU_HS |<br>
+                         AMD_PG_SUPPORT_SAMU |*/<br>
+                       0;<br>
+               break;<br>
+       case CHIP_TOPAZ:<br>
+               adev->cg_flags = 0;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_FIJI:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_TONGA:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_POLARIS11:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_POLARIS10:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_POLARIS12:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_VEGAM:<br>
+               adev->cg_flags = 0;<br>
+                       /*AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;*/<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_CARRIZO:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;<br>
+               /* rev0 hardware requires workarounds to support PG */<br>
+               adev->pg_flags = 0;<br>
+               if (adev->rev_id != 0x00 || CZ_REV_BRISTOL(adev->pdev->revision)) {<br>
+                       adev->pg_flags |= AMD_PG_SUPPORT_GFX_SMG |<br>
+                               AMD_PG_SUPPORT_GFX_PIPELINE |<br>
+                               AMD_PG_SUPPORT_CP |<br>
+                               AMD_PG_SUPPORT_UVD |<br>
+                               AMD_PG_SUPPORT_VCE;<br>
+               }<br>
+               break;<br>
+       case CHIP_STONEY:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_UVD_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS |<br>
+                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG;<br>
+               adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |<br>
+                       AMD_PG_SUPPORT_GFX_SMG |<br>
+                       AMD_PG_SUPPORT_GFX_PIPELINE |<br>
+                       AMD_PG_SUPPORT_CP |<br>
+                       AMD_PG_SUPPORT_UVD |<br>
+                       AMD_PG_SUPPORT_VCE;<br>
+               break;<br>
+       case CHIP_VEGA10:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_DRM_MGCG |<br>
+                       AMD_CG_SUPPORT_DRM_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_DF_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_VEGA12:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_VEGA20:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_ROM_MGCG |<br>
+                       AMD_CG_SUPPORT_VCE_MGCG |<br>
+                       AMD_CG_SUPPORT_UVD_MGCG;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_RAVEN:<br>
+               if (adev->rev_id >= 0x8) {<br>
+                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                               AMD_CG_SUPPORT_GFX_MGLS |<br>
+                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                               AMD_CG_SUPPORT_GFX_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_CGLS |<br>
+                               AMD_CG_SUPPORT_BIF_LS |<br>
+                               AMD_CG_SUPPORT_HDP_LS |<br>
+                               AMD_CG_SUPPORT_ROM_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_LS |<br>
+                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                               AMD_CG_SUPPORT_SDMA_LS |<br>
+                               AMD_CG_SUPPORT_VCN_MGCG;<br>
+<br>
+                       adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN;<br>
+               } else if (adev->pdev->device == 0x15d8) {<br>
+                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                               AMD_CG_SUPPORT_GFX_MGLS |<br>
+                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                               AMD_CG_SUPPORT_GFX_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_CGLS |<br>
+                               AMD_CG_SUPPORT_BIF_LS |<br>
+                               AMD_CG_SUPPORT_HDP_LS |<br>
+                               AMD_CG_SUPPORT_ROM_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_LS |<br>
+                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                               AMD_CG_SUPPORT_SDMA_LS;<br>
+<br>
+                       adev->pg_flags = AMD_PG_SUPPORT_SDMA |<br>
+                               AMD_PG_SUPPORT_MMHUB |<br>
+                               AMD_PG_SUPPORT_VCN |<br>
+                               AMD_PG_SUPPORT_VCN_DPG;<br>
+               } else {<br>
+                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                               AMD_CG_SUPPORT_GFX_MGLS |<br>
+                               AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
+                               AMD_CG_SUPPORT_GFX_CGCG |<br>
+                               AMD_CG_SUPPORT_GFX_CGLS |<br>
+                               AMD_CG_SUPPORT_BIF_MGCG |<br>
+                               AMD_CG_SUPPORT_BIF_LS |<br>
+                               AMD_CG_SUPPORT_HDP_MGCG |<br>
+                               AMD_CG_SUPPORT_HDP_LS |<br>
+                               AMD_CG_SUPPORT_DRM_MGCG |<br>
+                               AMD_CG_SUPPORT_DRM_LS |<br>
+                               AMD_CG_SUPPORT_ROM_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_MGCG |<br>
+                               AMD_CG_SUPPORT_MC_LS |<br>
+                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                               AMD_CG_SUPPORT_SDMA_LS |<br>
+                               AMD_CG_SUPPORT_VCN_MGCG;<br>
+<br>
+                       adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN;<br>
+               }<br>
+<br>
+               if (adev->pm.pp_feature & PP_GFXOFF_MASK)<br>
+                       adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |<br>
+                               AMD_PG_SUPPORT_CP |<br>
+                               AMD_PG_SUPPORT_RLC_SMU_HS;<br>
+               break;<br>
+       case CHIP_ARCTURUS:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_RENOIR:<br>
+               adev->cg_flags = 0;<br>
+               adev->pg_flags = 0;<br>
+               break;<br>
+       case CHIP_NAVI10:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_IH_CG |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
+                       AMD_CG_SUPPORT_ATHUB_LS |<br>
+                       AMD_CG_SUPPORT_VCN_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS;<br>
+               adev->pg_flags = AMD_PG_SUPPORT_VCN |<br>
+                       AMD_PG_SUPPORT_VCN_DPG |<br>
+                       AMD_PG_SUPPORT_MMHUB |<br>
+                       AMD_PG_SUPPORT_ATHUB;<br>
+               break;<br>
+       case CHIP_NAVI14:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_IH_CG |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
+                       AMD_CG_SUPPORT_ATHUB_LS |<br>
+                       AMD_CG_SUPPORT_VCN_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_MGCG |<br>
+                       AMD_CG_SUPPORT_BIF_LS;<br>
+               adev->pg_flags = AMD_PG_SUPPORT_VCN |<br>
+                       AMD_PG_SUPPORT_VCN_DPG;<br>
+               break;<br>
+       case CHIP_NAVI12:<br>
+               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
+                       AMD_CG_SUPPORT_GFX_MGLS |<br>
+                       AMD_CG_SUPPORT_GFX_CGCG |<br>
+                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
+                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
+                       AMD_CG_SUPPORT_IH_CG |<br>
+                       AMD_CG_SUPPORT_HDP_MGCG |<br>
+                       AMD_CG_SUPPORT_HDP_LS |<br>
+                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
+                       AMD_CG_SUPPORT_SDMA_LS |<br>
+                       AMD_CG_SUPPORT_MC_MGCG |<br>
+                       AMD_CG_SUPPORT_MC_LS |<br>
+                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
+                       AMD_CG_SUPPORT_ATHUB_LS |<br>
+                       AMD_CG_SUPPORT_VCN_MGCG;<br>
+               adev->pg_flags = AMD_PG_SUPPORT_VCN_DPG;<br>
+               break;<br>
+       default:<br>
+               /* FIXME: not supported yet */<br>
+               return -EINVAL;<br>
+       }<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
 /**<br>
  * amdgpu_device_fill_reset_magic - writes reset magic to gart pointer<br>
  *<br>
@@ -2827,6 +3412,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,<br>
                 goto failed;<br>
         }<br>
 <br>
+       r = amdgpu_device_apply_flags(adev);<br>
+       if (r)<br>
+               goto failed;<br>
+<br>
         adev->accel_working = true;<br>
 <br>
         amdgpu_vm_check_compute_bug(adev);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c<br>
index 7b63d7a8298a..01e2211e251d 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/cik.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c<br>
@@ -1862,74 +1862,12 @@ static int cik_common_early_init(void *handle)<br>
         adev->external_rev_id = 0xFF;<br>
         switch (adev->asic_type) {<br>
         case CHIP_BONAIRE:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x14;<br>
                 break;<br>
         case CHIP_HAWAII:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = 0x28;<br>
                 break;<br>
         case CHIP_KAVERI:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags =<br>
-                       /*AMD_PG_SUPPORT_GFX_PG |<br>
-                         AMD_PG_SUPPORT_GFX_SMG |<br>
-                         AMD_PG_SUPPORT_GFX_DMG |*/<br>
-                       AMD_PG_SUPPORT_UVD |<br>
-                       AMD_PG_SUPPORT_VCE |<br>
-                       /*  AMD_PG_SUPPORT_CP |<br>
-                         AMD_PG_SUPPORT_GDS |<br>
-                         AMD_PG_SUPPORT_RLC_SMU_HS |<br>
-                         AMD_PG_SUPPORT_ACP |<br>
-                         AMD_PG_SUPPORT_SAMU |*/<br>
-                       0;<br>
                 if (adev->pdev->device == 0x1312 ||<br>
                         adev->pdev->device == 0x1316 ||<br>
                         adev->pdev->device == 0x1317)<br>
@@ -1939,31 +1877,6 @@ static int cik_common_early_init(void *handle)<br>
                 break;<br>
         case CHIP_KABINI:<br>
         case CHIP_MULLINS:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags =<br>
-                       /*AMD_PG_SUPPORT_GFX_PG |<br>
-                         AMD_PG_SUPPORT_GFX_SMG | */<br>
-                       AMD_PG_SUPPORT_UVD |<br>
-                       /*AMD_PG_SUPPORT_VCE |<br>
-                         AMD_PG_SUPPORT_CP |<br>
-                         AMD_PG_SUPPORT_GDS |<br>
-                         AMD_PG_SUPPORT_RLC_SMU_HS |<br>
-                         AMD_PG_SUPPORT_SAMU |*/<br>
-                       0;<br>
                 if (adev->asic_type == CHIP_KABINI) {<br>
                         if (adev->rev_id == 0)<br>
                                 adev->external_rev_id = 0x81;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
index d4a2012b4832..30d100dc7b29 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
@@ -600,62 +600,12 @@ static int nv_common_early_init(void *handle)<br>
         adev->external_rev_id = 0xff;<br>
         switch (adev->asic_type) {<br>
         case CHIP_NAVI10:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_IH_CG |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
-                       AMD_CG_SUPPORT_ATHUB_LS |<br>
-                       AMD_CG_SUPPORT_VCN_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS;<br>
-               adev->pg_flags = AMD_PG_SUPPORT_VCN |<br>
-                       AMD_PG_SUPPORT_VCN_DPG |<br>
-                       AMD_PG_SUPPORT_MMHUB |<br>
-                       AMD_PG_SUPPORT_ATHUB;<br>
                 adev->external_rev_id = adev->rev_id + 0x1;<br>
                 break;<br>
         case CHIP_NAVI14:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_IH_CG |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
-                       AMD_CG_SUPPORT_ATHUB_LS |<br>
-                       AMD_CG_SUPPORT_VCN_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS;<br>
-               adev->pg_flags = AMD_PG_SUPPORT_VCN |<br>
-                       AMD_PG_SUPPORT_VCN_DPG;<br>
                 adev->external_rev_id = adev->rev_id + 20;<br>
                 break;<br>
         case CHIP_NAVI12:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_IH_CG |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_ATHUB_MGCG |<br>
-                       AMD_CG_SUPPORT_ATHUB_LS |<br>
-                       AMD_CG_SUPPORT_VCN_MGCG;<br>
-               adev->pg_flags = AMD_PG_SUPPORT_VCN_DPG;<br>
                 adev->external_rev_id = adev->rev_id + 0xa;<br>
                 break;<br>
         default:<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c<br>
index 904361451650..22ba2d7e797f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/si.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/si.c<br>
@@ -1442,104 +1442,21 @@ static int si_common_early_init(void *handle)<br>
         adev->external_rev_id = 0xFF;<br>
         switch (adev->asic_type) {<br>
         case CHIP_TAHITI:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = (adev->rev_id == 0) ? 1 :<br>
                                         (adev->rev_id == 1) ? 5 : 6;<br>
                 break;<br>
         case CHIP_PITCAIRN:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 20;<br>
                 break;<br>
-<br>
         case CHIP_VERDE:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
-               //???<br>
                 adev->external_rev_id = adev->rev_id + 40;<br>
                 break;<br>
         case CHIP_OLAND:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = 60;<br>
                 break;<br>
         case CHIP_HAINAN:<br>
-               adev->cg_flags =<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       /*AMD_CG_SUPPORT_GFX_CGCG |*/<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = 70;<br>
                 break;<br>
-<br>
         default:<br>
                 return -EINVAL;<br>
         }<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index c2d324d8da75..f2849fc463b8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -983,72 +983,14 @@ static int soc15_common_early_init(void *handle)<br>
         switch (adev->asic_type) {<br>
         case CHIP_VEGA10:<br>
                 adev->asic_funcs = &soc15_asic_funcs;<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_DRM_MGCG |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_DF_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = 0x1;<br>
                 break;<br>
         case CHIP_VEGA12:<br>
                 adev->asic_funcs = &soc15_asic_funcs;<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x14;<br>
                 break;<br>
         case CHIP_VEGA20:<br>
                 adev->asic_funcs = &vega20_asic_funcs;<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x28;<br>
                 break;<br>
         case CHIP_RAVEN:<br>
@@ -1061,95 +1003,13 @@ static int soc15_common_early_init(void *handle)<br>
                         adev->external_rev_id = adev->rev_id + 0x20;<br>
                 else<br>
                         adev->external_rev_id = adev->rev_id + 0x01;<br>
-<br>
-               if (adev->rev_id >= 0x8) {<br>
-                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                               AMD_CG_SUPPORT_GFX_MGLS |<br>
-                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                               AMD_CG_SUPPORT_GFX_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_CGLS |<br>
-                               AMD_CG_SUPPORT_BIF_LS |<br>
-                               AMD_CG_SUPPORT_HDP_LS |<br>
-                               AMD_CG_SUPPORT_ROM_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_LS |<br>
-                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                               AMD_CG_SUPPORT_SDMA_LS |<br>
-                               AMD_CG_SUPPORT_VCN_MGCG;<br>
-<br>
-                       adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN;<br>
-               } else if (adev->pdev->device == 0x15d8) {<br>
-                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                               AMD_CG_SUPPORT_GFX_MGLS |<br>
-                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                               AMD_CG_SUPPORT_GFX_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_CGLS |<br>
-                               AMD_CG_SUPPORT_BIF_LS |<br>
-                               AMD_CG_SUPPORT_HDP_LS |<br>
-                               AMD_CG_SUPPORT_ROM_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_LS |<br>
-                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                               AMD_CG_SUPPORT_SDMA_LS;<br>
-<br>
-                       adev->pg_flags = AMD_PG_SUPPORT_SDMA |<br>
-                               AMD_PG_SUPPORT_MMHUB |<br>
-                               AMD_PG_SUPPORT_VCN |<br>
-                               AMD_PG_SUPPORT_VCN_DPG;<br>
-               } else {<br>
-                       adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                               AMD_CG_SUPPORT_GFX_MGLS |<br>
-                               AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                               AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                               AMD_CG_SUPPORT_GFX_CGCG |<br>
-                               AMD_CG_SUPPORT_GFX_CGLS |<br>
-                               AMD_CG_SUPPORT_BIF_MGCG |<br>
-                               AMD_CG_SUPPORT_BIF_LS |<br>
-                               AMD_CG_SUPPORT_HDP_MGCG |<br>
-                               AMD_CG_SUPPORT_HDP_LS |<br>
-                               AMD_CG_SUPPORT_DRM_MGCG |<br>
-                               AMD_CG_SUPPORT_DRM_LS |<br>
-                               AMD_CG_SUPPORT_ROM_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_MGCG |<br>
-                               AMD_CG_SUPPORT_MC_LS |<br>
-                               AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                               AMD_CG_SUPPORT_SDMA_LS |<br>
-                               AMD_CG_SUPPORT_VCN_MGCG;<br>
-<br>
-                       adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN;<br>
-               }<br>
-<br>
-               if (adev->pm.pp_feature & PP_GFXOFF_MASK)<br>
-                       adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |<br>
-                               AMD_PG_SUPPORT_CP |<br>
-                               AMD_PG_SUPPORT_RLC_SMU_HS;<br>
                 break;<br>
         case CHIP_ARCTURUS:<br>
                 adev->asic_funcs = &vega20_asic_funcs;<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x32;<br>
                 break;<br>
         case CHIP_RENOIR:<br>
                 adev->asic_funcs = &soc15_asic_funcs;<br>
-               adev->cg_flags = 0;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x91;<br>
                 break;<br>
         default:<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c<br>
index 56c882b3ea3c..6a94c72e86f2 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vi.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c<br>
@@ -1042,9 +1042,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs =<br>
         .get_pcie_replay_count = &vi_get_pcie_replay_count,<br>
 };<br>
 <br>
-#define CZ_REV_BRISTOL(rev)     \<br>
-       ((rev >= 0xC8 && rev <= 0xCE) || (rev >= 0xE1 && rev <= 0xE6))<br>
-<br>
 static int vi_common_early_init(void *handle)<br>
 {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
@@ -1071,189 +1068,30 @@ static int vi_common_early_init(void *handle)<br>
         adev->external_rev_id = 0xFF;<br>
         switch (adev->asic_type) {<br>
         case CHIP_TOPAZ:<br>
-               adev->cg_flags = 0;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = 0x1;<br>
                 break;<br>
         case CHIP_FIJI:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x3c;<br>
                 break;<br>
         case CHIP_TONGA:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x14;<br>
                 break;<br>
         case CHIP_POLARIS11:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x5A;<br>
                 break;<br>
         case CHIP_POLARIS10:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x50;<br>
                 break;<br>
         case CHIP_POLARIS12:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x64;<br>
                 break;<br>
         case CHIP_VEGAM:<br>
-               adev->cg_flags = 0;<br>
-                       /*AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_3D_CGLS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_BIF_MGCG |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_ROM_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_MGCG |<br>
-                       AMD_CG_SUPPORT_MC_LS |<br>
-                       AMD_CG_SUPPORT_DRM_LS |<br>
-                       AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;*/<br>
-               adev->pg_flags = 0;<br>
                 adev->external_rev_id = adev->rev_id + 0x6E;<br>
                 break;<br>
         case CHIP_CARRIZO:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGCG |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;<br>
-               /* rev0 hardware requires workarounds to support PG */<br>
-               adev->pg_flags = 0;<br>
-               if (adev->rev_id != 0x00 || CZ_REV_BRISTOL(adev->pdev->revision)) {<br>
-                       adev->pg_flags |= AMD_PG_SUPPORT_GFX_SMG |<br>
-                               AMD_PG_SUPPORT_GFX_PIPELINE |<br>
-                               AMD_PG_SUPPORT_CP |<br>
-                               AMD_PG_SUPPORT_UVD |<br>
-                               AMD_PG_SUPPORT_VCE;<br>
-               }<br>
                 adev->external_rev_id = adev->rev_id + 0x1;<br>
                 break;<br>
         case CHIP_STONEY:<br>
-               adev->cg_flags = AMD_CG_SUPPORT_UVD_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGCG |<br>
-                       AMD_CG_SUPPORT_GFX_MGLS |<br>
-                       AMD_CG_SUPPORT_GFX_RLC_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CP_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS |<br>
-                       AMD_CG_SUPPORT_GFX_CGTS_LS |<br>
-                       AMD_CG_SUPPORT_GFX_CGLS |<br>
-                       AMD_CG_SUPPORT_BIF_LS |<br>
-                       AMD_CG_SUPPORT_HDP_MGCG |<br>
-                       AMD_CG_SUPPORT_HDP_LS |<br>
-                       AMD_CG_SUPPORT_SDMA_MGCG |<br>
-                       AMD_CG_SUPPORT_SDMA_LS |<br>
-                       AMD_CG_SUPPORT_VCE_MGCG;<br>
-               adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |<br>
-                       AMD_PG_SUPPORT_GFX_SMG |<br>
-                       AMD_PG_SUPPORT_GFX_PIPELINE |<br>
-                       AMD_PG_SUPPORT_CP |<br>
-                       AMD_PG_SUPPORT_UVD |<br>
-                       AMD_PG_SUPPORT_VCE;<br>
                 adev->external_rev_id = adev->rev_id + 0x61;<br>
                 break;<br>
         default:<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>