static int gaudi2_late_init(struct hl_device *hdev)
{
+ struct gaudi2_device *gaudi2 = hdev->asic_specific;
int rc;
- rc = hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_ENABLE_PCI_ACCESS, 0x0);
+ rc = hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_ENABLE_PCI_ACCESS,
+ gaudi2->virt_msix_db_dma_addr);
if (rc) {
dev_err(hdev->dev, "Failed to enable PCI access from CPU\n");
return rc;
static int gaudi2_sw_init(struct hl_device *hdev)
{
+ struct asic_fixed_properties *prop = &hdev->asic_prop;
struct gaudi2_device *gaudi2;
int i, rc;
goto free_cpu_accessible_dma_pool;
}
+ gaudi2->virt_msix_db_cpu_addr = hl_cpu_accessible_dma_pool_alloc(hdev, prop->pmmu.page_size,
+ &gaudi2->virt_msix_db_dma_addr);
+ if (!gaudi2->virt_msix_db_cpu_addr) {
+ dev_err(hdev->dev, "Failed to allocate DMA memory for virtual MSI-X doorbell\n");
+ rc = -ENOMEM;
+ goto free_cpu_accessible_dma_pool;
+ }
+
spin_lock_init(&gaudi2->hw_queues_lock);
spin_lock_init(&gaudi2->kdma_lock);
GFP_KERNEL | __GFP_ZERO);
if (!gaudi2->scratchpad_kernel_address) {
rc = -ENOMEM;
- goto free_cpu_accessible_dma_pool;
+ goto free_virt_msix_db_mem;
}
gaudi2_user_mapped_blocks_init(hdev);
gaudi2_user_interrupt_setup(hdev);
hdev->supports_coresight = true;
- hdev->asic_prop.supports_soft_reset = true;
hdev->supports_sync_stream = true;
hdev->supports_cb_mapping = true;
hdev->supports_wait_for_multi_cs = false;
+ prop->supports_soft_reset = true;
+
hdev->asic_funcs->set_pci_memory_regions(hdev);
return 0;
+free_virt_msix_db_mem:
+ hl_cpu_accessible_dma_pool_free(hdev, prop->pmmu.page_size, gaudi2->virt_msix_db_cpu_addr);
free_cpu_accessible_dma_pool:
gen_pool_destroy(hdev->cpu_accessible_dma_pool);
free_cpu_dma_mem:
static int gaudi2_sw_fini(struct hl_device *hdev)
{
+ struct asic_fixed_properties *prop = &hdev->asic_prop;
struct gaudi2_device *gaudi2 = hdev->asic_specific;
+ hl_cpu_accessible_dma_pool_free(hdev, prop->pmmu.page_size, gaudi2->virt_msix_db_cpu_addr);
+
gen_pool_destroy(hdev->cpu_accessible_dma_pool);
hl_asic_dma_free_coherent(hdev, HL_CPU_ACCESSIBLE_MEM_SIZE, hdev->cpu_accessible_dma_mem,
* currently used for HBW QMAN writes which is
* redundant.
* @scratchpad_bus_address: scratchpad bus address
+ * @virt_msix_db_cpu_addr: host memory page for the virtual MSI-X doorbell.
+ * @virt_msix_db_dma_addr: bus address of the page for the virtual MSI-X doorbell.
* @dram_bar_cur_addr: current address of DRAM PCI bar.
* @hw_cap_initialized: This field contains a bit per H/W engine. When that
* engine is initialized, that bit is set by the driver to
void *scratchpad_kernel_address;
dma_addr_t scratchpad_bus_address;
+ void *virt_msix_db_cpu_addr;
+ dma_addr_t virt_msix_db_dma_addr;
+
u64 dram_bar_cur_addr;
u64 hw_cap_initialized;
u64 active_hw_arc;