Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/core/memory: distinguish between coherent/non-coherent targets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+27 -13
+4 -3
drivers/gpu/drm/nouveau/include/nvkm/core/memory.h
··· 6 6 struct nvkm_vm; 7 7 8 8 enum nvkm_memory_target { 9 - NVKM_MEM_TARGET_INST, 10 - NVKM_MEM_TARGET_VRAM, 11 - NVKM_MEM_TARGET_HOST, 9 + NVKM_MEM_TARGET_INST, /* instance memory */ 10 + NVKM_MEM_TARGET_VRAM, /* video memory */ 11 + NVKM_MEM_TARGET_HOST, /* coherent system memory */ 12 + NVKM_MEM_TARGET_NCOH, /* non-coherent system memory */ 12 13 }; 13 14 14 15 struct nvkm_memory {
+8 -1
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
··· 68 68 } 69 69 nvkm_done(cur); 70 70 71 - target = (nvkm_memory_target(cur) == NVKM_MEM_TARGET_HOST) ? 0x3 : 0x0; 71 + switch (nvkm_memory_target(cur)) { 72 + case NVKM_MEM_TARGET_VRAM: target = 0; break; 73 + case NVKM_MEM_TARGET_NCOH: target = 3; break; 74 + default: 75 + mutex_unlock(&subdev->mutex); 76 + WARN_ON(1); 77 + return; 78 + } 72 79 73 80 nvkm_wr32(device, 0x002270, (nvkm_memory_addr(cur) >> 12) | 74 81 (target << 28));
+7 -4
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
··· 83 83 } 84 84 nvkm_done(mem); 85 85 86 - if (nvkm_memory_target(mem) == NVKM_MEM_TARGET_VRAM) 87 - target = 0; 88 - else 89 - target = 3; 86 + switch (nvkm_memory_target(mem)) { 87 + case NVKM_MEM_TARGET_VRAM: target = 0; break; 88 + case NVKM_MEM_TARGET_NCOH: target = 3; break; 89 + default: 90 + WARN_ON(1); 91 + return; 92 + } 90 93 91 94 nvkm_wr32(device, 0x002270, (nvkm_memory_addr(mem) >> 12) | 92 95 (target << 28));
+7 -4
drivers/gpu/drm/nouveau/nvkm/falcon/v1.c
··· 136 136 nvkm_falcon_wr32(falcon, 0xe00 + 4 * FALCON_DMAIDX_PHYS_SYS_NCOH, 0x6); 137 137 138 138 /* Set context */ 139 - if (nvkm_memory_target(ctx->memory) == NVKM_MEM_TARGET_VRAM) 140 - inst_loc = 0x0; /* FB */ 141 - else 142 - inst_loc = 0x3; /* Non-coherent sysmem */ 139 + switch (nvkm_memory_target(ctx->memory)) { 140 + case NVKM_MEM_TARGET_VRAM: inst_loc = 0; break; 141 + case NVKM_MEM_TARGET_NCOH: inst_loc = 3; break; 142 + default: 143 + WARN_ON(1); 144 + return; 145 + } 143 146 144 147 /* Enable context */ 145 148 nvkm_falcon_mask(falcon, 0x048, 0x1, 0x1);
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
··· 116 116 static enum nvkm_memory_target 117 117 gk20a_instobj_target(struct nvkm_memory *memory) 118 118 { 119 - return NVKM_MEM_TARGET_HOST; 119 + return NVKM_MEM_TARGET_NCOH; 120 120 } 121 121 122 122 static u64