RE: [PATCH] drm/amdgpu: Add handler for SDMA context empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <Lijo.Lazar@xxxxxxx>
Sent: Wednesday, January 1, 2025 04:58
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Zhang, Hawking <Hawking.Zhang@xxxxxxx>; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Ma, Le <Le.Ma@xxxxxxx>
Subject: [PATCH] drm/amdgpu: Add handler for SDMA context empty

Context empty interrupt is enabled for SDMA 4.4.2. Add a handler for context empty interrupt so that it is disposed of fast, and not propagated to KFD layer.

Signed-off-by: Lijo Lazar <lijo.lazar@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h |  1 +  drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
index 2db58b5812a8..5f60736051d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
@@ -107,6 +107,7 @@ struct amdgpu_sdma {
        struct amdgpu_irq_src   doorbell_invalid_irq;
        struct amdgpu_irq_src   pool_timeout_irq;
        struct amdgpu_irq_src   srbm_write_irq;
+       struct amdgpu_irq_src   ctxt_empty_irq;

        int                     num_instances;
        uint32_t                sdma_mask;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 56507ae919b0..5f1c6ae7202c 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
@@ -1406,6 +1406,12 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
                                      &adev->sdma.srbm_write_irq);
                if (r)
                        return r;
+
+               r = amdgpu_irq_add_id(adev, sdma_v4_4_2_seq_to_irq_id(i),
+                                     SDMA0_4_0__SRCID__SDMA_CTXEMPTY,
+                                     &adev->sdma.ctxt_empty_irq);
+               if (r)
+                       return r;
        }

        for (i = 0; i < adev->sdma.num_instances; i++) { @@ -1814,6 +1820,16 @@ static int sdma_v4_4_2_process_srbm_write_irq(struct amdgpu_device *adev,
        return 0;
 }

+static int sdma_v4_4_2_process_ctxt_empty_irq(struct amdgpu_device *adev,
+                                             struct amdgpu_irq_src *source,
+                                             struct amdgpu_iv_entry *entry) {
+       /* There is nothing useful to be done here, only kept for debug */
+       dev_dbg_ratelimited(adev->dev, "SDMA context empty interrupt");
+       sdma_v4_4_2_print_iv_entry(adev, entry);
+       return 0;
+}
+
 static void sdma_v4_4_2_inst_update_medium_grain_light_sleep(
        struct amdgpu_device *adev, bool enable, uint32_t inst_mask)  { @@ -2096,6 +2112,10 @@ static const struct amdgpu_irq_src_funcs sdma_v4_4_2_srbm_write_irq_funcs = {
        .process = sdma_v4_4_2_process_srbm_write_irq,
 };

+static const struct amdgpu_irq_src_funcs sdma_v4_4_2_ctxt_empty_irq_funcs = {
+       .process = sdma_v4_4_2_process_ctxt_empty_irq,
+};
+
 static void sdma_v4_4_2_set_irq_funcs(struct amdgpu_device *adev)  {
        adev->sdma.trap_irq.num_types = adev->sdma.num_instances; @@ -2104,6 +2124,7 @@ static void sdma_v4_4_2_set_irq_funcs(struct amdgpu_device *adev)
        adev->sdma.doorbell_invalid_irq.num_types = adev->sdma.num_instances;
        adev->sdma.pool_timeout_irq.num_types = adev->sdma.num_instances;
        adev->sdma.srbm_write_irq.num_types = adev->sdma.num_instances;
+       adev->sdma.ctxt_empty_irq.num_types = adev->sdma.num_instances;

        adev->sdma.trap_irq.funcs = &sdma_v4_4_2_trap_irq_funcs;
        adev->sdma.illegal_inst_irq.funcs = &sdma_v4_4_2_illegal_inst_irq_funcs;
@@ -2112,6 +2133,7 @@ static void sdma_v4_4_2_set_irq_funcs(struct amdgpu_device *adev)
        adev->sdma.doorbell_invalid_irq.funcs = &sdma_v4_4_2_doorbell_invalid_irq_funcs;
        adev->sdma.pool_timeout_irq.funcs = &sdma_v4_4_2_pool_timeout_irq_funcs;
        adev->sdma.srbm_write_irq.funcs = &sdma_v4_4_2_srbm_write_irq_funcs;
+       adev->sdma.ctxt_empty_irq.funcs = &sdma_v4_4_2_ctxt_empty_irq_funcs;
 }

 /**
--
2.25.1





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux