summaryrefslogtreecommitdiffstats
path: root/drivers/accel/habanalabs/common/pci/pci.c
diff options
context:
space:
mode:
authorOhad Sharabi <osharabi@habana.ai>2022-11-30 13:41:49 +0100
committerOded Gabbay <ogabbay@kernel.org>2023-01-26 10:52:11 +0100
commit54fcb384be6044ef17ec95a0aec0f86ad114b8d6 (patch)
treef9d4fb5e24627b57cea1231d5b6d08014a1216ef /drivers/accel/habanalabs/common/pci/pci.c
parenthabanalabs: define events to trace PCI LBW access (diff)
downloadlinux-54fcb384be6044ef17ec95a0aec0f86ad114b8d6.tar.xz
linux-54fcb384be6044ef17ec95a0aec0f86ad114b8d6.zip
habanalabs: trace LBW reads/writes
Add traces to LBW reads/writes. This may be handy when debugging configuration failure or events when tracking configuration flow. Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/accel/habanalabs/common/pci/pci.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/accel/habanalabs/common/pci/pci.c b/drivers/accel/habanalabs/common/pci/pci.c
index 5fe3da5fba30..d1f4c695baf2 100644
--- a/drivers/accel/habanalabs/common/pci/pci.c
+++ b/drivers/accel/habanalabs/common/pci/pci.c
@@ -10,6 +10,8 @@
#include <linux/pci.h>
+#include <trace/events/habanalabs.h>
+
#define HL_PLDM_PCI_ELBI_TIMEOUT_MSEC (HL_PCI_ELBI_TIMEOUT_MSEC * 100)
#define IATU_REGION_CTRL_REGION_EN_MASK BIT(31)
@@ -120,6 +122,9 @@ int hl_pci_elbi_read(struct hl_device *hdev, u64 addr, u32 *data)
if ((val & PCI_CONFIG_ELBI_STS_MASK) == PCI_CONFIG_ELBI_STS_DONE) {
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);
+
return 0;
}
@@ -179,8 +184,11 @@ static int hl_pci_elbi_write(struct hl_device *hdev, u64 addr, u32 data)
usleep_range(300, 500);
}
- if ((val & PCI_CONFIG_ELBI_STS_MASK) == PCI_CONFIG_ELBI_STS_DONE)
+ 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);
return 0;
+ }
if (val & PCI_CONFIG_ELBI_STS_ERR)
return -EIO;