Skip to content

Commit 5d658d0

Browse files
dlibemanogabbay
authored andcommitted
accel/habanalabs: mask part of hmmu page fault captured address
When receiving page fault from hmmu, the captured address is scrambled both by HW and by driver. The driver part is unscrambled but the HW part isn't getting unscrambled. To avoid declaring wrong address, the HW scrambled part will be masked. Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 7e63f31 commit 5d658d0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/accel/habanalabs/gaudi2/gaudi2.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@
162162
#define PSOC_RAZWI_ENG_STR_SIZE 128
163163
#define PSOC_RAZWI_MAX_ENG_PER_RTR 5
164164

165+
/* HW scrambles only bits 0-25 */
166+
#define HW_UNSCRAMBLED_BITS_MASK GENMASK_ULL(63, 26)
167+
165168
struct gaudi2_razwi_info {
166169
u32 axuser_xy;
167170
u32 rtr_ctrl;
@@ -8835,11 +8838,16 @@ static void gaudi2_handle_page_error(struct hl_device *hdev, u64 mmu_base, bool
88358838
addr <<= 32;
88368839
addr |= RREG32(mmu_base + MMU_OFFSET(mmDCORE0_HMMU0_MMU_PAGE_ERROR_CAPTURE_VA));
88378840

8838-
if (!is_pmmu)
8841+
if (is_pmmu) {
8842+
dev_err_ratelimited(hdev->dev, "PMMU page fault on va 0x%llx\n", addr);
8843+
} else {
8844+
88398845
addr = gaudi2_mmu_descramble_addr(hdev, addr);
8846+
addr &= HW_UNSCRAMBLED_BITS_MASK;
8847+
dev_err_ratelimited(hdev->dev, "HMMU page fault on va range 0x%llx - 0x%llx\n",
8848+
addr, addr + ~HW_UNSCRAMBLED_BITS_MASK);
8849+
}
88408850

8841-
dev_err_ratelimited(hdev->dev, "%s page fault on va 0x%llx\n",
8842-
is_pmmu ? "PMMU" : "HMMU", addr);
88438851
hl_handle_page_fault(hdev, addr, 0, is_pmmu, event_mask);
88448852

88458853
WREG32(mmu_base + MMU_OFFSET(mmDCORE0_HMMU0_MMU_ACCESS_PAGE_ERROR_VALID), 0);

0 commit comments

Comments
 (0)