habanalabs/gaudi: correct driver events numbering
authorOfir Bitton <obitton@habana.ai>
Mon, 7 Jun 2021 12:22:56 +0000 (15:22 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:42 +0000 (15:23 +0300)
Currently driver sends fc interrupt id to FW instead of using
cpu interrupt id. We intend to fix that and keep backward
compatibility by using the same interrupt values.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/include/gaudi/gaudi_async_events.h
drivers/misc/habanalabs/include/gaudi/gaudi_async_ids_map_extended.h

index a673e40..be83094 100644 (file)
@@ -3960,7 +3960,8 @@ static int gaudi_init_cpu_queues(struct hl_device *hdev, u32 cpu_timeout)
                        mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR :
                        le32_to_cpu(dyn_regs->gic_host_pi_upd_irq);
 
-       WREG32(irq_handler_offset, GAUDI_EVENT_PI_UPDATE);
+       WREG32(irq_handler_offset,
+               gaudi_irq_map_table[GAUDI_EVENT_PI_UPDATE].cpu_id);
 
        err = hl_poll_timeout(
                hdev,
@@ -4146,7 +4147,8 @@ static void gaudi_hw_fini(struct hl_device *hdev, bool hard_reset)
                                mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR :
                                le32_to_cpu(dyn_regs->gic_host_halt_irq);
 
-               WREG32(irq_handler_offset, GAUDI_EVENT_HALT_MACHINE);
+               WREG32(irq_handler_offset,
+                       gaudi_irq_map_table[GAUDI_EVENT_HALT_MACHINE].cpu_id);
        } else {
                if (hdev->asic_prop.hard_reset_done_by_fw)
                        gaudi_ask_hard_reset_without_linux(hdev);
@@ -4599,7 +4601,8 @@ static void gaudi_ring_doorbell(struct hl_device *hdev, u32 hw_queue_id, u32 pi)
                                mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR :
                                le32_to_cpu(dyn_regs->gic_host_pi_upd_irq);
 
-               WREG32(irq_handler_offset, GAUDI_EVENT_PI_UPDATE);
+               WREG32(irq_handler_offset,
+                       gaudi_irq_map_table[GAUDI_EVENT_PI_UPDATE].cpu_id);
        }
 }
 
@@ -8988,7 +8991,8 @@ static void gaudi_enable_events_from_fw(struct hl_device *hdev)
                        mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR :
                        le32_to_cpu(dyn_regs->gic_host_ints_irq);
 
-       WREG32(irq_handler_offset, GAUDI_EVENT_INTS_REGISTER);
+       WREG32(irq_handler_offset,
+               gaudi_irq_map_table[GAUDI_EVENT_INTS_REGISTER].cpu_id);
 }
 
 static int gaudi_map_pll_idx_to_fw_idx(u32 pll_idx)
index f66c759..2aee18e 100644 (file)
@@ -252,10 +252,6 @@ enum gaudi_async_event_id {
        GAUDI_EVENT_HBM3_SPI_0 = 407,
        GAUDI_EVENT_HBM3_SPI_1 = 408,
        GAUDI_EVENT_PSOC_GPIO_U16_0 = 421,
-       GAUDI_EVENT_PI_UPDATE = 484,
-       GAUDI_EVENT_HALT_MACHINE = 485,
-       GAUDI_EVENT_INTS_REGISTER = 486,
-       GAUDI_EVENT_SOFT_RESET = 487,
        GAUDI_EVENT_RAZWI_OR_ADC = 548,
        GAUDI_EVENT_TPC0_QM = 572,
        GAUDI_EVENT_TPC1_QM = 573,
@@ -303,6 +299,10 @@ enum gaudi_async_event_id {
        GAUDI_EVENT_NIC3_QP1 = 619,
        GAUDI_EVENT_NIC4_QP0 = 620,
        GAUDI_EVENT_NIC4_QP1 = 621,
+       GAUDI_EVENT_PI_UPDATE = 635,
+       GAUDI_EVENT_HALT_MACHINE = 636,
+       GAUDI_EVENT_INTS_REGISTER = 637,
+       GAUDI_EVENT_SOFT_RESET = 638,
        GAUDI_EVENT_FW_ALIVE_S = 645,
        GAUDI_EVENT_DEV_RESET_REQ = 646,
        GAUDI_EVENT_PKT_QUEUE_OUT_SYNC = 647,
index e87554a..ac4d4b5 100644 (file)
@@ -508,10 +508,10 @@ static struct gaudi_async_events_ids_map gaudi_irq_map_table[] = {
        { .fc_id = 481, .cpu_id = 330, .valid = 0, .name = "" },
        { .fc_id = 482, .cpu_id = 331, .valid = 0, .name = "" },
        { .fc_id = 483, .cpu_id = 332, .valid = 0, .name = "" },
-       { .fc_id = 484, .cpu_id = 333, .valid = 1, .name = "PI_UPDATE" },
-       { .fc_id = 485, .cpu_id = 334, .valid = 1, .name = "HALT_MACHINE" },
-       { .fc_id = 486, .cpu_id = 335, .valid = 1, .name = "INTS_REGISTER" },
-       { .fc_id = 487, .cpu_id = 336, .valid = 1, .name = "SOFT_RESET" },
+       { .fc_id = 484, .cpu_id = 333, .valid = 0, .name = "" },
+       { .fc_id = 485, .cpu_id = 334, .valid = 0, .name = "" },
+       { .fc_id = 486, .cpu_id = 335, .valid = 0, .name = "" },
+       { .fc_id = 487, .cpu_id = 336, .valid = 0, .name = "" },
        { .fc_id = 488, .cpu_id = 337, .valid = 0, .name = "" },
        { .fc_id = 489, .cpu_id = 338, .valid = 0, .name = "" },
        { .fc_id = 490, .cpu_id = 339, .valid = 0, .name = "" },
@@ -659,10 +659,10 @@ static struct gaudi_async_events_ids_map gaudi_irq_map_table[] = {
        { .fc_id = 632, .cpu_id = 481, .valid = 0, .name = "" },
        { .fc_id = 633, .cpu_id = 482, .valid = 0, .name = "" },
        { .fc_id = 634, .cpu_id = 483, .valid = 0, .name = "" },
-       { .fc_id = 635, .cpu_id = 484, .valid = 0, .name = "" },
-       { .fc_id = 636, .cpu_id = 485, .valid = 0, .name = "" },
-       { .fc_id = 637, .cpu_id = 486, .valid = 0, .name = "" },
-       { .fc_id = 638, .cpu_id = 487, .valid = 0, .name = "" },
+       { .fc_id = 635, .cpu_id = 484, .valid = 1, .name = "PI_UPDATE" },
+       { .fc_id = 636, .cpu_id = 485, .valid = 1, .name = "HALT_MACHINE" },
+       { .fc_id = 637, .cpu_id = 486, .valid = 1, .name = "INTS_REGISTER" },
+       { .fc_id = 638, .cpu_id = 487, .valid = 1, .name = "SOFT_RESET" },
        { .fc_id = 639, .cpu_id = 488, .valid = 0, .name = "" },
        { .fc_id = 640, .cpu_id = 489, .valid = 0, .name = "" },
        { .fc_id = 641, .cpu_id = 490, .valid = 0, .name = "" },