Skip to contentSkip to conversation

drm/amdgpu: Add nv mailbox irq in soc21

PATCH In review YuBiao Wang 2 participants 2 messages Nov 30, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add nv mailbox irq in soc21

Under virtualization guest needs to receive notification from host to perform reset in some cases. Add nv mailbox irq in soc21.

---
 drivers/gpu/drm/amd/amdgpu/soc21.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +17 -1
index c559f9bfc36d..41b94c824717 100644
@@ -43,6 +43,7 @@
 #include "soc15.h"
 #include "soc15_common.h"
 #include "soc21.h"
+#include "mxgpu_nv.h"
 
 static const struct amd_ip_funcs soc21_common_ip_funcs;
 
@@ -659,19 +660,31 @@ static int soc21_common_early_init(void *handle)
 		return -EINVAL;
 	}
 
-	if (amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev)) {
 		amdgpu_virt_init_setting(adev);
+		xgpu_nv_mailbox_set_irq_funcs(adev);
+	}
 
 	return 0;
 }
 
 static int soc21_common_late_init(void *handle)
 {
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	if (amdgpu_sriov_vf(adev))
+		xgpu_nv_mailbox_get_irq(adev);
+
 	return 0;
 }
 
 static int soc21_common_sw_init(void *handle)
 {
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	if (amdgpu_sriov_vf(adev))
+		xgpu_nv_mailbox_add_irq_id(adev);
+
 	return 0;
 }
 
@@ -709,6 +722,9 @@ static int soc21_common_hw_fini(void *handle)
 	/* disable the doorbell aperture */
 	soc21_enable_doorbell_aperture(adev, false);
 
+	if (amdgpu_sriov_vf(adev))
+		xgpu_nv_mailbox_put_irq(adev);
+
 	return 0;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

I assume the offset, as well as field, of MAILBOX_INT_CNTL register, and the mailbox irq source in soc21 adapters kept the same as the ones in navi1x.

With that confirmed, the change is

Regards,
Hawking

-----Original Message-----
From: YuBiao Wang <[email protected]>
Sent: Wednesday, November 30, 2022 17:35
To: [email protected]
Cc: Andrey Grodzovsky <[email protected]>; Quan, Evan <[email protected]>; Chen, Horace <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Xiao, Jack <[email protected]>; Zhang, Hawking <[email protected]>; Liu, Monk <[email protected]>; Xu, Feifei <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Wang, YuBiao <[email protected]>
Subject: [PATCH] drm/amdgpu: Add nv mailbox irq in soc21

Under virtualization guest needs to receive notification from host to perform reset in some cases. Add nv mailbox irq in soc21.

---
 drivers/gpu/drm/amd/amdgpu/soc21.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +17 -1
index c559f9bfc36d..41b94c824717 100644
@@ -43,6 +43,7 @@
 #include "soc15.h"
 #include "soc15_common.h"
 #include "soc21.h"
+#include "mxgpu_nv.h"
 
 static const struct amd_ip_funcs soc21_common_ip_funcs;
 
@@ -659,19 +660,31 @@ static int soc21_common_early_init(void *handle)
                return -EINVAL;
        }
 
-       if (amdgpu_sriov_vf(adev))
+       if (amdgpu_sriov_vf(adev)) {
                amdgpu_virt_init_setting(adev);
+               xgpu_nv_mailbox_set_irq_funcs(adev);
+       }
 
        return 0;
 }
 
 static int soc21_common_late_init(void *handle)  {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+       if (amdgpu_sriov_vf(adev))
+               xgpu_nv_mailbox_get_irq(adev);
+
        return 0;
 }
 
 static int soc21_common_sw_init(void *handle)  {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+       if (amdgpu_sriov_vf(adev))
+               xgpu_nv_mailbox_add_irq_id(adev);
+
        return 0;
 }
 
@@ -709,6 +722,9 @@ static int soc21_common_hw_fini(void *handle)
        /* disable the doorbell aperture */
        soc21_enable_doorbell_aperture(adev, false);
 
+       if (amdgpu_sriov_vf(adev))
+               xgpu_nv_mailbox_put_irq(adev);
+
        return 0;
 }
 

--
2.25.1