Skip to contentSkip to conversation

drm/amdgpu: Process bif doorbell event

PATCH In review Hawking Zhang 2 participants 2 messages Apr 1, 2024 – Apr 8, 2024

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

PATCH 1/1 drm/amdgpu: Process bif doorbell event

When BACO exit is triggered by doorbell transaction, firmware will config bif to issue msi interrupt to indicate doorbell transaction. If bif ring is not enabled in such case, driver needs to ack the interrupt by clearing the interrupt status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h |  2 +
 drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c   | 56 ++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc21.c       | 14 +++++-
 3 files changed, 71 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +2 -0
index 7b8c03be1d9e..db341921cfc1 100644
@@ -102,6 +102,7 @@ struct amdgpu_nbio_funcs {
 	u32 (*get_memory_partition_mode)(struct amdgpu_device *adev,
 					 u32 *supp_modes);
 	u64 (*get_pcie_replay_count)(struct amdgpu_device *adev);
+	u32 (*init_bif_doorbell_event)(struct amdgpu_device *adev);
 };
 
 struct amdgpu_nbio {
@@ -111,6 +112,7 @@ struct amdgpu_nbio {
 	struct ras_common_if *ras_if;
 	const struct amdgpu_nbio_funcs *funcs;
 	struct amdgpu_nbio_ras  *ras;
+	struct amdgpu_irq_src bif_doorbell_irq;
 };
 
 int amdgpu_nbio_ras_sw_init(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +56 -0

68 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/soc21.c +13 -1
index abe319b0f063..ee6d810589c0 100644
@@ -792,6 +792,9 @@ static int soc21_common_late_init(void *handle)
 			 * nbio v4_3 only support fatal error hanlding
 			 * just enable the interrupt directly */
 			amdgpu_irq_get(adev, &adev->nbio.ras_err_event_athub_irq, 0);
+		if (adev->nbio.bif_doorbell_irq.funcs &&
+		    adev->nbio.funcs && adev->nbio.funcs->init_bif_doorbell_event)
+			amdgpu_irq_get(adev, &adev->nbio.bif_doorbell_irq, 0);
 	}
 
 	/* Enable selfring doorbell aperture late because doorbell BAR
@@ -806,8 +809,12 @@ static int soc21_common_sw_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-	if (amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev)) {
 		xgpu_nv_mailbox_add_irq_id(adev);
+	} else if (adev->nbio.funcs &&
+		   adev->nbio.funcs->init_bif_doorbell_event) {
+		adev->nbio.funcs->init_bif_doorbell_event(adev);
+	}
 
 	return 0;
 }
@@ -855,6 +862,11 @@ static int soc21_common_hw_fini(void *handle)
 		if (adev->nbio.ras &&
 		    adev->nbio.ras_err_event_athub_irq.funcs)
 			amdgpu_irq_put(adev, &adev->nbio.ras_err_event_athub_irq, 0);
+
+		if (adev->nbio.funcs &&
+		    adev->nbio.funcs->init_bif_doorbell_event &&
+		    adev->nbio.bif_doorbell_irq.funcs)
+			amdgpu_irq_put(adev, &adev->nbio.bif_doorbell_irq, 0);
 	}
 
 	return 0;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Monday, April 1, 2024 7:15 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Feng, Kenneth <[email protected]>; Xiao, Jack <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amdgpu: Process bif doorbell event

When BACO exit is triggered by doorbell transaction, firmware will config bif to issue msi interrupt to indicate doorbell transaction. If bif ring is not enabled in such case, driver needs to ack the interrupt by clearing the interrupt status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h |  2 +
 drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c   | 56 ++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc21.c       | 14 +++++-
 3 files changed, 71 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +2 -0
index 7b8c03be1d9e..db341921cfc1 100644
@@ -102,6 +102,7 @@ struct amdgpu_nbio_funcs {
        u32 (*get_memory_partition_mode)(struct amdgpu_device *adev,
                                         u32 *supp_modes);
        u64 (*get_pcie_replay_count)(struct amdgpu_device *adev);
+       u32 (*init_bif_doorbell_event)(struct amdgpu_device *adev);
 };
 
 struct amdgpu_nbio {
@@ -111,6 +112,7 @@ struct amdgpu_nbio {
        struct ras_common_if *ras_if;
        const struct amdgpu_nbio_funcs *funcs;
        struct amdgpu_nbio_ras  *ras;
+       struct amdgpu_irq_src bif_doorbell_irq;
 };
 
 int amdgpu_nbio_ras_sw_init(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c

index 7f88a298ac5f..e5a331b6eee9 100644

drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +54 -0

64 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/soc21.c +3 -0
index abe319b0f063..ee6d810589c0 100644
@@ -792,6 +792,9 @@ static int soc21_common_late_init(void *handle)
                         * nbio v4_3 only support fatal error hanlding
                         * just enable the interrupt directly */
                        amdgpu_irq_get(adev, &adev->nbio.ras_err_event_athub_irq, 0);
+               if (adev->nbio.bif_doorbell_irq.funcs &&
+                   adev->nbio.funcs && adev->nbio.funcs->init_bif_doorbell_event)
+                       amdgpu_irq_get(adev, &adev->nbio.bif_doorbell_irq, 0);
        }
 
        /* Enable selfring doorbell aperture late because doorbell BAR @@ -806,8 +809,12 @@ static int soc21_common_sw_init(void *handle)  {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;

- if (amdgpu_sriov_vf(adev))

+       if (amdgpu_sriov_vf(adev)) {
                xgpu_nv_mailbox_add_irq_id(adev);

+ } else if (adev->nbio.funcs &&
+ adev->nbio.funcs->init_bif_doorbell_event) {
+ adev->nbio.funcs->init_bif_doorbell_event(adev);
+ }

        return 0;
 }
@@ -855,6 +862,11 @@ static int soc21_common_hw_fini(void *handle)
                if (adev->nbio.ras &&
                    adev->nbio.ras_err_event_athub_irq.funcs)
                        amdgpu_irq_put(adev, &adev->nbio.ras_err_event_athub_irq, 0);

+
+ if (adev->nbio.funcs &&
+ adev->nbio.funcs->init_bif_doorbell_event &&
+ adev->nbio.bif_doorbell_irq.funcs)

+                       amdgpu_irq_put(adev, &adev->nbio.bif_doorbell_irq, 0);
        }

        return 0;

--
2.17.1