<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);">
Hi Alex,</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);">
I only add the corresponding changes for IH, but not for GFX as GFX does not use the similar range functions.</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);">
Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Yong</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> Zhao, Yong<br>
<b>Sent:</b> Wednesday, February 6, 2019 10:49 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhao, Yong<br>
<b>Subject:</b> [PATCH 1/3] drm/amdgpu: Improve doorbell variable names</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Indicate that the doorbell offset and range is in dwords.<br>
<br>
Change-Id: Ib0f2564ffa7b1940ffb8725cdc03f662184f5436<br>
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  4 ++--<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h |  3 ++-<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h       |  2 +-<br>
 drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c       | 10 +++++-----<br>
 drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c       | 10 +++++-----<br>
 drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c       | 10 +++++-----<br>
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c       |  3 ++-<br>
 drivers/gpu/drm/amd/amdgpu/soc15.c           |  4 ++--<br>
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c        |  6 +++---<br>
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c       |  6 +++---<br>
 drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c |  6 +++++-<br>
 drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c |  6 +++++-<br>
 12 files changed, 40 insertions(+), 30 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index d67f8b1dfe80..88b3bbcea756 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -642,13 +642,13 @@ struct amdgpu_nbio_funcs {<br>
         void (*hdp_flush)(struct amdgpu_device *adev, struct amdgpu_ring *ring);<br>
         u32 (*get_memsize)(struct amdgpu_device *adev);<br>
         void (*sdma_doorbell_range)(struct amdgpu_device *adev, int instance,<br>
-                       bool use_doorbell, int doorbell_index, int doorbell_size);<br>
+                       bool use_doorbell, int index_in_dw, int range_dw_size);<br>
         void (*enable_doorbell_aperture)(struct amdgpu_device *adev,<br>
                                          bool enable);<br>
         void (*enable_doorbell_selfring_aperture)(struct amdgpu_device *adev,<br>
                                                   bool enable);<br>
         void (*ih_doorbell_range)(struct amdgpu_device *adev,<br>
-                                 bool use_doorbell, int doorbell_index);<br>
+                                 bool use_doorbell, int index_in_dw);<br>
         void (*update_medium_grain_clock_gating)(struct amdgpu_device *adev,<br>
                                                  bool enable);<br>
         void (*update_medium_grain_light_sleep)(struct amdgpu_device *adev,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h<br>
index 1cfec06f81d4..5c8d04c353d0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h<br>
@@ -39,6 +39,7 @@ struct amdgpu_doorbell {<br>
  * can be 64-bit, so the index defined is in qword.<br>
  */<br>
 struct amdgpu_doorbell_index {<br>
+       uint32_t entry_dw_size;<br>
         uint32_t kiq;<br>
         uint32_t mec_ring0;<br>
         uint32_t mec_ring1;<br>
@@ -73,7 +74,7 @@ struct amdgpu_doorbell_index {<br>
         };<br>
         uint32_t max_assignment;<br>
         /* Per engine SDMA doorbell size in dword */<br>
-       uint32_t sdma_doorbell_range;<br>
+       uint32_t dw_range_per_sdma_eng;<br>
 };<br>
 <br>
 typedef enum _AMDGPU_DOORBELL_ASSIGNMENT<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h<br>
index 1ccb1831382a..2572191b394a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h<br>
@@ -33,7 +33,7 @@ struct amdgpu_iv_entry;<br>
 struct amdgpu_ih_ring {<br>
         unsigned                ring_size;<br>
         uint32_t                ptr_mask;<br>
-       u32                     doorbell_index;<br>
+       u32                     doorbell_idx_in_dw;<br>
         bool                    use_doorbell;<br>
         bool                    use_bus_addr;<br>
 <br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c<br>
index cc967dbfd631..bcc41c957b24 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c<br>
@@ -68,7 +68,7 @@ static u32 nbio_v6_1_get_memsize(struct amdgpu_device *adev)<br>
 }<br>
 <br>
 static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instance,<br>
-                       bool use_doorbell, int doorbell_index, int doorbell_size)<br>
+                       bool use_doorbell, int index_in_dw, int range_dw_size)<br>
 {<br>
         u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :<br>
                         SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);<br>
@@ -76,8 +76,8 @@ static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instan<br>
         u32 doorbell_range = RREG32(reg);<br>
 <br>
         if (use_doorbell) {<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);<br>
         } else<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);<br>
 <br>
@@ -112,12 +112,12 @@ static void nbio_v6_1_enable_doorbell_selfring_aperture(struct amdgpu_device *ad<br>
 <br>
 <br>
 static void nbio_v6_1_ih_doorbell_range(struct amdgpu_device *adev,<br>
-                                       bool use_doorbell, int doorbell_index)<br>
+                                       bool use_doorbell, int index_in_dw)<br>
 {<br>
         u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0 , mmBIF_IH_DOORBELL_RANGE);<br>
 <br>
         if (use_doorbell) {<br>
-               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
+               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 2);<br>
         } else<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c<br>
index 1cdb98ad2db3..02a9093b464a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c<br>
@@ -67,7 +67,7 @@ static u32 nbio_v7_0_get_memsize(struct amdgpu_device *adev)<br>
 }<br>
 <br>
 static void nbio_v7_0_sdma_doorbell_range(struct amdgpu_device *adev, int instance,<br>
-                       bool use_doorbell, int doorbell_index, int doorbell_size)<br>
+                       bool use_doorbell, int index_in_dw, int range_dw_size)<br>
 {<br>
         u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :<br>
                         SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);<br>
@@ -75,8 +75,8 @@ static void nbio_v7_0_sdma_doorbell_range(struct amdgpu_device *adev, int instan<br>
         u32 doorbell_range = RREG32(reg);<br>
 <br>
         if (use_doorbell) {<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);<br>
         } else<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);<br>
 <br>
@@ -96,12 +96,12 @@ static void nbio_v7_0_enable_doorbell_selfring_aperture(struct amdgpu_device *ad<br>
 }<br>
 <br>
 static void nbio_v7_0_ih_doorbell_range(struct amdgpu_device *adev,<br>
-                                       bool use_doorbell, int doorbell_index)<br>
+                                       bool use_doorbell, int index_in_dw)<br>
 {<br>
         u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0 , mmBIF_IH_DOORBELL_RANGE);<br>
 <br>
         if (use_doorbell) {<br>
-               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
+               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 2);<br>
         } else<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c<br>
index 221f26e50322..c32a5bd055d9 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c<br>
@@ -65,7 +65,7 @@ static u32 nbio_v7_4_get_memsize(struct amdgpu_device *adev)<br>
 }<br>
 <br>
 static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instance,<br>
-                       bool use_doorbell, int doorbell_index, int doorbell_size)<br>
+                       bool use_doorbell, int index_in_dw, int range_dw_size)<br>
 {<br>
         u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :<br>
                         SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);<br>
@@ -73,8 +73,8 @@ static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instan<br>
         u32 doorbell_range = RREG32(reg);<br>
 <br>
         if (use_doorbell) {<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
-               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
+               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);<br>
         } else<br>
                 doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);<br>
 <br>
@@ -107,12 +107,12 @@ static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *ad<br>
 }<br>
 <br>
 static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev,<br>
-                                       bool use_doorbell, int doorbell_index)<br>
+                                       bool use_doorbell, int index_in_dw)<br>
 {<br>
         u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0 , mmBIF_IH_DOORBELL_RANGE);<br>
 <br>
         if (use_doorbell) {<br>
-               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);<br>
+               ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, index_in_dw);<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 2);<br>
         } else<br>
                 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0);<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 127b85983e8f..e65e9bc52bd4 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
@@ -1520,7 +1520,8 @@ static int sdma_v4_0_sw_init(void *handle)<br>
                                 ring->use_doorbell?"true":"false");<br>
 <br>
                 /* doorbell size is 2 dwords, get DWORD offset */<br>
-               ring->doorbell_index = adev->doorbell_index.sdma_engine[i] << 1;<br>
+               ring->doorbell_index = adev->doorbell_index.sdma_engine[i]<br>
+                               * adev->doorbell_index.entry_dw_size;<br>
 <br>
                 sprintf(ring->name, "sdma%d", i);<br>
                 r = amdgpu_ring_init(adev, ring, 1024,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index 99ebcf29dcb0..fbf4dde22f6c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -980,11 +980,11 @@ static void soc15_doorbell_range_init(struct amdgpu_device *adev)<br>
                 ring = &adev->sdma.instance[i].ring;<br>
                 adev->nbio_funcs->sdma_doorbell_range(adev, i,<br>
                         ring->use_doorbell, ring->doorbell_index,<br>
-                       adev->doorbell_index.sdma_doorbell_range);<br>
+                       adev->doorbell_index.dw_range_per_sdma_eng);<br>
         }<br>
 <br>
         adev->nbio_funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,<br>
-                                               adev->irq.ih.doorbell_index);<br>
+                                               adev->irq.ih.doorbell_idx_in_dw);<br>
 }<br>
 <br>
 static int soc15_common_hw_init(void *handle)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c<br>
index a20b711a6756..96403ec5c98f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c<br>
@@ -143,7 +143,7 @@ static int tonga_ih_irq_init(struct amdgpu_device *adev)<br>
         ih_doorbell_rtpr = RREG32(mmIH_DOORBELL_RPTR);<br>
         if (adev->irq.ih.use_doorbell) {<br>
                 ih_doorbell_rtpr = REG_SET_FIELD(ih_doorbell_rtpr, IH_DOORBELL_RPTR,<br>
-                                                OFFSET, adev->irq.ih.doorbell_index);<br>
+                                                OFFSET, adev->irq.ih.doorbell_idx_in_dw);<br>
                 ih_doorbell_rtpr = REG_SET_FIELD(ih_doorbell_rtpr, IH_DOORBELL_RPTR,<br>
                                                  ENABLE, 1);<br>
         } else {<br>
@@ -254,7 +254,7 @@ static void tonga_ih_set_rptr(struct amdgpu_device *adev,<br>
         if (ih->use_doorbell) {<br>
                 /* XXX check if swapping is necessary on BE */<br>
                 *ih->rptr_cpu = ih->rptr;<br>
-               WDOORBELL32(ih->doorbell_index, ih->rptr);<br>
+               WDOORBELL32(ih->doorbell_idx_in_dw, ih->rptr);<br>
         } else {<br>
                 WREG32(mmIH_RB_RPTR, ih->rptr);<br>
         }<br>
@@ -284,7 +284,7 @@ static int tonga_ih_sw_init(void *handle)<br>
                 return r;<br>
 <br>
         adev->irq.ih.use_doorbell = true;<br>
-       adev->irq.ih.doorbell_index = adev->doorbell_index.ih;<br>
+       adev->irq.ih.doorbell_idx_in_dw = adev->doorbell_index.ih;<br>
 <br>
         r = amdgpu_irq_init(adev);<br>
 <br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
index 6d1f804277f8..796004896661 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
@@ -184,7 +184,7 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev)<br>
         if (adev->irq.ih.use_doorbell) {<br>
                 ih_doorbell_rtpr = REG_SET_FIELD(ih_doorbell_rtpr,<br>
                                                  IH_DOORBELL_RPTR, OFFSET,<br>
-                                                adev->irq.ih.doorbell_index);<br>
+                                                adev->irq.ih.doorbell_idx_in_dw);<br>
                 ih_doorbell_rtpr = REG_SET_FIELD(ih_doorbell_rtpr,<br>
                                                  IH_DOORBELL_RPTR,<br>
                                                  ENABLE, 1);<br>
@@ -377,7 +377,7 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,<br>
         if (ih->use_doorbell) {<br>
                 /* XXX check if swapping is necessary on BE */<br>
                 *ih->rptr_cpu = ih->rptr;<br>
-               WDOORBELL32(ih->doorbell_index, ih->rptr);<br>
+               WDOORBELL32(ih->doorbell_idx_in_dw, ih->rptr);<br>
         } else if (ih == &adev->irq.ih) {<br>
                 WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);<br>
         } else if (ih == &adev->irq.ih1) {<br>
@@ -461,7 +461,7 @@ static int vega10_ih_sw_init(void *handle)<br>
 <br>
         /* TODO add doorbell for IH1 & IH2 as well */<br>
         adev->irq.ih.use_doorbell = true;<br>
-       adev->irq.ih.doorbell_index = adev->doorbell_index.ih << 1;<br>
+       adev->irq.ih.doorbell_idx_in_dw = adev->doorbell_index.ih << 1;<br>
 <br>
         r = amdgpu_irq_init(adev);<br>
 <br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c<br>
index 4b5d60ea3e78..d2409df2dde9 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c<br>
@@ -58,6 +58,7 @@ int vega10_reg_base_init(struct amdgpu_device *adev)<br>
 <br>
 void vega10_doorbell_index_init(struct amdgpu_device *adev)<br>
 {<br>
+       adev->doorbell_index.entry_dw_size = 2;<br>
         adev->doorbell_index.kiq = AMDGPU_DOORBELL64_KIQ;<br>
         adev->doorbell_index.mec_ring0 = AMDGPU_DOORBELL64_MEC_RING0;<br>
         adev->doorbell_index.mec_ring1 = AMDGPU_DOORBELL64_MEC_RING1;<br>
@@ -83,6 +84,9 @@ void vega10_doorbell_index_init(struct amdgpu_device *adev)<br>
         adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_DOORBELL64_VCE_RING6_7;<br>
         /* In unit of dword doorbell */<br>
         adev->doorbell_index.max_assignment = AMDGPU_DOORBELL64_MAX_ASSIGNMENT << 1;<br>
-       adev->doorbell_index.sdma_doorbell_range = 4;<br>
+       adev->doorbell_index.dw_range_per_sdma_eng =<br>
+                       (adev->doorbell_index.sdma_engine[1]<br>
+                       - adev->doorbell_index.sdma_engine[0])<br>
+                       * adev->doorbell_index.entry_dw_size;<br>
 }<br>
 <br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c<br>
index 53716c593b2b..b28c5999d8f0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c<br>
@@ -56,6 +56,7 @@ int vega20_reg_base_init(struct amdgpu_device *adev)<br>
 <br>
 void vega20_doorbell_index_init(struct amdgpu_device *adev)<br>
 {<br>
+       adev->doorbell_index.entry_dw_size = 2;<br>
         adev->doorbell_index.kiq = AMDGPU_VEGA20_DOORBELL_KIQ;<br>
         adev->doorbell_index.mec_ring0 = AMDGPU_VEGA20_DOORBELL_MEC_RING0;<br>
         adev->doorbell_index.mec_ring1 = AMDGPU_VEGA20_DOORBELL_MEC_RING1;<br>
@@ -86,6 +87,9 @@ void vega20_doorbell_index_init(struct amdgpu_device *adev)<br>
         adev->doorbell_index.uvd_vce.vce_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5;<br>
         adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7;<br>
         adev->doorbell_index.max_assignment = AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT << 1;<br>
-       adev->doorbell_index.sdma_doorbell_range = 20;<br>
+       adev->doorbell_index.dw_range_per_sdma_eng =<br>
+                       (adev->doorbell_index.sdma_engine[1]<br>
+                       - adev->doorbell_index.sdma_engine[0])<br>
+                       * adev->doorbell_index.entry_dw_size;<br>
 }<br>
 <br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>