summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorAntony Clince Alex <aalex@nvidia.com>2018-04-26 00:29:35 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-09 21:25:54 -0400
commit7e66f2a63d4855e763fa768047dfc32f6f96b771 (patch)
tree2c460b497653a361eeff58e6e2ddb5601eeb43b1 /drivers/gpu/nvgpu/common
parent50d1b0c72bfa5bf662c04db85e39c04ca3abfd67 (diff)
gpu: nvgpu: created os-agnostic sim header.
added a os-agnostic sim.h header which could be included in by any platform, moved out os specific headers to nvgpu/linux. JIRA VQRM-2368 Change-Id: I3861bfa75a6b8d2d909bc7223467fd68c208275b Signed-off-by: Antony Clince Alex <aalex@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1702816 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/sim.c7
-rw-r--r--drivers/gpu/nvgpu/common/linux/sim.h43
-rw-r--r--drivers/gpu/nvgpu/common/linux/sim_pci.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/sim_pci.h29
-rw-r--r--drivers/gpu/nvgpu/common/sim.c3
-rw-r--r--drivers/gpu/nvgpu/common/sim_pci.c2
8 files changed, 8 insertions, 85 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index e2b52dad..34850013 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -41,6 +41,7 @@
41#include <nvgpu/debug.h> 41#include <nvgpu/debug.h>
42#include <nvgpu/ctxsw_trace.h> 42#include <nvgpu/ctxsw_trace.h>
43#include <nvgpu/vidmem.h> 43#include <nvgpu/vidmem.h>
44#include <nvgpu/sim.h>
44 45
45#include "platform_gk20a.h" 46#include "platform_gk20a.h"
46#include "sysfs.h" 47#include "sysfs.h"
@@ -51,7 +52,6 @@
51#include "module_usermode.h" 52#include "module_usermode.h"
52#include "intr.h" 53#include "intr.h"
53#include "ioctl.h" 54#include "ioctl.h"
54#include "sim.h"
55 55
56#include "os_linux.h" 56#include "os_linux.h"
57#include "ctxsw_trace.h" 57#include "ctxsw_trace.h"
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index a9bcca70..b860e35e 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -35,8 +35,7 @@
35#include "sysfs.h" 35#include "sysfs.h"
36#include "os_linux.h" 36#include "os_linux.h"
37#include "platform_gk20a.h" 37#include "platform_gk20a.h"
38#include "sim.h" 38#include <nvgpu/sim.h>
39#include "sim_pci.h"
40 39
41#include "pci.h" 40#include "pci.h"
42#include "pci_usermode.h" 41#include "pci_usermode.h"
diff --git a/drivers/gpu/nvgpu/common/linux/sim.c b/drivers/gpu/nvgpu/common/linux/sim.c
index 5406035b..8e964f39 100644
--- a/drivers/gpu/nvgpu/common/linux/sim.c
+++ b/drivers/gpu/nvgpu/common/linux/sim.c
@@ -25,11 +25,11 @@
25#include <nvgpu/dma.h> 25#include <nvgpu/dma.h>
26#include <nvgpu/soc.h> 26#include <nvgpu/soc.h>
27#include <nvgpu/hw_sim.h> 27#include <nvgpu/hw_sim.h>
28#include <nvgpu/sim.h>
28#include "gk20a/gk20a.h" 29#include "gk20a/gk20a.h"
29#include "platform_gk20a.h" 30#include "platform_gk20a.h"
30#include "os_linux.h" 31#include "os_linux.h"
31#include "module.h" 32#include "module.h"
32#include "sim.h" /* will be removed in next patch */
33 33
34void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v) 34void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v)
35{ 35{
@@ -51,10 +51,9 @@ void nvgpu_remove_sim_support_linux(struct gk20a *g)
51{ 51{
52 struct sim_nvgpu_linux *sim_linux; 52 struct sim_nvgpu_linux *sim_linux;
53 53
54 if (!g->sim) { 54 if (!g->sim)
55 nvgpu_warn(g, "sim not allocated or not in sim_mode");
56 return; 55 return;
57 } 56
58 sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim); 57 sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim);
59 if (sim_linux->regs) { 58 if (sim_linux->regs) {
60 sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v()); 59 sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v());
diff --git a/drivers/gpu/nvgpu/common/linux/sim.h b/drivers/gpu/nvgpu/common/linux/sim.h
deleted file mode 100644
index 12f1a255..00000000
--- a/drivers/gpu/nvgpu/common/linux/sim.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 *
3 * nvgpu sim support
4 *
5 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __SIM_LINUX_H__
21#define __SIM_LINUX_H__
22
23#include <nvgpu/nvgpu_mem.h>
24#include "gk20a/sim_gk20a.h"
25
26struct sim_nvgpu_linux {
27 struct sim_nvgpu sim;
28 struct resource *reg_mem;
29 void __iomem *regs;
30 void (*remove_support_linux)(struct gk20a *g);
31};
32
33void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v);
34u32 sim_readl(struct sim_nvgpu *sim, u32 r);
35int nvgpu_init_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */
36int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); /* will be moved to common in subsequent patch */
37void nvgpu_free_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); /* will be moved to common in subsequent patch */
38void nvgpu_free_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */
39void nvgpu_remove_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */
40int nvgpu_init_sim_support_linux(struct gk20a *g,
41 struct platform_device *dev);
42void nvgpu_remove_sim_support_linux(struct gk20a *g);
43#endif
diff --git a/drivers/gpu/nvgpu/common/linux/sim_pci.c b/drivers/gpu/nvgpu/common/linux/sim_pci.c
index 9dac630c..d37767b7 100644
--- a/drivers/gpu/nvgpu/common/linux/sim_pci.c
+++ b/drivers/gpu/nvgpu/common/linux/sim_pci.c
@@ -24,11 +24,10 @@
24#include <nvgpu/nvgpu_mem.h> 24#include <nvgpu/nvgpu_mem.h>
25#include <nvgpu/dma.h> 25#include <nvgpu/dma.h>
26#include <nvgpu/hw_sim_pci.h> 26#include <nvgpu/hw_sim_pci.h>
27#include <nvgpu/sim.h>
27#include "gk20a/gk20a.h" 28#include "gk20a/gk20a.h"
28#include "os_linux.h" 29#include "os_linux.h"
29#include "module.h" 30#include "module.h"
30#include "sim.h" /* will be removed in subsequent patches */
31#include "sim_pci.h"/* will be removed in subsequent patches */
32 31
33static bool _nvgpu_pci_is_simulation(struct gk20a *g, u32 sim_base) 32static bool _nvgpu_pci_is_simulation(struct gk20a *g, u32 sim_base)
34{ 33{
@@ -50,7 +49,6 @@ void nvgpu_remove_sim_support_linux_pci(struct gk20a *g)
50 is_simulation = _nvgpu_pci_is_simulation(g, sim_r()); 49 is_simulation = _nvgpu_pci_is_simulation(g, sim_r());
51 50
52 if (!is_simulation) { 51 if (!is_simulation) {
53 nvgpu_warn(g, "not in sim_mode");
54 return; 52 return;
55 } 53 }
56 54
diff --git a/drivers/gpu/nvgpu/common/linux/sim_pci.h b/drivers/gpu/nvgpu/common/linux/sim_pci.h
deleted file mode 100644
index 645dbdbd..00000000
--- a/drivers/gpu/nvgpu/common/linux/sim_pci.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 *
3 * GK20A sim support
4 *
5 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __SIM_PCI_LINUX_H__
21#define __SIM_PCI_LINUX_H__
22
23#include "gk20a/sim_gk20a.h"
24#include "sim.h"
25
26int nvgpu_init_sim_support_pci(struct gk20a *g); /* this will be moved */
27int nvgpu_init_sim_support_linux_pci(struct gk20a *g);
28void nvgpu_remove_sim_support_linux_pci(struct gk20a *g);
29#endif
diff --git a/drivers/gpu/nvgpu/common/sim.c b/drivers/gpu/nvgpu/common/sim.c
index 0f88ec4d..6094d063 100644
--- a/drivers/gpu/nvgpu/common/sim.c
+++ b/drivers/gpu/nvgpu/common/sim.c
@@ -26,9 +26,8 @@
26#include <nvgpu/dma.h> 26#include <nvgpu/dma.h>
27#include <nvgpu/io.h> 27#include <nvgpu/io.h>
28#include <nvgpu/hw_sim.h> 28#include <nvgpu/hw_sim.h>
29#include <nvgpu/sim.h>
29#include "gk20a/gk20a.h" 30#include "gk20a/gk20a.h"
30#include "linux/sim.h"
31
32 31
33int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem) 32int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem)
34{ 33{
diff --git a/drivers/gpu/nvgpu/common/sim_pci.c b/drivers/gpu/nvgpu/common/sim_pci.c
index b4ca7bad..a72623e9 100644
--- a/drivers/gpu/nvgpu/common/sim_pci.c
+++ b/drivers/gpu/nvgpu/common/sim_pci.c
@@ -24,8 +24,8 @@
24#include <nvgpu/nvgpu_mem.h> 24#include <nvgpu/nvgpu_mem.h>
25#include <nvgpu/dma.h> 25#include <nvgpu/dma.h>
26#include <nvgpu/hw_sim_pci.h> 26#include <nvgpu/hw_sim_pci.h>
27#include <nvgpu/sim.h>
27#include "gk20a/gk20a.h" 28#include "gk20a/gk20a.h"
28#include "linux/sim.h"
29 29
30static inline u32 sim_msg_header_size(void) 30static inline u32 sim_msg_header_size(void)
31{ 31{