Skip to contentSkip to conversation

drm/amdgpu: fix S3 failure on specific platform

PATCH In review Ken Wang 4 participants 5 messages Jul 4, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Ken Wang

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix S3 failure on specific platform

Change-Id Ie932508ad6949f8bfc7c8db1f5874d3440d09fc6
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index ecc33c4..54c30fe 100644
@@ -1702,6 +1702,9 @@ struct amdgpu_device {
 	/* record hw reset is performed */
 	bool has_hw_reset;
 
+	/* record last mm index being written through WREG32*/
+	unsigned long last_mm_index;
+
 };
 
 static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
index 21e504a..24b908c 100644
@@ -124,6 +124,10 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
 {
 	trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
 
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
+		adev->last_mm_index = v;
+	}
+
 	if (!(acc_flags & AMDGPU_REGS_NO_KIQ) && amdgpu_sriov_runtime(adev)) {
 		BUG_ON(in_interrupt());
 		return amdgpu_virt_kiq_wreg(adev, reg, v);
@@ -139,6 +143,10 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
 		writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA * 4));
 		spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
 	}
+
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev->last_mm_index == 0x5702C) {
+		udelay(500);
+	}
 }
 
 u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
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): 1499142367-3809-1-git-send-email-Qingqing.Wang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Ken Wang
Sent: Tuesday, July 04, 2017 12:26 AM
To: [email protected]
Cc: Wang, Ken
Subject: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Change-Id Ie932508ad6949f8bfc7c8db1f5874d3440d09fc6

Do we need to add this to the io_rreg and io_wreg functions as well? Atom uses them for IIO tables. Might also want to give a brief description of the problem. Something like:
Certain MC registers need a delay after writing them to properly update in the init sequence.

Quoted 52 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index ecc33c4..54c30fe 100644
@@ -1702,6 +1702,9 @@ struct amdgpu_device {
 	/* record hw reset is performed */
 	bool has_hw_reset;
 
+	/* record last mm index being written through WREG32*/
+	unsigned long last_mm_index;
+
 };
 
 static inline struct amdgpu_device *amdgpu_ttm_adev(struct

ttm_bo_device *bdev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 21e504a..24b908c 100644
@@ -124,6 +124,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
 {
 	trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
 
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
+		adev->last_mm_index = v;
+	}
+
 	if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
 amdgpu_sriov_runtime(adev)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
 		BUG_ON(in_interrupt());
 		return amdgpu_virt_kiq_wreg(adev, reg, v);
@@ -139,6 +143,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
 		writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA
 * 4));
 		spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
 	}
+
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev-
 >last_mm_index == 0x5702C) {
+		udelay(500);
+	}

}

Quoted 8 lines

u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
--
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): BN6PR12MB165223A90A11C15208776C22F7D70-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

sure, I will add the delay to io_wreg.

________________________________
From: Deucher, Alexander
Sent: Tuesday, July 4, 2017 12:47:38 PM
To: Wang, Ken; [email protected]
Cc: Wang, Ken
Subject: RE: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Ken Wang
Sent: Tuesday, July 04, 2017 12:26 AM
To: [email protected]
Cc: Wang, Ken
Subject: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Change-Id Ie932508ad6949f8bfc7c8db1f5874d3440d09fc6

Do we need to add this to the io_rreg and io_wreg functions as well? Atom uses them for IIO tables. Might also want to give a brief description of the problem. Something like:
Certain MC registers need a delay after writing them to properly update in the init sequence.

Quoted 52 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index ecc33c4..54c30fe 100644
@@ -1702,6 +1702,9 @@ struct amdgpu_device {
       /* record hw reset is performed */
       bool has_hw_reset;
 
+     /* record last mm index being written through WREG32*/
+     unsigned long last_mm_index;
+
 };
 
 static inline struct amdgpu_device *amdgpu_ttm_adev(struct

ttm_bo_device *bdev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 21e504a..24b908c 100644
@@ -124,6 +124,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
 {
       trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
 
+     if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
+             adev->last_mm_index = v;
+     }
+
       if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
 amdgpu_sriov_runtime(adev)) {
               BUG_ON(in_interrupt());
               return amdgpu_virt_kiq_wreg(adev, reg, v);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -139,6 +143,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
               writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA
 * 4));
               spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
       }
+
+     if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev-
 >last_mm_index == 0x5702C) {
+             udelay(500);
+     }

}

Quoted 8 lines

u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
--
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

#5 lore raw
In reply to a message not in the archive

Am 04.07.2017 um 06:47 schrieb Deucher, Alexander:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Ken Wang
Sent: Tuesday, July 04, 2017 12:26 AM
To: [email protected]
Cc: Wang, Ken
Subject: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Quoted 5 lines
Quoted 2 lines
Change-Id Ie932508ad6949f8bfc7c8db1f5874d3440d09fc6

Do we need to add this to the io_rreg and io_wreg functions as well? Atom uses them for IIO tables. Might also want to give a brief description of the problem. Something like:
Certain MC registers need a delay after writing them to properly update in the init sequence.

I still have strong concerns adding such an ASIC specific workaround in the low level register access functions.

Since this register is only accessed from the VBIOS I thing the proper place to add it would be in the ATOM table parser.

Regards,
Christian.

Quoted 57 lines
Quoted 57 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
  2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index ecc33c4..54c30fe 100644
@@ -1702,6 +1702,9 @@ struct amdgpu_device {
  	/* record hw reset is performed */
  	bool has_hw_reset;
 
+	/* record last mm index being written through WREG32*/
+	unsigned long last_mm_index;
+
  };
 
  static inline struct amdgpu_device *amdgpu_ttm_adev(struct

ttm_bo_device *bdev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 21e504a..24b908c 100644
@@ -124,6 +124,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
  {
  	trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
 
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
+		adev->last_mm_index = v;
+	}
+
  	if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
 amdgpu_sriov_runtime(adev)) {
  		BUG_ON(in_interrupt());
  		return amdgpu_virt_kiq_wreg(adev, reg, v);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -139,6 +143,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
  		writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA
 * 4));
  		spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
  	}
+
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev-
 > last_mm_index == 0x5702C) {
+		udelay(500);
+	}
  }

u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
--
2.7.4

Quoted 8 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

_______________________________________________
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): 658c81d5-2b02-bb58-3dd8-51d549236015-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#7 lore raw
Quoted 22 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Tuesday, July 04, 2017 3:50 AM
To: Deucher, Alexander; Wang, Ken; [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Am 04.07.2017 um 06:47 schrieb Deucher, Alexander:

Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On

Behalf

Quoted 9 lines
Quoted 8 lines

Of Ken Wang
Sent: Tuesday, July 04, 2017 12:26 AM
To: [email protected]
Cc: Wang, Ken
Subject: [PATCH] drm/amdgpu: fix S3 failure on specific platform

Change-Id Ie932508ad6949f8bfc7c8db1f5874d3440d09fc6

Do we need to add this to the io_rreg and io_wreg functions as well? Atom

uses them for IIO tables. Might also want to give a brief description of the problem. Something like:

Quoted 1 line

Certain MC registers need a delay after writing them to properly update in

Quoted 8 lines

the init sequence.

Quoted 1 line

I still have strong concerns adding such an ASIC specific workaround in the low level register access functions.

Since this register is only accessed from the VBIOS I thing the proper place to add it would be in the ATOM table parser.

We should be able to implement something similar in the atom code, depending on whether the table in question uses the IIO stuff or "regular" register access.

Alex

Quoted 70 lines

Regards,
Christian.

Quoted 65 lines
Quoted 53 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
  2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index ecc33c4..54c30fe 100644
@@ -1702,6 +1702,9 @@ struct amdgpu_device {
  	/* record hw reset is performed */
  	bool has_hw_reset;
 
+	/* record last mm index being written through WREG32*/
+	unsigned long last_mm_index;
+
  };
 
  static inline struct amdgpu_device *amdgpu_ttm_adev(struct

ttm_bo_device *bdev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 21e504a..24b908c 100644
@@ -124,6 +124,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
  {
  	trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
 
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
+		adev->last_mm_index = v;
+	}
+
  	if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
 amdgpu_sriov_runtime(adev)) {
  		BUG_ON(in_interrupt());
  		return amdgpu_virt_kiq_wreg(adev, reg, v);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -139,6 +143,10 @@ void amdgpu_mm_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v,
  		writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA
 * 4));
  		spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
  	}
+
+	if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev-
 > last_mm_index == 0x5702C) {
+		udelay(500);
+	}
  }
Quoted 8 lines

u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
--
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