diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde.c | 21 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde_gm20b.c | 16 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde_gm20b.h | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde_gp10b.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde_gp10b.h | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/module.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops.c | 40 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops.h | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c | 34 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c | 36 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h | 22 |
12 files changed, 198 insertions, 58 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/cde.c b/drivers/gpu/nvgpu/os/linux/cde.c index 850f6deb..30cd0bff 100644 --- a/drivers/gpu/nvgpu/os/linux/cde.c +++ b/drivers/gpu/nvgpu/os/linux/cde.c | |||
@@ -1791,24 +1791,3 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd, | |||
1791 | dma_buf_put(dmabuf); | 1791 | dma_buf_put(dmabuf); |
1792 | return 0; | 1792 | return 0; |
1793 | } | 1793 | } |
1794 | |||
1795 | int nvgpu_cde_init_ops(struct nvgpu_os_linux *l) | ||
1796 | { | ||
1797 | struct gk20a *g = &l->g; | ||
1798 | u32 ver = g->params.gpu_arch + g->params.gpu_impl; | ||
1799 | |||
1800 | switch (ver) { | ||
1801 | case GK20A_GPUID_GM20B: | ||
1802 | case GK20A_GPUID_GM20B_B: | ||
1803 | l->ops.cde = gm20b_cde_ops.cde; | ||
1804 | break; | ||
1805 | case NVGPU_GPUID_GP10B: | ||
1806 | l->ops.cde = gp10b_cde_ops.cde; | ||
1807 | break; | ||
1808 | default: | ||
1809 | /* CDE is optional, so today ignoring unknown chip is fine */ | ||
1810 | break; | ||
1811 | } | ||
1812 | |||
1813 | return 0; | ||
1814 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/cde_gm20b.c b/drivers/gpu/nvgpu/os/linux/cde_gm20b.c index 1cd15c54..7f71b740 100644 --- a/drivers/gpu/nvgpu/os/linux/cde_gm20b.c +++ b/drivers/gpu/nvgpu/os/linux/cde_gm20b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GM20B CDE | 2 | * GM20B CDE |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -35,10 +35,10 @@ enum programs { | |||
35 | PROG_PASSTHROUGH = 6, | 35 | PROG_PASSTHROUGH = 6, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static void gm20b_cde_get_program_numbers(struct gk20a *g, | 38 | void gm20b_cde_get_program_numbers(struct gk20a *g, |
39 | u32 block_height_log2, | 39 | u32 block_height_log2, |
40 | u32 shader_parameter, | 40 | u32 shader_parameter, |
41 | int *hprog_out, int *vprog_out) | 41 | int *hprog_out, int *vprog_out) |
42 | { | 42 | { |
43 | int hprog = PROG_HPASS; | 43 | int hprog = PROG_HPASS; |
44 | int vprog = (block_height_log2 >= 2) ? | 44 | int vprog = (block_height_log2 >= 2) ? |
@@ -56,9 +56,3 @@ static void gm20b_cde_get_program_numbers(struct gk20a *g, | |||
56 | *hprog_out = hprog; | 56 | *hprog_out = hprog; |
57 | *vprog_out = vprog; | 57 | *vprog_out = vprog; |
58 | } | 58 | } |
59 | |||
60 | struct nvgpu_os_linux_ops gm20b_cde_ops = { | ||
61 | .cde = { | ||
62 | .get_program_numbers = gm20b_cde_get_program_numbers, | ||
63 | }, | ||
64 | }; | ||
diff --git a/drivers/gpu/nvgpu/os/linux/cde_gm20b.h b/drivers/gpu/nvgpu/os/linux/cde_gm20b.h index 640d6ab6..fac8aaff 100644 --- a/drivers/gpu/nvgpu/os/linux/cde_gm20b.h +++ b/drivers/gpu/nvgpu/os/linux/cde_gm20b.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GM20B CDE | 2 | * GM20B CDE |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -25,8 +25,9 @@ | |||
25 | #ifndef _NVHOST_GM20B_CDE | 25 | #ifndef _NVHOST_GM20B_CDE |
26 | #define _NVHOST_GM20B_CDE | 26 | #define _NVHOST_GM20B_CDE |
27 | 27 | ||
28 | #include "os_linux.h" | 28 | void gm20b_cde_get_program_numbers(struct gk20a *g, |
29 | 29 | u32 block_height_log2, | |
30 | extern struct nvgpu_os_linux_ops gm20b_cde_ops; | 30 | u32 shader_parameter, |
31 | int *hprog_out, int *vprog_out); | ||
31 | 32 | ||
32 | #endif | 33 | #endif |
diff --git a/drivers/gpu/nvgpu/os/linux/cde_gp10b.c b/drivers/gpu/nvgpu/os/linux/cde_gp10b.c index 5c0e79a7..f22f4b68 100644 --- a/drivers/gpu/nvgpu/os/linux/cde_gp10b.c +++ b/drivers/gpu/nvgpu/os/linux/cde_gp10b.c | |||
@@ -151,11 +151,3 @@ int gp10b_populate_scatter_buffer(struct gk20a *g, | |||
151 | 151 | ||
152 | return 0; | 152 | return 0; |
153 | } | 153 | } |
154 | |||
155 | struct nvgpu_os_linux_ops gp10b_cde_ops = { | ||
156 | .cde = { | ||
157 | .get_program_numbers = gp10b_cde_get_program_numbers, | ||
158 | .need_scatter_buffer = gp10b_need_scatter_buffer, | ||
159 | .populate_scatter_buffer = gp10b_populate_scatter_buffer, | ||
160 | }, | ||
161 | }; | ||
diff --git a/drivers/gpu/nvgpu/os/linux/cde_gp10b.h b/drivers/gpu/nvgpu/os/linux/cde_gp10b.h index 52e9f292..3ecca2ab 100644 --- a/drivers/gpu/nvgpu/os/linux/cde_gp10b.h +++ b/drivers/gpu/nvgpu/os/linux/cde_gp10b.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GP10B CDE | 2 | * GP10B CDE |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -27,6 +27,14 @@ | |||
27 | 27 | ||
28 | #include "os_linux.h" | 28 | #include "os_linux.h" |
29 | 29 | ||
30 | extern struct nvgpu_os_linux_ops gp10b_cde_ops; | 30 | void gp10b_cde_get_program_numbers(struct gk20a *g, |
31 | 31 | u32 block_height_log2, | |
32 | u32 shader_parameter, | ||
33 | int *hprog_out, int *vprog_out); | ||
34 | bool gp10b_need_scatter_buffer(struct gk20a *g); | ||
35 | int gp10b_populate_scatter_buffer(struct gk20a *g, | ||
36 | struct sg_table *sgt, | ||
37 | size_t surface_size, | ||
38 | void *scatter_buffer_ptr, | ||
39 | size_t scatter_buffer_size); | ||
32 | #endif | 40 | #endif |
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index c07faf08..3be879be 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "ioctl.h" | 56 | #include "ioctl.h" |
57 | 57 | ||
58 | #include "os_linux.h" | 58 | #include "os_linux.h" |
59 | #include "os_ops.h" | ||
59 | #include "ctxsw_trace.h" | 60 | #include "ctxsw_trace.h" |
60 | #include "driver_common.h" | 61 | #include "driver_common.h" |
61 | #include "channel.h" | 62 | #include "channel.h" |
@@ -183,17 +184,6 @@ static int gk20a_restore_registers(struct gk20a *g) | |||
183 | return 0; | 184 | return 0; |
184 | } | 185 | } |
185 | 186 | ||
186 | static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) | ||
187 | { | ||
188 | int err = 0; | ||
189 | |||
190 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
191 | err = nvgpu_cde_init_ops(l); | ||
192 | #endif | ||
193 | |||
194 | return err; | ||
195 | } | ||
196 | |||
197 | int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) | 187 | int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) |
198 | { | 188 | { |
199 | struct gk20a *g = &l->g; | 189 | struct gk20a *g = &l->g; |
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops.c b/drivers/gpu/nvgpu/os/linux/os_ops.c new file mode 100644 index 00000000..14f92787 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 "os_linux.h" | ||
18 | |||
19 | #include "os_ops_gm20b.h" | ||
20 | #include "os_ops_gp10b.h" | ||
21 | |||
22 | int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) | ||
23 | { | ||
24 | struct gk20a *g = &l->g; | ||
25 | u32 ver = g->params.gpu_arch + g->params.gpu_impl; | ||
26 | |||
27 | switch (ver) { | ||
28 | case GK20A_GPUID_GM20B: | ||
29 | case GK20A_GPUID_GM20B_B: | ||
30 | nvgpu_gm20b_init_os_ops(l); | ||
31 | break; | ||
32 | case NVGPU_GPUID_GP10B: | ||
33 | nvgpu_gp10b_init_os_ops(l); | ||
34 | break; | ||
35 | default: | ||
36 | break; | ||
37 | } | ||
38 | |||
39 | return 0; | ||
40 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops.h b/drivers/gpu/nvgpu/os/linux/os_ops.h new file mode 100644 index 00000000..af3ce0a7 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 __LINUX_OS_OPS_H | ||
18 | #define __LINUX_OS_OPS_H | ||
19 | |||
20 | int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l); | ||
21 | |||
22 | #endif | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c b/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c new file mode 100644 index 00000000..7db004eb --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 "os_linux.h" | ||
18 | |||
19 | #include "cde_gm20b.h" | ||
20 | |||
21 | static struct nvgpu_os_linux_ops gm20b_os_linux_ops = { | ||
22 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
23 | .cde = { | ||
24 | .get_program_numbers = gm20b_cde_get_program_numbers, | ||
25 | }, | ||
26 | #endif | ||
27 | }; | ||
28 | |||
29 | void nvgpu_gm20b_init_os_ops(struct nvgpu_os_linux *l) | ||
30 | { | ||
31 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
32 | l->ops.cde = gm20b_os_linux_ops.cde; | ||
33 | #endif | ||
34 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h b/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h new file mode 100644 index 00000000..7d27e401 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 __LINUX_OS_OPS_GM20B_H | ||
18 | #define __LINUX_OS_OPS_GM20B_H | ||
19 | |||
20 | void nvgpu_gm20b_init_os_ops(struct nvgpu_os_linux *l); | ||
21 | |||
22 | #endif | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c b/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c new file mode 100644 index 00000000..984dcdc0 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 "os_linux.h" | ||
18 | |||
19 | #include "cde_gp10b.h" | ||
20 | |||
21 | static struct nvgpu_os_linux_ops gp10b_os_linux_ops = { | ||
22 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
23 | .cde = { | ||
24 | .get_program_numbers = gp10b_cde_get_program_numbers, | ||
25 | .need_scatter_buffer = gp10b_need_scatter_buffer, | ||
26 | .populate_scatter_buffer = gp10b_populate_scatter_buffer, | ||
27 | }, | ||
28 | #endif | ||
29 | }; | ||
30 | |||
31 | void nvgpu_gp10b_init_os_ops(struct nvgpu_os_linux *l) | ||
32 | { | ||
33 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
34 | l->ops.cde = gp10b_os_linux_ops.cde; | ||
35 | #endif | ||
36 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h b/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h new file mode 100644 index 00000000..0be1bca1 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 __LINUX_OS_OPS_GP10B_H | ||
18 | #define __LINUX_OS_OPS_GP10B_H | ||
19 | |||
20 | void nvgpu_gp10b_init_os_ops(struct nvgpu_os_linux *l); | ||
21 | |||
22 | #endif | ||