[4/4] drm/amdgpu:determine if vPost is needed indeed

Submitted by Liu, Monk on Sept. 14, 2016, 12:12 p.m.

Details

Message ID MWHPR12MB118220B09C54875120397EC084F10@MWHPR12MB1182.namprd12.prod.outlook.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Liu, Monk Sept. 14, 2016, 12:12 p.m.
Sorry, ignore this one, it's not correct and I have sent another one 

BR Monk

-----Original Message-----
From: Monk Liu [mailto:Monk.Liu@amd.com] 
Sent: Wednesday, September 14, 2016 7:48 PM
To: amd-gfx@lists.freedesktop.org
Cc: Liu, Monk <Monk.Liu@amd.com>
Subject: [PATCH 4/4] drm/amdgpu:determine if vPost is needed indeed

Change-Id: Ic4bb5cb748180d60a672f9e160f1f3308397029b
Signed-off-by: Monk Liu <Monk.Liu@amd.com>

Conflicts:
	drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 38 ++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

 		amdgpu_asic_detect_sriov_bios(adev);
 
 	/* Post card if necessary */
-	if (!amdgpu_sriov_vf(adev) &&
-		(!amdgpu_card_posted(adev) || amdgpu_passthrough(adev))) {
+	if (amdgpu_vpost_needed(adev)) {
 		if (!adev->bios) {
-			dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n");
+			dev_err(adev->dev, "no vBIOS found\n");
 			r = -EINVAL;
 			goto failed;
 		}
-		DRM_INFO("GPU not posted. posting now...\n");
+		DRM_INFO("GPU posting now...\n");
 		r = amdgpu_atom_asic_init(adev->mode_info.atom_context);
 		if (r) {
 			dev_err(adev->dev, "gpu post error!\n");
--
1.9.1

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f8dd802..1839079 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -652,6 +652,37 @@  bool amdgpu_card_posted(struct amdgpu_device *adev)
 
 }
 
+static bool amdgpu_vpost_needed(struct amdgpu_device *adev) {
+	if (amdgpu_sriov_vf(adev))
+		return false;
+
+	if (amdgpu_passthrough(adev)) {
+		/* for FIJI: In whole GPU pass-through virtualization case
+		 * old smc fw won't clear some registers (e.g. MEM_SIZE, BIOS_SCRATCH)
+		 * so amdgpu_card_posted return false and driver will incorrectly skip vPost.
+		 * but if we force vPost do in pass-through case, the driver reload will hang.
+		 * so we'll skip vPost if smc version is above 00160e00 for FIJI.
+		 */
+		 if (adev->asic_type == CHIP_FIJI && adev->pm.fw_version >= 0x160e00)
+			return false;
+
+		 /* we assume vPost is neede for all other cases */
+		 return true;
+	} else {
+		/* in bare-metal case, amdgpu_card_posted return false
+		 * after system reboot/boot, and return true if driver
+		 * reloaded.
+		 * we shouldn't do vPost after driver reload otherwise GPU
+		 * could hang.
+		 */
+		if (amdgpu_card_posted(adev))
+			return false;
+	}
+
+	return true;
+}
+
 /**
  * amdgpu_dummy_page_init - init dummy page used by the driver
  *
@@ -1679,14 +1710,13 @@  int amdgpu_device_init(struct amdgpu_device *adev,