Skip to contentSkip to conversation

drm/amdgpu: Add GDS clearing workaround in later init for gfx9

PATCH In review Zhu, James 5 participants 8 messages Jun 7, 2019 – Jun 10, 2019 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Zhu, James

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Add GDS clearing workaround in later init for gfx9

Since Hardware bug, GDS exist ECC error after cold boot up, adding GDS clearing workaround in later init for gfx9.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +48 -0
index 76722fc..81f6ba8 100644
@@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
    { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
 };
 
+
+static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
+{
+	struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
+	int r;
+
+	r = amdgpu_ring_alloc(ring, 17);
+	if (r) {
+		DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",
+			ring->name, r);
+		return r;
+	}
+
+	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+	amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+			   WRITE_DATA_DST_SEL(0));
+	amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, 0x10000);
+
+	amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
+	amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
+				PACKET3_DMA_DATA_DST_SEL(1) |
+				PACKET3_DMA_DATA_SRC_SEL(2) |
+				PACKET3_DMA_DATA_ENGINE(0)));
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
+
+	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+	amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+				WRITE_DATA_DST_SEL(0));
+	amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+	amdgpu_ring_write(ring, 0);
+	amdgpu_ring_write(ring, 0x0);
+
+	amdgpu_ring_commit(ring);
+
+	return 0;
+}
+
+
 static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
 {
 	struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
@@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
 		return 0;
 	}
 
+	r = gfx_v9_0_do_edc_gds_workarounds(adev);
+	if (r)
+		return r;
+
 	/* requires IBs so do in late init after IB pool is initialized */
 	r = gfx_v9_0_do_edc_gpr_workarounds(adev);
 	if (r)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1559925472-20077-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 26 lines · James

Since Hardware bug, GDS exist ECC error after cold boot up, adding GDS clearing workaround in later init for gfx9.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
index 76722fc..81f6ba8 100644
@@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
    { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
 };
 
+
+static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
+{
+       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
+       int r;
+
+       r = amdgpu_ring_alloc(ring, 17);
+       if (r) {
+               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3655

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -0
+                       ring->name, r);
+               return r;
+       }
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                          WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x10000);

hardcoded size, please use the size from the driver.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3666

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -0
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
+       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
+                               PACKET3_DMA_DATA_DST_SEL(1) |
+                               PACKET3_DMA_DATA_SRC_SEL(2) |
+                               PACKET3_DMA_DATA_ENGINE(0)));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);

Instead of hardcoding the size, can you use the gds size from the driver (adev->gds.gds_size).

With that fixed:

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +18 -1
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                               WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x0);
+
+       amdgpu_ring_commit(ring);
+
+       return 0;
+}
+
+
 static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
 {
        struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
@@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
                return 0;
        }
 
+       r = gfx_v9_0_do_edc_gds_workarounds(adev);
+       if (r)
+               return r;
+
        /* requires IBs so do in late init after IB pool is initialized */
        r = gfx_v9_0_do_edc_gpr_workarounds(adev);
        if (r)
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_NBWcUtXsBbQP5uBvaOFgWXw3Lhj=ZOisVyTctqZph=xQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 49 lines · Alex Deucher
Quoted 25 lines · James

Since Hardware bug, GDS exist ECC error after cold boot up, adding GDS clearing workaround in later init for gfx9.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
  1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
index 76722fc..81f6ba8 100644
@@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
     { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
  };
 
+
+static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
+{
+       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
+       int r;
+
+       r = amdgpu_ring_alloc(ring, 17);
+       if (r) {
+               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3655

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -0
+                       ring->name, r);
+               return r;
+       }
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                          WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x10000);

hardcoded size, please use the size from the driver.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3666

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -0
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
+       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
+                               PACKET3_DMA_DATA_DST_SEL(1) |
+                               PACKET3_DMA_DATA_SRC_SEL(2) |
+                               PACKET3_DMA_DATA_ENGINE(0)));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
Quoted 2 lines

Instead of hardcoding the size, can you use the gds size from the driver (adev->gds.gds_size).

Hi Alex,

Do you mean adev->gds.mem.total_size?

But I see below operation in gfx_v9_0_ngg_init.

adev->gds.mem.total_size -= ....

Or you want me to add gds_size in struct amdgpu_gds?

James

Quoted 35 lines

With that fixed:

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +18 -1
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                               WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x0);
+
+       amdgpu_ring_commit(ring);
+
+       return 0;
+}
+
+
  static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
  {
         struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
@@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
                 return 0;
         }
 
+       r = gfx_v9_0_do_edc_gds_workarounds(adev);
+       if (r)
+               return r;
+
         /* requires IBs so do in late init after IB pool is initialized */
         r = gfx_v9_0_do_edc_gpr_workarounds(adev);
         if (r)
--

2.7.4

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 19203faa-970e-732b-a0e0-d2d1fe69ce30-5C7GfCeVMHo@public.gmane.org

#6 lore raw
Quoted 56 lines · James
Quoted 49 lines · Alex Deucher
Quoted 25 lines · James

Since Hardware bug, GDS exist ECC error after cold boot up, adding GDS clearing workaround in later init for gfx9.

---
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
   1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
index 76722fc..81f6ba8 100644
@@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
      { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
   };
 
+
+static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
+{
+       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
+       int r;
+
+       r = amdgpu_ring_alloc(ring, 17);
+       if (r) {
+               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3655

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -0
+                       ring->name, r);
+               return r;
+       }
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                          WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x10000);

hardcoded size, please use the size from the driver.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct soc15_reg_entry sec_ded_counter_registers[] = { · line 3666

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -0
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
+       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
+                               PACKET3_DMA_DATA_DST_SEL(1) |
+                               PACKET3_DMA_DATA_SRC_SEL(2) |
+                               PACKET3_DMA_DATA_ENGINE(0)));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
Quoted 2 lines

Instead of hardcoding the size, can you use the gds size from the driver (adev->gds.gds_size).

Hi Alex,

Do you mean adev->gds.mem.total_size?

Quoted 7 lines

But I see below operation in gfx_v9_0_ngg_init.

adev->gds.mem.total_size -= ....

Or you want me to add gds_size in struct amdgpu_gds?

James

Yeah, The amd-staging-drm-next branch has adev->gds.gds_size.

James

Quoted 35 lines
Quoted 35 lines

With that fixed:

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +18 -1
+
+       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
+       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
+                               WRITE_DATA_DST_SEL(0));
+       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
+       amdgpu_ring_write(ring, 0);
+       amdgpu_ring_write(ring, 0x0);
+
+       amdgpu_ring_commit(ring);
+
+       return 0;
+}
+
+
   static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
   {
          struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
@@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
                  return 0;
          }
 
+       r = gfx_v9_0_do_edc_gds_workarounds(adev);
+       if (r)
+               return r;
+
          /* requires IBs so do in late init after IB pool is initialized */
          r = gfx_v9_0_do_edc_gpr_workarounds(adev);
          if (r)
--

2.7.4

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 65266293-ac7a-c3ef-752b-1691299b1f28-5C7GfCeVMHo@public.gmane.org

#8 lore raw

James,

Do you set GDS_VMID0_BASE to 0?.. I don't see it in your patch.

Regards,
Leonid

On 2019-06-07, 15:42, "Zhu, James" <[email protected]> wrote:

    On 2019-06-07 3:12 p.m., Zhu, James wrote:
    > On 2019-06-07 2:16 p.m., Alex Deucher wrote:
    >> On Fri, Jun 7, 2019 at 12:38 PM Zhu, James <[email protected]> wrote:
    >>> Since Hardware bug, GDS exist ECC error after cold boot up,
    >>> adding GDS clearing workaround in later init for gfx9.
    >>>
    >>> Signed-off-by: James Zhu <[email protected]>
    >>> ---
    >>>    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
    >>>    1 file changed, 48 insertions(+)
    >>>
    >>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >>> index 76722fc..81f6ba8 100644
    >>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >>> @@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
    >>>       { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
    >>>    };
    >>>
    >>> +
    >>> +static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
    >>> +{
    >>> +       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
    >>> +       int r;
    >>> +
    >>> +       r = amdgpu_ring_alloc(ring, 17);
    >>> +       if (r) {
    >>> +               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",
    >>> +                       ring->name, r);
    >>> +               return r;
    >>> +       }
    >>> +
    >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
    >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
    >>> +                          WRITE_DATA_DST_SEL(0));
    >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, 0x10000);
    >> hardcoded size, please use the size from the driver.
    >>
    >>> +
    >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
    >>> +       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
    >>> +                               PACKET3_DMA_DATA_DST_SEL(1) |
    >>> +                               PACKET3_DMA_DATA_SRC_SEL(2) |
    >>> +                               PACKET3_DMA_DATA_ENGINE(0)));
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
    >> Instead of hardcoding the size, can you use the gds size from the
    >> driver (adev->gds.gds_size).
    > Hi Alex,
    >
    > Do you mean adev->gds.mem.total_size?
    >
    > But I see below operation in gfx_v9_0_ngg_init.
    >
    > adev->gds.mem.total_size -= ....
    >
    > Or you want me to add gds_size in struct amdgpu_gds?
    >
    > James
    
    Yeah, The amd-staging-drm-next branch has adev->gds.gds_size.
    
    James
    
    >
    >> With that fixed:
    >> Reviewed-by: Alex Deucher <[email protected]>
    >>
    >>> +
    >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
    >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
    >>> +                               WRITE_DATA_DST_SEL(0));
    >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
    >>> +       amdgpu_ring_write(ring, 0);
    >>> +       amdgpu_ring_write(ring, 0x0);
    >>> +
    >>> +       amdgpu_ring_commit(ring);
    >>> +
    >>> +       return 0;
    >>> +}
    >>> +
    >>> +
    >>>    static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
    >>>    {
    >>>           struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
    >>> @@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
    >>>                   return 0;
    >>>           }
    >>>
    >>> +       r = gfx_v9_0_do_edc_gds_workarounds(adev);
    >>> +       if (r)
    >>> +               return r;
    >>> +
    >>>           /* requires IBs so do in late init after IB pool is initialized */
    >>>           r = gfx_v9_0_do_edc_gpr_workarounds(adev);
    >>>           if (r)
    >>> --
    >>> 2.7.4
    >>>
    >>> _______________________________________________
    >>> amd-gfx mailing list
    >>> [email protected]
    >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3598A781-7AF5-4DDE-83AE-8835E85573D3-5C7GfCeVMHo@public.gmane.org

#10 lore raw

Yeah, that would be a good idea as well.

Additional to that I suggest to update GDS_VMID0_BASE/_SIZE with direct register writes instead of PM4 packets.

Christian.

Am 07.06.19 um 22:16 schrieb Shamis, Leonid:

Quoted 120 lines

James,

Do you set GDS_VMID0_BASE to 0?.. I don't see it in your patch.

Regards,
Leonid

On 2019-06-07, 15:42, "Zhu, James" <[email protected]> wrote:

     On 2019-06-07 3:12 p.m., Zhu, James wrote:
     > On 2019-06-07 2:16 p.m., Alex Deucher wrote:
     >> On Fri, Jun 7, 2019 at 12:38 PM Zhu, James <[email protected]> wrote:
     >>> Since Hardware bug, GDS exist ECC error after cold boot up,
     >>> adding GDS clearing workaround in later init for gfx9.
     >>>
     >>> Signed-off-by: James Zhu <[email protected]>
     >>> ---
     >>>    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
     >>>    1 file changed, 48 insertions(+)
     >>>
     >>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> index 76722fc..81f6ba8 100644
     >>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> @@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
     >>>       { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
     >>>    };
     >>>
     >>> +
     >>> +static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
     >>> +{
     >>> +       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
     >>> +       int r;
     >>> +
     >>> +       r = amdgpu_ring_alloc(ring, 17);
     >>> +       if (r) {
     >>> +               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",
     >>> +                       ring->name, r);
     >>> +               return r;
     >>> +       }
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
     >>> +                          WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x10000);
     >> hardcoded size, please use the size from the driver.
     >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
     >>> +       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
     >>> +                               PACKET3_DMA_DATA_DST_SEL(1) |
     >>> +                               PACKET3_DMA_DATA_SRC_SEL(2) |
     >>> +                               PACKET3_DMA_DATA_ENGINE(0)));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
     >> Instead of hardcoding the size, can you use the gds size from the
     >> driver (adev->gds.gds_size).
     > Hi Alex,
     >
     > Do you mean adev->gds.mem.total_size?
     >
     > But I see below operation in gfx_v9_0_ngg_init.
     >
     > adev->gds.mem.total_size -= ....
     >
     > Or you want me to add gds_size in struct amdgpu_gds?
     >
     > James
     
     Yeah, The amd-staging-drm-next branch has adev->gds.gds_size.
     
     James
     
     >
     >> With that fixed:
     >> Reviewed-by: Alex Deucher <[email protected]>
     >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
     >>> +                               WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x0);
     >>> +
     >>> +       amdgpu_ring_commit(ring);
     >>> +
     >>> +       return 0;
     >>> +}
     >>> +
     >>> +
     >>>    static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
     >>>    {
     >>>           struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
     >>> @@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
     >>>                   return 0;
     >>>           }
     >>>
     >>> +       r = gfx_v9_0_do_edc_gds_workarounds(adev);
     >>> +       if (r)
     >>> +               return r;
     >>> +
     >>>           /* requires IBs so do in late init after IB pool is initialized */
     >>>           r = gfx_v9_0_do_edc_gpr_workarounds(adev);
     >>>           if (r)
     >>> --
     >>> 2.7.4
     >>>
     >>> _______________________________________________
     >>> amd-gfx mailing list
     >>> [email protected]
     >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3ab2a128-3433-0e45-b555-2aff0892f8e6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#12 lore raw
Quoted 4 lines · Christian König

Yeah, that would be a good idea as well.

Additional to that I suggest to update GDS_VMID0_BASE/_SIZE with direct register writes instead of PM4 packets.

I can do so.

James

Quoted 140 lines

Christian.

Am 07.06.19 um 22:16 schrieb Shamis, Leonid:

Quoted 135 lines

James,

Do you set GDS_VMID0_BASE to 0?.. I don't see it in your patch.

Regards,
Leonid

On 2019-06-07, 15:42, "Zhu, James" <[email protected]> wrote:

          On 2019-06-07 3:12 p.m., Zhu, James wrote:
     > On 2019-06-07 2:16 p.m., Alex Deucher wrote:
     >> On Fri, Jun 7, 2019 at 12:38 PM Zhu, James <[email protected]> wrote:
     >>> Since Hardware bug, GDS exist ECC error after cold boot up, >>> adding GDS clearing workaround in later init for gfx9. >>>
     >>> Signed-off-by: James Zhu <[email protected]>
     >>> ---
     >>>    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48
+++++++++++++++++++++++++++++++++++
     >>>    1 file changed, 48 insertions(+)
     >>>
     >>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> index 76722fc..81f6ba8 100644
     >>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> @@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
     >>>       { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6}, >>>    };
     >>>
     >>> +
     >>> +static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
     >>> +{
     >>> +       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0]; >>> +       int r;
     >>> +
     >>> +       r = amdgpu_ring_alloc(ring, 17);
     >>> +       if (r) {
     >>> +               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",
     >>> +                       ring->name, r);
     >>> +               return r;
     >>> +       }
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) | >>> + WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x10000);
     >> hardcoded size, please use the size from the driver. >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5)); >>> +       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC | >>> + PACKET3_DMA_DATA_DST_SEL(1) |
     >>> + PACKET3_DMA_DATA_SRC_SEL(2) |
     >>> + PACKET3_DMA_DATA_ENGINE(0)));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
     >> Instead of hardcoding the size, can you use the gds size from the
     >> driver (adev->gds.gds_size).
     > Hi Alex,
     >
     > Do you mean adev->gds.mem.total_size?
     >
     > But I see below operation in gfx_v9_0_ngg_init.
     >
     > adev->gds.mem.total_size -= ....
     >
     > Or you want me to add gds_size in struct amdgpu_gds? >
     > James
          Yeah, The amd-staging-drm-next branch has adev->gds.gds_size. James
          >
     >> With that fixed:
     >> Reviewed-by: Alex Deucher <[email protected]> >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) | >>> + WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x0);
     >>> +
     >>> +       amdgpu_ring_commit(ring);
     >>> +
     >>> +       return 0;
     >>> +}
     >>> +
     >>> +
     >>>    static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
     >>>    {
     >>>           struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
     >>> @@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
     >>>                   return 0;
     >>>           }
     >>>
     >>> +       r = gfx_v9_0_do_edc_gds_workarounds(adev); >>> +       if (r)
     >>> +               return r;
     >>> +
     >>>           /* requires IBs so do in late init after IB pool is initialized */
     >>>           r = gfx_v9_0_do_edc_gpr_workarounds(adev); >>>           if (r)
     >>> --
     >>> 2.7.4
     >>>
     >>> _______________________________________________
     >>> amd-gfx mailing list
     >>> [email protected]
     >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw
In reply to a message not in the archive
Quoted 3 lines · Leonid

James,

Do you set GDS_VMID0_BASE to 0?.. I don't see it in your patch.

sure I will add it.

JAmes

Quoted 107 lines

Regards,
Leonid

On 2019-06-07, 15:42, "Zhu, James" <[email protected]> wrote:

     On 2019-06-07 3:12 p.m., Zhu, James wrote:
     > On 2019-06-07 2:16 p.m., Alex Deucher wrote:
     >> On Fri, Jun 7, 2019 at 12:38 PM Zhu, James <[email protected]> wrote:
     >>> Since Hardware bug, GDS exist ECC error after cold boot up,
     >>> adding GDS clearing workaround in later init for gfx9.
     >>>
     >>> Signed-off-by: James Zhu <[email protected]>
     >>> ---
     >>>    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 48 +++++++++++++++++++++++++++++++++++
     >>>    1 file changed, 48 insertions(+)
     >>>
     >>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> index 76722fc..81f6ba8 100644
     >>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
     >>> @@ -3634,6 +3634,50 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {
     >>>       { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},
     >>>    };
     >>>
     >>> +
     >>> +static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)
     >>> +{
     >>> +       struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
     >>> +       int r;
     >>> +
     >>> +       r = amdgpu_ring_alloc(ring, 17);
     >>> +       if (r) {
     >>> +               DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",
     >>> +                       ring->name, r);
     >>> +               return r;
     >>> +       }
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
     >>> +                          WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x10000);
     >> hardcoded size, please use the size from the driver.
     >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));
     >>> +       amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |
     >>> +                               PACKET3_DMA_DATA_DST_SEL(1) |
     >>> +                               PACKET3_DMA_DATA_SRC_SEL(2) |
     >>> +                               PACKET3_DMA_DATA_ENGINE(0)));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT | 0x10000);
     >> Instead of hardcoding the size, can you use the gds size from the
     >> driver (adev->gds.gds_size).
     > Hi Alex,
     >
     > Do you mean adev->gds.mem.total_size?
     >
     > But I see below operation in gfx_v9_0_ngg_init.
     >
     > adev->gds.mem.total_size -= ....
     >
     > Or you want me to add gds_size in struct amdgpu_gds?
     >
     > James
     
     Yeah, The amd-staging-drm-next branch has adev->gds.gds_size.
     
     James
     
     >
     >> With that fixed:
     >> Reviewed-by: Alex Deucher <[email protected]>
     >>
     >>> +
     >>> +       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
     >>> +       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |
     >>> +                               WRITE_DATA_DST_SEL(0));
     >>> +       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));
     >>> +       amdgpu_ring_write(ring, 0);
     >>> +       amdgpu_ring_write(ring, 0x0);
     >>> +
     >>> +       amdgpu_ring_commit(ring);
     >>> +
     >>> +       return 0;
     >>> +}
     >>> +
     >>> +
     >>>    static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
     >>>    {
     >>>           struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];
     >>> @@ -3810,6 +3854,10 @@ static int gfx_v9_0_ecc_late_init(void *handle)
     >>>                   return 0;
     >>>           }
     >>>
     >>> +       r = gfx_v9_0_do_edc_gds_workarounds(adev);
     >>> +       if (r)
     >>> +               return r;
     >>> +
     >>>           /* requires IBs so do in late init after IB pool is initialized */
     >>>           r = gfx_v9_0_do_edc_gpr_workarounds(adev);
Quoted 10 lines
     >>>           if (r)
     >>> --
     >>> 2.7.4
     >>>
     >>> _______________________________________________
     >>> amd-gfx mailing list
     >>> [email protected]
     >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx