<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);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhao, Yong <Yong.Zhao@amd.com><br>
<b>Sent:</b> Sunday, September 22, 2019 11:56 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhao, Yong <Yong.Zhao@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdkfd: Use better name for sdma queue non HWS path</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The old name is prone to confusion. The register offset is for a RLC queue<br>
rather than a SDMA engine. The value is not a base address, but a<br>
register offset.<br>
<br>
Change-Id: I55fb835f2105392344b1c17323bb55c03f927836<br>
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com><br>
---<br>
.../drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 85 +++++++++---------<br>
.../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 90 +++++++++----------<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 10 +--<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 10 +--<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 86 +++++++++---------<br>
5 files changed, 137 insertions(+), 144 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
index c9ce1516956e..d2c0666c2798 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
@@ -70,11 +70,11 @@ static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd)<br>
return (struct v9_sdma_mqd *)mqd;<br>
}<br>
<br>
-static uint32_t get_sdma_base_addr(struct amdgpu_device *adev,<br>
+static uint32_t get_rlc_reg_offset(struct amdgpu_device *adev,<br>
unsigned int engine_id,<br>
unsigned int queue_id)<br>
{<br>
- uint32_t base[8] = {<br>
+ uint32_t sdma_engine_reg_base[8] = {<br>
SOC15_REG_OFFSET(SDMA0, 0,<br>
mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL,<br>
SOC15_REG_OFFSET(SDMA1, 0,<br>
@@ -92,12 +92,11 @@ static uint32_t get_sdma_base_addr(struct amdgpu_device *adev,<br>
SOC15_REG_OFFSET(SDMA7, 0,<br>
mmSDMA7_RLC0_RB_CNTL) - mmSDMA7_RLC0_RB_CNTL<br>
};<br>
- uint32_t retval;<br>
<br>
- retval = base[engine_id] + queue_id * (mmSDMA0_RLC1_RB_CNTL -<br>
- mmSDMA0_RLC0_RB_CNTL);<br>
+ uint32_t retval = sdma_engine_reg_base[engine_id]<br>
+ + queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL);<br>
<br>
- pr_debug("sdma base address: 0x%x\n", retval);<br>
+ pr_debug("RLC register offset: 0x%x\n", retval);<br>
<br>
return retval;<br>
}<br>
@@ -107,22 +106,22 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
unsigned long end_jiffies;<br>
uint32_t data;<br>
uint64_t data64;<br>
uint64_t __user *wptr64 = (uint64_t __user *)wptr;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
m->sdmax_rlcx_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));<br>
<br>
end_jiffies = msecs_to_jiffies(2000) + jiffies;<br>
while (true) {<br>
- data = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ data = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (data & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -130,41 +129,41 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
m->sdmax_rlcx_doorbell_offset);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_doorbell, SDMA0_RLC0_DOORBELL,<br>
ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, data);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
if (read_user_wptr(mm, wptr64, data64)) {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
lower_32_bits(data64));<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
upper_32_bits(data64));<br>
} else {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
}<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE_HI,<br>
m->sdmax_rlcx_rb_base_hi);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
m->sdmax_rlcx_rb_rptr_addr_lo);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
m->sdmax_rlcx_rb_rptr_addr_hi);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_rb_cntl, SDMA0_RLC0_RB_CNTL,<br>
RB_ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, data);<br>
<br>
return 0;<br>
}<br>
@@ -174,7 +173,7 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,<br>
uint32_t (**dump)[2], uint32_t *n_regs)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
- uint32_t sdma_base_addr = get_sdma_base_addr(adev, engine_id, queue_id);<br>
+ uint32_t rlc_reg_offset = get_rlc_reg_offset(adev, engine_id, queue_id);<br>
uint32_t i = 0, reg;<br>
#undef HQD_N_REGS<br>
#define HQD_N_REGS (19+6+7+10)<br>
@@ -184,15 +183,15 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,<br>
return -ENOMEM;<br>
<br>
for (reg = mmSDMA0_RLC0_RB_CNTL; reg <= mmSDMA0_RLC0_DOORBELL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_STATUS; reg <= mmSDMA0_RLC0_CSA_ADDR_HI; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_IB_SUB_REMAIN;<br>
reg <= mmSDMA0_RLC0_MINOR_PTR_UPDATE; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_MIDCMD_DATA0;<br>
reg <= mmSDMA0_RLC0_MIDCMD_CNTL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
<br>
WARN_ON_ONCE(i != HQD_N_REGS);<br>
*n_regs = i;<br>
@@ -204,14 +203,14 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t sdma_rlc_rb_cntl;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- sdma_rlc_rb_cntl = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ sdma_rlc_rb_cntl = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
<br>
if (sdma_rlc_rb_cntl & SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK)<br>
return true;<br>
@@ -224,20 +223,20 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t temp;<br>
unsigned long end_jiffies = (utimeout * HZ / 1000) + jiffies;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
temp = temp & ~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK;<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, temp);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, temp);<br>
<br>
while (true) {<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -245,14 +244,14 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, 0);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) |<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL) |<br>
SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK);<br>
<br>
- m->sdmax_rlcx_rb_rptr = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR);<br>
+ m->sdmax_rlcx_rb_rptr = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR);<br>
m->sdmax_rlcx_rb_rptr_hi =<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI);<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI);<br>
<br>
return 0;<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
index a4325db8d093..ee520ad90717 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
@@ -307,11 +307,11 @@ static int kgd_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)<br>
return 0;<br>
}<br>
<br>
-static uint32_t get_sdma_base_addr(struct amdgpu_device *adev,<br>
+static uint32_t get_rlc_reg_offset(struct amdgpu_device *adev,<br>
unsigned int engine_id,<br>
unsigned int queue_id)<br>
{<br>
- uint32_t base[2] = {<br>
+ uint32_t sdma_engine_reg_base[2] = {<br>
SOC15_REG_OFFSET(SDMA0, 0,<br>
mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL,<br>
/* On gfx10, mmSDMA1_xxx registers are defined NOT based<br>
@@ -323,12 +323,11 @@ static uint32_t get_sdma_base_addr(struct amdgpu_device *adev,<br>
SOC15_REG_OFFSET(SDMA1, 0,<br>
mmSDMA1_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL<br>
};<br>
- uint32_t retval;<br>
<br>
- retval = base[engine_id] + queue_id * (mmSDMA0_RLC1_RB_CNTL -<br>
- mmSDMA0_RLC0_RB_CNTL);<br>
+ uint32_t retval = sdma_engine_reg_base[engine_id]<br>
+ + queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL);<br>
<br>
- pr_debug("sdma base address: 0x%x\n", retval);<br>
+ pr_debug("RLC register offset: 0x%x\n", retval);<br>
<br>
return retval;<br>
}<br>
@@ -489,23 +488,23 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v10_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
unsigned long end_jiffies;<br>
uint32_t data;<br>
uint64_t data64;<br>
uint64_t __user *wptr64 = (uint64_t __user *)wptr;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
- pr_debug("sdma load base addr %x for engine %d, queue %d\n", sdma_base_addr, m->sdma_engine_id, m->sdma_queue_id);<br>
+ pr_debug("sdma load base addr 0x%x for engine %d, queue %d\n", rlc_reg_offset, m->sdma_engine_id, m->sdma_queue_id);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
m->sdmax_rlcx_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));<br>
<br>
end_jiffies = msecs_to_jiffies(2000) + jiffies;<br>
while (true) {<br>
- data = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ data = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (data & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -513,41 +512,41 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
m->sdmax_rlcx_doorbell_offset);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_doorbell, SDMA0_RLC0_DOORBELL,<br>
ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, data);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
if (read_user_wptr(mm, wptr64, data64)) {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
lower_32_bits(data64));<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
upper_32_bits(data64));<br>
} else {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
}<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE_HI,<br>
m->sdmax_rlcx_rb_base_hi);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
m->sdmax_rlcx_rb_rptr_addr_lo);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
m->sdmax_rlcx_rb_rptr_addr_hi);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_rb_cntl, SDMA0_RLC0_RB_CNTL,<br>
RB_ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, data);<br>
<br>
return 0;<br>
}<br>
@@ -557,28 +556,25 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,<br>
uint32_t (**dump)[2], uint32_t *n_regs)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
- uint32_t sdma_base_addr = get_sdma_base_addr(adev, engine_id, queue_id);<br>
+ uint32_t rlc_reg_offset = get_rlc_reg_offset(adev, engine_id, queue_id);<br>
uint32_t i = 0, reg;<br>
#undef HQD_N_REGS<br>
#define HQD_N_REGS (19+6+7+10)<br>
<br>
- pr_debug("sdma dump engine id %d queue_id %d\n", engine_id, queue_id);<br>
- pr_debug("sdma base addr %x\n", sdma_base_addr);<br>
-<br>
*dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);<br>
if (*dump == NULL)<br>
return -ENOMEM;<br>
<br>
for (reg = mmSDMA0_RLC0_RB_CNTL; reg <= mmSDMA0_RLC0_DOORBELL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_STATUS; reg <= mmSDMA0_RLC0_CSA_ADDR_HI; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_IB_SUB_REMAIN;<br>
reg <= mmSDMA0_RLC0_MINOR_PTR_UPDATE; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_MIDCMD_DATA0;<br>
reg <= mmSDMA0_RLC0_MIDCMD_CNTL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
<br>
WARN_ON_ONCE(i != HQD_N_REGS);<br>
*n_regs = i;<br>
@@ -612,14 +608,14 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v10_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t sdma_rlc_rb_cntl;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- sdma_rlc_rb_cntl = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ sdma_rlc_rb_cntl = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
<br>
if (sdma_rlc_rb_cntl & SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK)<br>
return true;<br>
@@ -740,20 +736,20 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v10_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t temp;<br>
unsigned long end_jiffies = (utimeout * HZ / 1000) + jiffies;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
temp = temp & ~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK;<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, temp);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, temp);<br>
<br>
while (true) {<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -761,14 +757,14 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, 0);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) |<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL) |<br>
SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK);<br>
<br>
- m->sdmax_rlcx_rb_rptr = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR);<br>
+ m->sdmax_rlcx_rb_rptr = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR);<br>
m->sdmax_rlcx_rb_rptr_hi =<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI);<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI);<br>
<br>
return 0;<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
index c6abcf72e822..d0517b7ae089 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
@@ -303,14 +303,14 @@ static int kgd_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)<br>
return 0;<br>
}<br>
<br>
-static inline uint32_t get_sdma_base_addr(struct cik_sdma_rlc_registers *m)<br>
+static inline uint32_t get_rlc_reg_offset(struct cik_sdma_rlc_registers *m)<br>
{<br>
uint32_t retval;<br>
<br>
retval = m->sdma_engine_id * SDMA1_REGISTER_OFFSET +<br>
m->sdma_queue_id * KFD_CIK_SDMA_QUEUE_OFFSET;<br>
<br>
- pr_debug("sdma base address: 0x%x\n", retval);<br>
+ pr_debug("RLC register offset: 0x%x\n", retval);<br>
<br>
return retval;<br>
}<br>
@@ -417,7 +417,7 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
uint32_t data;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
<br>
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
m->sdma_rlc_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));<br>
@@ -528,7 +528,7 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)<br>
uint32_t sdma_rlc_rb_cntl;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
<br>
sdma_rlc_rb_cntl = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
<br>
@@ -650,7 +650,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
unsigned long end_jiffies = (utimeout * HZ / 1000) + jiffies;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
<br>
temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
temp = temp & ~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
index 4e8b4e949926..373501abdb6b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
@@ -260,13 +260,13 @@ static int kgd_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)<br>
return 0;<br>
}<br>
<br>
-static inline uint32_t get_sdma_base_addr(struct vi_sdma_mqd *m)<br>
+static inline uint32_t get_rlc_reg_offset(struct vi_sdma_mqd *m)<br>
{<br>
uint32_t retval;<br>
<br>
retval = m->sdma_engine_id * SDMA1_REGISTER_OFFSET +<br>
m->sdma_queue_id * KFD_VI_SDMA_QUEUE_OFFSET;<br>
- pr_debug("sdma base address: 0x%x\n", retval);<br>
+ pr_debug("RLC register offset: 0x%x\n", retval);<br>
<br>
return retval;<br>
}<br>
@@ -402,7 +402,7 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
uint32_t data;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
m->sdmax_rlcx_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));<br>
<br>
@@ -521,7 +521,7 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)<br>
uint32_t sdma_rlc_rb_cntl;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
<br>
sdma_rlc_rb_cntl = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
<br>
@@ -646,7 +646,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
unsigned long end_jiffies = (utimeout * HZ / 1000) + jiffies;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(m);<br>
+ sdma_base_addr = get_rlc_reg_offset(m);<br>
<br>
temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
temp = temp & ~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
index 55437f160a72..2dd5bc676029 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
@@ -226,22 +226,20 @@ int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)<br>
return 0;<br>
}<br>
<br>
-static uint32_t get_sdma_base_addr(struct amdgpu_device *adev,<br>
+static uint32_t get_rlc_reg_offset(struct amdgpu_device *adev,<br>
unsigned int engine_id,<br>
unsigned int queue_id)<br>
{<br>
- uint32_t base[2] = {<br>
+ uint32_t sdma_engine_reg_base[2] = {<br>
SOC15_REG_OFFSET(SDMA0, 0,<br>
mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL,<br>
SOC15_REG_OFFSET(SDMA1, 0,<br>
mmSDMA1_RLC0_RB_CNTL) - mmSDMA1_RLC0_RB_CNTL<br>
};<br>
- uint32_t retval;<br>
+ uint32_t retval = sdma_engine_reg_base[engine_id]<br>
+ + queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL);<br>
<br>
- retval = base[engine_id] + queue_id * (mmSDMA0_RLC1_RB_CNTL -<br>
- mmSDMA0_RLC0_RB_CNTL);<br>
-<br>
- pr_debug("sdma base address: 0x%x\n", retval);<br>
+ pr_debug("RLC register offset: 0x%x\n", retval);<br>
<br>
return retval;<br>
}<br>
@@ -388,22 +386,22 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
unsigned long end_jiffies;<br>
uint32_t data;<br>
uint64_t data64;<br>
uint64_t __user *wptr64 = (uint64_t __user *)wptr;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
m->sdmax_rlcx_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));<br>
<br>
end_jiffies = msecs_to_jiffies(2000) + jiffies;<br>
while (true) {<br>
- data = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ data = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (data & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -411,41 +409,41 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL_OFFSET,<br>
m->sdmax_rlcx_doorbell_offset);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_doorbell, SDMA0_RLC0_DOORBELL,<br>
ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, data);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR, m->sdmax_rlcx_rb_rptr);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 1);<br>
if (read_user_wptr(mm, wptr64, data64)) {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
lower_32_bits(data64));<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
upper_32_bits(data64));<br>
} else {<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR,<br>
m->sdmax_rlcx_rb_rptr);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_WPTR_HI,<br>
m->sdmax_rlcx_rb_rptr_hi);<br>
}<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_MINOR_PTR_UPDATE, 0);<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE, m->sdmax_rlcx_rb_base);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_BASE_HI,<br>
m->sdmax_rlcx_rb_base_hi);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,<br>
m->sdmax_rlcx_rb_rptr_addr_lo);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,<br>
m->sdmax_rlcx_rb_rptr_addr_hi);<br>
<br>
data = REG_SET_FIELD(m->sdmax_rlcx_rb_cntl, SDMA0_RLC0_RB_CNTL,<br>
RB_ENABLE, 1);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, data);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, data);<br>
<br>
return 0;<br>
}<br>
@@ -455,7 +453,7 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,<br>
uint32_t (**dump)[2], uint32_t *n_regs)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
- uint32_t sdma_base_addr = get_sdma_base_addr(adev, engine_id, queue_id);<br>
+ uint32_t rlc_reg_offset = get_rlc_reg_offset(adev, engine_id, queue_id);<br>
uint32_t i = 0, reg;<br>
#undef HQD_N_REGS<br>
#define HQD_N_REGS (19+6+7+10)<br>
@@ -465,15 +463,15 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,<br>
return -ENOMEM;<br>
<br>
for (reg = mmSDMA0_RLC0_RB_CNTL; reg <= mmSDMA0_RLC0_DOORBELL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_STATUS; reg <= mmSDMA0_RLC0_CSA_ADDR_HI; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_IB_SUB_REMAIN;<br>
reg <= mmSDMA0_RLC0_MINOR_PTR_UPDATE; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
for (reg = mmSDMA0_RLC0_MIDCMD_DATA0;<br>
reg <= mmSDMA0_RLC0_MIDCMD_CNTL; reg++)<br>
- DUMP_REG(sdma_base_addr + reg);<br>
+ DUMP_REG(rlc_reg_offset + reg);<br>
<br>
WARN_ON_ONCE(i != HQD_N_REGS);<br>
*n_regs = i;<br>
@@ -507,14 +505,14 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t sdma_rlc_rb_cntl;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- sdma_rlc_rb_cntl = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ sdma_rlc_rb_cntl = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
<br>
if (sdma_rlc_rb_cntl & SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK)<br>
return true;<br>
@@ -577,20 +575,20 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
{<br>
struct amdgpu_device *adev = get_amdgpu_device(kgd);<br>
struct v9_sdma_mqd *m;<br>
- uint32_t sdma_base_addr;<br>
+ uint32_t rlc_reg_offset;<br>
uint32_t temp;<br>
unsigned long end_jiffies = (utimeout * HZ / 1000) + jiffies;<br>
<br>
m = get_sdma_mqd(mqd);<br>
- sdma_base_addr = get_sdma_base_addr(adev, m->sdma_engine_id,<br>
+ rlc_reg_offset = get_rlc_reg_offset(adev, m->sdma_engine_id,<br>
m->sdma_queue_id);<br>
<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL);<br>
temp = temp & ~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK;<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, temp);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL, temp);<br>
<br>
while (true) {<br>
- temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
+ temp = RREG32(rlc_reg_offset + mmSDMA0_RLC0_CONTEXT_STATUS);<br>
if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)<br>
break;<br>
if (time_after(jiffies, end_jiffies))<br>
@@ -598,14 +596,14 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,<br>
usleep_range(500, 1000);<br>
}<br>
<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, 0);<br>
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) |<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_DOORBELL, 0);<br>
+ WREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL,<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_CNTL) |<br>
SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK);<br>
<br>
- m->sdmax_rlcx_rb_rptr = RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR);<br>
+ m->sdmax_rlcx_rb_rptr = RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR);<br>
m->sdmax_rlcx_rb_rptr_hi =<br>
- RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_HI);<br>
+ RREG32(rlc_reg_offset + mmSDMA0_RLC0_RB_RPTR_HI);<br>
<br>
return 0;<br>
}<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>