@@ -584,6 +584,7 @@ static void set_memory_based_intr(u32 *regs, struct xe_hw_engine *hwe)
584584{
585585 struct xe_memirq * memirq = & gt_to_tile (hwe -> gt )-> memirq ;
586586 struct xe_device * xe = gt_to_xe (hwe -> gt );
587+ u8 num_regs ;
587588
588589 if (!xe_device_uses_memirq (xe ))
589590 return ;
@@ -593,12 +594,18 @@ static void set_memory_based_intr(u32 *regs, struct xe_hw_engine *hwe)
593594 regs [CTX_INT_MASK_ENABLE_REG ] = RING_IMR (0 ).addr ;
594595 regs [CTX_INT_MASK_ENABLE_PTR ] = xe_memirq_enable_ptr (memirq );
595596
596- regs [CTX_LRI_INT_REPORT_PTR ] = MI_LOAD_REGISTER_IMM | MI_LRI_NUM_REGS (2 ) |
597+ num_regs = xe_device_has_msix (xe ) ? 3 : 2 ;
598+ regs [CTX_LRI_INT_REPORT_PTR ] = MI_LOAD_REGISTER_IMM | MI_LRI_NUM_REGS (num_regs ) |
597599 MI_LRI_LRM_CS_MMIO | MI_LRI_FORCE_POSTED ;
598600 regs [CTX_INT_STATUS_REPORT_REG ] = RING_INT_STATUS_RPT_PTR (0 ).addr ;
599601 regs [CTX_INT_STATUS_REPORT_PTR ] = xe_memirq_status_ptr (memirq , hwe );
600602 regs [CTX_INT_SRC_REPORT_REG ] = RING_INT_SRC_RPT_PTR (0 ).addr ;
601603 regs [CTX_INT_SRC_REPORT_PTR ] = xe_memirq_source_ptr (memirq , hwe );
604+
605+ if (xe_device_has_msix (xe )) {
606+ regs [CTX_CS_INT_VEC_REG ] = CS_INT_VEC (0 ).addr ;
607+ /* CTX_CS_INT_VEC_DATA will be set in xe_lrc_init */
608+ }
602609}
603610
604611static int lrc_ring_mi_mode (struct xe_hw_engine * hwe )
@@ -876,7 +883,7 @@ static void xe_lrc_finish(struct xe_lrc *lrc)
876883#define PVC_CTX_ACC_CTR_THOLD (0x2a + 1)
877884
878885static int xe_lrc_init (struct xe_lrc * lrc , struct xe_hw_engine * hwe ,
879- struct xe_vm * vm , u32 ring_size )
886+ struct xe_vm * vm , u32 ring_size , u16 msix_vec )
880887{
881888 struct xe_gt * gt = hwe -> gt ;
882889 struct xe_tile * tile = gt_to_tile (gt );
@@ -945,6 +952,14 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
945952 xe_drm_client_add_bo (vm -> xef -> client , lrc -> bo );
946953 }
947954
955+ if (xe_device_has_msix (xe )) {
956+ xe_lrc_write_ctx_reg (lrc , CTX_INT_STATUS_REPORT_PTR ,
957+ xe_memirq_status_ptr (& tile -> memirq , hwe ));
958+ xe_lrc_write_ctx_reg (lrc , CTX_INT_SRC_REPORT_PTR ,
959+ xe_memirq_source_ptr (& tile -> memirq , hwe ));
960+ xe_lrc_write_ctx_reg (lrc , CTX_CS_INT_VEC_DATA , msix_vec << 16 | msix_vec );
961+ }
962+
948963 if (xe_gt_has_indirect_ring_state (gt )) {
949964 xe_lrc_write_ctx_reg (lrc , CTX_INDIRECT_RING_STATE ,
950965 __xe_lrc_indirect_ring_ggtt_addr (lrc ));
@@ -1005,14 +1020,15 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
10051020 * @hwe: Hardware Engine
10061021 * @vm: The VM (address space)
10071022 * @ring_size: LRC ring size
1023+ * @msix_vec: MSI-X interrupt vector (for platforms that support it)
10081024 *
10091025 * Allocate and initialize the Logical Ring Context (LRC).
10101026 *
10111027 * Return pointer to created LRC upon success and an error pointer
10121028 * upon failure.
10131029 */
10141030struct xe_lrc * xe_lrc_create (struct xe_hw_engine * hwe , struct xe_vm * vm ,
1015- u32 ring_size )
1031+ u32 ring_size , u16 msix_vec )
10161032{
10171033 struct xe_lrc * lrc ;
10181034 int err ;
@@ -1021,7 +1037,7 @@ struct xe_lrc *xe_lrc_create(struct xe_hw_engine *hwe, struct xe_vm *vm,
10211037 if (!lrc )
10221038 return ERR_PTR (- ENOMEM );
10231039
1024- err = xe_lrc_init (lrc , hwe , vm , ring_size );
1040+ err = xe_lrc_init (lrc , hwe , vm , ring_size , msix_vec );
10251041 if (err ) {
10261042 kfree (lrc );
10271043 return ERR_PTR (err );
0 commit comments