]> Git Repo - J-linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
Merge tag 'x86-asm-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
[J-linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_object.c
index f7905bce0de15e49202dc23d022b9e68167bdcc8..ace837cfa0a6bc850c0c706376194eb2d324d5ad 100644 (file)
@@ -158,6 +158,14 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
                c++;
        }
 
+       if (domain & AMDGPU_GEM_DOMAIN_DOORBELL) {
+               places[c].fpfn = 0;
+               places[c].lpfn = 0;
+               places[c].mem_type = AMDGPU_PL_DOORBELL;
+               places[c].flags = 0;
+               c++;
+       }
+
        if (domain & AMDGPU_GEM_DOMAIN_GTT) {
                places[c].fpfn = 0;
                places[c].lpfn = 0;
@@ -477,7 +485,7 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
                goto fail;
        }
 
-       /* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU */
+       /* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU, _DOMAIN_DOORBELL */
        return true;
 
 fail:
@@ -1029,6 +1037,7 @@ void amdgpu_bo_unpin(struct amdgpu_bo *bo)
        } else if (bo->tbo.resource->mem_type == TTM_PL_TT) {
                atomic64_sub(amdgpu_bo_size(bo), &adev->gart_pin_size);
        }
+
 }
 
 static const char * const amdgpu_vram_names[] = {
@@ -1575,23 +1584,31 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
 {
        struct dma_buf_attachment *attachment;
        struct dma_buf *dma_buf;
-       unsigned int domain;
        const char *placement;
        unsigned int pin_count;
        u64 size;
 
-       domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
-       switch (domain) {
-       case AMDGPU_GEM_DOMAIN_VRAM:
-               placement = "VRAM";
-               break;
-       case AMDGPU_GEM_DOMAIN_GTT:
-               placement = " GTT";
-               break;
-       case AMDGPU_GEM_DOMAIN_CPU:
-       default:
-               placement = " CPU";
-               break;
+       if (dma_resv_trylock(bo->tbo.base.resv)) {
+               unsigned int domain;
+               domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
+               switch (domain) {
+               case AMDGPU_GEM_DOMAIN_VRAM:
+                       if (amdgpu_bo_in_cpu_visible_vram(bo))
+                               placement = "VRAM VISIBLE";
+                       else
+                               placement = "VRAM";
+                       break;
+               case AMDGPU_GEM_DOMAIN_GTT:
+                       placement = "GTT";
+                       break;
+               case AMDGPU_GEM_DOMAIN_CPU:
+               default:
+                       placement = "CPU";
+                       break;
+               }
+               dma_resv_unlock(bo->tbo.base.resv);
+       } else {
+               placement = "UNKNOWN";
        }
 
        size = amdgpu_bo_size(bo);
This page took 0.029783 seconds and 4 git commands to generate.