Commit 2a51558c authored by Oded Gabbay's avatar Oded Gabbay

habanalabs: remove DMA mask hack for Goya

This patch removes the non-standard DMA mask setting for Goya. Now that
the device CPU goes through the MMU, we are not limited to allocating the
CPU accessible memory area in the address space of under 39 bits.
Therefore, we don't need to set the DMA masking twice during
initialization, a practice that is not working on POWER architecture.

The patch sets the DMA mask to 48 bits once during the initialization. The
address of the CPU accessible memory area is configured to the MMU and the
matching VA is given to the device CPU.
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent f09415f5
...@@ -472,7 +472,7 @@ static int goya_early_init(struct hl_device *hdev) ...@@ -472,7 +472,7 @@ static int goya_early_init(struct hl_device *hdev)
prop->dram_pci_bar_size = pci_resource_len(pdev, DDR_BAR_ID); prop->dram_pci_bar_size = pci_resource_len(pdev, DDR_BAR_ID);
rc = hl_pci_init(hdev, 39); rc = hl_pci_init(hdev, 48);
if (rc) if (rc)
return rc; return rc;
...@@ -669,6 +669,9 @@ static int goya_sw_init(struct hl_device *hdev) ...@@ -669,6 +669,9 @@ static int goya_sw_init(struct hl_device *hdev)
goto free_dma_pool; goto free_dma_pool;
} }
dev_dbg(hdev->dev, "cpu accessible memory at bus address 0x%llx\n",
hdev->cpu_accessible_dma_address);
hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1); hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1);
if (!hdev->cpu_accessible_dma_pool) { if (!hdev->cpu_accessible_dma_pool) {
dev_err(hdev->dev, dev_err(hdev->dev,
...@@ -2481,25 +2484,11 @@ static int goya_hw_init(struct hl_device *hdev) ...@@ -2481,25 +2484,11 @@ static int goya_hw_init(struct hl_device *hdev)
if (rc) if (rc)
goto disable_queues; goto disable_queues;
/*
* Check if we managed to set the DMA mask to more then 32 bits. If so,
* let's try to increase it again because in Goya we set the initial
* dma mask to less then 39 bits so that the allocation of the memory
* area for the device's cpu will be under 39 bits
*/
if (hdev->dma_mask > 32) {
rc = hl_pci_set_dma_mask(hdev, 48);
if (rc)
goto disable_msix;
}
/* Perform read from the device to flush all MSI-X configuration */ /* Perform read from the device to flush all MSI-X configuration */
val = RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG); val = RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG);
return 0; return 0;
disable_msix:
goya_disable_msix(hdev);
disable_queues: disable_queues:
goya_disable_internal_queues(hdev); goya_disable_internal_queues(hdev);
goya_disable_external_queues(hdev); goya_disable_external_queues(hdev);
......
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