mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
accel/habanalabs: use parent device for trace events
Trace events might still be recorded after the accel device is released, while the device name is no longer available. Modify the trace functions to use the parent device instead, which is available at that point and still informative as the device name. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Ofir Bitton <obitton@habana.ai> Signed-off-by: Ofir Bitton <obitton@habana.ai>
This commit is contained in:
parent
ecda35d461
commit
3d4bd5e292
|
|
@ -130,8 +130,8 @@ static void *hl_dma_alloc_common(struct hl_device *hdev, size_t size, dma_addr_t
|
|||
}
|
||||
|
||||
if (trace_habanalabs_dma_alloc_enabled() && !ZERO_OR_NULL_PTR(ptr))
|
||||
trace_habanalabs_dma_alloc(hdev->dev, (u64) (uintptr_t) ptr, *dma_handle, size,
|
||||
caller);
|
||||
trace_habanalabs_dma_alloc(&(hdev)->pdev->dev, (u64) (uintptr_t) ptr, *dma_handle,
|
||||
size, caller);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ static void hl_asic_dma_free_common(struct hl_device *hdev, size_t size, void *c
|
|||
break;
|
||||
}
|
||||
|
||||
trace_habanalabs_dma_free(hdev->dev, store_cpu_addr, dma_handle, size, caller);
|
||||
trace_habanalabs_dma_free(&(hdev)->pdev->dev, store_cpu_addr, dma_handle, size, caller);
|
||||
}
|
||||
|
||||
void *hl_asic_dma_alloc_coherent_caller(struct hl_device *hdev, size_t size, dma_addr_t *dma_handle,
|
||||
|
|
@ -204,15 +204,15 @@ int hl_dma_map_sgtable_caller(struct hl_device *hdev, struct sg_table *sgt,
|
|||
return 0;
|
||||
|
||||
for_each_sgtable_dma_sg(sgt, sg, i)
|
||||
trace_habanalabs_dma_map_page(hdev->dev,
|
||||
page_to_phys(sg_page(sg)),
|
||||
sg->dma_address - prop->device_dma_offset_for_host_access,
|
||||
trace_habanalabs_dma_map_page(&(hdev)->pdev->dev,
|
||||
page_to_phys(sg_page(sg)),
|
||||
sg->dma_address - prop->device_dma_offset_for_host_access,
|
||||
#ifdef CONFIG_NEED_SG_DMA_LENGTH
|
||||
sg->dma_length,
|
||||
sg->dma_length,
|
||||
#else
|
||||
sg->length,
|
||||
sg->length,
|
||||
#endif
|
||||
dir, caller);
|
||||
dir, caller);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -247,7 +247,8 @@ void hl_dma_unmap_sgtable_caller(struct hl_device *hdev, struct sg_table *sgt,
|
|||
|
||||
if (trace_habanalabs_dma_unmap_page_enabled()) {
|
||||
for_each_sgtable_dma_sg(sgt, sg, i)
|
||||
trace_habanalabs_dma_unmap_page(hdev->dev, page_to_phys(sg_page(sg)),
|
||||
trace_habanalabs_dma_unmap_page(&(hdev)->pdev->dev,
|
||||
page_to_phys(sg_page(sg)),
|
||||
sg->dma_address - prop->device_dma_offset_for_host_access,
|
||||
#ifdef CONFIG_NEED_SG_DMA_LENGTH
|
||||
sg->dma_length,
|
||||
|
|
@ -2593,7 +2594,7 @@ inline u32 hl_rreg(struct hl_device *hdev, u32 reg)
|
|||
u32 val = readl(hdev->rmmio + reg);
|
||||
|
||||
if (unlikely(trace_habanalabs_rreg32_enabled()))
|
||||
trace_habanalabs_rreg32(hdev->dev, reg, val);
|
||||
trace_habanalabs_rreg32(&(hdev)->pdev->dev, reg, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
|
@ -2611,7 +2612,7 @@ inline u32 hl_rreg(struct hl_device *hdev, u32 reg)
|
|||
inline void hl_wreg(struct hl_device *hdev, u32 reg, u32 val)
|
||||
{
|
||||
if (unlikely(trace_habanalabs_wreg32_enabled()))
|
||||
trace_habanalabs_wreg32(hdev->dev, reg, val);
|
||||
trace_habanalabs_wreg32(&(hdev)->pdev->dev, reg, val);
|
||||
|
||||
writel(val, hdev->rmmio + reg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "habanalabs.h"
|
||||
#include <linux/habanalabs/hl_boot_if.h>
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -1803,7 +1804,7 @@ static void hl_fw_dynamic_send_cmd(struct hl_device *hdev,
|
|||
val = FIELD_PREP(COMMS_COMMAND_CMD_MASK, cmd);
|
||||
val |= FIELD_PREP(COMMS_COMMAND_SIZE_MASK, size);
|
||||
|
||||
trace_habanalabs_comms_send_cmd(hdev->dev, comms_cmd_str_arr[cmd]);
|
||||
trace_habanalabs_comms_send_cmd(&hdev->pdev->dev, comms_cmd_str_arr[cmd]);
|
||||
WREG32(le32_to_cpu(dyn_regs->kmd_msg_to_cpu), val);
|
||||
}
|
||||
|
||||
|
|
@ -1861,7 +1862,7 @@ static int hl_fw_dynamic_wait_for_status(struct hl_device *hdev,
|
|||
|
||||
dyn_regs = &fw_loader->dynamic_loader.comm_desc.cpu_dyn_regs;
|
||||
|
||||
trace_habanalabs_comms_wait_status(hdev->dev, comms_sts_str_arr[expected_status]);
|
||||
trace_habanalabs_comms_wait_status(&hdev->pdev->dev, comms_sts_str_arr[expected_status]);
|
||||
|
||||
/* Wait for expected status */
|
||||
rc = hl_poll_timeout(
|
||||
|
|
@ -1878,7 +1879,8 @@ static int hl_fw_dynamic_wait_for_status(struct hl_device *hdev,
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
trace_habanalabs_comms_wait_status_done(hdev->dev, comms_sts_str_arr[expected_status]);
|
||||
trace_habanalabs_comms_wait_status_done(&hdev->pdev->dev,
|
||||
comms_sts_str_arr[expected_status]);
|
||||
|
||||
/*
|
||||
* skip storing FW response for NOOP to preserve the actual desired
|
||||
|
|
@ -1952,7 +1954,7 @@ int hl_fw_dynamic_send_protocol_cmd(struct hl_device *hdev,
|
|||
{
|
||||
int rc;
|
||||
|
||||
trace_habanalabs_comms_protocol_cmd(hdev->dev, comms_cmd_str_arr[cmd]);
|
||||
trace_habanalabs_comms_protocol_cmd(&hdev->pdev->dev, comms_cmd_str_arr[cmd]);
|
||||
|
||||
/* first send clear command to clean former commands */
|
||||
rc = hl_fw_dynamic_send_clear_cmd(hdev, fw_loader);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include "../habanalabs.h"
|
||||
|
||||
|
|
@ -262,7 +263,7 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size, bool flu
|
|||
mmu_funcs->flush(ctx);
|
||||
|
||||
if (trace_habanalabs_mmu_unmap_enabled() && !rc)
|
||||
trace_habanalabs_mmu_unmap(hdev->dev, virt_addr, 0, page_size, flush_pte);
|
||||
trace_habanalabs_mmu_unmap(&hdev->pdev->dev, virt_addr, 0, page_size, flush_pte);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -349,7 +350,7 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr, u32 page_s
|
|||
if (flush_pte)
|
||||
mmu_funcs->flush(ctx);
|
||||
|
||||
trace_habanalabs_mmu_map(hdev->dev, virt_addr, phys_addr, page_size, flush_pte);
|
||||
trace_habanalabs_mmu_map(&hdev->pdev->dev, virt_addr, phys_addr, page_size, flush_pte);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ int hl_pci_elbi_read(struct hl_device *hdev, u64 addr, u32 *data)
|
|||
pci_read_config_dword(pdev, mmPCI_CONFIG_ELBI_DATA, data);
|
||||
|
||||
if (unlikely(trace_habanalabs_elbi_read_enabled()))
|
||||
trace_habanalabs_elbi_read(hdev->dev, (u32) addr, val);
|
||||
trace_habanalabs_elbi_read(&hdev->pdev->dev, (u32) addr, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ static int hl_pci_elbi_write(struct hl_device *hdev, u64 addr, u32 data)
|
|||
|
||||
if ((val & PCI_CONFIG_ELBI_STS_MASK) == PCI_CONFIG_ELBI_STS_DONE) {
|
||||
if (unlikely(trace_habanalabs_elbi_write_enabled()))
|
||||
trace_habanalabs_elbi_write(hdev->dev, (u32) addr, val);
|
||||
trace_habanalabs_elbi_write(&hdev->pdev->dev, (u32) addr, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user