summaryrefslogtreecommitdiffstats
path: root/drivers/misc/habanalabs/irq.c
diff options
context:
space:
mode:
authorTomer Tayar2019-04-28 18:17:38 +0200
committerOded Gabbay2019-04-28 18:17:38 +0200
commit03d5f641dc711eb93145ded91ed68b4be729be4d (patch)
tree11a2007fa857787211c44097645c697167730750 /drivers/misc/habanalabs/irq.c
parenthabanalabs: return old dram bar address upon change (diff)
downloadkernel-qcow2-linux-03d5f641dc711eb93145ded91ed68b4be729be4d.tar.gz
kernel-qcow2-linux-03d5f641dc711eb93145ded91ed68b4be729be4d.tar.xz
kernel-qcow2-linux-03d5f641dc711eb93145ded91ed68b4be729be4d.zip
habanalabs: Use single pool for CPU accessible host memory
The device's CPU accessible memory on host is managed in a dedicated pool, except for 2 regions - Primary Queue (PQ) and Event Queue (EQ) - which are allocated from generic DMA pools. Due to address length limitations of the CPU, the addresses of all these memory regions must have the same MSBs starting at bit 40. This patch modifies the allocation of the PQ and EQ to be also from the dedicated pool, to ensure compliance with the limitation. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs/irq.c')
-rw-r--r--drivers/misc/habanalabs/irq.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/habanalabs/irq.c b/drivers/misc/habanalabs/irq.c
index e69a09c10e3f..86a8ad57f1ca 100644
--- a/drivers/misc/habanalabs/irq.c
+++ b/drivers/misc/habanalabs/irq.c
@@ -284,8 +284,9 @@ int hl_eq_init(struct hl_device *hdev, struct hl_eq *q)
BUILD_BUG_ON(HL_EQ_SIZE_IN_BYTES > HL_PAGE_SIZE);
- p = hdev->asic_funcs->dma_alloc_coherent(hdev, HL_EQ_SIZE_IN_BYTES,
- &q->bus_address, GFP_KERNEL | __GFP_ZERO);
+ p = hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev,
+ HL_EQ_SIZE_IN_BYTES,
+ &q->bus_address);
if (!p)
return -ENOMEM;
@@ -308,8 +309,9 @@ void hl_eq_fini(struct hl_device *hdev, struct hl_eq *q)
{
flush_workqueue(hdev->eq_wq);
- hdev->asic_funcs->dma_free_coherent(hdev, HL_EQ_SIZE_IN_BYTES,
- (void *) (uintptr_t) q->kernel_address, q->bus_address);
+ hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev,
+ HL_EQ_SIZE_IN_BYTES,
+ (void *) (uintptr_t) q->kernel_address);
}
void hl_eq_reset(struct hl_device *hdev, struct hl_eq *q)