summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-10-18 16:24:53 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-10 18:46:54 -0500
commitee4970a33f41b56f2ada6a0b5ab6f9c400e39d88 (patch)
tree65d26ac7fd8667ac10cee8330a7647e9e72a745c /drivers/gpu/nvgpu/include
parent6911b4d48c414279731580f1212e29e4b691b04c (diff)
gpu: nvgpu: Make buf alignment generic
Drastically simplify and move the aligment computation for buffers getting mapped into the SGT code. An SGT is all that is needed for computing the alignment. However, this did require that a new SGT op was added: nvgpu_sgt_iommuable() This function returns true if the passed SGT is IOMMU'able and must be implemented by an SGT implementation that has IOMMU'able buffers. If this function is left as NULL then it is assumed that the buffer is not IOMMU'able. Also cleanup the parameter ordering convention among all nvgpu_sgt functions. Previously there was a mishmash of different parameter orderings. This patch now standardizes on the gk20a first approach seen everywhere else in the driver. JIRA NVGPU-30 JIRA NVGPU-246 JIRA NVGPU-71 Change-Id: Ic4ab7b752847cf795c7cfafed5a07818217bba86 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1583985 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index 6feacff7..2b8b7015 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -62,6 +62,11 @@ struct nvgpu_sgt_ops {
62 u64 (*sgl_gpu_addr)(struct gk20a *g, void *sgl, 62 u64 (*sgl_gpu_addr)(struct gk20a *g, void *sgl,
63 struct nvgpu_gmmu_attrs *attrs); 63 struct nvgpu_gmmu_attrs *attrs);
64 /* 64 /*
65 * If left NULL then iommuable is assumed to be false.
66 */
67 bool (*sgt_iommuable)(struct gk20a *g, struct nvgpu_sgt *sgt);
68
69 /*
65 * Note: this operates on the whole SGT not a specific SGL entry. 70 * Note: this operates on the whole SGT not a specific SGL entry.
66 */ 71 */
67 void (*sgt_free)(struct gk20a *g, struct nvgpu_sgt *sgt); 72 void (*sgt_free)(struct gk20a *g, struct nvgpu_sgt *sgt);
@@ -232,9 +237,12 @@ void *nvgpu_sgt_get_next(struct nvgpu_sgt *sgt, void *sgl);
232u64 nvgpu_sgt_get_phys(struct nvgpu_sgt *sgt, void *sgl); 237u64 nvgpu_sgt_get_phys(struct nvgpu_sgt *sgt, void *sgl);
233u64 nvgpu_sgt_get_dma(struct nvgpu_sgt *sgt, void *sgl); 238u64 nvgpu_sgt_get_dma(struct nvgpu_sgt *sgt, void *sgl);
234u64 nvgpu_sgt_get_length(struct nvgpu_sgt *sgt, void *sgl); 239u64 nvgpu_sgt_get_length(struct nvgpu_sgt *sgt, void *sgl);
235u64 nvgpu_sgt_get_gpu_addr(struct nvgpu_sgt *sgt, struct gk20a *g, void *sgl, 240u64 nvgpu_sgt_get_gpu_addr(struct gk20a *g, struct nvgpu_sgt *sgt, void *sgl,
236 struct nvgpu_gmmu_attrs *attrs); 241 struct nvgpu_gmmu_attrs *attrs);
237void nvgpu_sgt_free(struct nvgpu_sgt *sgt, struct gk20a *g); 242void nvgpu_sgt_free(struct gk20a *g, struct nvgpu_sgt *sgt);
243
244bool nvgpu_sgt_iommuable(struct gk20a *g, struct nvgpu_sgt *sgt);
245u64 nvgpu_sgt_alignment(struct gk20a *g, struct nvgpu_sgt *sgt);
238 246
239/** 247/**
240 * nvgpu_mem_create_from_mem - Create a new nvgpu_mem struct from an old one. 248 * nvgpu_mem_create_from_mem - Create a new nvgpu_mem struct from an old one.