diff options
author | Oded Gabbay <ogabbay@kernel.org> | 2021-05-19 14:52:14 +0300 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2021-06-18 15:23:40 +0300 |
commit | 1242e9f0f45873607f8e6699b4339c81d9f3de73 (patch) | |
tree | bf5a12f130150236d06924ce5ef55459c7b042b4 /drivers/misc/habanalabs/common/firmware_if.c | |
parent | 7fb2a1f5b7f81dce20587e79aae8fe8a9ac03986 (diff) |
habanalabs: check running index in eqe control
To harden the event queue mechanism, we add a running index to the
control header of the entry.
The firmware writes the index in each entry and the driver verifies
that the index of the current entry is larger by 1 of the index of
the previous entry.
In case it isn't, the driver will treat the entry as if it wasn't
valid (it won't process it but won't skip it).
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/firmware_if.c')
-rw-r--r-- | drivers/misc/habanalabs/common/firmware_if.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c index b00f763bcda6..17173020ff53 100644 --- a/drivers/misc/habanalabs/common/firmware_if.c +++ b/drivers/misc/habanalabs/common/firmware_if.c @@ -617,10 +617,17 @@ int hl_fw_cpucp_info_get(struct hl_device *hdev, goto out; } + /* assume EQ code doesn't need to check eqe index */ + hdev->event_queue.check_eqe_index = false; + /* Read FW application security bits again */ - if (hdev->asic_prop.fw_cpu_boot_dev_sts0_valid) + if (hdev->asic_prop.fw_cpu_boot_dev_sts0_valid) { hdev->asic_prop.fw_app_cpu_boot_dev_sts0 = RREG32(sts_boot_dev_sts0_reg); + if (hdev->asic_prop.fw_app_cpu_boot_dev_sts0 & + CPU_BOOT_DEV_STS0_EQ_INDEX_EN) + hdev->event_queue.check_eqe_index = true; + } if (hdev->asic_prop.fw_cpu_boot_dev_sts1_valid) hdev->asic_prop.fw_app_cpu_boot_dev_sts1 = |