summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-07-03 07:10:44 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-07 10:05:39 -0400
commitafa31cdd8cc6bb04faeed30b2cc30f5e6be888b5 (patch)
tree6cc8c7c48bb86c77dc2b1bc6a59af0ca1cabbb7f
parentcca0510e477944e8781184592a95debd7742262d (diff)
gpu: nvgpu: add support for L3 cache allocation of buffers
Add gv11b implementation of gpu_phys_addr() that checks the t19x GMMU attributes struct to determine if L3 allocation should be enabled. If L3 alloc is enabled then a special physical address bit is set. Add flag NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC to struct nvgpu_as_map_buffer_ex_args so that User space can add a hint to allocate buffer in L3 cache Jira GPUT19X-10 Bug 200279508 Change-Id: I1bb9876a670b252980922aa50e3e69b802be137f Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master/r/1512602 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/common/mm/gmmu_t19x.c25
-rw-r--r--drivers/gpu/nvgpu/gv11b/mm_gv11b.c17
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gmmu_t19x.h28
-rw-r--r--include/uapi/linux/nvgpu-t19x.h6
5 files changed, 77 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 33391a80..6fdabe62 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -1,6 +1,7 @@
1nvgpu-t19x := ../../../../nvgpu-t19x/drivers/gpu/nvgpu 1nvgpu-t19x := ../../../../nvgpu-t19x/drivers/gpu/nvgpu
2 2
3nvgpu-y += \ 3nvgpu-y += \
4 $(nvgpu-t19x)/common/mm/gmmu_t19x.o \
4 $(nvgpu-t19x)/common/linux/ioctl_tsg_t19x.o \ 5 $(nvgpu-t19x)/common/linux/ioctl_tsg_t19x.o \
5 $(nvgpu-t19x)/gv11b/gv11b.o \ 6 $(nvgpu-t19x)/gv11b/gv11b.o \
6 $(nvgpu-t19x)/gv11b/bus_gv11b.o \ 7 $(nvgpu-t19x)/gv11b/bus_gv11b.o \
diff --git a/drivers/gpu/nvgpu/common/mm/gmmu_t19x.c b/drivers/gpu/nvgpu/common/mm/gmmu_t19x.c
new file mode 100644
index 00000000..05abec1b
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/mm/gmmu_t19x.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <uapi/linux/nvgpu.h>
18
19#include <nvgpu/gmmu.h>
20
21void nvgpu_gmmu_add_t19x_attrs(struct nvgpu_gmmu_attrs *attrs, u32 flags)
22{
23 attrs->t19x_attrs.l3_alloc = (bool)(flags &
24 NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC);
25}
diff --git a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
index 9d1e0f25..cc8dafa3 100644
--- a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
@@ -23,6 +23,8 @@
23 23
24#include <nvgpu/hw/gv11b/hw_fb_gv11b.h> 24#include <nvgpu/hw/gv11b/hw_fb_gv11b.h>
25 25
26#define NVGPU_L3_ALLOC_BIT 36
27
26static bool gv11b_mm_is_bar1_supported(struct gk20a *g) 28static bool gv11b_mm_is_bar1_supported(struct gk20a *g)
27{ 29{
28 return false; 30 return false;
@@ -61,6 +63,20 @@ void gv11b_mm_l2_flush(struct gk20a *g, bool invalidate)
61 g->ops.mm.fb_flush(g); 63 g->ops.mm.fb_flush(g);
62} 64}
63 65
66/*
67 * On Volta the GPU determines whether to do L3 allocation for a mapping by
68 * checking bit 36 of the phsyical address. So if a mapping should allocte lines
69 * in the L3 this bit must be set.
70 */
71u64 gv11b_gpu_phys_addr(struct gk20a *g,
72 struct nvgpu_gmmu_attrs *attrs, u64 phys)
73{
74 if (attrs->t19x_attrs.l3_alloc)
75 return phys | NVGPU_L3_ALLOC_BIT;
76
77 return phys;
78}
79
64void gv11b_init_mm(struct gpu_ops *gops) 80void gv11b_init_mm(struct gpu_ops *gops)
65{ 81{
66 gp10b_init_mm(gops); 82 gp10b_init_mm(gops);
@@ -69,4 +85,5 @@ void gv11b_init_mm(struct gpu_ops *gops)
69 gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw; 85 gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw;
70 gops->mm.mmu_fault_pending = gv11b_mm_mmu_fault_pending; 86 gops->mm.mmu_fault_pending = gv11b_mm_mmu_fault_pending;
71 gops->mm.l2_flush = gv11b_mm_l2_flush; 87 gops->mm.l2_flush = gv11b_mm_l2_flush;
88 gops->mm.gpu_phys_addr = gv11b_gpu_phys_addr;
72} 89}
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gmmu_t19x.h b/drivers/gpu/nvgpu/include/nvgpu/gmmu_t19x.h
new file mode 100644
index 00000000..8e1a4846
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/gmmu_t19x.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __NVGPU_GMMU_T19X_H__
18#define __NVGPU_GMMU_T19X_H__
19
20struct nvgpu_gmmu_attrs;
21
22struct nvgpu_gmmu_attrs_t19x {
23 bool l3_alloc;
24};
25
26void nvgpu_gmmu_add_t19x_attrs(struct nvgpu_gmmu_attrs *attrs, u32 flags);
27
28#endif
diff --git a/include/uapi/linux/nvgpu-t19x.h b/include/uapi/linux/nvgpu-t19x.h
index 96514a88..bc37bc7c 100644
--- a/include/uapi/linux/nvgpu-t19x.h
+++ b/include/uapi/linux/nvgpu-t19x.h
@@ -27,6 +27,12 @@
27#define NVGPU_GPU_ARCH_GV110 0x00000150 27#define NVGPU_GPU_ARCH_GV110 0x00000150
28#define NVGPU_GPU_IMPL_GV11B 0x0000000B 28#define NVGPU_GPU_IMPL_GV11B 0x0000000B
29 29
30/*
31 * this flag is used in struct nvgpu_as_map_buffer_ex_args
32 * to provide L3 cache allocation hint
33 */
34#define NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC (1 << 7)
35
30/* subcontexts are available */ 36/* subcontexts are available */
31#define NVGPU_GPU_FLAGS_SUPPORT_TSG_SUBCONTEXTS (1ULL << 22) 37#define NVGPU_GPU_FLAGS_SUPPORT_TSG_SUBCONTEXTS (1ULL << 22)
32 38