<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<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);">
Thanks Feifei and Monk!</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> Liu, Monk <Monk.Liu@amd.com><br>
<b>Sent:</b> Monday, March 2, 2020 17:35<br>
<b>To:</b> Xu, Feifei <Feifei.Xu@amd.com>; Yin, Tianci (Rico) <Tianci.Yin@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Long, Gang <Gang.Long@amd.com>; Li, Pauline <Pauline.Li@amd.com>; Yin, Tianci (Rico) <Tianci.Yin@amd.com>; Gao, Likun <Likun.Gao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu: disable 3D pipe 1 on Navi1x</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Reviewed-by: Monk Liu <monk.liu@amd.com><br>
<br>
_____________________________________<br>
Monk Liu|GPU Virtualization Team |AMD<br>
<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Xu, Feifei<br>
Sent: Monday, March 2, 2020 5:32 PM<br>
To: Yin, Tianci (Rico) <Tianci.Yin@amd.com>; amd-gfx@lists.freedesktop.org<br>
Cc: Long, Gang <Gang.Long@amd.com>; Li, Pauline <Pauline.Li@amd.com>; Yin, Tianci (Rico) <Tianci.Yin@amd.com>; Gao, Likun <Likun.Gao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com><br>
Subject: RE: [PATCH] drm/amdgpu: disable 3D pipe 1 on Navi1x<br>
<br>
[AMD Official Use Only - Internal Distribution Only]<br>
<br>
<br>
<br>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com><br>
<br>
<br>
-----Original Message-----<br>
From: Tianci Yin <tianci.yin@amd.com> <br>
Sent: 2020年3月2日 9:57<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhang, Hawking <Hawking.Zhang@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Gao, Likun <Likun.Gao@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com>; Long, Gang <Gang.Long@amd.com>; Li, Pauline <Pauline.Li@amd.com>; Yin, Tianci (Rico) <Tianci.Yin@amd.com><br>
Subject: [PATCH] drm/amdgpu: disable 3D pipe 1 on Navi1x<br>
<br>
From: "Tianci.Yin" <tianci.yin@amd.com><br>
<br>
[why]<br>
CP firmware decide to skip setting the state for 3D pipe 1 for Navi1x as there is no use case.<br>
<br>
[how]<br>
Disable 3D pipe 1 on Navi1x.<br>
<br>
Change-Id: I6898bdfe31d4e7908bd9bcfa82b6a75e118e8727<br>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com><br>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 97 ++++++++++++++------------<br>
 1 file changed, 51 insertions(+), 46 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 760fe2ebe799..f348512eb8c3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
@@ -52,7 +52,7 @@<br>
  * 1. Primary ring<br>
  * 2. Async ring<br>
  */<br>
-#define GFX10_NUM_GFX_RINGS    2<br>
+#define GFX10_NUM_GFX_RINGS_NV1X       1<br>
 #define GFX10_MEC_HPD_SIZE      2048<br>
 <br>
 #define F32_CE_PROGRAM_RAM_SIZE         65536<br>
@@ -1305,7 +1305,7 @@ static int gfx_v10_0_sw_init(void *handle)<br>
         case CHIP_NAVI14:<br>
         case CHIP_NAVI12:<br>
                 adev->gfx.me.num_me = 1;<br>
-               adev->gfx.me.num_pipe_per_me = 2;<br>
+               adev->gfx.me.num_pipe_per_me = 1;<br>
                 adev->gfx.me.num_queue_per_pipe = 1;<br>
                 adev->gfx.mec.num_mec = 2;<br>
                 adev->gfx.mec.num_pipe_per_mec = 4;<br>
@@ -2711,18 +2711,20 @@ static int gfx_v10_0_cp_gfx_start(struct amdgpu_device *adev)<br>
         amdgpu_ring_commit(ring);<br>
 <br>
         /* submit cs packet to copy state 0 to next available state */<br>
-       ring = &adev->gfx.gfx_ring[1];<br>
-       r = amdgpu_ring_alloc(ring, 2);<br>
-       if (r) {<br>
-               DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);<br>
-               return r;<br>
-       }<br>
-<br>
-       amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));<br>
-       amdgpu_ring_write(ring, 0);<br>
+       if (adev->gfx.num_gfx_rings > 1) {<br>
+               /* maximum supported gfx ring is 2 */<br>
+               ring = &adev->gfx.gfx_ring[1];<br>
+               r = amdgpu_ring_alloc(ring, 2);<br>
+               if (r) {<br>
+                       DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);<br>
+                       return r;<br>
+               }<br>
 <br>
-       amdgpu_ring_commit(ring);<br>
+               amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));<br>
+               amdgpu_ring_write(ring, 0);<br>
 <br>
+               amdgpu_ring_commit(ring);<br>
+       }<br>
         return 0;<br>
 }<br>
 <br>
@@ -2819,39 +2821,41 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)<br>
         mutex_unlock(&adev->srbm_mutex);<br>
 <br>
         /* Init gfx ring 1 for pipe 1 */<br>
-       mutex_lock(&adev->srbm_mutex);<br>
-       gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);<br>
-       ring = &adev->gfx.gfx_ring[1];<br>
-       rb_bufsz = order_base_2(ring->ring_size / 8);<br>
-       tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);<br>
-       tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);<br>
-       /* Initialize the ring buffer's write pointers */<br>
-       ring->wptr = 0;<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));<br>
-       /* Set the wb address wether it's enabled or not */<br>
-       rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &<br>
-               CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);<br>
-       wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);<br>
-       WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,<br>
-               lower_32_bits(wptr_gpu_addr));<br>
-       WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,<br>
-               upper_32_bits(wptr_gpu_addr));<br>
-<br>
-       mdelay(1);<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);<br>
-<br>
-       rb_addr = ring->gpu_addr >> 8;<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));<br>
-       WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);<br>
-<br>
-       gfx_v10_0_cp_gfx_set_doorbell(adev, ring);<br>
-       mutex_unlock(&adev->srbm_mutex);<br>
-<br>
+       if (adev->gfx.num_gfx_rings > 1) {<br>
+               mutex_lock(&adev->srbm_mutex);<br>
+               gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);<br>
+               /* maximum supported gfx ring is 2 */<br>
+               ring = &adev->gfx.gfx_ring[1];<br>
+               rb_bufsz = order_base_2(ring->ring_size / 8);<br>
+               tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);<br>
+               tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);<br>
+               /* Initialize the ring buffer's write pointers */<br>
+               ring->wptr = 0;<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));<br>
+               /* Set the wb address wether it's enabled or not */<br>
+               rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &<br>
+                            CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);<br>
+               wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);<br>
+               WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,<br>
+                            lower_32_bits(wptr_gpu_addr));<br>
+               WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,<br>
+                            upper_32_bits(wptr_gpu_addr));<br>
+<br>
+               mdelay(1);<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);<br>
+<br>
+               rb_addr = ring->gpu_addr >> 8;<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));<br>
+               WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);<br>
+<br>
+               gfx_v10_0_cp_gfx_set_doorbell(adev, ring);<br>
+               mutex_unlock(&adev->srbm_mutex);<br>
+       }<br>
         /* Switch to pipe 0 */<br>
         mutex_lock(&adev->srbm_mutex);<br>
         gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID0); @@ -3967,7 +3971,8 @@ static int gfx_v10_0_early_init(void *handle)  {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
 <br>
-       adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS;<br>
+       adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;<br>
+<br>
         adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;<br>
 <br>
         gfx_v10_0_set_kiq_pm4_funcs(adev);<br>
--<br>
2.17.1<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C76b6cb68c8524e24a71a08d7be8c9b91%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637187383465069039&amp;sdata=5CYyoryFFaDwGEuB%2F1jyI5FuZCM2kM7hUKD2OuKN%2BhU%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C76b6cb68c8524e24a71a08d7be8c9b91%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637187383465069039&amp;sdata=5CYyoryFFaDwGEuB%2F1jyI5FuZCM2kM7hUKD2OuKN%2BhU%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</body>
</html>