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>
This commit is contained in:
Antony Clince Alex
2018-04-26 09:59:35 +05:30
committed by mobile promotions
parent 50d1b0c72b
commit 7e66f2a63d
11 changed files with 31 additions and 35 deletions

View File

@@ -41,6 +41,7 @@
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/ctxsw_trace.h> #include <nvgpu/ctxsw_trace.h>
#include <nvgpu/vidmem.h> #include <nvgpu/vidmem.h>
#include <nvgpu/sim.h>
#include "platform_gk20a.h" #include "platform_gk20a.h"
#include "sysfs.h" #include "sysfs.h"
@@ -51,7 +52,6 @@
#include "module_usermode.h" #include "module_usermode.h"
#include "intr.h" #include "intr.h"
#include "ioctl.h" #include "ioctl.h"
#include "sim.h"
#include "os_linux.h" #include "os_linux.h"
#include "ctxsw_trace.h" #include "ctxsw_trace.h"

View File

@@ -35,8 +35,7 @@
#include "sysfs.h" #include "sysfs.h"
#include "os_linux.h" #include "os_linux.h"
#include "platform_gk20a.h" #include "platform_gk20a.h"
#include "sim.h" #include <nvgpu/sim.h>
#include "sim_pci.h"
#include "pci.h" #include "pci.h"
#include "pci_usermode.h" #include "pci_usermode.h"

View File

@@ -25,11 +25,11 @@
#include <nvgpu/dma.h> #include <nvgpu/dma.h>
#include <nvgpu/soc.h> #include <nvgpu/soc.h>
#include <nvgpu/hw_sim.h> #include <nvgpu/hw_sim.h>
#include <nvgpu/sim.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "platform_gk20a.h" #include "platform_gk20a.h"
#include "os_linux.h" #include "os_linux.h"
#include "module.h" #include "module.h"
#include "sim.h" /* will be removed in next patch */
void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v) 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; struct sim_nvgpu_linux *sim_linux;
if (!g->sim) { if (!g->sim)
nvgpu_warn(g, "sim not allocated or not in sim_mode");
return; return;
}
sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim); sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim);
if (sim_linux->regs) { if (sim_linux->regs) {
sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v()); sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v());

View File

@@ -24,11 +24,10 @@
#include <nvgpu/nvgpu_mem.h> #include <nvgpu/nvgpu_mem.h>
#include <nvgpu/dma.h> #include <nvgpu/dma.h>
#include <nvgpu/hw_sim_pci.h> #include <nvgpu/hw_sim_pci.h>
#include <nvgpu/sim.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "os_linux.h" #include "os_linux.h"
#include "module.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) 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()); is_simulation = _nvgpu_pci_is_simulation(g, sim_r());
if (!is_simulation) { if (!is_simulation) {
nvgpu_warn(g, "not in sim_mode");
return; return;
} }

View File

@@ -26,9 +26,8 @@
#include <nvgpu/dma.h> #include <nvgpu/dma.h>
#include <nvgpu/io.h> #include <nvgpu/io.h>
#include <nvgpu/hw_sim.h> #include <nvgpu/hw_sim.h>
#include <nvgpu/sim.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "linux/sim.h"
int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem) int nvgpu_alloc_sim_buffer(struct gk20a *g, struct nvgpu_mem *mem)
{ {

View File

@@ -24,8 +24,8 @@
#include <nvgpu/nvgpu_mem.h> #include <nvgpu/nvgpu_mem.h>
#include <nvgpu/dma.h> #include <nvgpu/dma.h>
#include <nvgpu/hw_sim_pci.h> #include <nvgpu/hw_sim_pci.h>
#include <nvgpu/sim.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "linux/sim.h"
static inline u32 sim_msg_header_size(void) static inline u32 sim_msg_header_size(void)
{ {

View File

@@ -63,13 +63,13 @@ struct nvgpu_ctxsw_trace_filter;
#include <nvgpu/rwsem.h> #include <nvgpu/rwsem.h>
#include <nvgpu/clk_arb.h> #include <nvgpu/clk_arb.h>
#include <nvgpu/nvlink.h> #include <nvgpu/nvlink.h>
#include <nvgpu/sim.h>
#include "clk_gk20a.h" #include "clk_gk20a.h"
#include "ce2_gk20a.h" #include "ce2_gk20a.h"
#include "fifo_gk20a.h" #include "fifo_gk20a.h"
#include "tsg_gk20a.h" #include "tsg_gk20a.h"
#include "gr_gk20a.h" #include "gr_gk20a.h"
#include "sim_gk20a.h"
#include "pmu_gk20a.h" #include "pmu_gk20a.h"
#include "priv_ring_gk20a.h" #include "priv_ring_gk20a.h"
#include "therm_gk20a.h" #include "therm_gk20a.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "gk20a.h" #include "gk20a.h"
#include "sim_gk20a.h" #include <nvgpu/sim.h>
#include "gr_ctx_gk20a.h" #include "gr_ctx_gk20a.h"
#include <nvgpu/log.h> #include <nvgpu/log.h>

View File

@@ -20,8 +20,7 @@
#ifndef __SIM_LINUX_H__ #ifndef __SIM_LINUX_H__
#define __SIM_LINUX_H__ #define __SIM_LINUX_H__
#include <nvgpu/nvgpu_mem.h> #include <linux/platform_device.h>
#include "gk20a/sim_gk20a.h"
struct sim_nvgpu_linux { struct sim_nvgpu_linux {
struct sim_nvgpu sim; struct sim_nvgpu sim;
@@ -32,11 +31,7 @@ struct sim_nvgpu_linux {
void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v); void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v);
u32 sim_readl(struct sim_nvgpu *sim, u32 r); 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, int nvgpu_init_sim_support_linux(struct gk20a *g,
struct platform_device *dev); struct platform_device *dev);
void nvgpu_remove_sim_support_linux(struct gk20a *g); void nvgpu_remove_sim_support_linux(struct gk20a *g);

View File

@@ -20,10 +20,7 @@
#ifndef __SIM_PCI_LINUX_H__ #ifndef __SIM_PCI_LINUX_H__
#define __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); int nvgpu_init_sim_support_linux_pci(struct gk20a *g);
void nvgpu_remove_sim_support_linux_pci(struct gk20a *g); void nvgpu_remove_sim_support_linux_pci(struct gk20a *g);
#endif #endif

View File

@@ -1,9 +1,5 @@
/* /*
* drivers/video/tegra/host/gk20a/sim_gk20a.h * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* GK20A sim support
*
* Copyright (c) 2013-2018, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#ifndef __SIM_GK20A_H__ #ifndef __NVGPU_SIM_H__
#define __SIM_GK20A_H__ #define __NVGPU_SIM_H__
#include <nvgpu/nvgpu_mem.h>
struct gk20a; struct gk20a;
struct sim_nvgpu { struct sim_nvgpu {
struct gk20a *g; struct gk20a *g;
u32 send_ring_put; u32 send_ring_put;
@@ -41,5 +38,17 @@ struct sim_nvgpu {
int (*esc_readl)( int (*esc_readl)(
struct gk20a *g, char *path, u32 index, u32 *data); 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