habanalabs: make last_mask an MMU property
[linux-2.6-microblaze.git] / drivers / misc / habanalabs / common / mmu / mmu_v1.c
index 0f536f7..159da2f 100644 (file)
@@ -573,7 +573,7 @@ static int _hl_mmu_v1_unmap(struct hl_ctx *ctx,
 
        curr_pte = *(u64 *) (uintptr_t) hop3_pte_addr;
 
-       is_huge = curr_pte & LAST_MASK;
+       is_huge = curr_pte & mmu_prop->last_mask;
 
        if (is_dram_addr && !is_huge) {
                dev_err(hdev->dev,
@@ -597,7 +597,7 @@ static int _hl_mmu_v1_unmap(struct hl_ctx *ctx,
 
        if (hdev->dram_default_page_mapping && is_dram_addr) {
                u64 default_pte = (prop->mmu_dram_default_page_addr &
-                               HOP_PHYS_ADDR_MASK) | LAST_MASK |
+                               HOP_PHYS_ADDR_MASK) | mmu_prop->last_mask |
                                        PAGE_PRESENT_MASK;
                if (curr_pte == default_pte) {
                        dev_err(hdev->dev,
@@ -729,7 +729,7 @@ static int _hl_mmu_v1_map(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr,
 
        if (hdev->dram_default_page_mapping && is_dram_addr) {
                u64 default_pte = (prop->mmu_dram_default_page_addr &
-                                       HOP_PHYS_ADDR_MASK) | LAST_MASK |
+                                       HOP_PHYS_ADDR_MASK) | mmu_prop->last_mask |
                                                PAGE_PRESENT_MASK;
 
                if (curr_pte != default_pte) {
@@ -769,7 +769,7 @@ static int _hl_mmu_v1_map(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr,
                goto err;
        }
 
-       curr_pte = (phys_addr & HOP_PHYS_ADDR_MASK) | LAST_MASK
+       curr_pte = (phys_addr & HOP_PHYS_ADDR_MASK) | mmu_prop->last_mask
                        | PAGE_PRESENT_MASK;
 
        if (is_huge)
@@ -930,7 +930,7 @@ static int hl_mmu_v1_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr,
                if (!(hops->hop_info[i].hop_pte_val & PAGE_PRESENT_MASK))
                        return -EFAULT;
 
-               if (hops->hop_info[i].hop_pte_val & LAST_MASK)
+               if (hops->hop_info[i].hop_pte_val & mmu_prop->last_mask)
                        break;
        }