drm/radeon: add PRIME support (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 10 May 2012 22:33:13 +0000 (18:33 -0400)
committerDave Airlie <airlied@redhat.com>
Wed, 23 May 2012 09:47:11 +0000 (10:47 +0100)
This adds prime->fd and fd->prime support to radeon.
It passes the sg object to ttm and then populates
the gart entries using it.

Compile tested only.

v2: stub kmap + use new helpers + add reimporting

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
17 files changed:
drivers/gpu/drm/radeon/Makefile
drivers/gpu/drm/radeon/evergreen_blit_kms.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/r600_blit_kms.c
drivers/gpu/drm/radeon/radeon_benchmark.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/drm/radeon/radeon_drv.c
drivers/gpu/drm/radeon/radeon_gart.c
drivers/gpu/drm/radeon/radeon_gem.c
drivers/gpu/drm/radeon/radeon_object.c
drivers/gpu/drm/radeon/radeon_object.h
drivers/gpu/drm/radeon/radeon_prime.c [new file with mode: 0644]
drivers/gpu/drm/radeon/radeon_ring.c
drivers/gpu/drm/radeon/radeon_sa.c
drivers/gpu/drm/radeon/radeon_test.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/radeon/si.c

index 1efb6eba3c25c2719ae01277fc5c22a09d206ebd..a6598fd6642371b44ec2bf2f138077cb6f0c701d 100644 (file)
@@ -72,7 +72,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
        evergreen.o evergreen_cs.o evergreen_blit_shaders.o evergreen_blit_kms.o \
        evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \
        atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
-       si_blit_shaders.o
+       si_blit_shaders.o radeon_prime.o
 
 radeon-$(CONFIG_COMPAT) += radeon_ioc32.o
 radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o
index 30f04800b38ba06abfce0a33fa23b97eb85343a8..1e96bd458cfddbbdd0bad76824f0cecb6aa8fdfb 100644 (file)
@@ -668,7 +668,7 @@ int evergreen_blit_init(struct radeon_device *rdev)
        obj_size = ALIGN(obj_size, 256);
 
        r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
-                               &rdev->r600_blit.shader_obj);
+                            NULL, &rdev->r600_blit.shader_obj);
        if (r) {
                DRM_ERROR("evergreen failed to allocate shader\n");
                return r;
index ab5d6f2a06c207be993a17de3961d2338ab88850..f388a1d73b635f6e385e9defbc34d0b022538c4d 100644 (file)
@@ -1231,7 +1231,7 @@ int r600_vram_scratch_init(struct radeon_device *rdev)
        if (rdev->vram_scratch.robj == NULL) {
                r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE,
                                     PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
-                                    &rdev->vram_scratch.robj);
+                                    NULL, &rdev->vram_scratch.robj);
                if (r) {
                        return r;
                }
@@ -2769,7 +2769,7 @@ int r600_ih_ring_alloc(struct radeon_device *rdev)
                r = radeon_bo_create(rdev, rdev->ih.ring_size,
                                     PAGE_SIZE, true,
                                     RADEON_GEM_DOMAIN_GTT,
-                                    &rdev->ih.ring_obj);
+                                    NULL, &rdev->ih.ring_obj);
                if (r) {
                        DRM_ERROR("radeon: failed to create ih ring buffer (%d).\n", r);
                        return r;
index ef20822a1586a03d05f149098f172fedf55b7f4b..03b6e0d3d503e58bf3c49f87d004741552fd1df9 100644 (file)
@@ -552,7 +552,7 @@ int r600_blit_init(struct radeon_device *rdev)
        obj_size = ALIGN(obj_size, 256);
 
        r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
-                               &rdev->r600_blit.shader_obj);
+                            NULL, &rdev->r600_blit.shader_obj);
        if (r) {
                DRM_ERROR("r600 failed to allocate shader\n");
                return r;
index fef7b722b05dfda1b33bb624d6d4b79291793d5d..364f5b1a04b90ff933988303aa868c916eff306d 100644 (file)
@@ -103,7 +103,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
        int time;
 
        n = RADEON_BENCHMARK_ITERATIONS;
-       r = radeon_bo_create(rdev, size, PAGE_SIZE, true, sdomain, &sobj);
+       r = radeon_bo_create(rdev, size, PAGE_SIZE, true, sdomain, NULL, &sobj);
        if (r) {
                goto out_cleanup;
        }
@@ -115,7 +115,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
        if (r) {
                goto out_cleanup;
        }
-       r = radeon_bo_create(rdev, size, PAGE_SIZE, true, ddomain, &dobj);
+       r = radeon_bo_create(rdev, size, PAGE_SIZE, true, ddomain, NULL, &dobj);
        if (r) {
                goto out_cleanup;
        }
index 57637017eed628f7161e4d374f76fd236b42609d..066c98b888a51b4409323d5300863cf9b9fd7381 100644 (file)
@@ -193,7 +193,7 @@ int radeon_wb_init(struct radeon_device *rdev)
 
        if (rdev->wb.wb_obj == NULL) {
                r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true,
-                               RADEON_GEM_DOMAIN_GTT, &rdev->wb.wb_obj);
+                                    RADEON_GEM_DOMAIN_GTT, NULL, &rdev->wb.wb_obj);
                if (r) {
                        dev_warn(rdev->dev, "(%d) create WB bo failed\n", r);
                        return r;
index e62e56a57ee4429074b7b51fa1a73e342a06526e..f0bb2b543b13d2f5ab437c00efdc1a0ea52c663a 100644 (file)
@@ -105,6 +105,11 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
 int radeon_mode_dumb_destroy(struct drm_file *file_priv,
                             struct drm_device *dev,
                             uint32_t handle);
+struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
+                                       struct drm_gem_object *obj,
+                                       int flags);
+struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev,
+                                              struct dma_buf *dma_buf);
 
 #if defined(CONFIG_DEBUG_FS)
 int radeon_debugfs_init(struct drm_minor *minor);
@@ -333,7 +338,8 @@ static const struct file_operations radeon_driver_kms_fops = {
 static struct drm_driver kms_driver = {
        .driver_features =
            DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
-           DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM,
+           DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM |
+           DRIVER_PRIME,
        .dev_priv_size = 0,
        .load = radeon_driver_load_kms,
        .firstopen = radeon_driver_firstopen_kms,
@@ -368,6 +374,12 @@ static struct drm_driver kms_driver = {
        .dumb_map_offset = radeon_mode_dumb_mmap,
        .dumb_destroy = radeon_mode_dumb_destroy,
        .fops = &radeon_driver_kms_fops,
+
+       .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+       .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+       .gem_prime_export = radeon_gem_prime_export,
+       .gem_prime_import = radeon_gem_prime_import,
+
        .name = DRIVER_NAME,
        .desc = DRIVER_DESC,
        .date = DRIVER_DATE,
index 8e9ef3403acd91652163f0bf97c98d6568977092..4fa540273f15e35fac9117bce9591a7b35d28527 100644 (file)
@@ -80,7 +80,7 @@ int radeon_gart_table_vram_alloc(struct radeon_device *rdev)
        if (rdev->gart.robj == NULL) {
                r = radeon_bo_create(rdev, rdev->gart.table_size,
                                     PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
-                                    &rdev->gart.robj);
+                                    NULL, &rdev->gart.robj);
                if (r) {
                        return r;
                }
index e15cb1fe2c393bca0cba1d38d040300024aff9c5..c0130b052e3e96b91d5866a791b3c0f2b067d487 100644 (file)
@@ -42,6 +42,8 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
        struct radeon_bo *robj = gem_to_radeon_bo(gobj);
 
        if (robj) {
+               if (robj->gem_base.import_attach)
+                       drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
                radeon_bo_unref(&robj);
        }
 }
@@ -59,7 +61,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size,
        if (alignment < PAGE_SIZE) {
                alignment = PAGE_SIZE;
        }
-       r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, &robj);
+       r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, NULL, &robj);
        if (r) {
                if (r != -ERESTARTSYS)
                        DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n",
index 1affbc954c56c9b85363671332664216990ec059..830f1a7b486f2b3181968b76408b3f1175698639 100644 (file)
@@ -104,7 +104,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
 
 int radeon_bo_create(struct radeon_device *rdev,
                     unsigned long size, int byte_align, bool kernel, u32 domain,
-                    struct radeon_bo **bo_ptr)
+                    struct sg_table *sg, struct radeon_bo **bo_ptr)
 {
        struct radeon_bo *bo;
        enum ttm_bo_type type;
@@ -120,6 +120,8 @@ int radeon_bo_create(struct radeon_device *rdev,
        }
        if (kernel) {
                type = ttm_bo_type_kernel;
+       } else if (sg) {
+               type = ttm_bo_type_sg;
        } else {
                type = ttm_bo_type_device;
        }
@@ -155,7 +157,7 @@ retry:
        mutex_lock(&rdev->vram_mutex);
        r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,
                        &bo->placement, page_align, 0, !kernel, NULL,
-                       acc_size, NULL, &radeon_ttm_bo_destroy);
+                       acc_size, sg, &radeon_ttm_bo_destroy);
        mutex_unlock(&rdev->vram_mutex);
        if (unlikely(r != 0)) {
                if (r != -ERESTARTSYS) {
index befec7d12132a131e58bb54773f80914e9bca761..17fb99f177cf82f56cbb8d53fef0f5c642f930d7 100644 (file)
@@ -111,9 +111,10 @@ extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
                          bool no_wait);
 
 extern int radeon_bo_create(struct radeon_device *rdev,
-                               unsigned long size, int byte_align,
-                               bool kernel, u32 domain,
-                               struct radeon_bo **bo_ptr);
+                           unsigned long size, int byte_align,
+                           bool kernel, u32 domain,
+                           struct sg_table *sg,
+                           struct radeon_bo **bo_ptr);
 extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr);
 extern void radeon_bo_kunmap(struct radeon_bo *bo);
 extern void radeon_bo_unref(struct radeon_bo **bo);
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
new file mode 100644 (file)
index 0000000..24f5175
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2012 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * based on nouveau_prime.c
+ *
+ * Authors: Alex Deucher
+ */
+#include "drmP.h"
+#include "drm.h"
+
+#include "radeon.h"
+#include "radeon_drm.h"
+
+#include <linux/dma-buf.h>
+
+static struct sg_table *radeon_gem_map_dma_buf(struct dma_buf_attachment *attachment,
+                                              enum dma_data_direction dir)
+{
+       struct radeon_bo *bo = attachment->dmabuf->priv;
+       struct drm_device *dev = bo->rdev->ddev;
+       int npages = bo->tbo.num_pages;
+       struct sg_table *sg;
+       int nents;
+
+       mutex_lock(&dev->struct_mutex);
+       sg = drm_prime_pages_to_sg(bo->tbo.ttm->pages, npages);
+       nents = dma_map_sg(attachment->dev, sg->sgl, sg->nents, dir);
+       mutex_unlock(&dev->struct_mutex);
+       return sg;
+}
+
+static void radeon_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
+                                    struct sg_table *sg, enum dma_data_direction dir)
+{
+       dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
+       sg_free_table(sg);
+       kfree(sg);
+}
+
+static void radeon_gem_dmabuf_release(struct dma_buf *dma_buf)
+{
+       struct radeon_bo *bo = dma_buf->priv;
+
+       if (bo->gem_base.export_dma_buf == dma_buf) {
+               DRM_ERROR("unreference dmabuf %p\n", &bo->gem_base);
+               bo->gem_base.export_dma_buf = NULL;
+               drm_gem_object_unreference_unlocked(&bo->gem_base);
+       }
+}
+
+static void *radeon_gem_kmap_atomic(struct dma_buf *dma_buf, unsigned long page_num)
+{
+       return NULL;
+}
+
+static void radeon_gem_kunmap_atomic(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
+{
+
+}
+static void *radeon_gem_kmap(struct dma_buf *dma_buf, unsigned long page_num)
+{
+       return NULL;
+}
+
+static void radeon_gem_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
+{
+
+}
+
+struct dma_buf_ops radeon_dmabuf_ops =  {
+       .map_dma_buf = radeon_gem_map_dma_buf,
+       .unmap_dma_buf = radeon_gem_unmap_dma_buf,
+       .release = radeon_gem_dmabuf_release,
+       .kmap = radeon_gem_kmap,
+       .kmap_atomic = radeon_gem_kmap_atomic,
+       .kunmap = radeon_gem_kunmap,
+       .kunmap_atomic = radeon_gem_kunmap_atomic,
+};
+
+static int radeon_prime_create(struct drm_device *dev,
+                              size_t size,
+                              struct sg_table *sg,
+                              struct radeon_bo **pbo)
+{
+       struct radeon_device *rdev = dev->dev_private;
+       struct radeon_bo *bo;
+       int ret;
+
+       ret = radeon_bo_create(rdev, size, PAGE_SIZE, false,
+                              RADEON_GEM_DOMAIN_GTT, sg, pbo);
+       if (ret)
+               return ret;
+       bo = *pbo;
+       bo->gem_base.driver_private = bo;
+
+       mutex_lock(&rdev->gem.mutex);
+       list_add_tail(&bo->list, &rdev->gem.objects);
+       mutex_unlock(&rdev->gem.mutex);
+
+       return 0;
+}
+
+struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
+                                       struct drm_gem_object *obj,
+                                       int flags)
+{
+       struct radeon_bo *bo = gem_to_radeon_bo(obj);
+       int ret = 0;
+
+       /* pin buffer into GTT */
+       ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
+       if (ret)
+               return ERR_PTR(ret);
+
+       return dma_buf_export(bo, &radeon_dmabuf_ops, obj->size, flags);
+}
+
+struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev,
+                                              struct dma_buf *dma_buf)
+{
+       struct dma_buf_attachment *attach;
+       struct sg_table *sg;
+       struct radeon_bo *bo;
+       int ret;
+
+       if (dma_buf->ops == &radeon_dmabuf_ops) {
+               bo = dma_buf->priv;
+               if (bo->gem_base.dev == dev) {
+                       drm_gem_object_reference(&bo->gem_base);
+                       return &bo->gem_base;
+               }
+       }
+
+       /* need to attach */
+       attach = dma_buf_attach(dma_buf, dev->dev);
+       if (IS_ERR(attach))
+               return ERR_CAST(attach);
+
+       sg = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
+       if (IS_ERR(sg)) {
+               ret = PTR_ERR(sg);
+               goto fail_detach;
+       }
+
+       ret = radeon_prime_create(dev, dma_buf->size, sg, &bo);
+       if (ret)
+               goto fail_unmap;
+
+       bo->gem_base.import_attach = attach;
+
+       return &bo->gem_base;
+
+fail_unmap:
+       dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL);
+fail_detach:
+       dma_buf_detach(dma_buf, attach);
+       return ERR_PTR(ret);
+}
index a5dee76f4ebbc493b9e616b403871983d49f2ad7..493a7be753065afb8b2aba0d080efd75927c4569 100644 (file)
@@ -390,8 +390,8 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig
        /* Allocate ring buffer */
        if (ring->ring_obj == NULL) {
                r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true,
-                                       RADEON_GEM_DOMAIN_GTT,
-                                       &ring->ring_obj);
+                                    RADEON_GEM_DOMAIN_GTT,
+                                    NULL, &ring->ring_obj);
                if (r) {
                        dev_err(rdev->dev, "(%d) ring create failed\n", r);
                        return r;
index c3ac7f4c7b7035ccf6bfcf2ed9a0a74a446d15bd..32059b745728945dc931f94978cfc7992d2c30ad 100644 (file)
@@ -65,7 +65,7 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev,
        }
 
        r = radeon_bo_create(rdev, size, RADEON_GPU_PAGE_SIZE, true,
-                            RADEON_GEM_DOMAIN_CPU, &sa_manager->bo);
+                            RADEON_GEM_DOMAIN_CPU, NULL, &sa_manager->bo);
        if (r) {
                dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r);
                return r;
index b05738762790504c4495ce39ab664892a7e77498..efff929ea49dfb7f9eb29b5715e5c146b174c715 100644 (file)
@@ -59,7 +59,7 @@ void radeon_test_moves(struct radeon_device *rdev)
        }
 
        r = radeon_bo_create(rdev, size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
-                               &vram_obj);
+                            NULL, &vram_obj);
        if (r) {
                DRM_ERROR("Failed to create VRAM object\n");
                goto out_cleanup;
@@ -78,7 +78,7 @@ void radeon_test_moves(struct radeon_device *rdev)
                void **vram_start, **vram_end;
 
                r = radeon_bo_create(rdev, size, PAGE_SIZE, true,
-                                        RADEON_GEM_DOMAIN_GTT, gtt_obj + i);
+                                    RADEON_GEM_DOMAIN_GTT, NULL, gtt_obj + i);
                if (r) {
                        DRM_ERROR("Failed to create GTT object %d\n", i);
                        goto out_cleanup;
index 0f6aee8aa15289244b39fc9e3747a7bc2b1e11f9..c94a2257761f1cafc6cfeacbb2633aaa1c082a42 100644 (file)
@@ -611,10 +611,18 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm)
        struct radeon_ttm_tt *gtt = (void *)ttm;
        unsigned i;
        int r;
+       bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
 
        if (ttm->state != tt_unpopulated)
                return 0;
 
+       if (slave && ttm->sg) {
+               drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
+                                                gtt->ttm.dma_address, ttm->num_pages);
+               ttm->state = tt_unbound;
+               return 0;
+       }
+
        rdev = radeon_get_rdev(ttm->bdev);
 #if __OS_HAS_AGP
        if (rdev->flags & RADEON_IS_AGP) {
@@ -655,6 +663,10 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm)
        struct radeon_device *rdev;
        struct radeon_ttm_tt *gtt = (void *)ttm;
        unsigned i;
+       bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
+
+       if (slave)
+               return;
 
        rdev = radeon_get_rdev(ttm->bdev);
 #if __OS_HAS_AGP
@@ -726,8 +738,8 @@ int radeon_ttm_init(struct radeon_device *rdev)
                return r;
        }
        r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
-                               RADEON_GEM_DOMAIN_VRAM,
-                               &rdev->stollen_vga_memory);
+                            RADEON_GEM_DOMAIN_VRAM,
+                            NULL, &rdev->stollen_vga_memory);
        if (r) {
                return r;
        }
index 63ae41dac5ca5907439d11e1c59d350d7d8b9e30..549732e56ca959b0f07d4ce32f0ff0af0e480ab1 100644 (file)
@@ -2976,7 +2976,8 @@ int si_rlc_init(struct radeon_device *rdev)
        /* save restore block */
        if (rdev->rlc.save_restore_obj == NULL) {
                r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true,
-                               RADEON_GEM_DOMAIN_VRAM, &rdev->rlc.save_restore_obj);
+                                    RADEON_GEM_DOMAIN_VRAM, NULL,
+                                    &rdev->rlc.save_restore_obj);
                if (r) {
                        dev_warn(rdev->dev, "(%d) create RLC sr bo failed\n", r);
                        return r;
@@ -3000,7 +3001,8 @@ int si_rlc_init(struct radeon_device *rdev)
        /* clear state block */
        if (rdev->rlc.clear_state_obj == NULL) {
                r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true,
-                               RADEON_GEM_DOMAIN_VRAM, &rdev->rlc.clear_state_obj);
+                                    RADEON_GEM_DOMAIN_VRAM, NULL,
+                                    &rdev->rlc.clear_state_obj);
                if (r) {
                        dev_warn(rdev->dev, "(%d) create RLC c bo failed\n", r);
                        si_rlc_fini(rdev);