AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Zhao, Yong" <Yong.Zhao-5C7GfCeVMHo@public.gmane.org>,
	"Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 4/9] drm/amdkfd: Workaround PASID missing in gfx9 interrupt payload under non HWS
Date: Tue, 6 Nov 2018 01:40:52 +0000	[thread overview]
Message-ID: <1541468434-29384-5-git-send-email-Felix.Kuehling@amd.com> (raw)
In-Reply-To: <1541468434-29384-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

From: Yong Zhao <Yong.Zhao@amd.com>

This is a known gfx9 HW issue, and this change can perfectly workaround
the issue.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
index 8497864..a85904a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
@@ -23,7 +23,7 @@
 #include "kfd_priv.h"
 #include "kfd_events.h"
 #include "soc15_int.h"
-
+#include "kfd_device_queue_manager.h"
 
 static bool event_interrupt_isr_v9(struct kfd_dev *dev,
 					const uint32_t *ih_ring_entry,
@@ -43,14 +43,33 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev,
 	client_id = SOC15_CLIENT_ID_FROM_IH_ENTRY(ih_ring_entry);
 	pasid = SOC15_PASID_FROM_IH_ENTRY(ih_ring_entry);
 
+	/* This is a known issue for gfx9. Under non HWS, pasid is not set
+	 * in the interrupt payload, so we need to find out the pasid on our
+	 * own.
+	 */
+	if (!pasid && dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) {
+		const uint32_t pasid_mask = 0xffff;
+
+		*patched_flag = true;
+		memcpy(patched_ihre, ih_ring_entry,
+				dev->device_info->ih_ring_entry_size);
+
+		pasid = dev->kfd2kgd->get_atc_vmid_pasid_mapping_pasid(
+				dev->kgd, vmid);
+
+		/* Patch the pasid field */
+		patched_ihre[3] = cpu_to_le32((le32_to_cpu(patched_ihre[3])
+					& ~pasid_mask) | pasid);
+	}
+
 	pr_debug("client id 0x%x, source id %d, vmid %d, pasid 0x%x. raw data:\n",
 		 client_id, source_id, vmid, pasid);
 	pr_debug("%8X, %8X, %8X, %8X, %8X, %8X, %8X, %8X.\n",
 		 data[0], data[1], data[2], data[3],
 		 data[4], data[5], data[6], data[7]);
 
-	/* If there is no valid PASID, it's likely a firmware bug */
-	if (WARN_ONCE(pasid == 0, "FW bug: No PASID in KFD interrupt"))
+	/* If there is no valid PASID, it's likely a bug */
+	if (WARN_ONCE(pasid == 0, "Bug: No PASID in KFD interrupt"))
 		return 0;
 
 	/* Interrupt types we care about: various signals and faults.
-- 
2.7.4

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

  parent reply	other threads:[~2018-11-06  1:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  1:40 [PATCH 0/9] KFD upstreaming Nov 2018, part 1 Kuehling, Felix
     [not found] ` <1541468434-29384-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06  1:40   ` [PATCH 1/9] drm/amdkfd: Replace mqd with mqd_mgr as the variable name for mqd_manager Kuehling, Felix
     [not found]     ` <1541468434-29384-2-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:32       ` Alex Deucher
2018-11-06  1:40   ` [PATCH 2/9] drm/amdkfd: Added Vega12 and Polaris12 for KFD Kuehling, Felix
     [not found]     ` <1541468434-29384-3-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:33       ` Alex Deucher
2018-11-06  1:40   ` [PATCH 3/9] drm/amdkfd: Adjust the debug message in KFD ISR Kuehling, Felix
     [not found]     ` <1541468434-29384-4-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:33       ` Alex Deucher
2018-11-06  1:40   ` Kuehling, Felix [this message]
     [not found]     ` <1541468434-29384-5-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:34       ` [PATCH 4/9] drm/amdkfd: Workaround PASID missing in gfx9 interrupt payload under non HWS Alex Deucher
2018-11-06  1:40   ` [PATCH 5/9] drm/amdgpu: Remove explicit wait after VM validate Kuehling, Felix
     [not found]     ` <1541468434-29384-6-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:35       ` Alex Deucher
2018-11-06  1:40   ` [PATCH 7/9] drm/amdkfd: Fix and simplify sync object handling for KFD Kuehling, Felix
     [not found]     ` <1541468434-29384-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-16 20:19       ` Kuehling, Felix
     [not found]         ` <972bbc9e-8f5d-9740-f400-4e1211e8e00f-5C7GfCeVMHo@public.gmane.org>
2018-11-17 16:01           ` Koenig, Christian
2018-11-06  1:40   ` [PATCH 6/9] drm/amdgpu: KFD Restore process: Optimize waiting Kuehling, Felix
     [not found]     ` <1541468434-29384-7-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-06 21:36       ` Alex Deucher
2018-11-06  1:40   ` [PATCH 8/9] drm/amdgpu: Fix KFD doorbell SG BO mapping Kuehling, Felix
2018-11-06  1:40   ` [PATCH 9/9] drm/amdkfd: change system memory overcommit limit Kuehling, Felix

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=1541468434-29384-5-git-send-email-Felix.Kuehling@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=Yong.Zhao-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@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