All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tianci Yin <tianci.yin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: "Long Gang" <Gang.Long@amd.com>,
	"Tianci Yin" <tianci.yin@amd.com>,
	"Feifei Xu" <Feifei.Xu@amd.com>,
	"Kevin Wang" <Kevin1.Wang@amd.com>,
	"Tuikov Luben" <Luben.Tuikov@amd.com>,
	"Deucher Alexander" <Alexander.Deucher@amd.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Xiaojie Yuan" <xiaojie.yuan@amd.com>
Subject: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Date: Wed, 8 Jan 2020 20:36:48 +0800	[thread overview]
Message-ID: <20200108123648.7422-1-tianci.yin@amd.com> (raw)

From: "Tianci.Yin" <tianci.yin@amd.com>

[why]
In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU,
then the bottom region of VRAM was allocated as GTT, unfortunately
a small region of bottom VRAM was encroached by UMC firmware during
GDDR6 BIST training, this cause pagefault.

[how]
Forcing stolen_size to 3MB, then the bottom region of VRAM was
allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free in late_init phase,
no memory wasted.

Change-Id: Icd0ad7de41333282949bb1e3e676c6c307ddd081
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 21 +++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
index c91dd602d5f1..440b793316df 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -60,6 +60,11 @@
  */
 #define AMDGPU_GMC_FAULT_TIMEOUT	5000ULL
 
+/*
+ * Default stolen memory size, 1024 * 768 * 4
+ */
+#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE	0x300000
+
 struct firmware;
 
 /*
@@ -192,6 +197,7 @@ struct amdgpu_gmc {
 	uint32_t                srbm_soft_reset;
 	bool			prt_warning;
 	uint64_t		stolen_size;
+	bool			stolen_temp_reserved;
 	/* apertures */
 	u64			shared_aperture_start;
 	u64			shared_aperture_end;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 7dc8c068c62a..0c96b67d6ca7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int r;
 
+	if (adev->gmc.stolen_temp_reserved) {
+		amdgpu_bo_late_init(adev);
+		adev->gmc.stolen_temp_reserved = false;
+	}
+
 	r = amdgpu_gmc_allocate_vm_inv_eng(adev);
 	if (r)
 		return r;
@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)
 		return r;
 
 	adev->gmc.stolen_size = gmc_v10_0_get_vbios_fb_size(adev);
+	/*
+	 * In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU,
+	 * then the bottom region of VRAM was allocated as GTT, unfortunately
+	 * a small region of bottom VRAM was encroached by UMC firmware during
+	 * GDDR6 BIST training, this cause pagefault.
+	 * The page fault can be fixed by forcing stolen_size to 3MB, then the bottom
+	 * region of VRAM was allocated as stolen memory, GTT corruption avoid.
+	 * The stolen memory of the 2nd GPU will be free in late_init phase,
+	 * no memory wasted.
+	 */
+	if (adev->fw_vram_usage.mem_train_support &&
+		adev->gmc.stolen_size == 0) {
+		adev->gmc.stolen_size = AMDGPU_STOLEN_VGA_DEFAULT_SIZE;
+		adev->gmc.stolen_temp_reserved = true;
+	} else
+		adev->gmc.stolen_temp_reserved = false;
 
 	/* Memory manager */
 	r = amdgpu_bo_init(adev);
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2020-01-08 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 12:36 Tianci Yin [this message]
2020-01-08 12:52 ` [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled Christian König
2020-01-08 14:49   ` Alex Deucher
2020-01-08 15:04     ` Christian König
2020-01-09  3:07       ` Yin, Tianci (Rico)
2020-01-09  3:12         ` Alex Deucher
2020-01-09  3:15           ` Yin, Tianci (Rico)
2020-01-09 10:29             ` Christian König
2020-01-09 11:30               ` Yin, Tianci (Rico)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200108123648.7422-1-tianci.yin@amd.com \
    --to=tianci.yin@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Feifei.Xu@amd.com \
    --cc=Gang.Long@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Kevin1.Wang@amd.com \
    --cc=Luben.Tuikov@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=xiaojie.yuan@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.