to complete the amdgpu_rlc_spm_interrupt() stub by wiring it to the
new SPM-layer interrupt handler amdgpu_spm_interrupt().

amdgpu_rlc_spm_interrupt(adev, xcc_id) is the entry point called by
IP-specific IRQ process callbacks (e.g. gfx_v9_0_spm_irq,
gfx_v9_4_3_spm_irq) when the RLC fires a Stream Performance Monitor
interrupt. It guards against unconfigured hardware by returning early
if adev->gfx.spmfuncs is NULL, then delegates to amdgpu_spm_interrupt().

amdgpu_spm_interrupt(adev, xcc_id) is added to amdgpu_spm.c as the
SPM-manager-level interrupt handler. The implementation is currently a
stub (TODO) and will be completed in a later patch to schedule the SPM
work queue for draining the ring buffer when the hardware signals that
data is available or the ring is near full.

Signed-off-by: James Zhu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_spm.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_spm.h | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
index faf2a34df42f..fa89dc04d072 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
@@ -671,5 +671,8 @@ void amdgpu_rlc_spm_release(struct amdgpu_device *adev, int 
xcc_id, struct amdgp
 
 void amdgpu_rlc_spm_interrupt(struct amdgpu_device *adev, int xcc_id)
 {
-       /* TODO: */
+       if (!adev->gfx.spmfuncs)
+               return;
+
+       amdgpu_spm_interrupt(adev, xcc_id);
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.c
index 27f4ed1aa1e0..af7ee74aaa35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.c
@@ -60,3 +60,8 @@ void amdgpu_spm_mgr_fini(struct amdgpu_spm_mgr *spm_mgr)
                spm_mgr->file = NULL;
        }
 }
+
+void amdgpu_spm_interrupt(struct amdgpu_device *adev, int xcc_id)
+{
+       /* TODO */
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.h
index 06b4f6dba41b..ade50abfa590 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_spm.h
@@ -30,5 +30,6 @@ struct amdgpu_spm_mgr {
 
 int amdgpu_spm_mgr_init(struct amdgpu_spm_mgr *spm_mgr);
 void amdgpu_spm_mgr_fini(struct amdgpu_spm_mgr *spm_mgr);
+void amdgpu_spm_interrupt(struct amdgpu_device *adev, int xcc_id);
 
 #endif
-- 
2.34.1

Reply via email to