Skip to contentSkip to conversation

drm/amdgpu: set kiq irq in sriov case for gfx_v9.

PATCH In review Rex Zhu 3 participants 3 messages Apr 17, 2017 – Apr 18, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: set kiq irq in sriov case for gfx_v9.

As the kiq ring is NULL in baremetal case, the irq function will result in a BUG_ON in some case.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -6
index f6b2329..35657c3 100644
@@ -1029,9 +1029,11 @@ static int gfx_v9_0_sw_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	/* KIQ event */
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 178, &adev->gfx.kiq.irq);
-	if (r)
-		return r;
+	if (amdgpu_sriov_vf()) {
+		r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 178, &adev->gfx.kiq.irq);
+		if (r)
+			return r;
+	}
 
 	/* EOP Event */
 	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 181, &adev->gfx.eop_irq);
@@ -3590,9 +3592,10 @@ static void gfx_v9_0_set_irq_funcs(struct amdgpu_device *adev)
 
 	adev->gfx.priv_inst_irq.num_types = 1;
 	adev->gfx.priv_inst_irq.funcs = &gfx_v9_0_priv_inst_irq_funcs;
-
-	adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
-	adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+	if (amdgpu_sriov_vf(adev)) {
+		adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
+		adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+	}
 }
 
 static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev)
Signature · 6 lines
1.9.1

_______________________________________________
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): 1492432250-23878-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 4 lines · Rex Zhu

As the kiq ring is NULL in baremetal case, the irq function will result in a BUG_ON in some case.

We need to rework this eventually to mirror gfx8 so we can enable KIQ for gfx9 bare metal, but for now:

Quoted 40 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -7
index f6b2329..35657c3 100644
@@ -1029,9 +1029,11 @@ static int gfx_v9_0_sw_init(void *handle)
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
        /* KIQ event */
-       r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 178, &adev->gfx.kiq.irq);
-       if (r)
-               return r;
+       if (amdgpu_sriov_vf()) {
+               r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 178, &adev->gfx.kiq.irq);
+               if (r)
+                       return r;
+       }
 
        /* EOP Event */
        r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP, 181, &adev->gfx.eop_irq);
@@ -3590,9 +3592,10 @@ static void gfx_v9_0_set_irq_funcs(struct amdgpu_device *adev)
 
        adev->gfx.priv_inst_irq.num_types = 1;
        adev->gfx.priv_inst_irq.funcs = &gfx_v9_0_priv_inst_irq_funcs;
-
-       adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
-       adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+       if (amdgpu_sriov_vf(adev)) {
+               adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
+               adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+       }
 }
 
 static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev)
--

1.9.1

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

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

Please refer to commit 4e683cb26 that fix for gfx8, I think the commit can also fix BUG_ON case of gfx9.

Thanks!
Xiangliang Yu

Quoted 56 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Monday, April 17, 2017 8:31 PM
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH] drm/amdgpu: set kiq irq in sriov case for gfx_v9.

As the kiq ring is NULL in baremetal case, the irq function will result in a BUG_ON in some case.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -3
index f6b2329..35657c3 100644
@@ -1029,9 +1029,11 @@ static int gfx_v9_0_sw_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	/* KIQ event */
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP,
 178, &adev->gfx.kiq.irq);
-	if (r)
-		return r;
+	if (amdgpu_sriov_vf()) {
+		r = amdgpu_irq_add_id(adev,
 AMDGPU_IH_CLIENTID_GRBM_CP, 178, &adev->gfx.kiq.irq);
+		if (r)
+			return r;
+	}
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	/* EOP Event */
 	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_GRBM_CP,

181, &adev->gfx.eop_irq); @@ -3590,9 +3592,10 @@ static void gfx_v9_0_set_irq_funcs(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -4
 	adev->gfx.priv_inst_irq.num_types = 1;
 	adev->gfx.priv_inst_irq.funcs = &gfx_v9_0_priv_inst_irq_funcs;
-
-	adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
-	adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+	if (amdgpu_sriov_vf(adev)) {
+		adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST;
+		adev->gfx.kiq.irq.funcs = &gfx_v9_0_kiq_irq_funcs;
+	}
 }
 
 static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev)
--

1.9.1

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