diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.h | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 2 |
7 files changed, 43 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index b7444a9e..0dd0d62c 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c | |||
@@ -274,3 +274,15 @@ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g) | |||
274 | atomic_read(&l->sw_irq_nonstall_last_handled)) | 274 | atomic_read(&l->sw_irq_nonstall_last_handled)) |
275 | <= 0, 0); | 275 | <= 0, 0); |
276 | } | 276 | } |
277 | |||
278 | static void nvgpu_free_gk20a(struct gk20a *g) | ||
279 | { | ||
280 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
281 | |||
282 | kfree(l); | ||
283 | } | ||
284 | |||
285 | void nvgpu_init_gk20a(struct gk20a *g) | ||
286 | { | ||
287 | g->free = nvgpu_free_gk20a; | ||
288 | } | ||
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.h b/drivers/gpu/nvgpu/common/linux/driver_common.h new file mode 100644 index 00000000..6f42f775 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/driver_common.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016-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_LINUX_DRIVER_COMMON | ||
18 | #define NVGPU_LINUX_DRIVER_COMMON | ||
19 | |||
20 | void nvgpu_init_gk20a(struct gk20a *g); | ||
21 | |||
22 | #endif | ||
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 4aff6a2d..4841b032 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include "cde_gm20b.h" | 53 | #include "cde_gm20b.h" |
54 | #include "cde_gp10b.h" | 54 | #include "cde_gp10b.h" |
55 | #include "ctxsw_trace.h" | 55 | #include "ctxsw_trace.h" |
56 | #include "driver_common.h" | ||
56 | 57 | ||
57 | #define CLASS_NAME "nvidia-gpu" | 58 | #define CLASS_NAME "nvidia-gpu" |
58 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ | 59 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ |
@@ -1027,6 +1028,7 @@ static int gk20a_probe(struct platform_device *dev) | |||
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | gk20a = &l->g; | 1030 | gk20a = &l->g; |
1031 | nvgpu_init_gk20a(gk20a); | ||
1030 | set_gk20a(dev, gk20a); | 1032 | set_gk20a(dev, gk20a); |
1031 | l->dev = &dev->dev; | 1033 | l->dev = &dev->dev; |
1032 | gk20a->log_mask = NVGPU_DEFAULT_DBG_MASK; | 1034 | gk20a->log_mask = NVGPU_DEFAULT_DBG_MASK; |
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 118567e5..296d0a7c 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #include "os_linux.h" | 39 | #include "os_linux.h" |
40 | #include "driver_common.h" | ||
40 | 41 | ||
41 | #define PCI_INTERFACE_NAME "card-%s%%s" | 42 | #define PCI_INTERFACE_NAME "card-%s%%s" |
42 | 43 | ||
@@ -457,6 +458,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
457 | } | 458 | } |
458 | 459 | ||
459 | g = &l->g; | 460 | g = &l->g; |
461 | nvgpu_init_gk20a(g); | ||
460 | 462 | ||
461 | nvgpu_kmem_init(g); | 463 | nvgpu_kmem_init(g); |
462 | 464 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index f71a51fd..e8db9d2c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -518,7 +518,8 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount) | |||
518 | if (g->remove_support) | 518 | if (g->remove_support) |
519 | g->remove_support(g); | 519 | g->remove_support(g); |
520 | 520 | ||
521 | kfree(g); | 521 | if (g->free) |
522 | g->free(g); | ||
522 | } | 523 | } |
523 | 524 | ||
524 | /** | 525 | /** |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 7e7d9688..5b22d1a4 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -1070,6 +1070,7 @@ struct nvgpu_gpu_params { | |||
1070 | }; | 1070 | }; |
1071 | 1071 | ||
1072 | struct gk20a { | 1072 | struct gk20a { |
1073 | void (*free)(struct gk20a *g); | ||
1073 | struct nvgpu_nvhost_dev *nvhost_dev; | 1074 | struct nvgpu_nvhost_dev *nvhost_dev; |
1074 | 1075 | ||
1075 | /* | 1076 | /* |
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 93f9eaf4..2cd99e8c 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "common/linux/os_linux.h" | 47 | #include "common/linux/os_linux.h" |
48 | #include "common/linux/ioctl.h" | 48 | #include "common/linux/ioctl.h" |
49 | #include "common/linux/scale.h" | 49 | #include "common/linux/scale.h" |
50 | #include "common/linux/driver_common.h" | ||
50 | 51 | ||
51 | #ifdef CONFIG_TEGRA_19x_GPU | 52 | #ifdef CONFIG_TEGRA_19x_GPU |
52 | #include <vgpu/vgpu_t19x.h> | 53 | #include <vgpu/vgpu_t19x.h> |
@@ -657,6 +658,7 @@ int vgpu_probe(struct platform_device *pdev) | |||
657 | return -ENOMEM; | 658 | return -ENOMEM; |
658 | } | 659 | } |
659 | gk20a = &l->g; | 660 | gk20a = &l->g; |
661 | nvgpu_init_gk20a(gk20a); | ||
660 | 662 | ||
661 | nvgpu_kmem_init(gk20a); | 663 | nvgpu_kmem_init(gk20a); |
662 | 664 | ||