Skip to content

Commit

Permalink
habanalabs: Read upper bits of trace buffer from RWPHI
Browse files Browse the repository at this point in the history
The trace buffer address is 40 bits wide.
The end of the buffer is set in the RWP register (lower 32 bits), and in
the RWPHI register (upper 8 bits).
Currently only the lower 32 bits are read, and this patch fixes it and
concatenates the upper 8 bits to the output address.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
  • Loading branch information
Tomer Tayar authored and Oded Gabbay committed Jun 4, 2019
1 parent e4c814a commit 1f65105
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/misc/habanalabs/goya/goya_coresight.c
Original file line number Diff line number Diff line change
@@ -425,8 +425,18 @@ static int goya_config_etr(struct hl_device *hdev,
WREG32(base_reg + 0x28, 0);
WREG32(base_reg + 0x304, 0);

if (params->output_size >= sizeof(u32))
*(u32 *) params->output = RREG32(base_reg + 0x18);
if (params->output_size >= sizeof(u64)) {
u32 rwp, rwphi;

/*
* The trace buffer address is 40 bits wide. The end of
* the buffer is set in the RWP register (lower 32
* bits), and in the RWPHI register (upper 8 bits).
*/
rwp = RREG32(base_reg + 0x18);
rwphi = RREG32(base_reg + 0x3c) & 0xff;
*(u64 *) params->output = ((u64) rwphi << 32) | rwp;
}
}

return 0;

0 comments on commit 1f65105

Please sign in to comment.