<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:Calibri;font-size:10pt;color:#008000;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As long as there is no hw programming sequence requirement to do it as two separate writes this looks fine to me.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com></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> Liang, Prike <Prike.Liang@amd.com><br>
<b>Sent:</b> Friday, November 15, 2024 3:39 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>; Liang, Prike <Prike.Liang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: reduce the mmio writes in kiq setting</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">There's no need to perform the two MMIO writes in the KIQ<br>
Setting registers programmed period, and reducing the MMIO<br>
writes will save the driver loading time.<br>
<br>
Signed-off-by: Prike Liang <Prike.Liang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 ++------<br>
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +---<br>
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +---<br>
8 files changed, 9 insertions(+), 27 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
index 9da95b25e158..ffd3c45b4ccd 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
@@ -6593,17 +6593,13 @@ static void gfx_v10_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp);<br>
+ WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp | 0x80);<br>
break;<br>
default:<br>
tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp | 0x80);<br>
break;<br>
}<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
index 5aff8f72de9c..a2aedcabae65 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
@@ -3890,9 +3890,7 @@ static void gfx_v11_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static void gfx_v11_0_cp_set_doorbell_range(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
index 9fec28d8a5fc..c61d383c45c4 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
@@ -2826,9 +2826,7 @@ static void gfx_v12_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static void gfx_v12_0_cp_set_doorbell_range(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
index 480c41ee947e..d465c3ea6e6c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
@@ -4304,9 +4304,7 @@ static void gfx_v8_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32(mmRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32(mmRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32(mmRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32(mmRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
index e9248a855ba7..a6cb30558f2f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -3482,9 +3482,7 @@ static void gfx_v9_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15_RLC(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15_RLC(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15_RLC(GC, 0, mmRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static void gfx_v9_0_mqd_set_priority(struct amdgpu_ring *ring, struct v9_mqd *mqd)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c<br>
index 016290f00592..ae3c8645633b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c<br>
@@ -1771,9 +1771,7 @@ static void gfx_v9_4_3_xcc_kiq_setting(struct amdgpu_ring *ring, int xcc_id)<br>
tmp = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static void gfx_v9_4_3_mqd_set_priority(struct amdgpu_ring *ring, struct v9_mqd *mqd)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
index 8ca137313961..3b818441c7ba 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
@@ -1491,9 +1491,7 @@ static void mes_v11_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static void mes_v11_0_kiq_clear(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c<br>
index 9d0e342a2f81..44b0d0f76944 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c<br>
@@ -1453,9 +1453,7 @@ static void mes_v12_0_kiq_setting(struct amdgpu_ring *ring)<br>
tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);<br>
tmp &= 0xffffff00;<br>
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
- tmp |= 0x80;<br>
- WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);<br>
+ WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp | 0x80);<br>
}<br>
<br>
static int mes_v12_0_kiq_hw_init(struct amdgpu_device *adev)<br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>