<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">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Acked-by: Alex Deucher <alexander.deucher@amd.com><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> Yu, Lang <Lang.Yu@amd.com><br>
<b>Sent:</b> Thursday, October 12, 2023 3:31 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Yifan <Yifan1.Zhang@amd.com>; Yu, Lang <Lang.Yu@amd.com><br>
<b>Subject:</b> [PATCH 1/2] drm/amdgpu: correct NBIO v7.11 programing</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Use v7.7 before, switch to v7.11 now.<br>
Fix incorrect programing.<br>
<br>
Signed-off-by: Lang Yu <Lang.Yu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c       | 56 +++++++++----------<br>
 .../asic_reg/nbio/nbio_7_11_0_offset.h        |  9 ++-<br>
 2 files changed, 33 insertions(+), 32 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c<br>
index 6873eead1e19..3a94f249929e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c<br>
@@ -66,19 +66,19 @@ static void nbio_v7_11_sdma_doorbell_range(struct amdgpu_device *adev, int insta<br>
                                           bool use_doorbell, int doorbell_index,<br>
                                           int doorbell_size)<br>
 {<br>
-       u32 reg = SOC15_REG_OFFSET(NBIO, 0, regGDC0_BIF_SDMA0_DOORBELL_RANGE);<br>
+       u32 reg = SOC15_REG_OFFSET(NBIO, 0, regGDC0_BIF_CSDMA_DOORBELL_RANGE);<br>
         u32 doorbell_range = RREG32_PCIE_PORT(reg);<br>
 <br>
         if (use_doorbell) {<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range,<br>
-                                              GDC0_BIF_SDMA0_DOORBELL_RANGE,<br>
+                                              GDC0_BIF_CSDMA_DOORBELL_RANGE,<br>
                                                OFFSET, doorbell_index);<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range,<br>
-                                              GDC0_BIF_SDMA0_DOORBELL_RANGE,<br>
+                                              GDC0_BIF_CSDMA_DOORBELL_RANGE,<br>
                                                SIZE, doorbell_size);<br>
         } else {<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range,<br>
-                                              GDC0_BIF_SDMA0_DOORBELL_RANGE,<br>
+                                              GDC0_BIF_CSDMA_DOORBELL_RANGE,<br>
                                                SIZE, 0);<br>
         }<br>
 <br>
@@ -145,27 +145,25 @@ static void nbio_v7_11_enable_doorbell_aperture(struct amdgpu_device *adev,<br>
 static void nbio_v7_11_enable_doorbell_selfring_aperture(struct amdgpu_device *adev,<br>
                                                         bool enable)<br>
 {<br>
-/*     u32 tmp = 0;<br>
+       u32 tmp = 0;<br>
 <br>
         if (enable) {<br>
-               tmp = REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
+               tmp = REG_SET_FIELD(tmp, BIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
                                 DOORBELL_SELFRING_GPA_APER_EN, 1) |<br>
-                       REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
+                     REG_SET_FIELD(tmp, BIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
                                 DOORBELL_SELFRING_GPA_APER_MODE, 1) |<br>
-                       REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
+                     REG_SET_FIELD(tmp, BIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
                                 DOORBELL_SELFRING_GPA_APER_SIZE, 0);<br>
 <br>
                 WREG32_SOC15(NBIO, 0,<br>
-                       regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_LOW,<br>
+                       regBIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_BASE_LOW,<br>
                         lower_32_bits(adev->doorbell.base));<br>
                 WREG32_SOC15(NBIO, 0,<br>
-                       regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_HIGH,<br>
+                       regBIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_BASE_HIGH,<br>
                         upper_32_bits(adev->doorbell.base));<br>
         }<br>
 <br>
-       WREG32_SOC15(NBIO, 0, regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,<br>
-               tmp);<br>
-*/<br>
+       WREG32_SOC15(NBIO, 0, regBIF_BX_PF1_DOORBELL_SELFRING_GPA_APER_CNTL, tmp);<br>
 }<br>
 <br>
 <br>
@@ -216,12 +214,12 @@ static void nbio_v7_11_ih_control(struct amdgpu_device *adev)<br>
 <br>
 static u32 nbio_v7_11_get_hdp_flush_req_offset(struct amdgpu_device *adev)<br>
 {<br>
-       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_GPU_HDP_FLUSH_REQ);<br>
+       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF1_GPU_HDP_FLUSH_REQ);<br>
 }<br>
 <br>
 static u32 nbio_v7_11_get_hdp_flush_done_offset(struct amdgpu_device *adev)<br>
 {<br>
-       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_GPU_HDP_FLUSH_DONE);<br>
+       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF1_GPU_HDP_FLUSH_DONE);<br>
 }<br>
 <br>
 static u32 nbio_v7_11_get_pcie_index_offset(struct amdgpu_device *adev)<br>
@@ -236,27 +234,27 @@ static u32 nbio_v7_11_get_pcie_data_offset(struct amdgpu_device *adev)<br>
 <br>
 static u32 nbio_v7_11_get_pcie_port_index_offset(struct amdgpu_device *adev)<br>
 {<br>
-       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_RSMU_INDEX);<br>
+       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF1_RSMU_INDEX);<br>
 }<br>
 <br>
 static u32 nbio_v7_11_get_pcie_port_data_offset(struct amdgpu_device *adev)<br>
 {<br>
-       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_RSMU_DATA);<br>
+       return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF1_RSMU_DATA);<br>
 }<br>
 <br>
 const struct nbio_hdp_flush_reg nbio_v7_11_hdp_flush_reg = {<br>
-       .ref_and_mask_cp0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP0_MASK,<br>
-       .ref_and_mask_cp1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP1_MASK,<br>
-       .ref_and_mask_cp2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP2_MASK,<br>
-       .ref_and_mask_cp3 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP3_MASK,<br>
-       .ref_and_mask_cp4 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP4_MASK,<br>
-       .ref_and_mask_cp5 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP5_MASK,<br>
-       .ref_and_mask_cp6 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP6_MASK,<br>
-       .ref_and_mask_cp7 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP7_MASK,<br>
-       .ref_and_mask_cp8 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP8_MASK,<br>
-       .ref_and_mask_cp9 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP9_MASK,<br>
-       .ref_and_mask_sdma0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA0_MASK,<br>
-       .ref_and_mask_sdma1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA1_MASK,<br>
+       .ref_and_mask_cp0 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP0_MASK,<br>
+       .ref_and_mask_cp1 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP1_MASK,<br>
+       .ref_and_mask_cp2 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP2_MASK,<br>
+       .ref_and_mask_cp3 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP3_MASK,<br>
+       .ref_and_mask_cp4 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP4_MASK,<br>
+       .ref_and_mask_cp5 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP5_MASK,<br>
+       .ref_and_mask_cp6 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP6_MASK,<br>
+       .ref_and_mask_cp7 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP7_MASK,<br>
+       .ref_and_mask_cp8 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP8_MASK,<br>
+       .ref_and_mask_cp9 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__CP9_MASK,<br>
+       .ref_and_mask_sdma0 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__SDMA0_MASK,<br>
+       .ref_and_mask_sdma1 = BIF_BX_PF1_GPU_HDP_FLUSH_DONE__SDMA1_MASK,<br>
 };<br>
 <br>
 static void nbio_v7_11_init_registers(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_7_11_0_offset.h b/drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_7_11_0_offset.h<br>
index f446b1760f7c..846a8cf3926a 100644<br>
--- a/drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_7_11_0_offset.h<br>
+++ b/drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_7_11_0_offset.h<br>
@@ -8187,9 +8187,9 @@<br>
 #define regBIF_BX0_PCIE_INDEX_BASE_IDX                                                                  5<br>
 #define regBIF_BX0_PCIE_DATA                                                                            0x800d<br>
 #define regBIF_BX0_PCIE_DATA_BASE_IDX                                                                   5<br>
-#define regBIF_BX0_PCIE_INDEX2                                                                          0xe<br>
+#define regBIF_BX0_PCIE_INDEX2                                                                          0x800e<br>
 #define regBIF_BX0_PCIE_INDEX2_BASE_IDX                                                                 0<br>
-#define regBIF_BX0_PCIE_DATA2                                                                           0xf<br>
+#define regBIF_BX0_PCIE_DATA2                                                                           0x800f<br>
 #define regBIF_BX0_PCIE_DATA2_BASE_IDX                                                                  0<br>
 #define regBIF_BX0_SBIOS_SCRATCH_0                                                                      0x8048<br>
 #define regBIF_BX0_SBIOS_SCRATCH_0_BASE_IDX                                                             5<br>
@@ -8678,7 +8678,10 @@<br>
 #define regBIF_BX_PF1_MM_DATA_BASE_IDX                                                                  0<br>
 #define regBIF_BX_PF1_MM_INDEX_HI                                                                       0x0006<br>
 #define regBIF_BX_PF1_MM_INDEX_HI_BASE_IDX                                                              0<br>
-<br>
+#define regBIF_BX_PF1_RSMU_INDEX                                                                        0x0000<br>
+#define regBIF_BX_PF1_RSMU_INDEX_BASE_IDX                                                               1<br>
+#define regBIF_BX_PF1_RSMU_DATA                                                                         0x0001<br>
+#define regBIF_BX_PF1_RSMU_DATA_BASE_IDX                                                                1<br>
 <br>
 // addressBlock: nbio_nbif0_bif_bx_BIFDEC1:1<br>
 // base address: 0x0<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>