diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index e2b52dada..348500133 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "platform_gk20a.h" #include "sysfs.h" @@ -51,7 +52,6 @@ #include "module_usermode.h" #include "intr.h" #include "ioctl.h" -#include "sim.h" #include "os_linux.h" #include "ctxsw_trace.h" diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index a9bcca704..b860e35ea 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c @@ -35,8 +35,7 @@ #include "sysfs.h" #include "os_linux.h" #include "platform_gk20a.h" -#include "sim.h" -#include "sim_pci.h" +#include #include "pci.h" #include "pci_usermode.h" diff --git a/drivers/gpu/nvgpu/common/linux/sim.c b/drivers/gpu/nvgpu/common/linux/sim.c index 5406035b2..8e964f399 100644 --- a/drivers/gpu/nvgpu/common/linux/sim.c +++ b/drivers/gpu/nvgpu/common/linux/sim.c @@ -25,11 +25,11 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "platform_gk20a.h" #include "os_linux.h" #include "module.h" -#include "sim.h" /* will be removed in next patch */ void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v) { @@ -51,10 +51,9 @@ void nvgpu_remove_sim_support_linux(struct gk20a *g) { struct sim_nvgpu_linux *sim_linux; - if (!g->sim) { - nvgpu_warn(g, "sim not allocated or not in sim_mode"); + if (!g->sim) return; - } + sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim); if (sim_linux->regs) { sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v()); diff --git a/drivers/gpu/nvgpu/common/linux/sim_pci.c b/drivers/gpu/nvgpu/common/linux/sim_pci.c index 9dac630cb..d37767b71 100644 --- a/drivers/gpu/nvgpu/common/linux/sim_pci.c +++ b/drivers/gpu/nvgpu/common/linux/sim_pci.c @@ -24,11 +24,10 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "os_linux.h" #include "module.h" -#include "sim.h" /* will be removed in subsequent patches */ -#include "sim_pci.h"/* will be removed in subsequent patches */ static bool _nvgpu_pci_is_simulation(struct gk20a *g, u32 sim_base) { @@ -50,7 +49,6 @@ void nvgpu_remove_sim_support_linux_pci(struct gk20a *g) is_simulation = _nvgpu_pci_is_simulation(g, sim_r()); if (!is_simulation) { - nvgpu_warn(g, "not in sim_mode"); return; } diff --git a/drivers/gpu/nvgpu/common/sim.c b/drivers/gpu/nvgpu/common/sim.c index 0f88ec4d4..6094d063e 100644 --- a/drivers/gpu/nvgpu/common/sim.c +++ b/drivers/gpu/nvgpu/common/sim.c @@ -26,9 +26,8 @@ #include #include #include +#include #include "gk20a/gk20a.h" -#include "linux/sim.h" - int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem) { diff --git a/drivers/gpu/nvgpu/common/sim_pci.c b/drivers/gpu/nvgpu/common/sim_pci.c index b4ca7bad9..a72623e9c 100644 --- a/drivers/gpu/nvgpu/common/sim_pci.c +++ b/drivers/gpu/nvgpu/common/sim_pci.c @@ -24,8 +24,8 @@ #include #include #include +#include #include "gk20a/gk20a.h" -#include "linux/sim.h" static inline u32 sim_msg_header_size(void) { diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 7e1e751b0..aac3380e4 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -63,13 +63,13 @@ struct nvgpu_ctxsw_trace_filter; #include #include #include +#include #include "clk_gk20a.h" #include "ce2_gk20a.h" #include "fifo_gk20a.h" #include "tsg_gk20a.h" #include "gr_gk20a.h" -#include "sim_gk20a.h" #include "pmu_gk20a.h" #include "priv_ring_gk20a.h" #include "therm_gk20a.h" diff --git a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a_sim.c b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a_sim.c index 146b0e220..9674e2d68 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a_sim.c +++ b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a_sim.c @@ -25,7 +25,7 @@ */ #include "gk20a.h" -#include "sim_gk20a.h" +#include #include "gr_ctx_gk20a.h" #include diff --git a/drivers/gpu/nvgpu/common/linux/sim.h b/drivers/gpu/nvgpu/include/nvgpu/linux/sim.h similarity index 66% rename from drivers/gpu/nvgpu/common/linux/sim.h rename to drivers/gpu/nvgpu/include/nvgpu/linux/sim.h index 12f1a2556..c5aab8991 100644 --- a/drivers/gpu/nvgpu/common/linux/sim.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/sim.h @@ -20,8 +20,7 @@ #ifndef __SIM_LINUX_H__ #define __SIM_LINUX_H__ -#include -#include "gk20a/sim_gk20a.h" +#include struct sim_nvgpu_linux { struct sim_nvgpu sim; @@ -32,11 +31,7 @@ struct sim_nvgpu_linux { void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v); u32 sim_readl(struct sim_nvgpu *sim, u32 r); -int nvgpu_init_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */ -int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); /* will be moved to common in subsequent patch */ -void nvgpu_free_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); /* will be moved to common in subsequent patch */ -void nvgpu_free_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */ -void nvgpu_remove_sim_support(struct gk20a *g); /* will be moved to common in subsequent patch */ + int nvgpu_init_sim_support_linux(struct gk20a *g, struct platform_device *dev); void nvgpu_remove_sim_support_linux(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/common/linux/sim_pci.h b/drivers/gpu/nvgpu/include/nvgpu/linux/sim_pci.h similarity index 87% rename from drivers/gpu/nvgpu/common/linux/sim_pci.h rename to drivers/gpu/nvgpu/include/nvgpu/linux/sim_pci.h index 645dbdbd5..5784ecba2 100644 --- a/drivers/gpu/nvgpu/common/linux/sim_pci.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/sim_pci.h @@ -20,10 +20,7 @@ #ifndef __SIM_PCI_LINUX_H__ #define __SIM_PCI_LINUX_H__ -#include "gk20a/sim_gk20a.h" -#include "sim.h" - -int nvgpu_init_sim_support_pci(struct gk20a *g); /* this will be moved */ int nvgpu_init_sim_support_linux_pci(struct gk20a *g); void nvgpu_remove_sim_support_linux_pci(struct gk20a *g); + #endif diff --git a/drivers/gpu/nvgpu/gk20a/sim_gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/sim.h similarity index 71% rename from drivers/gpu/nvgpu/gk20a/sim_gk20a.h rename to drivers/gpu/nvgpu/include/nvgpu/sim.h index e74d33d56..78b749dd4 100644 --- a/drivers/gpu/nvgpu/gk20a/sim_gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/sim.h @@ -1,9 +1,5 @@ /* - * drivers/video/tegra/host/gk20a/sim_gk20a.h - * - * GK20A sim support - * - * Copyright (c) 2013-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,11 +19,12 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#ifndef __SIM_GK20A_H__ -#define __SIM_GK20A_H__ +#ifndef __NVGPU_SIM_H__ +#define __NVGPU_SIM_H__ + +#include struct gk20a; - struct sim_nvgpu { struct gk20a *g; u32 send_ring_put; @@ -41,5 +38,17 @@ struct sim_nvgpu { int (*esc_readl)( struct gk20a *g, char *path, u32 index, u32 *data); }; +#ifdef __KERNEL__ +#include "linux/sim.h" +#include "linux/sim_pci.h" +#else -#endif /*__SIM_GK20A_H__*/ +#endif +int nvgpu_init_sim_support(struct gk20a *g); +int nvgpu_init_sim_support_pci(struct gk20a *g); +int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); +void nvgpu_free_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem); +void nvgpu_free_sim_support(struct gk20a *g); +void nvgpu_remove_sim_support(struct gk20a *g); + +#endif