AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/6] drm/amdgpu:fix vf_error_put
Date: Wed, 18 Oct 2017 16:48:24 +0800	[thread overview]
Message-ID: <1508316505-8506-5-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1508316505-8506-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

it should not work on non-SR-IOV case

Change-Id: Icf34f88a0642e4b04c857a07b72df3bb772075d6
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   | 7 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c | 7 ++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b05536c..fec60bc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2057,6 +2057,9 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
 		if (amdgpu_atombios_has_gpu_virtualization_table(adev))
 			adev->virt.caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS;
 	}
+
+	if (!(adev->virt.caps & AMDGPU_SRIOV_CAPS_SRIOV_VBIOS))
+		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0);
 }
 
 bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
@@ -2268,7 +2271,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (amdgpu_vpost_needed(adev)) {
 		if (!adev->bios) {
 			dev_err(adev->dev, "no vBIOS found\n");
-			amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0);
 			r = -EINVAL;
 			goto failed;
 		}
@@ -2276,7 +2278,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		r = amdgpu_atom_asic_init(adev->mode_info.atom_context);
 		if (r) {
 			dev_err(adev->dev, "gpu post error!\n");
-			amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_POST_ERROR, 0, 0);
 			goto failed;
 		}
 	} else {
@@ -3101,7 +3102,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 		}
 	} else {
 		dev_err(adev->dev, "asic resume failed (%d).\n", r);
-		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ASIC_RESUME_FAIL, 0, r);
 		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
 			if (adev->rings[i] && adev->rings[i]->sched.thread) {
 				kthread_unpark(adev->rings[i]->sched.thread);
@@ -3119,7 +3119,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 	if (r) {
 		/* bad news, how to tell it to userspace ? */
 		dev_info(adev->dev, "GPU reset failed\n");
-		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
 	}
 	else {
 		dev_info(adev->dev, "GPU reset successed!\n");
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c
index 746b813..7f70979 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c
@@ -31,7 +31,12 @@ void amdgpu_vf_error_put(struct amdgpu_device *adev,
 			 uint64_t error_data)
 {
 	int index;
-	uint16_t error_code = AMDGIM_ERROR_CODE(AMDGIM_ERROR_CATEGORY_VF, sub_error_code);
+	uint16_t error_code;
+
+	if (!amdgpu_sriov_vf(adev))
+		return;
+
+	error_code = AMDGIM_ERROR_CODE(AMDGIM_ERROR_CATEGORY_VF, sub_error_code);
 
 	mutex_lock(&adev->virt.vf_errors.lock);
 	index = adev->virt.vf_errors.write_count % AMDGPU_VF_ERROR_ENTRY_SIZE;
-- 
2.7.4

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

  parent reply	other threads:[~2017-10-18  8:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  8:48 [PATCH 1/6] drm/amdgpu:reduce wb to 512 slot Monk Liu
     [not found] ` <1508316505-8506-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-18  8:48   ` [PATCH 2/6] drm/amdgpu:fix regression on KIQ enable Monk Liu
2017-10-18  8:48   ` [PATCH 3/6] drm/amdgpu/sriov:now must reinit psp Monk Liu
     [not found]     ` <1508316505-8506-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-19  2:53       ` Alex Deucher
2017-10-18  8:48   ` [PATCH 4/6] drm/amdgpu:fix duplicated setting job's vram_lost Monk Liu
     [not found]     ` <1508316505-8506-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-18  9:08       ` Christian König
2017-10-18  8:48   ` Monk Liu [this message]
2017-10-18  8:48   ` [PATCH 6/6] drm/amdgpu:don't check soft_reset for sriov Monk Liu
     [not found]     ` <1508316505-8506-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-18  9:10       ` Christian König
2017-10-18  9:06   ` [PATCH 1/6] drm/amdgpu:reduce wb to 512 slot Christian König

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=1508316505-8506-5-git-send-email-Monk.Liu@amd.com \
    --to=monk.liu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox