Commit 5f92c1e2 authored by Oded Gabbay's avatar Oded Gabbay

habanalabs: remove all kdma locks

We don't use KDMA concurrently in the driver. The only use is through
debugfs and we don't protect concurrent access through it.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 0c819c9a
...@@ -1452,8 +1452,6 @@ struct engines_data { ...@@ -1452,8 +1452,6 @@ struct engines_data {
* @compute_reset_late_init: perform certain actions needed after a compute reset * @compute_reset_late_init: perform certain actions needed after a compute reset
* @hw_queues_lock: acquire H/W queues lock. * @hw_queues_lock: acquire H/W queues lock.
* @hw_queues_unlock: release H/W queues lock. * @hw_queues_unlock: release H/W queues lock.
* @kdma_lock: acquire H/W queues lock. Relevant from GRECO ASIC
* @kdma_unlock: release H/W queues lock. Relevant from GRECO ASIC
* @get_pci_id: retrieve PCI ID. * @get_pci_id: retrieve PCI ID.
* @get_eeprom_data: retrieve EEPROM data from F/W. * @get_eeprom_data: retrieve EEPROM data from F/W.
* @get_monitor_dump: retrieve monitor registers dump from F/W. * @get_monitor_dump: retrieve monitor registers dump from F/W.
...@@ -1590,8 +1588,6 @@ struct hl_asic_funcs { ...@@ -1590,8 +1588,6 @@ struct hl_asic_funcs {
int (*compute_reset_late_init)(struct hl_device *hdev); int (*compute_reset_late_init)(struct hl_device *hdev);
void (*hw_queues_lock)(struct hl_device *hdev); void (*hw_queues_lock)(struct hl_device *hdev);
void (*hw_queues_unlock)(struct hl_device *hdev); void (*hw_queues_unlock)(struct hl_device *hdev);
void (*kdma_lock)(struct hl_device *hdev, int dcore_id);
void (*kdma_unlock)(struct hl_device *hdev, int dcore_id);
u32 (*get_pci_id)(struct hl_device *hdev); u32 (*get_pci_id)(struct hl_device *hdev);
int (*get_eeprom_data)(struct hl_device *hdev, void *data, size_t max_size); int (*get_eeprom_data)(struct hl_device *hdev, void *data, size_t max_size);
int (*get_monitor_dump)(struct hl_device *hdev, void *data); int (*get_monitor_dump)(struct hl_device *hdev, void *data);
......
...@@ -9196,8 +9196,6 @@ static const struct hl_asic_funcs gaudi_funcs = { ...@@ -9196,8 +9196,6 @@ static const struct hl_asic_funcs gaudi_funcs = {
.compute_reset_late_init = gaudi_compute_reset_late_init, .compute_reset_late_init = gaudi_compute_reset_late_init,
.hw_queues_lock = gaudi_hw_queues_lock, .hw_queues_lock = gaudi_hw_queues_lock,
.hw_queues_unlock = gaudi_hw_queues_unlock, .hw_queues_unlock = gaudi_hw_queues_unlock,
.kdma_lock = NULL,
.kdma_unlock = NULL,
.get_pci_id = gaudi_get_pci_id, .get_pci_id = gaudi_get_pci_id,
.get_eeprom_data = gaudi_get_eeprom_data, .get_eeprom_data = gaudi_get_eeprom_data,
.get_monitor_dump = gaudi_get_monitor_dump, .get_monitor_dump = gaudi_get_monitor_dump,
......
...@@ -3010,7 +3010,6 @@ static int gaudi2_sw_init(struct hl_device *hdev) ...@@ -3010,7 +3010,6 @@ static int gaudi2_sw_init(struct hl_device *hdev)
} }
spin_lock_init(&gaudi2->hw_queues_lock); spin_lock_init(&gaudi2->hw_queues_lock);
spin_lock_init(&gaudi2->kdma_lock);
gaudi2->scratchpad_kernel_address = hl_asic_dma_alloc_coherent(hdev, PAGE_SIZE, gaudi2->scratchpad_kernel_address = hl_asic_dma_alloc_coherent(hdev, PAGE_SIZE,
&gaudi2->scratchpad_bus_address, &gaudi2->scratchpad_bus_address,
...@@ -6464,22 +6463,6 @@ static void gaudi2_hw_queues_unlock(struct hl_device *hdev) ...@@ -6464,22 +6463,6 @@ static void gaudi2_hw_queues_unlock(struct hl_device *hdev)
spin_unlock(&gaudi2->hw_queues_lock); spin_unlock(&gaudi2->hw_queues_lock);
} }
static void gaudi2_kdma_lock(struct hl_device *hdev, int dcore_id)
__acquires(&gaudi2->kdma_lock)
{
struct gaudi2_device *gaudi2 = hdev->asic_specific;
spin_lock(&gaudi2->kdma_lock);
}
static void gaudi2_kdma_unlock(struct hl_device *hdev, int dcore_id)
__releases(&gaudi2->kdma_lock)
{
struct gaudi2_device *gaudi2 = hdev->asic_specific;
spin_unlock(&gaudi2->kdma_lock);
}
static u32 gaudi2_get_pci_id(struct hl_device *hdev) static u32 gaudi2_get_pci_id(struct hl_device *hdev)
{ {
return hdev->pdev->device; return hdev->pdev->device;
...@@ -9122,8 +9105,6 @@ static int gaudi2_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size, v ...@@ -9122,8 +9105,6 @@ static int gaudi2_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size, v
goto unreserve_va; goto unreserve_va;
} }
hdev->asic_funcs->kdma_lock(hdev, 0);
/* Enable MMU on KDMA */ /* Enable MMU on KDMA */
gaudi2_kdma_set_mmbp_asid(hdev, false, ctx->asid); gaudi2_kdma_set_mmbp_asid(hdev, false, ctx->asid);
...@@ -9151,8 +9132,6 @@ static int gaudi2_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size, v ...@@ -9151,8 +9132,6 @@ static int gaudi2_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size, v
gaudi2_kdma_set_mmbp_asid(hdev, true, HL_KERNEL_ASID_ID); gaudi2_kdma_set_mmbp_asid(hdev, true, HL_KERNEL_ASID_ID);
hdev->asic_funcs->kdma_unlock(hdev, 0);
mutex_lock(&ctx->mmu_lock); mutex_lock(&ctx->mmu_lock);
hl_mmu_unmap_contiguous(ctx, reserved_va_base, SZ_2M); hl_mmu_unmap_contiguous(ctx, reserved_va_base, SZ_2M);
hl_mmu_invalidate_cache_range(hdev, false, MMU_OP_USERPTR, hl_mmu_invalidate_cache_range(hdev, false, MMU_OP_USERPTR,
...@@ -9951,8 +9930,6 @@ static const struct hl_asic_funcs gaudi2_funcs = { ...@@ -9951,8 +9930,6 @@ static const struct hl_asic_funcs gaudi2_funcs = {
.compute_reset_late_init = gaudi2_compute_reset_late_init, .compute_reset_late_init = gaudi2_compute_reset_late_init,
.hw_queues_lock = gaudi2_hw_queues_lock, .hw_queues_lock = gaudi2_hw_queues_lock,
.hw_queues_unlock = gaudi2_hw_queues_unlock, .hw_queues_unlock = gaudi2_hw_queues_unlock,
.kdma_lock = gaudi2_kdma_lock,
.kdma_unlock = gaudi2_kdma_unlock,
.get_pci_id = gaudi2_get_pci_id, .get_pci_id = gaudi2_get_pci_id,
.get_eeprom_data = gaudi2_get_eeprom_data, .get_eeprom_data = gaudi2_get_eeprom_data,
.get_monitor_dump = gaudi2_get_monitor_dump, .get_monitor_dump = gaudi2_get_monitor_dump,
......
...@@ -457,7 +457,6 @@ struct dup_block_ctx { ...@@ -457,7 +457,6 @@ struct dup_block_ctx {
* the user can map. * the user can map.
* @lfsr_rand_seeds: array of MME ACC random seeds to set. * @lfsr_rand_seeds: array of MME ACC random seeds to set.
* @hw_queues_lock: protects the H/W queues from concurrent access. * @hw_queues_lock: protects the H/W queues from concurrent access.
* @kdma_lock: protects the KDMA engine from concurrent access.
* @scratchpad_kernel_address: general purpose PAGE_SIZE contiguous memory, * @scratchpad_kernel_address: general purpose PAGE_SIZE contiguous memory,
* this memory region should be write-only. * this memory region should be write-only.
* currently used for HBW QMAN writes which is * currently used for HBW QMAN writes which is
...@@ -509,7 +508,6 @@ struct dup_block_ctx { ...@@ -509,7 +508,6 @@ struct dup_block_ctx {
* @flush_db_fifo: flag to force flush DB FIFO after a write. * @flush_db_fifo: flag to force flush DB FIFO after a write.
* @hbm_cfg: HBM subsystem settings * @hbm_cfg: HBM subsystem settings
* @hw_queues_lock_mutex: used by simulator instead of hw_queues_lock. * @hw_queues_lock_mutex: used by simulator instead of hw_queues_lock.
* @kdma_lock_mutex: used by simulator instead of kdma_lock.
*/ */
struct gaudi2_device { struct gaudi2_device {
int (*cpucp_info_get)(struct hl_device *hdev); int (*cpucp_info_get)(struct hl_device *hdev);
...@@ -518,7 +516,6 @@ struct gaudi2_device { ...@@ -518,7 +516,6 @@ struct gaudi2_device {
int lfsr_rand_seeds[MME_NUM_OF_LFSR_SEEDS]; int lfsr_rand_seeds[MME_NUM_OF_LFSR_SEEDS];
spinlock_t hw_queues_lock; spinlock_t hw_queues_lock;
spinlock_t kdma_lock;
void *scratchpad_kernel_address; void *scratchpad_kernel_address;
dma_addr_t scratchpad_bus_address; dma_addr_t scratchpad_bus_address;
......
...@@ -5481,8 +5481,6 @@ static const struct hl_asic_funcs goya_funcs = { ...@@ -5481,8 +5481,6 @@ static const struct hl_asic_funcs goya_funcs = {
.compute_reset_late_init = goya_compute_reset_late_init, .compute_reset_late_init = goya_compute_reset_late_init,
.hw_queues_lock = goya_hw_queues_lock, .hw_queues_lock = goya_hw_queues_lock,
.hw_queues_unlock = goya_hw_queues_unlock, .hw_queues_unlock = goya_hw_queues_unlock,
.kdma_lock = NULL,
.kdma_unlock = NULL,
.get_pci_id = goya_get_pci_id, .get_pci_id = goya_get_pci_id,
.get_eeprom_data = goya_get_eeprom_data, .get_eeprom_data = goya_get_eeprom_data,
.get_monitor_dump = goya_get_monitor_dump, .get_monitor_dump = goya_get_monitor_dump,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment