[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Harish Kasiviswanathan <harish.kasiviswanat...@amd.com>

-----Original Message-----
From: Joshi, Mukul <mukul.jo...@amd.com> 
Sent: Thursday, May 6, 2021 3:47 PM
To: amd-gfx@lists.freedesktop.org
Cc: Kasiviswanathan, Harish <harish.kasiviswanat...@amd.com>; Joshi, Mukul 
<mukul.jo...@amd.com>; Zeng, Oak <oak.z...@amd.com>
Subject: [PATCH] drm/amdgpu: Enable TCP channel hashing for Aldebaran

Enable TCP channel hashing to match DF hash settings for Aldebaran.

Signed-off-by: Mukul Joshi <mukul.jo...@amd.com>
Signed-off-by: Oak Zeng <oak.z...@amd.com>
Reviewed-by: Joseph Greathouse <joseph.greatho...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/df_v3_6.c            | 17 +++++++++++------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c           |  3 ++-
 .../amd/include/asic_reg/df/df_3_6_sh_mask.h    |  1 +
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c 
b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
index 0d8459d63bac..36ba229576d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
+++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
@@ -219,11 +219,11 @@ static void df_v3_6_query_hashes(struct amdgpu_device 
*adev)
        adev->df.hash_status.hash_2m = false;
        adev->df.hash_status.hash_1g = false;
 
-       if (adev->asic_type != CHIP_ARCTURUS)
-               return;
-
-       /* encoding for hash-enabled on Arcturus */
-       if (adev->df.funcs->get_fb_channel_number(adev) == 0xe) {
+       /* encoding for hash-enabled on Arcturus and Aldebaran */
+       if ((adev->asic_type == CHIP_ARCTURUS &&
+            adev->df.funcs->get_fb_channel_number(adev) == 0xe) ||
+            (adev->asic_type == CHIP_ALDEBARAN &&
+             adev->df.funcs->get_fb_channel_number(adev) == 0x1e)) {
                tmp = RREG32_SOC15(DF, 0, mmDF_CS_UMC_AON0_DfGlobalCtrl);
                adev->df.hash_status.hash_64k = REG_GET_FIELD(tmp,
                                                DF_CS_UMC_AON0_DfGlobalCtrl,
@@ -278,7 +278,12 @@ static u32 df_v3_6_get_fb_channel_number(struct 
amdgpu_device *adev)
        u32 tmp;
 
        tmp = RREG32_SOC15(DF, 0, mmDF_CS_UMC_AON0_DramBaseAddress0);
-       tmp &= DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan_MASK;
+       if (adev->asic_type == CHIP_ALDEBARAN)
+               tmp &=
+               ALDEBARAN_DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan_MASK;
+       else
+               tmp &= DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan_MASK;
+
        tmp >>= DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan__SHIFT;
 
        return tmp;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 16a3b279a9ef..22608c45f07c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -3937,7 +3937,8 @@ static void gfx_v9_0_init_tcp_config(struct amdgpu_device 
*adev)
 {
        u32 tmp;
 
-       if (adev->asic_type != CHIP_ARCTURUS)
+       if (adev->asic_type != CHIP_ARCTURUS &&
+           adev->asic_type != CHIP_ALDEBARAN)
                return;
 
        tmp = RREG32_SOC15(GC, 0, mmTCP_ADDR_CONFIG);
diff --git a/drivers/gpu/drm/amd/include/asic_reg/df/df_3_6_sh_mask.h 
b/drivers/gpu/drm/amd/include/asic_reg/df/df_3_6_sh_mask.h
index 7afa87c7ff54..f804e13b002e 100644
--- a/drivers/gpu/drm/amd/include/asic_reg/df/df_3_6_sh_mask.h
+++ b/drivers/gpu/drm/amd/include/asic_reg/df/df_3_6_sh_mask.h
@@ -50,6 +50,7 @@
 #define DF_CS_UMC_AON0_DramBaseAddress0__AddrRngVal_MASK                       
                        0x00000001L
 #define DF_CS_UMC_AON0_DramBaseAddress0__LgcyMmioHoleEn_MASK                   
                        0x00000002L
 #define DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan_MASK                     
                        0x0000003CL
+#define ALDEBARAN_DF_CS_UMC_AON0_DramBaseAddress0__IntLvNumChan_MASK           
                        0x0000007CL
 #define DF_CS_UMC_AON0_DramBaseAddress0__IntLvAddrSel_MASK                     
                        0x00000E00L
 #define DF_CS_UMC_AON0_DramBaseAddress0__DramBaseAddr_MASK                     
                        0xFFFFF000L
 
-- 
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to