diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/sim_pci.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sim_pci.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sim_pci.c b/drivers/gpu/nvgpu/common/linux/sim_pci.c deleted file mode 100644 index d37767b7..00000000 --- a/drivers/gpu/nvgpu/common/linux/sim_pci.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017-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 <linux/io.h> | ||
18 | #include <linux/highmem.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <nvgpu/log.h> | ||
22 | #include <nvgpu/linux/vm.h> | ||
23 | #include <nvgpu/bitops.h> | ||
24 | #include <nvgpu/nvgpu_mem.h> | ||
25 | #include <nvgpu/dma.h> | ||
26 | #include <nvgpu/hw_sim_pci.h> | ||
27 | #include <nvgpu/sim.h> | ||
28 | #include "gk20a/gk20a.h" | ||
29 | #include "os_linux.h" | ||
30 | #include "module.h" | ||
31 | |||
32 | static bool _nvgpu_pci_is_simulation(struct gk20a *g, u32 sim_base) | ||
33 | { | ||
34 | u32 cfg; | ||
35 | bool is_simulation = false; | ||
36 | |||
37 | cfg = nvgpu_readl(g, sim_base + sim_config_r()); | ||
38 | if (sim_config_mode_v(cfg) == sim_config_mode_enabled_v()) | ||
39 | is_simulation = true; | ||
40 | |||
41 | return is_simulation; | ||
42 | } | ||
43 | |||
44 | void nvgpu_remove_sim_support_linux_pci(struct gk20a *g) | ||
45 | { | ||
46 | struct sim_nvgpu_linux *sim_linux; | ||
47 | bool is_simulation; | ||
48 | |||
49 | is_simulation = _nvgpu_pci_is_simulation(g, sim_r()); | ||
50 | |||
51 | if (!is_simulation) { | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | if (!g->sim) { | ||
56 | nvgpu_warn(g, "sim_gk20a not allocated"); | ||
57 | return; | ||
58 | } | ||
59 | sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim); | ||
60 | |||
61 | if (sim_linux->regs) { | ||
62 | sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v()); | ||
63 | sim_linux->regs = NULL; | ||
64 | } | ||
65 | nvgpu_kfree(g, sim_linux); | ||
66 | g->sim = NULL; | ||
67 | } | ||
68 | |||
69 | int nvgpu_init_sim_support_linux_pci(struct gk20a *g) | ||
70 | { | ||
71 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
72 | struct sim_nvgpu_linux *sim_linux; | ||
73 | int err = -ENOMEM; | ||
74 | bool is_simulation; | ||
75 | |||
76 | is_simulation = _nvgpu_pci_is_simulation(g, sim_r()); | ||
77 | __nvgpu_set_enabled(g, NVGPU_IS_FMODEL, is_simulation); | ||
78 | |||
79 | if (!is_simulation) | ||
80 | return 0; | ||
81 | |||
82 | sim_linux = nvgpu_kzalloc(g, sizeof(*sim_linux)); | ||
83 | if (!sim_linux) | ||
84 | return err; | ||
85 | g->sim = &sim_linux->sim; | ||
86 | g->sim->g = g; | ||
87 | sim_linux->regs = l->regs + sim_r(); | ||
88 | sim_linux->remove_support_linux = nvgpu_remove_sim_support_linux_pci; | ||
89 | |||
90 | return 0; | ||
91 | } | ||