struct amdgpu_bo_param bp;
        dma_addr_t dma_addr;
        struct page *p;
+       unsigned long x;
        int ret;
 
        if (adev->gart.bo != NULL)
        if (!p)
                return -ENOMEM;
 
+       /* assign pages to this device */
+       for (x = 0; x < (1UL << order); x++)
+               p[x].mapping = adev->mman.bdev.dev_mapping;
+
        /* If the hardware does not support UTCL2 snooping of the CPU caches
         * then set_memory_wc() could be used as a workaround to mark the pages
         * as write combine memory.
        unsigned int order = get_order(adev->gart.table_size);
        struct sg_table *sg = adev->gart.bo->tbo.sg;
        struct page *p;
+       unsigned long x;
        int ret;
 
        ret = amdgpu_bo_reserve(adev->gart.bo, false);
        sg_free_table(sg);
        kfree(sg);
        p = virt_to_page(adev->gart.ptr);
+       for (x = 0; x < (1UL << order); x++)
+               p[x].mapping = NULL;
        __free_pages(p, order);
 
        adev->gart.ptr = NULL;